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
+8 -16
View File
@@ -49,15 +49,14 @@
</template>
<script>
import {userUnionId} from "@/api/public";
import { mapGetters } from 'vuex'
export default {
name: "room",
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
token: null,
unionId: null,
uid: null,
userInfo: null,
storeId: null,
merName: null,
@@ -72,6 +71,7 @@ export default {
list: [], //消息列表
}
},
computed: mapGetters(['userInfo']),
onLoad(options) {
this.storeId = options.id;
this.merName = options.name;
@@ -82,7 +82,8 @@ export default {
}
this.token = uni.getStorageSync("login_status");
this.userInfo = uni.getStorageSync("userInfo");
this.getUnionId();
this.uid = this.userInfo.uid
this.connectSocketInit()
},
onUnload() {
if (this.socketOpen) {
@@ -90,15 +91,6 @@ export default {
}
},
methods: {
getUnionId() {
userUnionId().then(res => {
if (res.success) {
this.unionId = res.data;
this.connectSocketInit();
}
});
},
getUploadToken() {
let that = this;
@@ -136,7 +128,7 @@ export default {
let param = {
type: "msg",
user_type: 0,
unionid: that.unionId,
uid: that.uid,
username: that.userInfo.nickname,
header: that.userInfo.avatar,
room_id: that.roomId,
@@ -201,7 +193,7 @@ export default {
let param = {
type: "msg",
user_type: 0,
unionid: this.unionId,
uid: this.uid,
username: this.userInfo.nickname,
header: this.userInfo.avatar,
room_id: this.roomId,
@@ -217,7 +209,7 @@ export default {
let param = {
type: "join",
user_type: 0,
unionid: this.unionId,
uid: this.uid,
username: this.userInfo.nickname,
header: this.userInfo.avatar,
store_id: this.storeId