messageReminder.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="aui-news-box">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <uni-swipe-action>
  6. <!-- 基础用法 -->
  7. <uni-swipe-action-item v-for="(list, index) in lists" :key="index" :right-options="swipeOptions"
  8. @click="swipeClick($event, index)">
  9. <view class="aui-news-item">
  10. <view class="aui-news-item-hd">
  11. <image :src="list.img" mode="widthFix" lazy-load class="img" />
  12. </view>
  13. <view class="aui-news-item-bd">
  14. <view class="title">
  15. <h4>{{list.titleType}}</h4>
  16. <span>{{list.time}}</span>
  17. </view>
  18. <view class="content">
  19. <p>{{list.result.content}}</p>
  20. </view>
  21. </view>
  22. </view>
  23. </uni-swipe-action-item>
  24. </uni-swipe-action>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. swipeOptions: [{
  32. text: '删除',
  33. value: '1',
  34. style: {
  35. backgroundColor: '#dd524d'
  36. }
  37. }],
  38. lists: [{
  39. id: 1,
  40. titleType: "系统消息",
  41. time: "08:48",
  42. img: '/static/image/messageIcon/icon-item-001.png',
  43. result: {}
  44. },
  45. {
  46. id: 2,
  47. titleType: "服务消息",
  48. time: "08:48",
  49. img: '/static/image/messageIcon/icon-item-002.png',
  50. result: {}
  51. },
  52. {
  53. id: 3,
  54. titleType: "订单进度",
  55. time: "昨天",
  56. img: '/static/image/messageIcon/icon-item-003.png',
  57. result: {}
  58. },
  59. {
  60. id: 4,
  61. titleType: "保单提醒",
  62. time: "星期六",
  63. img: '/static/image/messageIcon/icon-item-004.png',
  64. result: {}
  65. },
  66. {
  67. id: 5,
  68. titleType: "佣金消息",
  69. time: "星期六",
  70. img: '/static/image/messageIcon/icon-item-005.png',
  71. result: {}
  72. }, {
  73. id: 6,
  74. titleType: "增员服务",
  75. time: "星期五",
  76. img: '/static/image/messageIcon/icon-item-001.png',
  77. result: {}
  78. }
  79. ],
  80. }
  81. },
  82. onShow() {
  83. this.getUserMessage();
  84. },
  85. onPullDownRefresh() {
  86. // 执行刷新逻辑
  87. this.getUserMessage();
  88. },
  89. methods: {
  90. async getUserMessage() {
  91. let res = await this.$http.get('/api/message/getUserMessage');
  92. if (res.code == '200') {
  93. res.data.map(val => {
  94. this.lists.map(ele => {
  95. if (val.msgType == ele.id) {
  96. ele.result = val;
  97. }
  98. })
  99. return val;
  100. })
  101. uni.stopPullDownRefresh();
  102. }
  103. },
  104. }
  105. }
  106. </script>
  107. <style>
  108. .aui-news-box {
  109. margin-top: 8px;
  110. background: #fff;
  111. }
  112. .aui-news-item {
  113. padding: 30upx;
  114. position: relative;
  115. display: flex;
  116. align-items: center;
  117. }
  118. .aui-news-item-hd {
  119. margin-right: 30upx;
  120. width: 110upx;
  121. display: flex;
  122. flex-shrink: 0;
  123. background: #fff;
  124. border-radius: 30upx;
  125. }
  126. .aui-news-item-hd .img {
  127. width: 100%;
  128. }
  129. .aui-news-item-bd {
  130. display: flex;
  131. flex-direction: column;
  132. width: 550upx;
  133. }
  134. .aui-news-item-bd .title {
  135. display: flex;
  136. justify-content: space-between;
  137. padding-bottom: 10upx;
  138. }
  139. .aui-news-item-bd .title h4 {
  140. font-weight: 400;
  141. font-size: 32upx;
  142. line-height: 50upx;
  143. width: 250upx;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. white-space: nowrap;
  147. color: #333;
  148. }
  149. .aui-news-item-bd .title span {
  150. color: #848689;
  151. }
  152. .aui-news-item-bd p {
  153. width: 100%;
  154. color: #848689;
  155. overflow: hidden;
  156. text-overflow: ellipsis;
  157. white-space: nowrap;
  158. }
  159. .aui-news-item:before {
  160. content: '';
  161. position: absolute;
  162. z-index: 2;
  163. bottom: 0;
  164. left: 0;
  165. width: 100%;
  166. height: 1px;
  167. border-bottom: 1px solid #d8d8d8;
  168. transform: scaleY(0.5);
  169. }
  170. </style>