myMsg.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="my-msg">
  3. <navbar ref="navbar" backColor="#666" :config="config"></navbar>
  4. <view class="middle">
  5. <view class="item" @click="goTodel(0, '活动消息')">
  6. <view class="left">
  7. <!-- <text class="iconfont">&#xe652;</text> -->
  8. <image src="/static/czd/myMsg_iocn1.png" mode=""></image>
  9. </view>
  10. <view class="right">
  11. <view class="msg">
  12. <view class="name">
  13. 活动消息
  14. <text class="count" v-if="titleOne.num == 0 ? false : titleOne.num">{{ titleOne.num }}</text>
  15. <!-- <text >{{msg[0] && msg[0].num? msg[0].num : ''}}</text> -->
  16. </view>
  17. <view class="time">{{ titleOne.time ? titleOne.time : '' }}</view>
  18. </view>
  19. <view class="advertisement">{{ titleOne.remark ? titleOne.remark : '' }}</view>
  20. </view>
  21. </view>
  22. <view class="item" @click="goTodel(1, '支付消息')">
  23. <view class="left">
  24. <!-- <text class="iconfont">&#xe641;</text> -->
  25. <image src="/static/czd/myMsg_iocn5.png" mode=""></image>
  26. </view>
  27. <view class="right right2">
  28. <view class="msg">
  29. <view class="name">
  30. 支付消息
  31. <text class="count" v-if="titleTwo == 0 ? false : titleTwo.num">{{ titleTwo.num }}</text>
  32. </view>
  33. <view class="time">{{ titleTwo.time ? titleTwo.time : '' }}</view>
  34. </view>
  35. <view class="advertisement">{{ titleTwo.remark ? titleTwo.remark : '' }}</view>
  36. </view>
  37. </view>
  38. <view class="item" @click="goTodel(2, '物流消息')">
  39. <view class="left right3">
  40. <!-- <text class="iconfont">&#xe691;</text> -->
  41. <image src="/static/czd/myMsg_iocn3.png" mode=""></image>
  42. </view>
  43. <view class="right right4">
  44. <view class="msg">
  45. <view class="name">
  46. 物流消息
  47. <text class="count" v-if="titleThree.num == 0 ? false : titleThree.num">{{ titleThree.num }}</text>
  48. </view>
  49. <view class="time">{{ titleThree.time ? titleThree.time : '' }}</view>
  50. </view>
  51. <view class="advertisement">{{ titleThree.remark ? titleThree.remark : '' }}</view>
  52. </view>
  53. </view>
  54. <view class="item" @click="goTodel(3, '售后消息')">
  55. <view class="left">
  56. <!-- <text class="iconfont">&#xf132;</text> -->
  57. <image src="/static/czd/myMsg_iocn2.png" mode=""></image>
  58. </view>
  59. <view class="right right5">
  60. <view class="msg">
  61. <view class="name">
  62. 售后消息
  63. <text class="count" v-if="titleFour == 0 ? false : titleFour.num">{{ titleFour.num }}</text>
  64. </view>
  65. <view class="time">{{ titleFour.time ? titleFour.time : '' }}</view>
  66. </view>
  67. <view class="advertisement">{{ titleFour.remark ? titleFour.remark : '' }}</view>
  68. </view>
  69. </view>
  70. <!-- <view class="item" @click="goTodel(4, '互动消息')">
  71. <view class="left" style="background: #4bbcfe;"><text class="iconfont">&#xe6f9;</text></view>
  72. <view class="right">
  73. <view class="msg">
  74. <view class="name">
  75. 互动消息
  76. <text v-if="titleFive == 0 ? false : titleFive.num">{{ titleFive.num }}</text>
  77. </view>
  78. <view class="time">{{ titleFive.time ? titleFive.time : '' }}</view>
  79. </view>
  80. <view class="advertisement">{{ titleFive.remark ? titleFive.remark : '' }}</view>
  81. </view>
  82. </view>
  83. <view class="item" @click="goTodel(5, '系统消息')">
  84. <view class="left">
  85. <image src="/static/czd/myMsg_iocn4.png" mode=""></image>
  86. </view>
  87. <view class="right right5">
  88. <view class="msg">
  89. <view class="name">
  90. 系统消息
  91. <text class="count" v-if="titleSix == 0 ? false : titleSix.num">{{ titleSix.num }}</text>
  92. </view>
  93. <view class="time">{{ titleSix.time ? titleSix.time : '' }}</view>
  94. </view>
  95. <view class="advertisement">{{ titleSix.remark ? titleSix.remark : '' }}</view>
  96. </view>
  97. </view> -->
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import {
  104. unreadInfo
  105. } from '@/api/userInfo.js';
  106. export default {
  107. data() {
  108. return {
  109. config: {
  110. back: true, //false是tolbar页面 是则不写
  111. title: '我的消息',
  112. color: '#1A1A1A',
  113. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  114. backgroundColor: [1, '#fff'],
  115. statusBarFontColor: '#1A1A1A'
  116. },
  117. msg: [], //获取的msg
  118. title: [],
  119. titleOne: {},
  120. titleTwo: {},
  121. titleThree: {},
  122. titleFour: {},
  123. titleFive: {},
  124. titleSix: {}
  125. };
  126. },
  127. onShow() {
  128. this.getMsg();
  129. },
  130. methods: {
  131. //跳转消息中心
  132. goTodel(type, name) {
  133. uni.navigateTo({
  134. url: './eventDetails?type=' + type + '&name=' + name
  135. });
  136. },
  137. //获取消息
  138. getMsg() {
  139. this.$http.get(unreadInfo).then(res => {
  140. if (res && res.code == 200) {
  141. console.log(res);
  142. this.msg = res.list;
  143. this.titleOne = this.msg[0];
  144. this.titleTwo = this.msg[1];
  145. this.titleThree = this.msg[2];
  146. this.titleFour = this.msg[3];
  147. this.titleFive = this.msg[4];
  148. this.titleSix = this.msg[5];
  149. // this.msg.forEach(function(v){
  150. // // console.log("type",v.type)
  151. // let newMsg = v.type
  152. // console.log(newMsg,11111)
  153. // })
  154. }
  155. });
  156. }
  157. }
  158. };
  159. </script>
  160. <style scoped lang="scss">
  161. .middle {
  162. padding: 0 30rpx;
  163. .item {
  164. display: flex;
  165. align-items: center;
  166. padding: 30rpx 0 26rpx;
  167. border-bottom: 1rpx solid #e6e6e6;
  168. .left {
  169. margin-right: 24rpx;
  170. width: 78rpx;
  171. height: 78rpx;
  172. border-radius: 50%;
  173. // background: #4bbcfe;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. color: #fff;
  178. .iconfont {
  179. font-size: 48rpx;
  180. }
  181. image {
  182. width: 78rpx;
  183. height: 78rpx;
  184. border-radius: 50%;
  185. }
  186. }
  187. .left2 {
  188. background: #ad9be5;
  189. }
  190. .left3 {
  191. background: #4ed47f;
  192. }
  193. .left4 {
  194. background: #e4c78d;
  195. }
  196. .left5 {
  197. background: #fe9168;
  198. }
  199. .right {
  200. flex: 1;
  201. display: flex;
  202. flex-direction: column;
  203. justify-content: space-around;
  204. .msg {
  205. display: flex;
  206. justify-content: space-between;
  207. align-items: flex-start;
  208. .name {
  209. font-size: 28rpx;
  210. color: #1a1a1a;
  211. font-weight: 400;
  212. text {
  213. margin-left: 10rpx;
  214. color: #ffffff;
  215. font-size: 20rpx;
  216. font-weight: 400;
  217. padding: 0 6rpx;
  218. background-color: #ff0000;
  219. border-radius: 13rpx;
  220. }
  221. }
  222. .time {
  223. font-size: 26rpx;
  224. color: #999999;
  225. font-weight: 400;
  226. }
  227. }
  228. .advertisement {
  229. font-size: 24rpx;
  230. color: #999999;
  231. font-weight: 400;
  232. margin-top: 17rpx;
  233. }
  234. }
  235. }
  236. }
  237. .count {
  238. padding: 0px 11rpx !important;
  239. border-radius: 100rpx !important;
  240. }
  241. </style>