newDetails.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="Body">
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="list">
  5. <view class="item" v-for="(v,i) in list" :key="i" :class="!v.read?'dian':''">
  6. <view class="item_t">
  7. <view class="item_t_l">
  8. <image :src="$getImgPath(v.icon)" mode=""></image>
  9. {{v.name||'--'}}
  10. </view>
  11. <view class="item_t_r">{{v.createTime?v.createTime.substr(0,16):''}}</view>
  12. </view>
  13. <view class="item_c">
  14. <view class="item_c_title">{{v.title}}</view>
  15. <view class="item_c_des">{{v.content}}</view>
  16. </view>
  17. <view class="item_b" @click="goDetails(v)">
  18. <view>查看详情</view>
  19. <view><u-icon name="arrow-right" size="32rpx" color="#999"></u-icon></view>
  20. </view>
  21. </view>
  22. <u-loadmore :status="status" />
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. config: {
  31. back: true, //false是tolbar页面 是则不写
  32. title: '应用消息',
  33. color: '#000',
  34. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  35. // backgroundColor: [0, '#2cba28'],
  36. rightSlot: true,
  37. },
  38. param: {
  39. pageSize: 10,
  40. pageNum: 1
  41. },
  42. total: 0,
  43. list: [],
  44. // 加载前值为loadmore,加载中为loading,没有数据为nomore
  45. status: 'loadmore',
  46. }
  47. },
  48. onLoad(options) {
  49. this.param.type=options.type
  50. },
  51. onShow() {
  52. this.getList()
  53. },
  54. //上拉触底函数
  55. onReachBottom() {
  56. if (this.status == 'loadmore') { //此处进行判断上锁,防止重复请求
  57. this.status = 'loading'
  58. this.param.pageNum += 1 //页数加1
  59. this.getList()
  60. }
  61. },
  62. onPullDownRefresh() {
  63. if (this.status != 'loading') {
  64. this.status = 'loading'
  65. this.param.pageNum = 1
  66. this.getList()
  67. }
  68. },
  69. methods: {
  70. getList() {
  71. this.$yghttp.get('/message/page', this.param).then(res => {
  72. if (this.param.pageNum == 1) {
  73. this.list = res.rows;
  74. } else {
  75. this.list.push(...res.rows)
  76. }
  77. this.total = res.total;
  78. if (this.total <= this.list.length) {
  79. this.status = 'nomore'
  80. } else {
  81. this.status = 'loadmore'
  82. }
  83. uni.stopPullDownRefresh();
  84. })
  85. },
  86. goDetails(item) {
  87. this.$yghttp.get(`/message/info/${item.id}`).then(res=>{
  88. this.$openMessage(item)
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. page {
  96. background-color: #F8F8F8;
  97. }
  98. </style>
  99. <style lang="scss">
  100. .Body {
  101. .list {
  102. padding: 30rpx;
  103. .item {
  104. background: #fff;
  105. padding: 20rpx 30rpx;
  106. border-radius: 10rpx;
  107. margin-bottom: 30rpx;
  108. .item_t {
  109. display: flex;
  110. justify-content: space-between;
  111. align-items: center;
  112. border-bottom: 3rpx solid rgb(239, 239, 239);
  113. padding-bottom: 20rpx;
  114. margin-bottom: 20rpx;
  115. .item_t_l {
  116. display: flex;
  117. align-items: center;
  118. font-weight: 700;
  119. font-size: 30rpx;
  120. position: relative;
  121. image {
  122. width: 60rpx;
  123. height: 60rpx;
  124. margin-right: 20rpx;
  125. }
  126. &:before{
  127. content: "";
  128. display: block;
  129. width: 100rpx;
  130. height: 10rpx;
  131. background: #fff;
  132. position: absolute;
  133. bottom: -28rpx;
  134. left: 0;
  135. }
  136. }
  137. .item_t_r {
  138. color: rgb(142, 142, 142);
  139. }
  140. }
  141. .item_c {
  142. padding-bottom: 20rpx;
  143. border-bottom: 3rpx solid rgb(239, 239, 239);
  144. .item_c_title {
  145. font-size: 32rpx;
  146. line-height: 60rpx;
  147. font-weight: 700;
  148. }
  149. .item_c_des {
  150. line-height: 46rpx;
  151. color: rgb(142, 142, 142);
  152. }
  153. }
  154. .item_b {
  155. padding: 30rpx 0 20rpx 0;
  156. display: flex;
  157. justify-content: space-between;
  158. color: #3EBCD0;
  159. }
  160. }
  161. }
  162. }
  163. .dian{
  164. position: relative;
  165. &::before{
  166. content: "";
  167. display: block;
  168. width: 15rpx;
  169. height: 15rpx;
  170. border-radius: 50%;
  171. background: rgb(240,74,62);
  172. position: absolute;
  173. top: 10rpx;
  174. right: 10rpx;
  175. }
  176. }
  177. </style>