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/login.vue | 38 +++++++++++++++++++++++++++++++++++--- 1 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/views/login.vue b/src/views/login.vue index af01c3d..bf40696 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,7 +1,7 @@ <template> <div class="login"> <!-- <div style="padding-top: 130px;"> --> - <div style="font-weight: 700;font-size: 50px;">鏅鸿兘鍋ュ悍浣撴绠$悊绯荤粺</div> + <div style="font-weight: 700;font-size: 50px;">鏅鸿兘鍋ュ悍浣撴绠$悊绯荤粺</div> <!-- </div> --> @@ -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() { @@ -78,6 +80,7 @@ username: "", password: "", mobile: false, + hospId: "", // username:"13800138008", // password:"888888", rememberMe: false, @@ -136,6 +139,7 @@ created() { this.getstate(); this.getCookie(); + this.loadAll(); }, methods: { getstate() { @@ -149,7 +153,34 @@ }) }, + loadAll() { + const env = process.env.VUE_APP_ENV; + 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); + + 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"; @@ -233,6 +264,7 @@ } } this.$router.push({ path: this.redirect || "/" }).catch(() => { }); + location.reload(); } }).catch(() => { -- Gitblit v1.8.0