|
|
@@ -33,7 +33,7 @@ import DictTag from '@/components/DictTag'
|
|
|
// 头部标签组件
|
|
|
import VueMeta from 'vue-meta'
|
|
|
import * as echarts from "echarts";
|
|
|
-
|
|
|
+Vue.prototype.$runtimeConfig = {}
|
|
|
// 全局方法挂载
|
|
|
|
|
|
import { VueJsonp } from 'vue-jsonp'
|
|
|
@@ -81,6 +81,7 @@ Vue.component('FileUpload', FileUpload)
|
|
|
Vue.component('ImageUpload', ImageUpload)
|
|
|
|
|
|
import H5Editor from "@/components/H5Editor";
|
|
|
+import { getConfigByKey } from '@/api/system/config'
|
|
|
Vue.component('H5Editor', H5Editor)
|
|
|
|
|
|
Vue.use(directive)
|
|
|
@@ -101,10 +102,41 @@ Vue.use(Element, {
|
|
|
})
|
|
|
|
|
|
Vue.config.productionTip = false
|
|
|
+async function initRuntimeConfig() {
|
|
|
+ try {
|
|
|
+ const res = await getConfigByKey('his.adminUi.config')
|
|
|
+
|
|
|
+ const configValue = res?.data?.configValue
|
|
|
+ if (!configValue) return
|
|
|
+
|
|
|
+ // 后端配置 JSON
|
|
|
+ const form = JSON.parse(configValue)
|
|
|
+
|
|
|
+ // 字段映射表(核心优化点)
|
|
|
+ const mapping = {
|
|
|
+ VUE_APP_LIVE_WS_URL: 'liveWebSocketUrl',
|
|
|
+ VUE_APP_COURSE_DEFAULT: 'courseDefaultType',
|
|
|
+ }
|
|
|
+
|
|
|
+ // 写入运行时配置
|
|
|
+ Object.keys(mapping).forEach(key => {
|
|
|
+ Vue.prototype.$runtimeConfig[key] = form[mapping[key]] ?? null
|
|
|
+ })
|
|
|
+ console.log('runtimeConfig:', Vue.prototype.$runtimeConfig)
|
|
|
+ } catch (e) {
|
|
|
+ console.error('初始化运行时配置失败', e)
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
-new Vue({
|
|
|
- el: '#app',
|
|
|
- router,
|
|
|
- store,
|
|
|
- render: h => h(App)
|
|
|
-})
|
|
|
+
|
|
|
+async function bootstrap() {
|
|
|
+ await initRuntimeConfig()
|
|
|
+ new Vue({
|
|
|
+ el: '#app',
|
|
|
+ router,
|
|
|
+ store,
|
|
|
+ render: h => h(App)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+bootstrap()
|