From 83f3a4c10eecb80204f61c1210d3685e20c0a9f7 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 24 Feb 2026 11:06:40 +0800
Subject: [PATCH] feat:获取登录账号信息

---
 applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue |   36 ++++++++++++++++++------------------
 uniapps/work-app/src/pages/login/index.vue                          |   13 +++++++++++--
 2 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
index 8f98065..ccbd146 100644
--- a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
+++ b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
@@ -44,11 +44,11 @@
 /** ✅ 你的 WS 地址前缀(后面拼 userId) */
 // const WS_BASE = 'ws://218.202.104.82:38201/ws/chat?userId='
 const WS_BASE = 'ws://218.202.104.82:38201/ws/chat'
-
-const uid = ref('2021475329842999298')
+const newUserInfo = ref(null)
+const uid = ref('')
 const peerUid = ref('2021474568497131521')
 // 联系人名称
-const contactName = ref('张三')
+const contactName = ref('')
 
 const connected = ref(false)
 const state = ref('idle') // idle | calling | ringing | in-call
@@ -138,16 +138,16 @@
 
 // 从URL参数或本地存储获取用户ID
 const getUserIdFromStorage = () => {
-	// 从url获取用户id
-	const contact = JSON.parse(decodeURIComponent(receiveParameters.value))
-	console.log('从url获取用户id',contact?.userId)
-	// 从本地获取用户id
-	const userId = localStorage.getItem('userId') || sessionStorage.getItem('userId')
-	console.log('从本地存储获取userId:', userId)
-	if (userId) {
+	const userId = '2021474815063486465'
+	try {
+		const params = JSON.parse(decodeURIComponent(route.query.params));
+		newUserInfo.value = params.new_userInfo
+		const userIdFromParams = params.new_userInfo?.userId
+		console.log('从url获取用户id', userIdFromParams)
+		return userIdFromParams || userId
+	} catch (error) {
 		return userId
 	}
-	return '2021475329842999298' // 默认值
 }
 
 // 心跳
@@ -591,8 +591,8 @@
 const receiveParameters = ref(route.query.contact || null);
 
 onMounted(() => {
-	console.log('收拾收拾',route.query.voiceparams);
-	console.log('接收参数', receiveParameters)
+	console.log('对方打给我的',route.query.voiceparams);
+	console.log('接收拨打电话:对方参数', receiveParameters)
 	if (route.query && route.query.params) {
 		try {
 			const params = JSON.parse(decodeURIComponent(route.query.params));
@@ -609,11 +609,11 @@
 	if (receiveParameters.value) {
 		try {
 			const contact = JSON.parse(decodeURIComponent(receiveParameters.value))
-			if (contact.friendId) {
-				peerUid.value = contact.friendId
-				contactName.value = contact.friendNickName || '未知联系人'
-				log('🔗 从contact参数获取peerUid:', contact.friendId)
-				log('👤 联系人名称:', contactName.value)
+			if (contact.userId) {
+				peerUid.value = contact.userId
+				contactName.value = contact.nickName || '未知联系人'
+				// log('🔗 从contact参数获取peerUid:', peerUid.value)
+				// log('👤 联系人名称:', contactName.value)
 			}
 		} catch (e) {
 			log('❌ 解析contact参数失败:', String(e))
diff --git a/uniapps/work-app/src/pages/login/index.vue b/uniapps/work-app/src/pages/login/index.vue
index fcb6289..9adcab6 100644
--- a/uniapps/work-app/src/pages/login/index.vue
+++ b/uniapps/work-app/src/pages/login/index.vue
@@ -38,7 +38,7 @@
 import { getAssetsImage } from "@/utils/index.js";
 import {ticketLoginInterfaceApi} from '@/api/work/index.js'
 import md5 from "js-md5";
-import { loginByUsername } from "@/api/user/index.js";
+import { loginByUsername,getUserInfo } from "@/api/user/index.js";
 import { useUserStore, useLocationStore } from "@/store/index.js";
 import locationUtil from "@/utils/location.js";
 import websocketService from "@/utils/websocket.js";
@@ -85,6 +85,15 @@
   username: "zhx",
   password: "123456",
 });
+const getUserInfoData = () => {
+  getUserInfo().then((res) => {
+   const currentUserInfo = userStore.$state.userInfo;
+      userStore.setUserInfo({
+        ...currentUserInfo,
+        new_userInfo: res.data.data
+      });
+  });
+};
 async function submit() {
 
   if (!loginForm.value.username.trim()) {
@@ -151,7 +160,7 @@
     } catch (error) {
       console.error('处理位置服务失败:', error);
     }
-
+await getUserInfoData()
  // 调用工单登录接口
     await gdLogin()
 

--
Gitblit v1.9.3