index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="propertyNotice_manage">
  3. <div class="whiteBoard">
  4. <div class="addRepair" @tap="newRelease">新增发布 <van-icon name="add" style="margin-left: 8rpx"/></div>
  5. <div class="noticeItem" v-for="item in repairList">
  6. <div class="noticeName">{{item.title}}</div>
  7. <div class="noticeBottom">
  8. <div class="noticeTime">{{item.releaseTime}}</div>
  9. <div class="noticeBtnBox">
  10. <button class="mbtn editBtn" @tap="editClick(item)">编辑</button>
  11. <button class="mbtn closeBtn" @tap="changeType(item)">{{ item.status === 'published'?'下架':'上架' }}</button>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import dayjs from "dayjs";
  20. import { noticeParkList,propertyNoticeList,getUserLocalStorageInfo, noticeParkEdit } from "@/js_sdk/http";
  21. export default {
  22. name: "index",
  23. data(){
  24. return{
  25. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  26. type:'',
  27. repairList:[
  28. // {name:'关于组织2020年无锡市服务业提质增效资金项目申报的通知',time:'2024-1-21 13:00'},
  29. // {name:'关于组织2020年无锡市服务业提质增效资金项目申报的通知',time:'2024-1-21 13:00'},
  30. // {name:'关于组织2020年无锡市',time:'2024-1-21 13:00'},
  31. ]
  32. }
  33. },
  34. onLoad(type){
  35. // console.log('type',type)
  36. this.type = type.type
  37. const data = {
  38. userId:this.getUserLocalStorageInfo.userId,
  39. type:type.type,
  40. status:''
  41. }
  42. if (type.type=='1'){
  43. uni.setNavigationBarTitle({
  44. title: '园区通知',
  45. });
  46. const dayjs = require('dayjs')
  47. noticeParkList(data).then(res=>{
  48. if (res.length) {
  49. res.forEach(e => {
  50. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  51. e.type = type.type
  52. })
  53. this.repairList = res
  54. }
  55. })
  56. }else{
  57. uni.setNavigationBarTitle({
  58. title: '物业通知',
  59. });
  60. const dayjs = require('dayjs')
  61. propertyNoticeList(data).then(res=>{
  62. if (res.length){
  63. res.forEach(e=>{
  64. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  65. e.type = type.type
  66. })
  67. this.repairList = res
  68. }
  69. })
  70. }
  71. },
  72. methods:{
  73. newRelease(){
  74. uni.navigateTo({
  75. url:'/pages/subPackages/propertyNotice_manage/newRelease?addType=' + '发布' + '&noticeType=' + this.type
  76. })
  77. },
  78. editClick(item) {
  79. uni.navigateTo({
  80. url:'/pages/subPackages/propertyNotice_manage/newRelease?addType=' + '编辑' + '&id=' + item.id+ '&noticeType=' + this.type
  81. })
  82. },
  83. changeType(item) {
  84. let status = ''
  85. if(item.status === 'published'){
  86. status = 'off_shelf'
  87. }else {
  88. status = 'published'
  89. }
  90. noticeParkEdit({id:item.id,status}).then(res=>{
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. .propertyNotice_manage{
  98. .whiteBoard{
  99. background: white;
  100. margin-top: 24rpx;
  101. box-sizing: border-box;
  102. padding: 32rpx;
  103. height: 1424rpx;
  104. .addRepair{
  105. display: flex;
  106. justify-content: flex-end;
  107. align-items: center;
  108. color: rgba(3, 101, 249, 1);
  109. }
  110. .noticeItem{
  111. padding: 24rpx 32rpx;
  112. width: 686rpx;
  113. background: rgba(245, 247, 250, 1);
  114. box-sizing: border-box;
  115. border-radius: 16rpx;
  116. margin-top: 24rpx;
  117. .noticeName{
  118. color:rgba(34, 34, 34, 1);
  119. font-size: 32rpx;
  120. font-weight: 600;
  121. line-height: 48rpx;
  122. }
  123. .noticeBottom{
  124. display: flex;
  125. justify-content: space-between;
  126. align-items: center;
  127. margin-top: 16rpx;
  128. .noticeTime{
  129. font-size: 28rpx;
  130. color: rgba(102, 102, 102, 1);
  131. }
  132. .noticeBtnBox{
  133. display: flex;
  134. .mbtn{
  135. width: 160rpx;
  136. height: 60rpx;
  137. border-radius: 32rpx;
  138. display: flex;
  139. align-items: center;
  140. justify-content: center;
  141. font-size: 28rpx;
  142. &::after{
  143. border: none;
  144. }
  145. }
  146. .editBtn{
  147. border: 1px solid rgba(3, 101, 249, 1);
  148. color: rgba(3, 101, 249, 1);
  149. background: white;
  150. margin-right: 24rpx;
  151. }
  152. .closeBtn{
  153. color: white;
  154. background: linear-gradient( 316deg, #84AAFF 0%, #0365F9 100%);
  155. }
  156. }
  157. }
  158. }
  159. }
  160. }
  161. </style>