Files
xdd-uniapp-new/pkg_common/views/roomLogs.vue
T

106 lines
2.4 KiB
Vue

<template>
<view class="common-roomLogs">
<view v-if="list.length > 0">
<view
v-for="(item,index) in list"
:key="index" @click="goRoom(item)"
class="item flex"
>
<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>
<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 { mapGetters } from 'vuex'
export default {
name: 'RoomLogs',
data() {
return {
webUrl:this.$VUE_APP_RESOURCES_URL,
uid: null,
list: []
}
},
computed: mapGetters(['userInfo']),
onShow() {
this.uid = this.userInfo.uid
this.fetchList()
},
methods: {
goRoom(item) {
uni.navigateTo({url: `/pkg_common/views/room?id=${item.store_id}&name=${item.store_name}`})
},
fetchList() {
const _this = this
uni.request({
url: _this.$SERVICE_API_URL + '/customer-chat-list',
method: 'POST',
data: {uid: _this.uid},
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>