Files
xdd-uniapp-new/pkg_common/views/roomLogs.vue
T
2023-09-20 21:49:33 +08:00

109 lines
2.4 KiB
Vue

<template>
<view class="common-roomLogs">
<view class="item flex" v-for="(item,index) in list" :key="index" @click="goRoom(item)"
v-if="list.length>0">
<image class="cover flex-0" :src="item.store_avatar || webUrl+'/20221114155314348118.png'"/>
<view>
<view class="flex jc-between ai-center">
<view class="name">{{ item.store_name }}</view>
<view class="datetime" v-if="item.last_msg">{{ item.last_msg.created_at }}</view>
</view>
<view class="sub one-t" v-if="item.last_msg">{{ item.last_msg.msg_type===0?item.last_msg.msg_content:'[图片]' }}</view>
</view>
</view>
<view class="v4-nodata" v-if="list.length===0">
<image src="@/static/images/img_nodata.png" mode="scaleToFill"/>
<view class="text">暂无数据</view>
</view>
</view>
</template>
<script>
import {userUnionId} from "@/api/public";
export default {
name: "roomLogs",
data() {
return {
webUrl:this.$VUE_APP_RESOURCES_URL,
unionId: null,
list: []
}
},
onShow() {
this.getUnionId();
},
methods: {
goRoom(item) {
uni.navigateTo({url: `/pkg_common/views/room?id=${item.store_id}&name=${item.store_name}`})
},
getUnionId() {
userUnionId().then(res => {
if (res.success) {
this.unionId = res.data;
this.fetchList();
}
});
},
fetchList() {
uni.request({
url: this.$SERVICE_API_URL + "/customer-chat-list",
method: "POST",
data: {unionid: this.unionId},
success: res => {
if (res.data.status_code === 200) {
this.list = res.data.content;
}
}
})
}
}
}
</script>
<style scoped lang="less">
.common-roomLogs {
min-height: 100vh;
box-sizing: border-box;
padding: 32rpx;
background: #F5F5F5;
.item {
margin-bottom: 24rpx;
padding: 28rpx 20rpx 24rpx;
border-radius: 8rpx;
background: #FFFFFF;
.cover {
width: 80rpx;
height: 80rpx;
margin-right: 18rpx;
border-radius: 50%;
}
.name {
font-size: 26rpx;
font-weight: bold;
line-height: 38rpx;
color: #333333;
}
.datetime {
font-size: 22rpx;
line-height: 32rpx;
color: #999999;
}
.sub {
width: 548rpx;
margin-top: 12rpx;
font-size: 24rpx;
line-height: 34rpx;
color: #666666;
}
}
}
</style>