فهرست منبع

配置文件修改

zhongxiaoyu 2 سال پیش
والد
کامیت
a4d18749ff
5فایلهای تغییر یافته به همراه34 افزوده شده و 12 حذف شده
  1. 9 0
      public/baseConfig.js
  2. 0 10
      public/config.js
  3. 21 0
      public/configLoader.js
  4. 3 1
      src/views/realTime/hooks/useTrackData.ts
  5. 1 1
      vite.config.ts

+ 9 - 0
public/baseConfig.js

@@ -0,0 +1,9 @@
+/* url配置 */
+const PLATFROM_CONFIG = {
+  baseNewUrl: 'http://120.26.64.82:8093/', //登录前的http请求地址
+  baseUrl: 'http://120.26.64.82:8095/', // 4A-http请求地址
+  appKeyString: '9inu7zpllz1folzsljm498dcpi0lsog1', //appSecret
+  appId: 'q7kdjmmaf0kerwpf', //appid
+  baseURLCA: 'http://10.211.67.163:16300', // 登录后的http请求地址-测试
+  baggageMessageURL: '/openApi/query',
+}

+ 0 - 10
public/demo.js → public/config.js

@@ -1,13 +1,3 @@
-/* url配置 */
-const PLATFROM_CONFIG = {
-  baseNewUrl: 'http://120.26.64.82:8093/', //登录前的http请求地址
-  baseUrl: 'http://120.26.64.82:8095/', // 4A-http请求地址
-  appKeyString: '9inu7zpllz1folzsljm498dcpi0lsog1', //appSecret
-  appId: 'q7kdjmmaf0kerwpf', //appid
-  baseURLCA: 'http://10.211.67.163:16300', // 登录后的http请求地址-测试
-  baggageMessageURL: '/openApi/query',
-}
-
 /* 轮询间隔 */
 const LOOP_INTERVAL = {
   airport: 15 * 1000,

+ 21 - 0
public/configLoader.js

@@ -0,0 +1,21 @@
+const baseConfig = document.createElement('script')
+baseConfig.type = 'text/javascript'
+baseConfig.src = './baseConfig.js'
+document.head.appendChild(baseConfig)
+
+const config = document.createElement('script')
+config.id = 'configJS'
+config.type = 'text/javascript'
+config.src = './config.js?t=' + new Date().getTime()
+document.head.appendChild(config)
+
+if (!window.configLoadLoop) {
+  window.configLoadLoop = setInterval(function () {
+    document.head.removeChild(document.getElementById('configJS'))
+    const config = document.createElement('script')
+    config.id = 'configJS'
+    config.type = 'text/javascript'
+    config.src = './config.js?t=' + new Date().getTime()
+    document.head.appendChild(config)
+  }, 60 * 1000)
+}

+ 3 - 1
src/views/realTime/hooks/useTrackData.ts

@@ -112,8 +112,10 @@ const trackNodesMap = {
 
 export function useTrackData(name: string, trackData: MaybeRef<CommonData[]>) {
   const isInternational = name.includes('International')
+  
+  // const defaultTrackAirlines = []
+  
   const trackAirlines = ref<TrackAirline[]>([])
-
   const getTrackAirlines = () => {
     const airlines = unref(trackData).reduce(
       (

+ 1 - 1
vite.config.ts

@@ -142,7 +142,7 @@ export default ({ command, mode }: any) => {
           // Inject data into ejs template
           data: {
             title: setting.title,
-            injectScript: `<script src="./demo.js"></script>`
+            injectScript: `<script src="./configLoader.js"></script>`
           }
         }
       })