客服模块优化

This commit is contained in:
赵毅 2025-09-25 14:53:00 +08:00
parent 95ab7bee52
commit 62ddc43aa2
2 changed files with 19 additions and 8 deletions

View File

@ -8,7 +8,7 @@
<view v-else>
<view v-for="record in recordsList" :key="record.id">
<view class="record-item" @tap="goToChatPage(record)">
<image :src="record.avatar || '/static/logo.png'" class="record-avatar" mode="aspectFill"></image>
<image :src="getAvatarUrl(record)" class="record-avatar" mode="aspectFill"></image>
<view class="record-info">
<view class="record-title-row">
<text class="record-title">{{ record.contact_name }}</text>
@ -23,7 +23,7 @@
</template>
<script>
import { request } from '../../../utils/index'
import { menuButtonInfo, picUrl, request } from '../../../utils'
import { apiArr } from '../../../api/customerService'
export default {
@ -64,6 +64,13 @@ export default {
this.isLoading = false
}
},
getAvatarUrl(record){
if(record.client_id_one == uni.getStorageSync('openId')){
return record.two.avatar ? picUrl + record.two.avatar : 'http://localhost:8080/defaultTx.png'
}else{
return record.one.avatar ? picUrl + record.one.avatar : 'http://localhost:8080/defaultTx.png'
}
},
//
formatTime(time){
const date = new Date(time)
@ -98,8 +105,6 @@ export default {
//
goToChatPage(record){
console.log('🚀 ~ goToChatPage ~ record:', record)
console.log('🚀 ~ goToChatPage ~ itemObj:', this.itemObj)
this.$set(record, 'type', 2)
//

View File

@ -32,7 +32,7 @@ packages/customerService/index/index
'other': !message.isSelf,
'loading': message.isLoading
}" class="message-item">
<image :src="message.isSelf ? userAvatar : (chatTarget.employee_image)" class="message-avatar"
<image :src="message.isSelf ? userAvatar : getAvatarUrl(message)" class="message-avatar"
mode="aspectFill"></image>
<view class="message-content">
{{ message.content }}
@ -141,6 +141,9 @@ export default {
onShow(){
},
methods: {
getAvatarUrl(record){
return this.chatTarget.employee_image ? this.chatTarget.employee_image : 'http://localhost:8080/defaultTx.png'
},
async connect(){
this.client = null
const options = {
@ -342,10 +345,13 @@ export default {
},
//
loadMoreHistory(){
loadMoreHistory(e){
//
if (!e || e.detail.direction === 'top') {
if (!this.isLoadingHistory && this.hasMoreHistory) {
this.loadHistoryMessages()
}
}
},
//