|
|
@@ -96,6 +96,9 @@ import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
import { getFirstLogin } from "@/api/login";
|
|
|
import WechatLoginDialog from "@/views/WechatLoginDialog";
|
|
|
import { setToken } from "@/utils/auth";
|
|
|
+import {getConfigByKey} from "@/api/system/config";
|
|
|
+import Vue from 'vue'
|
|
|
+
|
|
|
export default {
|
|
|
name: "Login",
|
|
|
components: { WechatLoginDialog },
|
|
|
@@ -152,6 +155,30 @@ export default {
|
|
|
this.getCookie();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 重新加载运行时配置
|
|
|
+ async reloadRuntimeConfig() {
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await getConfigByKey('his.adminUi.config')
|
|
|
+
|
|
|
+ const configValue = res?.data?.configValue
|
|
|
+ if (!configValue) return
|
|
|
+
|
|
|
+ // 后端配置 JSON
|
|
|
+ const form = JSON.parse(configValue)
|
|
|
+
|
|
|
+ // 直接更新全局配置
|
|
|
+ const config = {
|
|
|
+ VUE_APP_LIVE_WS_URL: form.liveWebSocketUrl || '',
|
|
|
+ VUE_APP_COURSE_DEFAULT: form.courseDefaultType || '1',
|
|
|
+ }
|
|
|
+ // 更新到全局
|
|
|
+ Vue.prototype.$runtimeConfig = config
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error('重新加载运行时配置异常:', error)
|
|
|
+ }
|
|
|
+ },
|
|
|
checkFirstLogin() {
|
|
|
getFirstLogin().then(res => {
|
|
|
if (res.code === 200 && res.data) {
|
|
|
@@ -228,6 +255,7 @@ export default {
|
|
|
this.checkFirstLogin();
|
|
|
}
|
|
|
})
|
|
|
+ this.reloadRuntimeConfig()
|
|
|
.catch(res => {
|
|
|
console.log("登录失败")
|
|
|
console.log(res)
|