123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <template>
- <view class="my-msg">
- <navbar ref="navbar" backColor="#666" :config="config"></navbar>
- <view class="middle">
- <view class="item" @click="goTodel(0, '活动消息')">
- <view class="left">
- <!-- <text class="iconfont"></text> -->
- <image src="/static/czd/myMsg_iocn1.png" mode=""></image>
- </view>
- <view class="right">
- <view class="msg">
- <view class="name">
- 活动消息
- <text class="count" v-if="titleOne.num == 0 ? false : titleOne.num">{{ titleOne.num }}</text>
- <!-- <text >{{msg[0] && msg[0].num? msg[0].num : ''}}</text> -->
- </view>
- <view class="time">{{ titleOne.time ? titleOne.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleOne.remark ? titleOne.remark : '' }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(1, '支付消息')">
- <view class="left">
- <!-- <text class="iconfont"></text> -->
- <image src="/static/czd/myMsg_iocn5.png" mode=""></image>
- </view>
- <view class="right right2">
- <view class="msg">
- <view class="name">
- 支付消息
- <text class="count" v-if="titleTwo == 0 ? false : titleTwo.num">{{ titleTwo.num }}</text>
- </view>
- <view class="time">{{ titleTwo.time ? titleTwo.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleTwo.remark ? titleTwo.remark : '' }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(2, '物流消息')">
- <view class="left right3">
- <!-- <text class="iconfont"></text> -->
- <image src="/static/czd/myMsg_iocn3.png" mode=""></image>
- </view>
- <view class="right right4">
- <view class="msg">
- <view class="name">
- 物流消息
- <text class="count" v-if="titleThree.num == 0 ? false : titleThree.num">{{ titleThree.num }}</text>
- </view>
- <view class="time">{{ titleThree.time ? titleThree.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleThree.remark ? titleThree.remark : '' }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(3, '售后消息')">
- <view class="left">
- <!-- <text class="iconfont"></text> -->
- <image src="/static/czd/myMsg_iocn2.png" mode=""></image>
- </view>
- <view class="right right5">
- <view class="msg">
- <view class="name">
- 售后消息
- <text class="count" v-if="titleFour == 0 ? false : titleFour.num">{{ titleFour.num }}</text>
- </view>
- <view class="time">{{ titleFour.time ? titleFour.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleFour.remark ? titleFour.remark : '' }}</view>
- </view>
- </view>
- <!-- <view class="item" @click="goTodel(4, '互动消息')">
- <view class="left" style="background: #4bbcfe;"><text class="iconfont"></text></view>
- <view class="right">
- <view class="msg">
- <view class="name">
- 互动消息
- <text v-if="titleFive == 0 ? false : titleFive.num">{{ titleFive.num }}</text>
- </view>
- <view class="time">{{ titleFive.time ? titleFive.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleFive.remark ? titleFive.remark : '' }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(5, '系统消息')">
- <view class="left">
- <image src="/static/czd/myMsg_iocn4.png" mode=""></image>
- </view>
- <view class="right right5">
- <view class="msg">
- <view class="name">
- 系统消息
- <text class="count" v-if="titleSix == 0 ? false : titleSix.num">{{ titleSix.num }}</text>
- </view>
- <view class="time">{{ titleSix.time ? titleSix.time : '' }}</view>
- </view>
- <view class="advertisement">{{ titleSix.remark ? titleSix.remark : '' }}</view>
- </view>
- </view> -->
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- unreadInfo
- } from '@/api/userInfo.js';
- export default {
- data() {
- return {
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '我的消息',
- color: '#1A1A1A',
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- backgroundColor: [1, '#fff'],
- statusBarFontColor: '#1A1A1A'
- },
- msg: [], //获取的msg
- title: [],
- titleOne: {},
- titleTwo: {},
- titleThree: {},
- titleFour: {},
- titleFive: {},
- titleSix: {}
- };
- },
- onShow() {
- this.getMsg();
- },
- methods: {
- //跳转消息中心
- goTodel(type, name) {
- uni.navigateTo({
- url: './eventDetails?type=' + type + '&name=' + name
- });
- },
- //获取消息
- getMsg() {
- this.$http.get(unreadInfo).then(res => {
- if (res && res.code == 200) {
- console.log(res);
- this.msg = res.list;
- this.titleOne = this.msg[0];
- this.titleTwo = this.msg[1];
- this.titleThree = this.msg[2];
- this.titleFour = this.msg[3];
- this.titleFive = this.msg[4];
- this.titleSix = this.msg[5];
- // this.msg.forEach(function(v){
- // // console.log("type",v.type)
- // let newMsg = v.type
- // console.log(newMsg,11111)
- // })
- }
- });
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .middle {
- padding: 0 30rpx;
- .item {
- display: flex;
- align-items: center;
- padding: 30rpx 0 26rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .left {
- margin-right: 24rpx;
- width: 78rpx;
- height: 78rpx;
- border-radius: 50%;
- // background: #4bbcfe;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- .iconfont {
- font-size: 48rpx;
- }
- image {
- width: 78rpx;
- height: 78rpx;
- border-radius: 50%;
- }
- }
- .left2 {
- background: #ad9be5;
- }
- .left3 {
- background: #4ed47f;
- }
- .left4 {
- background: #e4c78d;
- }
- .left5 {
- background: #fe9168;
- }
- .right {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- .msg {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- .name {
- font-size: 28rpx;
- color: #1a1a1a;
- font-weight: 400;
- text {
- margin-left: 10rpx;
- color: #ffffff;
- font-size: 20rpx;
- font-weight: 400;
- padding: 0 6rpx;
- background-color: #ff0000;
- border-radius: 13rpx;
- }
- }
- .time {
- font-size: 26rpx;
- color: #999999;
- font-weight: 400;
- }
- }
- .advertisement {
- font-size: 24rpx;
- color: #999999;
- font-weight: 400;
- margin-top: 17rpx;
- }
- }
- }
- }
- .count {
- padding: 0px 11rpx !important;
- border-radius: 100rpx !important;
- }
- </style>
|