客服模块优化
This commit is contained in:
parent
95ab7bee52
commit
62ddc43aa2
@ -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)
|
||||
// 跳转到聊天页面
|
||||
|
||||
@ -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,9 +345,12 @@ export default {
|
||||
},
|
||||
|
||||
// 加载更多历史消息
|
||||
loadMoreHistory(){
|
||||
if (!this.isLoadingHistory && this.hasMoreHistory) {
|
||||
this.loadHistoryMessages()
|
||||
loadMoreHistory(e){
|
||||
// 只有当滚动到顶部时才加载更多历史消息
|
||||
if (!e || e.detail.direction === 'top') {
|
||||
if (!this.isLoadingHistory && this.hasMoreHistory) {
|
||||
this.loadHistoryMessages()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user