Refactor(客服):接收传输使用uid字段
This commit is contained in:
@@ -49,15 +49,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {userUnionId} from "@/api/public";
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "room",
|
name: "room",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
token: null,
|
token: null,
|
||||||
unionId: null,
|
uid: null,
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
storeId: null,
|
storeId: null,
|
||||||
merName: null,
|
merName: null,
|
||||||
@@ -72,6 +71,7 @@ export default {
|
|||||||
list: [], //消息列表
|
list: [], //消息列表
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: mapGetters(['userInfo']),
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.storeId = options.id;
|
this.storeId = options.id;
|
||||||
this.merName = options.name;
|
this.merName = options.name;
|
||||||
@@ -82,7 +82,8 @@ export default {
|
|||||||
}
|
}
|
||||||
this.token = uni.getStorageSync("login_status");
|
this.token = uni.getStorageSync("login_status");
|
||||||
this.userInfo = uni.getStorageSync("userInfo");
|
this.userInfo = uni.getStorageSync("userInfo");
|
||||||
this.getUnionId();
|
this.uid = this.userInfo.uid
|
||||||
|
this.connectSocketInit()
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
if (this.socketOpen) {
|
if (this.socketOpen) {
|
||||||
@@ -90,15 +91,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getUnionId() {
|
|
||||||
userUnionId().then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.unionId = res.data;
|
|
||||||
this.connectSocketInit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getUploadToken() {
|
getUploadToken() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
||||||
@@ -136,7 +128,7 @@ export default {
|
|||||||
let param = {
|
let param = {
|
||||||
type: "msg",
|
type: "msg",
|
||||||
user_type: 0,
|
user_type: 0,
|
||||||
unionid: that.unionId,
|
uid: that.uid,
|
||||||
username: that.userInfo.nickname,
|
username: that.userInfo.nickname,
|
||||||
header: that.userInfo.avatar,
|
header: that.userInfo.avatar,
|
||||||
room_id: that.roomId,
|
room_id: that.roomId,
|
||||||
@@ -201,7 +193,7 @@ export default {
|
|||||||
let param = {
|
let param = {
|
||||||
type: "msg",
|
type: "msg",
|
||||||
user_type: 0,
|
user_type: 0,
|
||||||
unionid: this.unionId,
|
uid: this.uid,
|
||||||
username: this.userInfo.nickname,
|
username: this.userInfo.nickname,
|
||||||
header: this.userInfo.avatar,
|
header: this.userInfo.avatar,
|
||||||
room_id: this.roomId,
|
room_id: this.roomId,
|
||||||
@@ -217,7 +209,7 @@ export default {
|
|||||||
let param = {
|
let param = {
|
||||||
type: "join",
|
type: "join",
|
||||||
user_type: 0,
|
user_type: 0,
|
||||||
unionid: this.unionId,
|
uid: this.uid,
|
||||||
username: this.userInfo.nickname,
|
username: this.userInfo.nickname,
|
||||||
header: this.userInfo.avatar,
|
header: this.userInfo.avatar,
|
||||||
store_id: this.storeId
|
store_id: this.storeId
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="common-roomLogs">
|
<view class="common-roomLogs">
|
||||||
<view class="item flex" v-for="(item,index) in list" :key="index" @click="goRoom(item)"
|
<view v-if="list.length > 0">
|
||||||
v-if="list.length>0">
|
<view
|
||||||
<image class="cover flex-0" :src="item.store_avatar || webUrl+'/20221114155314348118.png'"/>
|
v-for="(item,index) in list"
|
||||||
<view>
|
:key="index" @click="goRoom(item)"
|
||||||
<view class="flex jc-between ai-center">
|
class="item flex"
|
||||||
<view class="name">{{ item.store_name }}</view>
|
>
|
||||||
<view class="datetime" v-if="item.last_msg">{{ item.last_msg.created_at }}</view>
|
<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 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>
|
||||||
|
|
||||||
<view class="v4-nodata" v-if="list.length===0">
|
<view class="v4-nodata" v-if="list.length===0">
|
||||||
<image src="@/static/images/img_nodata.png" mode="scaleToFill"/>
|
<image src="@/static/images/img_nodata.png" mode="scaleToFill"/>
|
||||||
<view class="text">暂无数据</view>
|
<view class="text">暂无数据</view>
|
||||||
@@ -20,42 +24,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {userUnionId} from "@/api/public";
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "roomLogs",
|
name: 'RoomLogs',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
webUrl:this.$VUE_APP_RESOURCES_URL,
|
webUrl:this.$VUE_APP_RESOURCES_URL,
|
||||||
unionId: null,
|
uid: null,
|
||||||
list: []
|
list: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: mapGetters(['userInfo']),
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getUnionId();
|
this.uid = this.userInfo.uid
|
||||||
|
this.fetchList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goRoom(item) {
|
goRoom(item) {
|
||||||
uni.navigateTo({url: `/pkg_common/views/room?id=${item.store_id}&name=${item.store_name}`})
|
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() {
|
fetchList() {
|
||||||
|
const _this = this
|
||||||
uni.request({
|
uni.request({
|
||||||
url: this.$SERVICE_API_URL + "/customer-chat-list",
|
url: _this.$SERVICE_API_URL + '/customer-chat-list',
|
||||||
method: "POST",
|
method: 'POST',
|
||||||
data: {unionid: this.unionId},
|
data: {uid: _this.uid},
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.data.status_code === 200) {
|
if (res.data.status_code === 200) {
|
||||||
this.list = res.data.content;
|
_this.list = res.data.content
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user