From 9290a0a7023a612cddc5971553a6efb727a51165 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期二, 19 八月 2025 17:34:58 +0800
Subject: [PATCH] qx
---
src/views/login.vue | 63 ++++++++++++++-----------------
1 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index a87bc0f..bf40696 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -58,17 +58,19 @@
<!-- 搴曢儴 -->
<div class="el-login-footer">
- <span>Copyright 漏 2023-2024 All Rights Reserved.</span>
+ <span>Copyright 漏 2024-2025 All Rights Reserved.</span>
<!-- <span>Copyright 漏 2022-2023榫欑編缃戠粶 All Rights Reserved.</span> -->
</div>
</div>
</template>
<script>
+
import { getCodeImg, getconfigKey } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
-
+import ini from 'ini';
+import fs from 'fs'; // Node.js 鏂囦欢绯荤粺妯″潡
export default {
name: "Login",
data() {
@@ -152,43 +154,33 @@
},
loadAll() {
- const env = process.env.VUE_APP_ENV
- if (env === 'development') {
- this.loginForm.hospId = this.$route.query.hospId
- Cookies.set("hospId", this.loginForm.hospId);
- } else if (env === 'production') {
- // 鑾峰彇褰撳墠URL鐨勭鍙e彿
+ const env = process.env.VUE_APP_ENV;
const port = window.location.port;
-
- switch (port) {
- case '9011':
- this.loginForm.hospId = "chkwyy";
- break;
- case '9012':
+ // yuanqu.ini鍔犺浇hospId
+ fetch('/yuanqu.ini')
+ .then(response => {
+ if (!response.ok) {
+ throw new Error('Failed to fetch config.ini');
+ }
+ return response.text();
+ })
+ .then(text => {
+ const config = ini.parse(text);
- this.loginForm.hospId = "xamjyy";
- break;
-
- case '8094':
-
- this.loginForm.hospId = "pbkwyy";
- break;
- }
- Cookies.set("hospId", this.loginForm.hospId);
- }
-
-
- // 瀛樺偍hospId鍒癈ookie
-
-
- // 鏇存柊URL鍙傛暟
- if (this.loginForm.hospId) {
- const query = { ...this.$route.query, hospId: this.loginForm.hospId };
- this.$router.replace({ query });
- }
+ if (config[env] && config[env][port]) {
+ this.loginForm.hospId = config[env][port];
+ Cookies.set("hospId", this.loginForm.hospId);
+ } else {
+ console.error(`No hospId found for environment ${env} and port ${port}`);
+ this.$message.error(`閰嶇疆閿欒锛氭湭鎵惧埌鐜 ${env} 鍜岀鍙� ${port} 瀵瑰簲鐨勫尰闄D`);
+ }
+ })
+ .catch(error => {
+ console.error('Error fetching or parsing config.ini:', error);
+ this.$message.error('鏃犳硶鍔犺浇閰嶇疆鏂囦欢锛岃鑱旂郴绠$悊鍛�');
+ });
},
-
hide() {
// this.loginForm.username = "10001";
// this.loginForm.password = "admin123";
@@ -272,6 +264,7 @@
}
}
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
+ location.reload();
}
}).catch(() => {
--
Gitblit v1.8.0