zhaoke 2 سال پیش
والد
کامیت
88f2806e38
2فایلهای تغییر یافته به همراه81 افزوده شده و 67 حذف شده
  1. 13 4
      public/config.js
  2. 68 63
      vite.config.ts

+ 13 - 4
public/config.js

@@ -4,7 +4,16 @@ var LOOP_INTERVAL = {
   flight: 15 * 1000,
   waybill: 15 * 1000,
   goods: 15 * 1000,
-}
+};
+
+const PLATFROM_CONFIG = {
+  baseNewUrl: "http://120.26.64.82:8083/", //登录前的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",
+};
 
 var DATACONTENT_ID = {
   /***-----登录------***/
@@ -34,7 +43,7 @@ var DATACONTENT_ID = {
   jscJgNodePeakId: 1803551, //国际进港-节点峰值-id
   jscJgNumbersId: 1803552, //国际进港-航班数&运单数-id
   jscJgAirlineTrafficId: 1803553, //国际进港-航司运量-id
-  
+
   /***-----权限管理------***/
   authTreeId: 40, //权限管理-权限树
   authTreeNewId: 92, //权限管理-权限树
@@ -259,7 +268,7 @@ var DATACONTENT_ID = {
   nodeExportAirline: 1805, // 节点统计导出-航线
   nodeExportAirport: 1805, // 节点统计导出-航站
   nodeAxisDesc: 90, // 节点统计指示器名称解释
-}
+};
 
 var SERVICE_ID = {
   /***-----账号管理------***/
@@ -294,4 +303,4 @@ var SERVICE_ID = {
 
   /***-----离港管理------***/
   departureScId: 8011, //发送报警预警日志信息
-}
+};

+ 68 - 63
vite.config.ts

@@ -1,37 +1,37 @@
 // @ts-ignore
-import path from 'path'
-import vue from '@vitejs/plugin-vue'
-import legacy from '@vitejs/plugin-legacy'
-import vueJsx from '@vitejs/plugin-vue-jsx'
-import viteSvgIcons from 'vite-plugin-svg-icons'
+import path from "path";
+import vue from "@vitejs/plugin-vue";
+import legacy from "@vitejs/plugin-legacy";
+import vueJsx from "@vitejs/plugin-vue-jsx";
+import viteSvgIcons from "vite-plugin-svg-icons";
 //mock
-import { viteMockServe } from 'vite-plugin-mock'
+import { viteMockServe } from "vite-plugin-mock";
 //inject title
-import { createHtmlPlugin } from 'vite-plugin-html'
+import { createHtmlPlugin } from "vite-plugin-html";
 //setup name
 // import VueSetupExtend from 'vite-plugin-vue-setup-extend-plus'
 
 //auto import element-plus has some issue
-import Components from 'unplugin-vue-components/vite'
+import Components from "unplugin-vue-components/vite";
 // import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
 
 // import Icons from 'unplugin-icons/vite'
 // import IconsResolver from 'unplugin-icons/resolver'
-import UnoCSS from 'unocss/vite'
-import { presetAttributify, presetIcons, presetUno } from 'unocss'
+import UnoCSS from "unocss/vite";
+import { presetAttributify, presetIcons, presetUno } from "unocss";
 
-import mkcert from 'vite-plugin-mkcert'
-import DefineOptions from 'unplugin-vue-define-options/vite'
+import mkcert from "vite-plugin-mkcert";
+import DefineOptions from "unplugin-vue-define-options/vite";
 //auto import vue https://www.npmjs.com/package/unplugin-auto-import
-import AutoImport from 'unplugin-auto-import/vite'
+import AutoImport from "unplugin-auto-import/vite";
 
-import setting from './src/settings'
+import setting from "./src/settings";
 
-const prodMock = setting.openProdMock
+const prodMock = setting.openProdMock;
 // import packageJson from './package.json'
 // import { loadEnv } from 'vite'
-import { optimizeDependencies, optimizeElementPlus } from './optimize-include'
-const pathSrc = path.resolve(__dirname, 'src')
+import { optimizeDependencies, optimizeElementPlus } from "./optimize-include";
+const pathSrc = path.resolve(__dirname, "src");
 export default ({ command, mode }: any) => {
   return {
     //detail to look https://vitejs.cn/config/#base
@@ -39,12 +39,14 @@ export default ({ command, mode }: any) => {
     //define global var
     define: {
       //fix "path" module issue
-      'process.platform': null,
-      'process.version': null,
-      GLOBAL_STRING: JSON.stringify('i am global var from vite.config.js define'),
+      "process.platform": null,
+      "process.version": null,
+      GLOBAL_STRING: JSON.stringify(
+        "i am global var from vite.config.js define"
+      ),
       GLOBAL_VAR: {
-        test: 'i am global var from vite.config.js define'
-      }
+        test: "i am global var from vite.config.js define",
+      },
     },
     clearScreen: false,
     server: {
@@ -53,7 +55,7 @@ export default ({ command, mode }: any) => {
       open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序;
       cors: true, // 类型: boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源
       host: true,
-      https: false //whether open https 开启https首次运行比较慢 且有个输入密码过程
+      https: false, //whether open https 开启https首次运行比较慢 且有个输入密码过程
       //proxy look for https://vitejs.cn/config/#server-proxy
       // proxy: {
       //   '/api': {
@@ -66,7 +68,7 @@ export default ({ command, mode }: any) => {
     preview: {
       port: 5008,
       host: true,
-      strictPort: true
+      strictPort: true,
     },
     plugins: [
       vue({ reactivityTransform: true }),
@@ -75,7 +77,7 @@ export default ({ command, mode }: any) => {
       // }),
       vueJsx(),
       UnoCSS({
-        presets: [presetUno(), presetAttributify(), presetIcons()]
+        presets: [presetUno(), presetAttributify(), presetIcons()],
       }),
 
       DefineOptions(),
@@ -87,21 +89,24 @@ export default ({ command, mode }: any) => {
       // }),
       viteSvgIcons({
         // config svg dir that can config multi
-        iconDirs: [path.resolve(process.cwd(), 'src/icons/common'), path.resolve(process.cwd(), 'src/icons/nav-bar')],
+        iconDirs: [
+          path.resolve(process.cwd(), "src/icons/common"),
+          path.resolve(process.cwd(), "src/icons/nav-bar"),
+        ],
         // appoint svg icon using mode
-        symbolId: 'icon-[dir]-[name]'
+        symbolId: "icon-[dir]-[name]",
       }),
       //https://github.com/anncwb/vite-plugin-mock/blob/HEAD/README.zh_CN.md
       viteMockServe({
         supportTs: true,
-        mockPath: 'mock',
-        localEnabled: command === 'serve',
+        mockPath: "mock",
+        localEnabled: command === "serve",
         prodEnabled: prodMock,
         injectCode: `
           import { setupProdMockServer } from './mockProdServer';
           setupProdMockServer();
         `,
-        logger: true
+        logger: true,
       }),
       // VueSetupExtend(),using  DefineOptions instant of it
       //https://github.com/antfu/unplugin-auto-import/blob/HEAD/src/types.ts
@@ -114,27 +119,27 @@ export default ({ command, mode }: any) => {
           // import icons
           // https://github.com/antfu/unplugin-icons
           // IconsResolver(),
-        ]
+        ],
       }),
       AutoImport({
         // resolvers: [ElementPlusResolver()],
         imports: [
-          'vue',
-          'pinia',
-          'vue-router',
+          "vue",
+          "pinia",
+          "vue-router",
           {
-            '@/hooks/global/useCommon': ['useCommon'],
-            '@/hooks/global/useElement': ['useElement'],
-            '@/hooks/global/useVueRouter': ['useVueRouter'],
-            '@/utils/axiosReq': ['axiosReq']
-          }
+            "@/hooks/global/useCommon": ["useCommon"],
+            "@/hooks/global/useElement": ["useElement"],
+            "@/hooks/global/useVueRouter": ["useVueRouter"],
+            "@/utils/axiosReq": ["axiosReq"],
+          },
         ],
         eslintrc: {
           enabled: true, // Default `false`
-          filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
-          globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
+          filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
+          globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
         },
-        dts: true //auto generation auto-imports.d.ts file
+        dts: true, //auto generation auto-imports.d.ts file
       }),
       // auto config of index.html title
       createHtmlPlugin({
@@ -142,15 +147,15 @@ export default ({ command, mode }: any) => {
           // Inject data into ejs template
           data: {
             title: setting.title,
-            injectScript: `<script src="./configLoader.js"></script>`
-          }
-        }
-      })
+            injectScript: `<script src="./config.js"></script>`,
+          },
+        },
+      }),
     ],
     // logLevel: 'error',
     build: {
       //target: 'es2015',
-      minify: 'terser',
+      minify: "terser",
       brotliSize: false,
       // 消除打包大小超过500kb警告
       chunkSizeWarningLimit: 5000,
@@ -159,25 +164,25 @@ export default ({ command, mode }: any) => {
         //detail to look https://terser.org/docs/api-reference#compress-options
         compress: {
           drop_console: false,
-          pure_funcs: ['console.log', 'console.info'],
-          drop_debugger: true
-        }
+          pure_funcs: ["console.log", "console.info"],
+          drop_debugger: true,
+        },
       },
       //build assets Separate
-      assetsDir: 'static/assets',
+      assetsDir: "static/assets",
       rollupOptions: {
         output: {
-          chunkFileNames: 'static/js/[name]-[hash].js',
-          entryFileNames: 'static/js/[name]-[hash].js',
-          assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
-        }
-      }
+          chunkFileNames: "static/js/[name]-[hash].js",
+          entryFileNames: "static/js/[name]-[hash].js",
+          assetFileNames: "static/[ext]/[name]-[hash].[ext]",
+        },
+      },
     },
     resolve: {
       alias: {
-        '~/': `${pathSrc}/`,
-        '@/': `${pathSrc}/`
-      }
+        "~/": `${pathSrc}/`,
+        "@/": `${pathSrc}/`,
+      },
       //why remove it , look for https://github.com/vitejs/vite/issues/6026
       // extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.mjs']
     },
@@ -207,7 +212,7 @@ export default ({ command, mode }: any) => {
     optimizeDeps: {
       //include: [...optimizeDependencies,...optimizeElementPlus] //on-demand element-plus use this
       // include: [...optimizeDependencies]
-      include: ['moment-mini']
-    }
-  }
-}
+      include: ["moment-mini"],
+    },
+  };
+};