From 9799e992bc987425f21ad0b799e3d25d822329e3 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 13 十一月 2026 16:41:37 +0800
Subject: [PATCH] 登录问题处理
---
src/views/login.vue | 79 ++++++++++++++++++++++++---------------
1 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index ae3f1a4..c0bf921 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -39,16 +39,17 @@
</el-input>
</el-form-item>
<!-- 涓�===================姘� -->
- <el-form-item prop="campusid">
+ <el-form-item prop="orgid">
<el-select
style="width: 100%"
- v-model="loginForm.campusid"
+ v-model="loginForm.orgid"
placeholder="璇烽�夋嫨闄㈠尯"
>
<el-option
v-for="item in options"
+ :key="item.value"
:label="item.label"
- :value="item.campusid"
+ :value="item.value"
>
</el-option>
<i slot="prefix" class="el-icon-mobile"></i>
@@ -127,7 +128,7 @@
password: "",
rememberMe: false,
code: "",
- orgid: "H41010500003",
+ orgid: "",
},
options: [],
loginRules: {
@@ -137,7 +138,7 @@
password: [
{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" },
],
- campusid: [{ required: true, trigger: "blur", message: "璇烽�夋嫨闄㈠尯" }],
+ orgid: [{ required: true, trigger: "change", message: "璇烽�夋嫨闄㈠尯" }],
},
loading: false,
// 楠岃瘉鐮佸紑鍏�
@@ -155,6 +156,7 @@
immediate: true,
},
},
+
created() {
this.getorganization();
this.getCode();
@@ -162,6 +164,12 @@
// if (localStorage.getItem('orgid')) {
// this.loginForm.orgid = localStorage.getItem('orgid');
// }
+ },
+ computed: {
+ isAdmin() {
+ const roles = this.$store.getters.roles || [];
+ return roles.includes("mydstaff");
+ },
},
methods: {
getCode() {
@@ -177,10 +185,14 @@
getorganization() {
getorganization({ pageSize: 30 }).then((res) => {
if (res.code == 200) {
- this.options = res.rows.map((item) => ({
- value: item.orgid,
- label: item.organizationName,
+ // 涓嬫媺鍊煎繀椤诲敮涓�锛氬競涓� 3 涓櫌鍖虹殑 orgid 閮芥槸 1锛�
+ // 涓芥按鍖哄煙鍚勬満鏋勭殑 organizationID 閮芥槸 1锛屽崟鐢ㄤ换涓�瀛楁閮戒細閲嶅銆�
+ // 杩欓噷鐢ㄣ�宱rgid + organizationID + 涓嬫爣銆嶇粍鎴愬敮涓�閿紝鐧诲綍鏃跺啀鍙栫湡瀹炲弬鏁般��
+ this.options = (res.rows || []).map((item, index) => ({
+ value: `${item.orgid}__${item.organizationID}__${index}`,
+ label: item.organizationName || "",
campusid: item.organizationID,
+ orgid: item.orgid,
}));
}
});
@@ -193,7 +205,7 @@
return label.includes("鍗楀崕") && label.includes("闄勪竴");
});
if (hasNanhua) {
- this.loginForm.password = "nhfy@0230";
+ this.loginForm.password = "Nhfy@023299.*";
}
},
getCookie() {
@@ -226,36 +238,43 @@
Cookies.remove("rememberMe");
}
- // 鍔ㄦ�佽缃� campusid 鍙傛暟
const selectedOrg = this.options.find(
- (item) => item.campusid === this.loginForm.campusid
+ (item) => item.value === this.loginForm.orgid
);
- this.loginForm.campusid = selectedOrg.campusid || 1;
- this.loginForm.orgid = selectedOrg.value || 1;
- this.loginForm.orgname = selectedOrg.label || "";
- // 甯備竴澶勭悊-----------------
- // if (selectedOrg) {
- // if (selectedOrg.label.includes("婀栨花")) {
- // this.loginForm.campusid = 1;
- // } else if (selectedOrg.label.includes("鍚村北")) {
- // this.loginForm.campusid = 2;
- // } else {
- // this.loginForm.campusid = 1; // 榛樿鍊兼垨鍏朵粬澶勭悊
- // }
- // }
- // --------------------------------
+ if (!selectedOrg) {
+ this.loading = false;
+ this.$message.error("闄㈠尯淇℃伅宸插け鏁堬紝璇烽噸鏂伴�夋嫨闄㈠尯");
+ return;
+ }
+ // 涓嬫媺妗嗗瓨鐨勬槸鍞竴閿紝鎻愪氦鍓嶆崲鎴愬悗绔渶瑕佺殑鐪熷疄 orgid / campusid
+ const loginInfo = {
+ ...this.loginForm,
+ campusid: selectedOrg.campusid,
+ orgid: selectedOrg.orgid,
+ orgname: selectedOrg.label,
+ };
this.$store
- .dispatch("Login", this.loginForm)
+ .dispatch("Login", loginInfo)
.then((res) => {
if (this.loginForm.username == "admin") {
this.$router.push({ path: "/index" }).catch(() => {});
+ } else if (this.isAdmin) {
+ console.log(1);
+
+ this.$router
+ .push({ path: "/Intelligentcenter/dispose" })
+ .catch(() => {});
} else {
+ console.log(2);
+
this.$router
.push({ path: "/followvisit/discharge" })
.catch(() => {});
}
})
.catch(() => {
+ console.log(3);
+
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
@@ -333,7 +352,7 @@
width: 100%;
text-align: center;
font-size: 13px;
- color: #3664D9;
+ color: #3664d9;
z-index: 10;
}
@@ -361,18 +380,18 @@
.tech-label,
.tech-name,
.hotline {
- color: #3664D9;;
+ color: #3664d9;
font-size: 13px;
}
.tech-name {
- color: #3664D9;;
+ color: #3664d9;
font-weight: 500;
}
.hotline {
font-size: 12px;
- color: #3664D9;;
+ color: #3664d9;
}
.login-code-img {
height: 38px;
--
Gitblit v1.9.3