From 5df476ae693d7577c7a0031ae12c67558b9832a7 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期六, 12 九月 2026 10:48:10 +0800
Subject: [PATCH] 测试完成
---
src/views/loginSSO.vue | 109 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 82 insertions(+), 27 deletions(-)
diff --git a/src/views/loginSSO.vue b/src/views/loginSSO.vue
index d195a79..b11fb85 100644
--- a/src/views/loginSSO.vue
+++ b/src/views/loginSSO.vue
@@ -34,45 +34,47 @@
},
methods: {
// 鍖归厤orgid - 浼樺寲涓哄璞℃槧灏�
- mateOrgid(orgid) {
+ mateOrgid(campusid, orgid) {
const orgMap = {
- "30001002": {
+ 30001002: {
orgname: "鐪佺珛鍚屽痉缈犺嫅闄㈠尯",
ZuHuID: "1400361376454545408",
deptCode: "1017",
},
- "30001003": {
+ 30001003: {
orgname: "鐪佺珛鍚屽痉涔嬫睙闄㈠尯",
ZuHuID: "1400360867068907520",
deptCode: "01040201",
},
- "30001004": {
+ 30001004: {
orgname: "鐪佺珛鍚屽痉闂叉灄闄㈠尯",
ZuHuID: "1429338802177000002",
deptCode: "",
},
- "30001005": {
+ 30001005: {
orgname: "鐪佺珛鍚屽痉澶╃洰灞辫矾闄㈠尯",
ZuHuID: "1429338802177000003",
deptCode: "",
},
- "30001006": {
+ 30001006: {
orgname: "鐪佺珛鍚屽痉闈掑北婀栭櫌鍖�",
ZuHuID: "1429338802177000004",
deptCode: "",
},
- "30001007": {
- orgname: "娴嬭瘯闄㈠尯",
+ 30001007: {
+ orgname: "鐪佺珛鍚屽痉缈犺嫅闄㈠尯", //娴嬭瘯
ZuHuID: "1429338802177000005",
deptCode: "",
},
};
- const orgInfo = orgMap[orgid];
+ const orgInfo = orgMap[campusid];
if (orgInfo) {
localStorage.setItem("orgname", orgInfo.orgname);
localStorage.setItem("ZuHuID", orgInfo.ZuHuID);
localStorage.setItem("deptCode", orgInfo.deptCode);
+ localStorage.setItem("campusid", campusid);
+ localStorage.setItem("orgid", orgid);
return orgInfo;
}
return null;
@@ -147,7 +149,30 @@
// 3. 娓呯悊鏃х郴缁熸暟鎹�
this.clearOldSystemData();
- const { token, orgid, orgname, ZuHuID, deptCode, redirect } = params;
+ const {
+ token,
+ orgid,
+ orgname,
+ ZuHuID,
+ deptCode,
+ redirect,
+ campusid,
+ taskid,
+ patid,
+ id,
+ Voicetype,
+ visitCount,
+ } = params;
+ console.log(
+ token,
+ orgid,
+ orgname,
+ ZuHuID,
+ deptCode,
+ redirect,
+ campusid,
+ "鍙傛暟鏃ュ織"
+ );
// 4. 瀛樺偍token
setToken(token);
@@ -157,7 +182,7 @@
// 5. 澶勭悊鏈烘瀯淇℃伅
if (orgid) {
// 浼樺厛浣跨敤mateOrgid鏄犲皠
- const orgInfo = this.mateOrgid(orgid);
+ const orgInfo = this.mateOrgid(campusid, orgid);
if (!orgInfo) {
// 濡傛灉娌℃湁鏄犲皠锛屼娇鐢ㄤ紶鍏ョ殑鍙傛暟
if (orgname) localStorage.setItem("orgname", orgname);
@@ -166,23 +191,46 @@
}
localStorage.setItem("orgid", orgid);
- if (this.$store.dispatch && typeof this.$store.dispatch === "function") {
+ if (
+ this.$store.dispatch &&
+ typeof this.$store.dispatch === "function"
+ ) {
await this.$store.dispatch("UpdateOrgId", orgid);
}
}
this.loadingDetail = "璁剧疆鏈烘瀯淇℃伅...";
- // 6. 鑾峰彇鐢ㄦ埛淇℃伅
- if (this.$store.dispatch && typeof this.$store.dispatch === "function") {
+ // 6. 鑾峰彇鐢ㄦ埛淇℃伅 + 鐢熸垚鍔ㄦ�佽矾鐢�
+ if (
+ this.$store.dispatch &&
+ typeof this.$store.dispatch === "function"
+ ) {
await this.$store.dispatch("GetInfo");
+ // SSO 鍏嶇櫥鍦ㄨ烦杞墠宸插畬鎴� GetInfo锛岃矾鐢卞畧鍗笉浼氬啀瑙﹀彂 GenerateRoutes
+ // 蹇呴』鍦ㄦ澶勬樉寮忚皟鐢紝鍚﹀垯鍔ㄦ�佽矾鐢变笉浼氭敞鍐�
+ await this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
+ this.$router.addRoutes(accessRoutes);
+ });
}
this.loadingDetail = "鑾峰彇鐢ㄦ埛淇℃伅...";
// 7. 澶勭悊閲嶅畾鍚戣矾寰�
let redirectPath = "/followvisit/discharge";
+ let redirectQuery = {};
- if (redirect) {
- // 瑙g爜浼犲叆鐨勯噸瀹氬悜璺緞
+ // 7.1 濡傛灉瀛樺湪 taskid锛屼紭鍏堣烦杞埌璇︽儏椤靛苟甯︿笂鍙傛暟
+ if (taskid) {
+ redirectPath = "/followvisit/record/detailpage";
+ redirectQuery = {
+ taskid: taskid,
+ patid: patid || "",
+ id: id || "",
+ Voicetype: Voicetype || "",
+ visitCount: visitCount || "",
+ };
+ console.log("浣跨敤taskid璺宠浆鍒拌鎯呴〉:", redirectPath, redirectQuery);
+ } else if (redirect) {
+ // 7.2 濡傛灉浼犲叆鐨剅edirect瀛樺湪锛屼娇鐢ㄤ紶鍏ョ殑閲嶅畾鍚戣矾寰�
try {
redirectPath = decodeURIComponent(redirect);
console.log("浣跨敤浼犲叆鐨勯噸瀹氬悜璺緞:", redirectPath);
@@ -191,6 +239,7 @@
redirectPath = this.getDefaultRedirectPath();
}
} else {
+ // 7.3 浣跨敤榛樿璺緞
redirectPath = this.getDefaultRedirectPath();
}
@@ -200,18 +249,20 @@
// 9. 寤惰繜璺宠浆锛岀‘淇濈姸鎬佸凡鏇存柊
setTimeout(() => {
this.loadingDetail = "璺宠浆鍒扮洰鏍囬〉闈�...";
- console.log("鍑嗗璺宠浆鍒�:", redirectPath);
+ console.log("鍑嗗璺宠浆鍒�:", redirectPath, "鍙傛暟:", redirectQuery);
// 鉁� 浣跨敤 push 鑰屼笉鏄� replace锛屼繚鐣欏巻鍙茶褰�
- this.$router.push({ path: redirectPath }).then(() => {
- console.log("SSO鐧诲綍鎴愬姛锛岃烦杞畬鎴�");
- }).catch((error) => {
- console.error("璺敱璺宠浆澶辫触:", error);
- // 鍥為��鍒伴粯璁ら〉闈�
- this.$router.push({ path: "/followvisit/discharge" });
- });
+ this.$router
+ .push({ path: redirectPath, query: redirectQuery })
+ .then(() => {
+ console.log("SSO鐧诲綍鎴愬姛锛岃烦杞畬鎴�");
+ })
+ .catch((error) => {
+ console.error("璺敱璺宠浆澶辫触:", error);
+ // 鍥為��鍒伴粯璁ら〉闈�
+ this.$router.push({ path: "/followvisit/discharge" });
+ });
}, 500);
-
} catch (error) {
console.error("SSO鐧诲綍澶辫触:", error);
this.errorMessage = `鍗曠偣鐧诲綍澶辫触: ${error.message || "鏈煡閿欒"}`;
@@ -273,8 +324,12 @@
}
@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
}
.loading-content p {
--
Gitblit v1.9.3