information.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!-- 消息 -->
  2. <template>
  3. <view id="information">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="for-info-box" v-for="(item,index) in dataList" :key="index" @click="goInfoPage(item)">
  6. <img src="@/images/basicsModules/icon_xx_tz.png">
  7. <view class="right-box">
  8. <view class="top-box">
  9. <view>{{item.userName}}</view>
  10. <view>{{item.deptName}}</view>
  11. <view>{{item.sendTime}}</view>
  12. </view>
  13. <view class="bottom">{{item.title}}</view>
  14. </view>
  15. </view>
  16. <view class="get-null-box" v-if="!dataList[0]">暂无更多数据</view>
  17. </scroll-view>
  18. <tab-bar ref='infoAll'></tab-bar>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. systemNoticeGetNoticeList
  24. } from '@/api/basicsModules/index.js'
  25. // #ifdef MP-WEIXIN
  26. import {
  27. tabBar
  28. } from '@/component/tabBar.vue'
  29. // #endif
  30. export default {
  31. // #ifdef MP-WEIXIN
  32. components: {
  33. tabBar
  34. },
  35. // #endif
  36. // #ifdef H5
  37. components: {
  38. "tabBar": () => import('@/component/tabBar.vue'),
  39. },
  40. // #endif
  41. data() {
  42. return {
  43. queryParams: {
  44. page: 1,
  45. pageSize: 20,
  46. },
  47. total: 0,
  48. dataList: [],
  49. }
  50. },
  51. onLoad() {
  52. },
  53. onShow() {
  54. },
  55. mounted() {
  56. this.getList();
  57. },
  58. methods: {
  59. //滚动事件
  60. scrollGet() {
  61. let self = this;
  62. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  63. console.log('没有更多数据!')
  64. } else {
  65. setTimeout(function() {
  66. self.queryParams.page += 1;
  67. self.getList();
  68. }, 1000)
  69. }
  70. },
  71. //获取列表数据
  72. async getList() {
  73. let self = this;
  74. const {
  75. data
  76. } = await systemNoticeGetNoticeList(this.queryParams);
  77. if (data.code == 200) {
  78. this.dataList = [...this.dataList, ...data.data.records]
  79. this.total = data.data.total;
  80. }
  81. },
  82. formatDate(date) {
  83. let newDate = new Date(date);
  84. let YY = newDate.getFullYear() + '-';
  85. let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
  86. let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
  87. return YY + MM + DD;
  88. },
  89. }
  90. }
  91. </script>
  92. <style lang="stylus" scoped>
  93. #information {
  94. height: 100%;
  95. display flex;
  96. background #fff;
  97. .info-max-box {
  98. flex: 1;
  99. overflow: scroll;
  100. padding-bottom: 100rpx;
  101. background #fff;
  102. margin: 0 20rpx;
  103. .for-info-box:nth-child(1) {
  104. border: none;
  105. }
  106. .for-info-box {
  107. height: 150rpx;
  108. border-top: 1rpx solid #F5F5F5;
  109. display flex;
  110. img {
  111. border-radius: 50%;
  112. margin: 25rpx 28rpx 25rpx 20rpx;
  113. width: 100rpx;
  114. height: 100rpx;
  115. }
  116. .right-box {
  117. flex: 1;
  118. .top-box {
  119. display flex;
  120. line-height: 67rpx;
  121. margin-top: 7rpx;
  122. view:nth-child(1) {
  123. font-size: 30rpx;
  124. color: #333333;
  125. margin-right: 28rpx;
  126. }
  127. view:nth-child(2) {
  128. font-size: 24rpx;
  129. color: #CCCCCC;
  130. flex: 1;
  131. white-space: nowrap;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. }
  135. view:nth-child(3) {
  136. font-size: 20rpx;
  137. color: #CCCCCC;
  138. text-align right;
  139. }
  140. }
  141. .bottom {
  142. width: 530rpx;
  143. line-height: 62rpx;
  144. font-size: 25rpx;
  145. color: #666666;
  146. display block;
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. white-space: nowrap;
  150. }
  151. }
  152. }
  153. .get-null-box {
  154. height: 100rpx;
  155. line-height: 100rpx;
  156. color: #999;
  157. text-align center
  158. }
  159. }
  160. }
  161. </style>