index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <!-- @format -->
  2. <template>
  3. <view
  4. style="height: 100vh; background-color: #f3f4f9; padding: 20rpx"
  5. class=""
  6. >
  7. <view v-if="ledgerList.length">
  8. <view
  9. v-for="item in ledgerList"
  10. style="
  11. background-color: #fff;
  12. border-radius: 20rpx;
  13. padding: 20rpx;
  14. margin: 0rpx auto 20rpx;
  15. "
  16. class=""
  17. >
  18. <view @click="detailInfo(item)" class="">
  19. <view style="display: inline-block" class="">
  20. <view
  21. style="line-height: 60rpx; font-size: 36rpx; font-weight: 700"
  22. class=""
  23. >
  24. {{ item.title }}
  25. </view>
  26. <view>
  27. {{ item.typeName }}
  28. </view>
  29. <view style="line-height: 50rpx; color: #929292" class="">
  30. {{ item.createTime }}
  31. </view>
  32. </view>
  33. <view style="float: right; margin-top: 30rpx" class="">
  34. <view v-if="item.readStatus == 1" style="color: limegreen" class="">
  35. 已读
  36. </view>
  37. <view v-if="item.readStatus == 0" style="color: red" class="">
  38. 未读
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view v-else>
  45. <u-empty mode="message"> </u-empty>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import { msgList } from "@/api/work.js";
  51. export default {
  52. data() {
  53. return {
  54. readColor: {
  55. 已撤回: "#fa3534",
  56. 已接收: "#2979ff",
  57. 待提交: "#2979ff",
  58. 备案中: "#2979ff",
  59. 已拒绝: "#fa3534",
  60. 勿备案: "#fa3534",
  61. 未备案: "#909399",
  62. 免备案: "#909399",
  63. 已退回: "#fa3534",
  64. },
  65. read: [], //备案字典
  66. queryParams: {
  67. pageNum: 1,
  68. pageSize: 10,
  69. },
  70. ledgerList: [],
  71. total: 0,
  72. current: 0,
  73. swiperDotIndex: 0,
  74. data: [
  75. {
  76. image: "/static/images/banner/banner01.jpg",
  77. },
  78. {
  79. image: "/static/images/banner/banner02.jpg",
  80. },
  81. {
  82. image: "/static/images/banner/banner03.jpg",
  83. },
  84. ],
  85. };
  86. },
  87. onLoad() {
  88. // useDict("read_status").then((res) => {
  89. // this.read = res;
  90. // });
  91. this.getList();
  92. uni.startPullDownRefresh();
  93. },
  94. onPullDownRefresh() {
  95. this.getList();
  96. console.log("refresh");
  97. setTimeout(function () {
  98. uni.stopPullDownRefresh();
  99. }, 800);
  100. },
  101. methods: {
  102. detailInfo(item) {
  103. uni.navigateTo({
  104. url: "/pages/work/detailInfo?id=" + item.id,
  105. });
  106. },
  107. getList() {
  108. msgList({
  109. ...this.queryParams,
  110. }).then(({ rows, total }) => {
  111. this.ledgerList = rows;
  112. this.total = total;
  113. });
  114. },
  115. onReachBottom() {
  116. //触底事件
  117. if (this.queryParams.pageNum * this.queryParams.pageSize >= this.total) {
  118. uni.showToast({
  119. title: "没有更多数据了",
  120. icon: "none",
  121. duration: 1000,
  122. });
  123. setTimeout(() => {
  124. uni.hideLoading();
  125. }, 500);
  126. } else {
  127. if (this.queryParams.pageNum <= this.queryParams.pageNum - 1) {
  128. setTimeout(() => {
  129. uni.hideLoading();
  130. }, 500);
  131. } else {
  132. uni.showLoading({
  133. title: "加载中",
  134. });
  135. this.queryParams.pageNum++;
  136. msgList({
  137. ...this.queryParams,
  138. }).then(({ rows, total }) => {
  139. this.ledgerList = [...this.ledgerList, ...rows];
  140. this.total = total;
  141. });
  142. }
  143. setTimeout(() => {
  144. uni.hideLoading();
  145. }, 500);
  146. }
  147. },
  148. clickBannerItem(item) {
  149. console.info(item);
  150. },
  151. changeSwiper(e) {
  152. this.current = e.detail.current;
  153. },
  154. changeGrid(e) {
  155. this.$modal.showToast("模块建设中~");
  156. },
  157. },
  158. };
  159. </script>
  160. <style lang="scss">
  161. /* #ifndef APP-NVUE */
  162. page {
  163. display: flex;
  164. flex-direction: column;
  165. box-sizing: border-box;
  166. background-color: #fff;
  167. min-height: 100%;
  168. height: auto;
  169. }
  170. view {
  171. font-size: 14px;
  172. line-height: inherit;
  173. }
  174. /* #endif */
  175. .text {
  176. text-align: center;
  177. font-size: 26rpx;
  178. margin-top: 10rpx;
  179. }
  180. .grid-item-box {
  181. flex: 1;
  182. /* #ifndef APP-NVUE */
  183. display: flex;
  184. /* #endif */
  185. flex-direction: column;
  186. align-items: center;
  187. justify-content: center;
  188. padding: 15px 0;
  189. }
  190. .uni-margin-wrap {
  191. width: 690rpx;
  192. width: 100%;
  193. }
  194. .swiper {
  195. height: 300rpx;
  196. }
  197. .swiper-box {
  198. height: 150px;
  199. }
  200. .swiper-item {
  201. /* #ifndef APP-NVUE */
  202. display: flex;
  203. /* #endif */
  204. flex-direction: column;
  205. justify-content: center;
  206. align-items: center;
  207. color: #fff;
  208. height: 300rpx;
  209. line-height: 300rpx;
  210. }
  211. @media screen and (min-width: 500px) {
  212. .uni-swiper-dot-box {
  213. width: 400px;
  214. /* #ifndef APP-NVUE */
  215. margin: 0 auto;
  216. /* #endif */
  217. margin-top: 8px;
  218. }
  219. .image {
  220. width: 100%;
  221. }
  222. }
  223. </style>