From b4441fcb4127328cde87167d0816b77ae516e5bf Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期二, 22 七月 2025 09:06:32 +0800 Subject: [PATCH] 1 --- src/views/logincopt.vue | 99 ++++++++++++++++++------ src/views/system/tijian/index.vue | 8 +- src/permission.js | 1 src/views/login.vue | 99 ++++++------------------ 4 files changed, 103 insertions(+), 104 deletions(-) diff --git a/src/permission.js b/src/permission.js index a70d80b..ac86064 100644 --- a/src/permission.js +++ b/src/permission.js @@ -51,7 +51,6 @@ path:"/login", query:{ redirect:to.fullPath, - hospId:"" } }) NProgress.done() diff --git a/src/views/login.vue b/src/views/login.vue index 6373287..bf40696 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -69,7 +69,8 @@ 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() { @@ -153,81 +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 port = window.location.port; + const env = process.env.VUE_APP_ENV; + const port = window.location.port; - switch (port) { + // 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); - case '8094': - - this.loginForm.hospId = "pbkwyy"; - break; - case '8095': - this.loginForm.hospId = "jdczgzyy"; - break; - case '8096': - this.loginForm.hospId = "sqyy"; - break; - case '8097': - this.loginForm.hospId = "wbzxyy"; - break; - case '8098': - this.loginForm.hospId = "bjxjyy"; - break; - case '8099': - this.loginForm.hospId = "bjfhyy"; - break; - case '8100': - this.loginForm.hospId = "ssyjyy"; - break; - case '8101': - this.loginForm.hospId = "bjsqyy"; - break; - } - Cookies.set("hospId", this.loginForm.hospId); - } else if (env === 'staging') { - // 鑾峰彇褰撳墠URL鐨勭鍙e彿 - const port = window.location.port; - - switch (port) { - case '9013': - this.loginForm.hospId = "pbkwyy"; - break; - - case '9014': - this.loginForm.hospId = "jdczgzyy"; - break; - case '9015': - this.loginForm.hospId = "sqyy"; - break; - case '9016': - this.loginForm.hospId = "wbzxyy"; - break; - case '9017': - this.loginForm.hospId = "bjxjyy"; - break; - case '9018': - this.loginForm.hospId = "ssyjyy"; - break; - case '9019': - this.loginForm.hospId = "bjsqyy"; - 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"; diff --git a/src/views/login copy.vue b/src/views/logincopt.vue similarity index 82% rename from src/views/login copy.vue rename to src/views/logincopt.vue index bf40696..6373287 100644 --- a/src/views/login copy.vue +++ b/src/views/logincopt.vue @@ -69,8 +69,7 @@ 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() { @@ -154,33 +153,81 @@ }, loadAll() { - const env = process.env.VUE_APP_ENV; - const port = window.location.port; + 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 port = window.location.port; - // 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); + switch (port) { - 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('鏃犳硶鍔犺浇閰嶇疆鏂囦欢锛岃鑱旂郴绠$悊鍛�'); - }); + case '8094': + + this.loginForm.hospId = "pbkwyy"; + break; + case '8095': + this.loginForm.hospId = "jdczgzyy"; + break; + case '8096': + this.loginForm.hospId = "sqyy"; + break; + case '8097': + this.loginForm.hospId = "wbzxyy"; + break; + case '8098': + this.loginForm.hospId = "bjxjyy"; + break; + case '8099': + this.loginForm.hospId = "bjfhyy"; + break; + case '8100': + this.loginForm.hospId = "ssyjyy"; + break; + case '8101': + this.loginForm.hospId = "bjsqyy"; + break; + } + Cookies.set("hospId", this.loginForm.hospId); + } else if (env === 'staging') { + // 鑾峰彇褰撳墠URL鐨勭鍙e彿 + const port = window.location.port; + + switch (port) { + case '9013': + this.loginForm.hospId = "pbkwyy"; + break; + + case '9014': + this.loginForm.hospId = "jdczgzyy"; + break; + case '9015': + this.loginForm.hospId = "sqyy"; + break; + case '9016': + this.loginForm.hospId = "wbzxyy"; + break; + case '9017': + this.loginForm.hospId = "bjxjyy"; + break; + case '9018': + this.loginForm.hospId = "ssyjyy"; + break; + case '9019': + this.loginForm.hospId = "bjsqyy"; + 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 }); + } }, + hide() { // this.loginForm.username = "10001"; // this.loginForm.password = "admin123"; diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index a0d7bad..340ff8c 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -984,10 +984,10 @@ pacName: null, pacRemark: null, }, - // valueUrl: "ws://127.0.0.1:6789/websocket", - // valueUrls: "ws://127.0.0.1:6789/websocket", - valueUrl: "ws://192.168.1.244:6789/websocket", - valueUrls: "ws://192.168.1.244:6789/websocket", + valueUrl: "ws://127.0.0.1:6789/websocket", + valueUrls: "ws://127.0.0.1:6789/websocket", + // valueUrl: "ws://192.168.1.244:6789/websocket", + // valueUrls: "ws://192.168.1.244:6789/websocket", webSocket: null, // 韬唤璇侀渶瑕� // socket: null, -- Gitblit v1.8.0