index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. onPullDownRefresh() {
  40. this.getList(this.type)
  41. setTimeout(function () {
  42. uni.stopPullDownRefresh();
  43. }, 1000);
  44. },
  45. onLoad(type){
  46. // console.log('type',type)
  47. this.type = type.type
  48. this.getList(type.type)
  49. },
  50. methods:{
  51. getList(type){
  52. const data = {
  53. userId:this.getUserLocalStorageInfo.userId,
  54. type:type,
  55. status:'published'
  56. }
  57. if (type=='1'){
  58. uni.setNavigationBarTitle({
  59. title: '园区通知',
  60. });
  61. const dayjs = require('dayjs')
  62. noticeParkList(data).then(res=>{
  63. res.forEach(e=>{
  64. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  65. e.type = type
  66. })
  67. this.noticeList = res
  68. })
  69. }else{
  70. uni.setNavigationBarTitle({
  71. title: '物业通知',
  72. });
  73. const dayjs = require('dayjs')
  74. propertyNoticeList(data).then(res=>{
  75. res.forEach(e=>{
  76. e.releaseTime = dayjs(e.releaseTime).format('YYYY-MM-DD HH:mm:ss')
  77. e.type = type
  78. })
  79. this.noticeList = res
  80. })
  81. }
  82. },
  83. toDetail(item){
  84. uni.navigateTo({
  85. url: "/pages/subPackages/propertyNotice/detail?type=" + JSON.stringify(item),
  86. });
  87. },
  88. clickLike(item){
  89. if (item.collectorsStatus == '1'){
  90. item.collectorsStatus = '2'
  91. }else{
  92. item.collectorsStatus = '1'
  93. }
  94. const data = {
  95. id:item.id,
  96. userId:this.getUserLocalStorageInfo.userId,
  97. collectorsStatus:item.collectorsStatus
  98. }
  99. if (this.type === '1'){
  100. noticeParkClickCollect(data).then(res=>{
  101. })
  102. }else{
  103. propertyNoticeClickCollect(data).then(res=>{
  104. })
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .propertyNotice{
  112. .noticeUl{
  113. display: flex;
  114. flex-direction: column;
  115. align-items: center;
  116. .noticeLi{
  117. margin-top: 24rpx;
  118. width: 686rpx;
  119. height: 162rpx;
  120. border-radius: 16rpx;
  121. display: flex;
  122. align-items: center;
  123. background: rgba(255, 255, 255, 1);
  124. padding: 0 32rpx;
  125. box-sizing: border-box;
  126. .leftImg{
  127. width: 80rpx;
  128. height: 80rpx;
  129. }
  130. .rightBox{
  131. display: flex;
  132. flex-direction: column;
  133. margin-left: 16rpx;
  134. .noticeTitle{
  135. color: rgba(34, 34, 34, 1);
  136. font-size: 32rpx;
  137. }
  138. .noticeTimeBox{
  139. font-size: 32rpx;
  140. margin-top: 12rpx;
  141. display: flex;
  142. justify-content: space-between;
  143. width: 526rpx;
  144. .noticeTime{
  145. color: rgba(136, 136, 136, 1);
  146. font-size: 28rpx;
  147. }
  148. .likeIcon{
  149. color: red;
  150. }
  151. .unLikeIcon{
  152. color: rgba(230, 235, 241, 1);
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>