index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="announcement">
  3. <div class="tap-part">
  4. <div class="info-list">
  5. <div class="info-item" v-for="item in list1" @click="goDetailPage(item)">
  6. <div class="left">
  7. <i class="iconfont icon-tongzhi"></i>
  8. <van-icon name="bell" style="font-size: 6.4vw; color: #60f" custom-class="iconfont" />
  9. </div>
  10. <div class="center">
  11. <div class="top">
  12. {{ item.noticeTitle }}
  13. </div>
  14. <!-- <div style="color: #acaaaa" class="top" v-else>
  15. {{ item.noticeTitle }}
  16. </div> -->
  17. <div class="bottom">
  18. <span> {{ item.publishDate }}</span>
  19. </div>
  20. </div>
  21. <div class="icon-collect right" @click.stop="changeCollectorsNoticeParkStatus(item)">
  22. <i class="iconfont icon-xinaixin blue" v-if="item.collectorsStatus === '2'"></i>
  23. <i class="iconfont icon-xinaixin" v-else></i>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import { noticeList, clickCollectParkNotice } from "@/js_sdk/api_park_notice";
  32. export default {
  33. data() {
  34. return {
  35. active: 0,
  36. list1: [],
  37. list2: [
  38. // {
  39. // title:
  40. // '关于组织2020年无锡市服务业提质增效资金项目申报的通知关于组织2020年无锡市服务业提质增效资金项目申报的通知',
  41. // date: '2020-09-18',
  42. // time: '19:34:06',
  43. // collect: false
  44. // },
  45. ],
  46. params: {},
  47. totalPage: 1,
  48. };
  49. },
  50. // created() {
  51. // if ('SCNjNSP7LJ9aarv1cNw' == null || 'SCNjNSP7LJ9aarv1cNw' === '') {
  52. // this.$showToast('请先登录后再试')
  53. // return
  54. // }
  55. // this.initParkNotice()
  56. // // this.initPropertyNotice()
  57. // },
  58. onLoad() {
  59. this.initParkNotice();
  60. },
  61. methods: {
  62. goDetailPage(e) {
  63. console.log(e);
  64. uni.navigateTo({
  65. url:
  66. "/pages/subPackages/announcement/detail?id=" +
  67. e.id +
  68. "&readStatus=" +
  69. e.readStatus,
  70. });
  71. },
  72. initParkNotice() {
  73. const _this = this;
  74. // _this.params.parks = '' //绑定园区
  75. // _this.params.companyId = "SCNjNSP7LJ9aarv1cNw";
  76. noticeList(_this.params).then((res) => {
  77. console.log(res);
  78. if (res) {
  79. _this.list1 = [];
  80. res.forEach((e) => {
  81. console.log(e);
  82. _this.list1.push(e);
  83. });
  84. }
  85. if (!res || res.length < 1) {
  86. this.$showToast("暂无通知公告");
  87. }
  88. });
  89. },
  90. initPropertyNotice() {
  91. const _this = this;
  92. // _this.params.parks = '' //绑定园区
  93. _this.params.type = "2";
  94. propertyNoticeList(_this.params).then((res) => {
  95. console.log(res);
  96. if (res) {
  97. _this.list2 = [];
  98. res.forEach((item) => {
  99. const jsons = this.getItemJson(item);
  100. _this.list2.push(jsons);
  101. });
  102. }
  103. });
  104. },
  105. getItemJson: function (item) {
  106. item.releaseTime = this.$common.transServDate(item.releaseTime);
  107. return item;
  108. },
  109. changeCollectorsNoticeParkStatus(val) {
  110. if (val.collectorsStatus === "2") {
  111. const _this = this;
  112. clickCollectParkNotice({
  113. id: val.id,
  114. // userId: "SCNjNSP7LJ9aarv1cNw",
  115. collectorsStatus: "1",
  116. }).then((res) => {
  117. _this.initParkNotice();
  118. });
  119. } else {
  120. const _this = this;
  121. clickCollectParkNotice({
  122. id: val.id,
  123. // userId: "SCNjNSP7LJ9aarv1cNw",
  124. collectorsStatus: "2",
  125. }).then((res) => {
  126. _this.initParkNotice();
  127. });
  128. }
  129. },
  130. changeCollectorsPropertyNoticStatus(val) {
  131. if (val.collectorsStatus === "2") {
  132. const _this = this;
  133. clickCollectPropertyNotice({
  134. id: val.id,
  135. // userId: "SCNjNSP7LJ9aarv1cNw",
  136. collectorsStatus: "1",
  137. }).then((res) => {
  138. _this.initPropertyNotice();
  139. });
  140. } else {
  141. const _this = this;
  142. clickCollectPropertyNotice({
  143. id: val.id,
  144. // userId: "SCNjNSP7LJ9aarv1cNw",
  145. collectorsStatus: "2",
  146. }).then((res) => {
  147. _this.initPropertyNotice();
  148. });
  149. }
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="scss" type="text/scss" scoped>
  155. .announcement {
  156. box-sizing: border-box;
  157. .tap-part {
  158. margin-top: 10rpx;
  159. height: calc(100vh - 10rpx);
  160. .van-tabs {
  161. height: 100%;
  162. }
  163. .info-list {
  164. height: calc(100vh - 9 2rpx);
  165. background-color: #fff;
  166. padding: 0 20rpx;
  167. overflow-y: auto;
  168. .info-item {
  169. display: flex;
  170. padding: 30rpx 0;
  171. border-bottom: 1px solid #dddddd;
  172. .left {
  173. text-align: center;
  174. width: 160rpx;
  175. i {
  176. font-size: 48rpx;
  177. color: rgba(102, 0, 255, 1);
  178. }
  179. }
  180. .center {
  181. width: 508rpx;
  182. height: 100rpx;
  183. display: flex;
  184. flex-direction: column;
  185. justify-content: space-between;
  186. .top {
  187. width: 508rpx;
  188. font-size: 26rpx;
  189. font-weight: 700;
  190. color: $text3;
  191. line-height: 1.3;
  192. }
  193. .bottom {
  194. span {
  195. font-size: 20rpx;
  196. color: #666666;
  197. &:first-child {
  198. margin-right: 40rpx;
  199. }
  200. }
  201. }
  202. }
  203. .right {
  204. width: 160rpx;
  205. height: 100rpx;
  206. text-align: center;
  207. line-height: 100rpx;
  208. i {
  209. font-size: 3 2rpx;
  210. color: #dddddd;
  211. &.blue {
  212. color: rgba(102, 0, 255, 1);
  213. }
  214. }
  215. .collect {
  216. color: #ffd111;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>