You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/pages/account/message/group.vue

113 lines
2.8 KiB

3 years ago
<!--
* @Author: ch
* @Date: 2022-03-22 16:13:00
* @LastEditors: ch
3 years ago
* @LastEditTime: 2022-05-14 16:32:09
3 years ago
* @Description: file content
-->
<template>
3 years ago
<view >
3 years ago
<BsEmpty tips="暂时还没有消息哦~" v-if="!$store.state.sessionData.length"
:icon="require('@/static/message/empty.png')" />
<view class="msgItem" v-for="item in $store.state.sessionData" :key="item.id"
3 years ago
@click="openMsg(item)">
<image class="msgItem--headImg" src="@/static/account/tx.png"></image>
<view class="msgItem--con">
<view>
3 years ago
<text class="msgItem--title">{{item.fromNickname}}</text>
3 years ago
<text class="msgItem--text" v-if="item.lastMessage">
<template v-if="item.lastMessage.type == msgType.TXT">{{item.lastMessage.payload.content || item.lastMessage.payload.text}}</template>
<template v-if="item.lastMessage.type == msgType.CUSTOM">[]</template>
<template v-if="item.lastMessage.type == msgType.IMG">[]</template>
<template v-if="item.lastMessage.type == msgType.VIDEO">[]</template>
</text>
</view>
<view class="msgItem--right">
3 years ago
<text class="msgItem--time" v-if="item.lastMessage">{{item.lastMessage.createTimeStamp}}</text>
3 years ago
<u-badge class="msgItem--badge" :value="item.unreadCount"></u-badge>
</view>
</view>
</view>
3 years ago
</view>
</template>
<script>
import BsEmpty from '../../../components/BsEmpty.vue';
3 years ago
import {MSG_TYPE} from '@/common/dicts/im';
3 years ago
export default {
3 years ago
components: { BsEmpty },
data (){
return {
3 years ago
msgType : MSG_TYPE,
3 years ago
sessionData : this.$store.state.sessionData
}
3 years ago
},
3 years ago
onShow(){
if(!this.$store.state.token){
this.$Router.push('/login');
}
},
3 years ago
methods:{
openMsg(item){
3 years ago
this.$store.commit('SET_SESSION_MSG_ID', item.id);
if(item.type === 3){
this.$Router.push(`/messageChat?sessionId=${item.id}`);
}else{
this.$Router.push(`/messageSystem`);
}
3 years ago
}
3 years ago
}
3 years ago
}
</script>
<style lang="scss" scoped>
.msgItem{
display: flex;
padding: 40rpx 0 0 40rpx;
&--headImg{
width: 106rpx;
height: 106rpx;
margin-right: 30rpx;
}
&--con{
flex: 1;
display: flex;
justify-content: space-between;
border-bottom: 1px solid $color-grey2;
padding: 0 40rpx 40rpx 0;
}
&--title{
width: 350rpx;
display: block;
font-size: $font-size-lg;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
margin-bottom: 20rpx;
}
&--text{
width: 350rpx;
font-size: $font-size-base;
line-height: 36rpx;
color: $color-grey4;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
&--right{
text-align: right;
}
&--time{
font-size: $font-size-sm;
color: $color-grey4;
display: block;
height: 36rpx;
line-height: 36rpx;
margin-bottom: 20rpx;
}
&--badge{
display: inline-block;
}
}
3 years ago
</style>