index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="propertyNotice">
  3. <ul class="noticeUl">
  4. <li class="noticeLi" v-for="item in noticeList" @tap="toDetail(item)">
  5. <img :src="item.readStatus=='1'?unReadImg:readImg" class="leftImg"/>
  6. <div class="rightBox">
  7. <span class="noticeTitle">{{item.title}}</span>
  8. <span class="noticeTimeBox">
  9. <span class="noticeTime">{{item.releaseTime}}</span>
  10. <van-icon name="like" :class="item.collectorsStatus=='2'?'likeIcon':'unLikeIcon'" @tap.stop="clickLike(item)"/>
  11. </span>
  12. </div>
  13. </li>
  14. </ul>
  15. </div>
  16. </template>
  17. <script>
  18. import { noticeParkList,getUserLocalStorageInfo,noticeParkClickCollect,propertyNoticeList,propertyNoticeClickCollect } from "@/js_sdk/http";
  19. import dayjs from "dayjs";
  20. export default {
  21. name: "index",
  22. data(){
  23. return {
  24. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  25. unReadImg:'https://www.idea-co-sf.com/gardenProduct/image/xiaoxi02.png',
  26. readImg:'https://www.idea-co-sf.com/gardenProduct/image/xiaoxi01.png',
  27. noticeList:[
  28. // { title:'XXXXX南门出口道闸维修的通知', isRead:false, isLike:true },
  29. // { title:'XXXXXXXX停电的紧急通知', isRead:true, isLike:false },
  30. // { title:'XXXXX南门出口道闸维修的通知', isRead:false, isLike:true },
  31. // { title:'关于强降雨天气防范措的通知', isRead:true, isLike:true },
  32. // { title:'关于无端午节禁止施工的温馨提示', isRead:false, isLike:false },
  33. // { title:'关于园区枇杷消杀禁止采摘的通知', isRead:false, isLike:true },
  34. // { title:'关于开展爱邻活动的通知', isRead:true, isLike:false },
  35. ],
  36. type:''
  37. }
  38. },
  39. onLoad(type){
  40. // console.log('type',type)
  41. this.type = type.type
  42. const data = {
  43. userId:this.getUserLocalStorageInfo.userId,
  44. type:type.type,
  45. status:'published'
  46. }
  47. if (type.type=='1'){
  48. uni.setNavigationBarTitle({
  49. title: '园区通知',
  50. });
  51. const dayjs = require('dayjs')
  52. noticeParkList(data).then(res=>{
  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.noticeList = res
  58. })
  59. }else{
  60. uni.setNavigationBarTitle({
  61. title: '物业通知',
  62. });
  63. const dayjs = require('dayjs')
  64. propertyNoticeList(data).then(res=>{
  65. res.forEach(e=>{
  66. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  67. e.type = type.type
  68. })
  69. this.noticeList = res
  70. })
  71. }
  72. },
  73. methods:{
  74. toDetail(item){
  75. uni.navigateTo({
  76. url: "/pages/subPackages/propertyNotice/detail?type=" + JSON.stringify(item),
  77. });
  78. },
  79. clickLike(item){
  80. if (item.collectorsStatus == '1'){
  81. item.collectorsStatus = '2'
  82. }else{
  83. item.collectorsStatus = '1'
  84. }
  85. const data = {
  86. id:item.id,
  87. userId:this.getUserLocalStorageInfo.userId,
  88. collectorsStatus:item.collectorsStatus
  89. }
  90. if (this.type === '1'){
  91. noticeParkClickCollect(data).then(res=>{
  92. })
  93. }else{
  94. propertyNoticeClickCollect(data).then(res=>{
  95. })
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .propertyNotice{
  103. .noticeUl{
  104. display: flex;
  105. flex-direction: column;
  106. align-items: center;
  107. .noticeLi{
  108. margin-top: 24rpx;
  109. width: 686rpx;
  110. height: 162rpx;
  111. border-radius: 16rpx;
  112. display: flex;
  113. align-items: center;
  114. background: rgba(255, 255, 255, 1);
  115. padding: 0 32rpx;
  116. box-sizing: border-box;
  117. .leftImg{
  118. width: 80rpx;
  119. height: 80rpx;
  120. }
  121. .rightBox{
  122. display: flex;
  123. flex-direction: column;
  124. margin-left: 16rpx;
  125. .noticeTitle{
  126. color: rgba(34, 34, 34, 1);
  127. font-size: 32rpx;
  128. }
  129. .noticeTimeBox{
  130. font-size: 32rpx;
  131. margin-top: 12rpx;
  132. display: flex;
  133. justify-content: space-between;
  134. width: 526rpx;
  135. .noticeTime{
  136. color: rgba(136, 136, 136, 1);
  137. font-size: 28rpx;
  138. }
  139. .likeIcon{
  140. color: red;
  141. }
  142. .unLikeIcon{
  143. color: rgba(230, 235, 241, 1);
  144. }
  145. }
  146. }
  147. }
  148. }
  149. }
  150. </style>