项目初始化
This commit is contained in:
265
pages/tabbar/components/message/viewItem.vue
Normal file
265
pages/tabbar/components/message/viewItem.vue
Normal file
@@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 系统消息 -->
|
||||
<view class="msg-list" v-if="item.groupType == 3">
|
||||
<view class="msg-user">
|
||||
<view class="avatar">
|
||||
<!-- <image class="img" src="@/static/images/bell.png"></image> -->
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="text-black">
|
||||
<view class="text-nickname">
|
||||
<view class="nickname green">通知助手</view>
|
||||
</view>
|
||||
<text class="time">前天</text>
|
||||
</view>
|
||||
<view class="text-gray">
|
||||
<view class="text-msg">
|
||||
<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 class="msg-list" @longpress="onLongPress" :data-index="index" v-if="item.groupType == 1">
|
||||
<view class="msg-user">
|
||||
<view class="avatar" @click="detail(item)">
|
||||
<image class="img" :src="item.avatar"></image>
|
||||
<view class="badge" v-if="item.online"></view>
|
||||
</view>
|
||||
<view class="content" @click="toChat(item)">
|
||||
<view class="text-black">
|
||||
<view class="text-nickname">
|
||||
<view class="nickname">{{item.nickname}}</view>
|
||||
<view class="sex-badge" v-if="item.sex == 2">
|
||||
<u-icon name="ziyuan2" custom-prefix="iconfont"></u-icon>
|
||||
</view>
|
||||
<view class="sex-man" v-if="item.sex == 1">
|
||||
<u-icon name="ziyuan3" custom-prefix="iconfont"></u-icon>
|
||||
</view>
|
||||
<!-- <image class="vip-img" src="@/static/images/vip.png"></image> -->
|
||||
</view>
|
||||
<text class="time">{{item.time}}</text>
|
||||
</view>
|
||||
<view class="text-gray">
|
||||
<view class="text-msg">
|
||||
<view v-if="item.lastMessageReadStatus == '1'">已读</view>
|
||||
<view class="text" v-if="item.lastMessageContentType == 1">{{item.lastMessageContent}}</view>
|
||||
<view v-if="item.lastMessageContentType == 3">[语音消息]</view>
|
||||
<view v-if="item.lastMessageContentType == 4">[图片消息]</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">{{item.unreadMessageCount}}</tui-badge>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sheep from '@/sheep';
|
||||
import tuiBadge from "@/components/thorui/tui-badge/tui-badge.vue";
|
||||
export default {
|
||||
components: {
|
||||
tuiBadge,
|
||||
},
|
||||
props: {
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1,
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {
|
||||
dd: '',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onLongPress(e) {
|
||||
this.$emit('onLongPress', e);
|
||||
},
|
||||
detail(e) {
|
||||
sheep.$router.go('/pages/user/detail/index',{id: e.userId});
|
||||
},
|
||||
toChat(e) {
|
||||
e.unreadMessageCount = 0;
|
||||
this.$u.route({
|
||||
url: 'pages/im/index',
|
||||
params: {
|
||||
groupId: e.groupId,
|
||||
receiveUserId: e.userId,
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</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;
|
||||
background-color: #ddd;
|
||||
border-radius: 100%;
|
||||
|
||||
.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;
|
||||
|
||||
.nickname {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 200rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text-gray {
|
||||
font-size: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
color: #aaaaaa;
|
||||
|
||||
.text-msg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
max-width: 340rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.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>
|
Reference in New Issue
Block a user