message.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view>
  3. <u-navbar title="消息" title-color="#101010" ></u-navbar>
  4. <!-- 消息列表 -->
  5. <view class="message-list" >
  6. <view class="message-item" @click="messageList1()" >
  7. <view class="icon icon2">
  8. <image class="img" src="@/assets/img/antFill-account-book.svg" mode=""></image>
  9. <view class="dot" v-if="headlineBill.unReadtNum" >
  10. </view>
  11. </view>
  12. <view class="content">
  13. <view class="title">
  14. <view class="title-name">
  15. 账单提醒
  16. </view>
  17. <view class="title-time" v-if="headlineBill.billPush">
  18. {{headlineBill.billPush.createTime}}
  19. </view>
  20. <view class="title-time" v-else>
  21. </view>
  22. </view>
  23. <view class="value" v-if="headlineBill.billPush" >
  24. {{headlineBill.billPush.name}}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="message-list" v-if="messageList.length" >
  30. <view class="message-item" v-for="(item,i) in messageList" :key="i"
  31. v-show="item.message"
  32. @click="gotoUrl('/pages/message/messageList?type='+item.typeId+'&typeName='+item.typeName)" >
  33. <view class="icon" :class="'icon'+item.typeId">
  34. <image class="img" v-if="item.iconUrl" :src="item.iconUrl" mode=""></image>
  35. <image class="img" v-else src="@/assets/img/antFill-notification.svg" mode=""></image>
  36. <view class="dot" v-if="item.unReadtNum">
  37. </view>
  38. </view>
  39. <view class="content">
  40. <view class="title">
  41. <view class="title-name">
  42. {{item.typeName}}
  43. </view>
  44. <view class="title-time" v-if="item.message">
  45. {{item.message.createTime}}
  46. </view>
  47. </view>
  48. <view class="value" v-if="item.message" v-html="item.message.content">
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <u-divider :isnone="list.length==0&&messageList.length==0" nonetext="没有找到相关内容"
  54. border-color="#CFD2D5">已经到底了</u-divider>
  55. <Tabbar :current="1" ref="tabbarMain" :prefetchNum="prefetchNum" ></Tabbar>
  56. </view>
  57. </template>
  58. <script>
  59. import * as API from '@/apis/pagejs/message.js'
  60. import Tabbar from '@/components/Tabbar.vue'
  61. export default {
  62. components: {
  63. Tabbar
  64. },
  65. data() {
  66. return {
  67. list:[],
  68. headlineBill:{},
  69. messageList:[],
  70. prefetchNum:0
  71. }
  72. },
  73. onLoad() {
  74. },
  75. onShow() {
  76. this.prefetch()
  77. },
  78. methods: {
  79. prefetch(){
  80. API.prefetch({
  81. }).then((response) => {
  82. this.prefetchNum=response.data
  83. this.getBillList()
  84. this.getMessageTypeList()
  85. }).catch(error => {
  86. //uni.hideLoading();
  87. uni.hideLoading();
  88. uni.showToast({
  89. icon: "none",
  90. title: error
  91. })
  92. })
  93. },
  94. messageList1(){
  95. this.gotoUrl('/pages/message/messageList?type=AA&typeName=账单提醒')
  96. },
  97. getMessageTypeList(){
  98. uni.showLoading({
  99. mask:true,title:'加载中...'
  100. })
  101. API.messageTypeList().then((response) => {
  102. uni.hideLoading();
  103. this.messageList=response.data.typeList;
  104. }).catch(error => {
  105. uni.hideLoading();
  106. uni.showToast({
  107. icon: "none",
  108. title: error
  109. })
  110. })
  111. },
  112. getBillList(){
  113. uni.showLoading({
  114. mask:true,title:'加载中...'
  115. })
  116. API.headlineBill().then((response) => {
  117. uni.hideLoading();
  118. this.headlineBill=response.data;
  119. var num=response.data.unReadtNum;
  120. if (this.$refs.tabbarMain) {
  121. this.$refs.tabbarMain.setprefetchNum(this.prefetchNum+num);
  122. }
  123. }).catch(error => {
  124. uni.hideLoading();
  125. uni.showToast({
  126. icon: "none",
  127. title: error
  128. })
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .message-list{
  136. background-color: #fff;
  137. .message-item{
  138. display: flex;
  139. padding: 32rpx;
  140. border-bottom: 1px solid rgba(240,240,240,1);
  141. .icon{
  142. width: 96rpx;
  143. height: 96rpx;
  144. border-radius: 12px;
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. position: relative;
  149. background: linear-gradient(180.4deg, rgba(127,213,151,1) 2.1%,rgba(67,176,116,1) 101.21%);
  150. .img{
  151. width: 56rpx;
  152. height: 56rpx;
  153. }
  154. .dot{
  155. width: 20rpx;
  156. height: 20rpx;
  157. border-radius:999px;
  158. background-color: rgba(255,0,0,1);
  159. position: absolute;
  160. top:-6rpx;
  161. right:-6rpx;
  162. }
  163. }
  164. .icon2{
  165. background: linear-gradient(180deg, rgba(121,172,255,1) 0%,rgba(57,132,255,1) 100%);
  166. color: rgba(255,255,255,1);
  167. }
  168. .icon3{
  169. background: linear-gradient(180.29deg, rgba(255,214,125,1) 0.9%,rgba(255,150,0,1) 100.4%);
  170. }
  171. .icon4{
  172. background: linear-gradient(180.29deg, rgba(255,124,112,1) 0.9%,rgba(255,79,63,1) 100.4%);
  173. }
  174. .icon5{
  175. background: linear-gradient(178.44deg, rgba(122,232,227,1) 3.96%,rgba(57,182,182,1) 100.6%);
  176. }
  177. .icon6{
  178. background: linear-gradient(179.2deg, rgba(168,178,238,1) 6.28%,rgba(123,123,240,1) 96.94%);
  179. }
  180. .content{
  181. flex:1;
  182. margin-left: 24rpx;
  183. display: flex;
  184. flex-direction: column;
  185. justify-content: space-between;
  186. .title{
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: center;
  190. .title-name{
  191. color: rgb(16,16,16);
  192. font-size: 32rpx;
  193. }
  194. .title-time{
  195. color: rgb(140,140,140);
  196. font-size: 24rpx;
  197. }
  198. }
  199. .value{
  200. width: 560rpx;
  201. white-space: nowrap;
  202. overflow: hidden;
  203. text-overflow: ellipsis;
  204. margin-top: 10rpx;
  205. font-size: 24rpx
  206. }
  207. }
  208. }
  209. }
  210. </style>