Refactor(客服):接收传输使用uid字段

This commit is contained in:
lifizer
2024-07-05 18:19:18 +08:00
parent d1813f3dca
commit fc392a5e01
2 changed files with 32 additions and 43 deletions
+24 -27
View File
@@ -1,17 +1,21 @@
<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 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 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>
@@ -20,42 +24,35 @@
</template>
<script>
import {userUnionId} from "@/api/public";
import { mapGetters } from 'vuex'
export default {
name: "roomLogs",
name: 'RoomLogs',
data() {
return {
webUrl:this.$VUE_APP_RESOURCES_URL,
unionId: null,
uid: null,
list: []
}
},
computed: mapGetters(['userInfo']),
onShow() {
this.getUnionId();
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}`})
},
getUnionId() {
userUnionId().then(res => {
if (res.success) {
this.unionId = res.data;
this.fetchList();
}
});
},
fetchList() {
const _this = this
uni.request({
url: this.$SERVICE_API_URL + "/customer-chat-list",
method: "POST",
data: {unionid: this.unionId},
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;
_this.list = res.data.content
}
}
})