tidings.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view>
  3. <!-- <view class="px3 pt-1">
  4. <home-swipers :swipers="swipers"></home-swipers>
  5. </view>-->
  6. <template v-if="listData.length > 0">
  7. <view
  8. class="mx3 my2 p3 bg-color-white"
  9. v-for="(item, index) in listData"
  10. :key="index"
  11. @tap="handleDetail(item)"
  12. style="border-radius: 16rpx"
  13. >
  14. <view class="d-flex j-between">
  15. <view class="f-size-32 f-weight-bold main-color-text">{{
  16. typeDict[item.detailType]
  17. }}</view>
  18. <view class="f-size-26 text-color-b">{{
  19. item.taskCreateTime
  20. }}</view>
  21. </view>
  22. <view class="f-size-28 text-color-3 f-weight-4 mt-2 pb-2 border-bottom">
  23. <rich-text :nodes="item.content"></rich-text>
  24. </view>
  25. <view class="f-size-28 text-color-3 f-weight-4 mt-2" style="text-align: right" v-if="item.status === 1">
  26. 未读
  27. </view>
  28. <view class="f-size-28 text-color-3 f-weight-4 mt-2 " style="text-align: right" v-if="item.status === 2">
  29. 已读
  30. </view>
  31. </view>
  32. <view class="py3">
  33. <u-loadmore :status="status" />
  34. </view>
  35. </template>
  36. <template v-else>
  37. <view class="empty">
  38. <u-empty text="暂无数据" mode="list"></u-empty>
  39. </view>
  40. </template>
  41. <u-tabbar
  42. :list="tabbar"
  43. :mid-button="true"
  44. active-color="#0082ff"
  45. ></u-tabbar>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. // 加载更多
  53. status: 'loadmore',
  54. swipers: [
  55. {
  56. src:
  57. 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1277128339,1786094255&fm=26&gp=0.jpg'
  58. },
  59. {
  60. src:
  61. 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607335140204&di=24940a7098585bb646fa4a1012f89c74&imgtype=0&src=http%3A%2F%2Fibw.bwnet.com.tw%2Fimage%2Fpool%2F2018%2F12%2F65faa451f9530955ae7e022c66bb5da1.jpg'
  62. }
  63. ],
  64. page: 1,
  65. limit: 10,
  66. type: '',
  67. loadMore: true,
  68. listData: [],
  69. typeDict: {},
  70. tabbar: [
  71. {
  72. iconPath: '/static/tabars/home.png',
  73. pagePath: '/pages/home/home',
  74. selectedIconPath: '/static/tabars/home_s.png',
  75. text: '首页'
  76. },
  77. {
  78. iconPath: '/static/tabars/order.png',
  79. pagePath: '/pages/operate/operate',
  80. selectedIconPath: '/static/tabars/order_s.png',
  81. text: '功能'
  82. },
  83. {
  84. iconPath: '/static/tabars/publish.png',
  85. pagePath: '/pages/middle/middle',
  86. selectedIconPath: '/static/tabars/publish.png',
  87. text: '报修',
  88. midButton: true
  89. },
  90. {
  91. iconPath: '/static/tabars/tiding.png',
  92. pagePath: '/pages/tidings/tidings',
  93. selectedIconPath: '/static/tabars/tiding_s.png',
  94. text: '消息'
  95. },
  96. {
  97. iconPath: '/static/tabars/mine.png',
  98. pagePath: '/pages/my/my',
  99. selectedIconPath: '/static/tabars/mine_s.png',
  100. text: '我的'
  101. }
  102. ]
  103. };
  104. },
  105. onPullDownRefresh() {
  106. // 请求结束取消刷新
  107. this.page = 1;
  108. this.loadMore = true;
  109. this.listData = [];
  110. this.initData();
  111. uni.stopPullDownRefresh();
  112. },
  113. onReachBottom() {
  114. if (this.loadMore) {
  115. this.page++;
  116. this.initData();
  117. }
  118. },
  119. onShow() {
  120. this.initData();
  121. },
  122. methods: {
  123. getDict() {
  124. this.typeDict = this.$DictCache.getLabelByValueMapByType(
  125. this.$DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE
  126. );
  127. },
  128. // 去详情
  129. handleDetail(detail) {
  130. if (detail.status === 1) {
  131. this.$Http
  132. .updateWorkplaceBacklog({ id: detail.id })
  133. .then((res) => {
  134. console.log('已置为已办');
  135. });
  136. }
  137. uni.navigateTo({
  138. url:
  139. '/pages/tidings-detail/tidings-detail?detail=' +
  140. JSON.stringify(detail)
  141. });
  142. },
  143. initData() {
  144. const that = this;
  145. that.status = 'loading';
  146. this.$Http
  147. .getWorkplaceBacklogUserPage({
  148. pageNum: this.page,
  149. pageSize: this.limit,
  150. dataScope: {
  151. sortBy: 'desc',
  152. sortName: 'task_create_time'
  153. }
  154. })
  155. .then((res) => {
  156. that.getDict();
  157. const data = res.data.rows;
  158. if (data && data.length > 0 && data.length < that.limit) {
  159. that.status = 'nomore';
  160. that.loadMore = false;
  161. } else if (data.length === that.limit) {
  162. that.status = 'loadmore';
  163. } else {
  164. that.status = 'nomore';
  165. }
  166. // that.listData = [...that.listData, ...data];
  167. that.listData = data;
  168. });
  169. }
  170. }
  171. };
  172. </script>
  173. <style>
  174. page {
  175. background-color: #f4f4f4 !important;
  176. }
  177. </style>