index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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, propertyNoticeEdit } 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. this.getPageList()
  38. },
  39. methods:{
  40. getPageList(){
  41. const data = {
  42. userId:this.getUserLocalStorageInfo.userId,
  43. type:this.type,
  44. status:''
  45. }
  46. if (this.type=='1'){
  47. uni.setNavigationBarTitle({
  48. title: '园区通知',
  49. });
  50. const dayjs = require('dayjs')
  51. noticeParkList(data).then(res=>{
  52. if (res.length) {
  53. res.forEach(e => {
  54. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  55. e.type = type.type
  56. })
  57. this.repairList = res
  58. }
  59. })
  60. }else{
  61. uni.setNavigationBarTitle({
  62. title: '物业通知',
  63. });
  64. const dayjs = require('dayjs')
  65. propertyNoticeList(data).then(res=>{
  66. if (res.length){
  67. res.forEach(e=>{
  68. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  69. e.type = this.type
  70. })
  71. this.repairList = res
  72. }
  73. })
  74. }
  75. },
  76. newRelease(){
  77. uni.navigateTo({
  78. url:'/pages/subPackages/propertyNotice_manage/newRelease?addType=' + '发布' + '&noticeType=' + this.type
  79. })
  80. },
  81. editClick(item) {
  82. uni.navigateTo({
  83. url:'/pages/subPackages/propertyNotice_manage/newRelease?addType=' + '编辑' + '&id=' + item.id+ '&noticeType=' + this.type
  84. })
  85. },
  86. changeType(item) {
  87. let status = ''
  88. if(item.status === 'published'){
  89. status = 'off_shelf'
  90. }else {
  91. status = 'published'
  92. }
  93. this.repairList= []
  94. propertyNoticeEdit({id:item.id,status}).then(res=>{
  95. this.getPageList()
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .propertyNotice_manage{
  103. .whiteBoard{
  104. background: white;
  105. margin-top: 24rpx;
  106. box-sizing: border-box;
  107. padding: 32rpx;
  108. height: 1424rpx;
  109. .addRepair{
  110. display: flex;
  111. justify-content: flex-end;
  112. align-items: center;
  113. color: rgba(3, 101, 249, 1);
  114. }
  115. .noticeItem{
  116. padding: 24rpx 32rpx;
  117. width: 686rpx;
  118. background: rgba(245, 247, 250, 1);
  119. box-sizing: border-box;
  120. border-radius: 16rpx;
  121. margin-top: 24rpx;
  122. .noticeName{
  123. color:rgba(34, 34, 34, 1);
  124. font-size: 32rpx;
  125. font-weight: 600;
  126. line-height: 48rpx;
  127. }
  128. .noticeBottom{
  129. display: flex;
  130. justify-content: space-between;
  131. align-items: center;
  132. margin-top: 16rpx;
  133. .noticeTime{
  134. font-size: 28rpx;
  135. color: rgba(102, 102, 102, 1);
  136. }
  137. .noticeBtnBox{
  138. display: flex;
  139. .mbtn{
  140. width: 160rpx;
  141. height: 60rpx;
  142. border-radius: 32rpx;
  143. display: flex;
  144. align-items: center;
  145. justify-content: center;
  146. font-size: 28rpx;
  147. &::after{
  148. border: none;
  149. }
  150. }
  151. .editBtn{
  152. border: 1px solid rgba(3, 101, 249, 1);
  153. color: rgba(3, 101, 249, 1);
  154. background: white;
  155. margin-right: 24rpx;
  156. }
  157. .closeBtn{
  158. color: white;
  159. background: linear-gradient( 316deg, #84AAFF 0%, #0365F9 100%);
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. </style>