index.vue 6.1 KB

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