Browse Source

设置已读

chenjj 3 days ago
parent
commit
617c4e93d1
2 changed files with 6 additions and 2 deletions
  1. 2 2
      pages_orderuser/pages/talk/pages/index/index.vue
  2. 4 0
      utils/WebSocketManager.js

+ 2 - 2
pages_orderuser/pages/talk/pages/index/index.vue

@@ -77,7 +77,7 @@ export default {
 			orderId: '',
 			orderInfo: {},//订单信息
 			userType: uni.getStorageSync('userType'), //读取本地存储
-			system: '2',
+			system: 2,
 			userId: uni.getStorageSync('userId'), //读取本地存储
 			conversationRecordId: null,//会话id
 			storeUser: store.state.user,
@@ -110,7 +110,7 @@ export default {
 		}
 	
 		//1用户2志愿者3后台
-		this.system = this.userType === 1 ? '1' : '2';
+		this.system = this.userType === 1 ? 1 : 2;
 		//客服
 		if(options.customerService){
 			// this.system = 3;

+ 4 - 0
utils/WebSocketManager.js

@@ -1,6 +1,7 @@
 import config from '@/config'
 const baseUrl = config.baseUrl
 import store from '@/store'
+import { getToken } from '@/utils/auth'
 class WebSocketManager {
     constructor(userId) {
         // 1用户 2志愿者
@@ -37,6 +38,9 @@ class WebSocketManager {
         this.socketTask = uni.connectSocket({
             url: this.url,
             success: () => console.log('WebSocket 连接创建成功'),
+            header: { 
+                'Authorization': `Bearer ${getToken()}` 
+            }, 
         });
 
         this._setupEventListeners();