216 lines
3.9 KiB
Vue
216 lines
3.9 KiB
Vue
![]() |
<template>
|
||
|
<view>
|
||
|
<!-- 用户消息 -->
|
||
|
<view class="msg-list" @click="toChat(item)" :data-index="index">
|
||
|
<view class="msg-user">
|
||
|
<view class="avatar">
|
||
|
<image class="img" :src="item.avatar"></image>
|
||
|
<view class="badge"></view>
|
||
|
</view>
|
||
|
<view class="content">
|
||
|
<view class="text-black">
|
||
|
<view class="text-nickname">
|
||
|
<view class="nickname">{{item.nickname}}</view>
|
||
|
<view class="sex-badge" v-if="item.sex == 1">
|
||
|
<u-icon name="ziyuan2" custom-prefix="iconfont"></u-icon>
|
||
|
</view>
|
||
|
<view class="sex-man" v-if="item.sex == 0">
|
||
|
<u-icon name="ziyuan3" custom-prefix="iconfont"></u-icon>
|
||
|
</view>
|
||
|
<image class="vip-img" src="@/static/images/vip.png"></image>
|
||
|
</view>
|
||
|
<text class="time">19:39</text>
|
||
|
</view>
|
||
|
<view class="text-gray">
|
||
|
<view class="text-msg">
|
||
|
<view>[已读]</view>
|
||
|
<view>希望打个赏哦</view>
|
||
|
</view>
|
||
|
<view v-if="item.slashed == 1">
|
||
|
<u-icon name="bell-slash" custom-prefix="iconfont"></u-icon>
|
||
|
</view>
|
||
|
<view v-else>
|
||
|
<view v-if="item.unreadMessageCount > 0">
|
||
|
<tui-badge :scaleRatio="0.8" type="green" dot></tui-badge>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import tuiBadge from "@/components/thorui/tui-badge/tui-badge.vue";
|
||
|
import ImConversationApi from '@/sheep/api/im/memberConversation';
|
||
|
export default {
|
||
|
components: {
|
||
|
tuiBadge,
|
||
|
},
|
||
|
props: {
|
||
|
index: {
|
||
|
type: Number,
|
||
|
default: -1,
|
||
|
},
|
||
|
item: {
|
||
|
type: Object,
|
||
|
default: function() {
|
||
|
return {
|
||
|
dd: '',
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
toChat(e) {
|
||
|
ImConversationApi.createMemberConversation({
|
||
|
userId: e.id,
|
||
|
groupType: 1,
|
||
|
lastMessageContentType: 1,
|
||
|
}).then(res => {
|
||
|
this.$u.route({
|
||
|
url: 'pages/im/index',
|
||
|
params: {
|
||
|
groupId: res.data,
|
||
|
receiveUserId: e.id,
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.msg-list {
|
||
|
display: flex;
|
||
|
padding: 15px;
|
||
|
|
||
|
.msg-user{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
flex: 1;
|
||
|
|
||
|
.avatar {
|
||
|
width: 88rpx;
|
||
|
height: 88rpx;
|
||
|
position: relative;
|
||
|
|
||
|
.img {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
border-radius: 100%;
|
||
|
}
|
||
|
|
||
|
.badge {
|
||
|
width: 20rpx;
|
||
|
height: 20rpx;
|
||
|
top: 0;
|
||
|
right: 0;
|
||
|
border: 1px solid #fff;
|
||
|
position: absolute;
|
||
|
background-color: #dd514c;
|
||
|
border-radius: 85px;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.content {
|
||
|
display: flex;
|
||
|
flex: 1;
|
||
|
flex-direction: column;
|
||
|
margin-left: 10px;
|
||
|
|
||
|
.new {
|
||
|
width: 14rpx;
|
||
|
height: 14rpx;
|
||
|
background-color: #dd514c;
|
||
|
border-radius: 85px;
|
||
|
}
|
||
|
|
||
|
.text-black {
|
||
|
font-size: 28rpx;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: space-between;
|
||
|
color: #333333;
|
||
|
margin-bottom: 8rpx;
|
||
|
|
||
|
.tag {
|
||
|
margin-right: 5px;
|
||
|
}
|
||
|
|
||
|
.time {
|
||
|
color: #aaaaaa;
|
||
|
font-size: 24rpx;
|
||
|
}
|
||
|
|
||
|
.text-nickname {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.text-gray {
|
||
|
font-size: 24rpx;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: space-between;
|
||
|
color: #aaaaaa;
|
||
|
|
||
|
.text-msg {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.green {
|
||
|
color: #735fed;
|
||
|
}
|
||
|
|
||
|
.sex-badge {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
background-color: #e03997;
|
||
|
color: #ffffff;
|
||
|
border-radius: 3px;
|
||
|
font-size: 8px;
|
||
|
height: 30rpx;
|
||
|
width: 30rpx;
|
||
|
margin: 0 10rpx;
|
||
|
}
|
||
|
|
||
|
.sex-man {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
background-color: #0081ff;
|
||
|
color: #ffffff;
|
||
|
border-radius: 3px;
|
||
|
font-size: 8px;
|
||
|
height: 30rpx;
|
||
|
width: 30rpx;
|
||
|
margin: 0 10rpx;
|
||
|
}
|
||
|
|
||
|
.vip-img {
|
||
|
width: 34rpx;
|
||
|
height: 34rpx;
|
||
|
}
|
||
|
|
||
|
.svip-img {
|
||
|
width: 60rpx;
|
||
|
height: 30rpx;
|
||
|
}
|
||
|
</style>
|