客服模块优化
This commit is contained in:
parent
95ab7bee52
commit
62ddc43aa2
@ -8,7 +8,7 @@
|
|||||||
<view v-else>
|
<view v-else>
|
||||||
<view v-for="record in recordsList" :key="record.id">
|
<view v-for="record in recordsList" :key="record.id">
|
||||||
<view class="record-item" @tap="goToChatPage(record)">
|
<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-info">
|
||||||
<view class="record-title-row">
|
<view class="record-title-row">
|
||||||
<text class="record-title">{{ record.contact_name }}</text>
|
<text class="record-title">{{ record.contact_name }}</text>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { request } from '../../../utils/index'
|
import { menuButtonInfo, picUrl, request } from '../../../utils'
|
||||||
import { apiArr } from '../../../api/customerService'
|
import { apiArr } from '../../../api/customerService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -64,6 +64,13 @@ export default {
|
|||||||
this.isLoading = false
|
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){
|
formatTime(time){
|
||||||
const date = new Date(time)
|
const date = new Date(time)
|
||||||
@ -98,8 +105,6 @@ export default {
|
|||||||
|
|
||||||
// 跳转到聊天页面
|
// 跳转到聊天页面
|
||||||
goToChatPage(record){
|
goToChatPage(record){
|
||||||
console.log('🚀 ~ goToChatPage ~ record:', record)
|
|
||||||
console.log('🚀 ~ goToChatPage ~ itemObj:', this.itemObj)
|
|
||||||
|
|
||||||
this.$set(record, 'type', 2)
|
this.$set(record, 'type', 2)
|
||||||
// 跳转到聊天页面
|
// 跳转到聊天页面
|
||||||
|
|||||||
@ -32,7 +32,7 @@ packages/customerService/index/index
|
|||||||
'other': !message.isSelf,
|
'other': !message.isSelf,
|
||||||
'loading': message.isLoading
|
'loading': message.isLoading
|
||||||
}" class="message-item">
|
}" 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>
|
mode="aspectFill"></image>
|
||||||
<view class="message-content">
|
<view class="message-content">
|
||||||
{{ message.content }}
|
{{ message.content }}
|
||||||
@ -141,6 +141,9 @@ export default {
|
|||||||
onShow(){
|
onShow(){
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAvatarUrl(record){
|
||||||
|
return this.chatTarget.employee_image ? this.chatTarget.employee_image : 'http://localhost:8080/defaultTx.png'
|
||||||
|
},
|
||||||
async connect(){
|
async connect(){
|
||||||
this.client = null
|
this.client = null
|
||||||
const options = {
|
const options = {
|
||||||
@ -342,9 +345,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 加载更多历史消息
|
// 加载更多历史消息
|
||||||
loadMoreHistory(){
|
loadMoreHistory(e){
|
||||||
if (!this.isLoadingHistory && this.hasMoreHistory) {
|
// 只有当滚动到顶部时才加载更多历史消息
|
||||||
this.loadHistoryMessages()
|
if (!e || e.detail.direction === 'top') {
|
||||||
|
if (!this.isLoadingHistory && this.hasMoreHistory) {
|
||||||
|
this.loadHistoryMessages()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user