Bladeren bron

修改bug

ZaiZai 1 jaar geleden
bovenliggende
commit
2b3230c71c
5 gewijzigde bestanden met toevoegingen van 39 en 55 verwijderingen
  1. 0 2
      index.html
  2. 2 0
      src/App.vue
  3. 11 12
      src/config/index.js
  4. 11 26
      src/utils/tools.js
  5. 15 15
      vite.config.js

+ 0 - 2
index.html

@@ -8,8 +8,6 @@
         <link rel="stylesheet" href="/plugins/element-plus/theme-chalk/dark/css-vars.css" />
         <link rel="stylesheet" href="/plugins/remixicon/remixicon.css" />
         <link rel="stylesheet" href="/plugins/fonts/index.css" />
-        <!-- <script type='text/javascript' src='http://47.110.251.215:6831/web-apps/apps/api/documents/api.js'></script> -->
-        <script type='text/javascript' src='http://192.168.0.109:6831/web-apps/apps/api/documents/api.js'></script>
         <script src="https://static.bimface.com/api/BimfaceSDKLoader/BimfaceSDKLoader@latest-release.js" charset="utf-8"></script>
         <title></title>
     </head>

+ 2 - 0
src/App.vue

@@ -10,6 +10,7 @@ import { useAppStore } from '~src/store'
 import { useOsTheme } from 'hc-vue3-ui'
 import { getObjValue, setElementMainColor } from 'js-fast-way'
 import { getStoreValue, setStoreValue } from '~uti/storage'
+import { addDocumentsJs } from '~uti/tools'
 import { getVersionJson } from '~api/other'
 import split from 'split.js'
 
@@ -30,6 +31,7 @@ watch(() => [
 nextTick(()=> {
     window['$split'] = split
     setUserTheme(appStore.getThemeVal, appStore.getColor)
+    addDocumentsJs()
     //生产环境下,检测更新
     if (import.meta.env.PROD) {
         getVersionJsonApi()

+ 11 - 12
src/config/index.js

@@ -3,31 +3,30 @@ import config from './index.json'
 export default {
     title: '档案管理 泓创智诚',
     desc: '泓创智诚数字工程档案平台',
-    key: 'archives',          // 配置主键,目前用于存储
-    clientId: 'archives',     // 客户端id
+    key: 'archives', // 配置主键,目前用于存储
+    clientId: 'archives', // 客户端id
     clientSecret: 'archives_secret', // 客户端密钥
-    tenantMode: true,       // 是否开启租户模式
-    tenantId: "000000",     // 管理组租户编号
-    captchaMode: false,     // 是否开启验证码模式
-    switchMode: false,      // 是否开启部门切换模式
+    tenantMode: true, // 是否开启租户模式
+    tenantId: '000000', // 管理组租户编号
+    captchaMode: false, // 是否开启验证码模式
+    switchMode: false, // 是否开启部门切换模式
     tokenTime: 3000,
     tokenHeader: 'Blade-Auth',
     tokenKey: 'archives-access-token',
     refreshTokenKey: 'archives-refresh-token',
-    statusWhiteList: [],    //http的status默认放行列表
-    role_id: "1610526744728031234",  //档案总管理角色组ID
-    isLog: 'auto',  //是否打印日志
+    statusWhiteList: [], //http的status默认放行列表
+    role_id: '1610526744728031234', //档案总管理角色组ID
+    isLog: 'auto', //是否打印日志
     ...config,
     ossUrl: 'https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com', //oss地址
     // socket: 'wss://business.hcxxy.com/wss/websocket/',  //测试线上
     //socket: 'ws://192.168.0.113:8686/websocket/archive/',  //王文龙
     // socket: 'ws://archives.hczcxx.cn/websocket/archive/',
-    socket: 'wss://archives.hczcxx.cn/wss/websocket/archive/'
-
+    socket: 'wss://archives.hczcxx.cn/wss/websocket/archive/',
 
     //这里不再支持配置请求地址,请在 src/config/index.json 文件中配置。
     //相关参数,可查阅 src/config/index.md 文件说明
 
-    //target: 'http://47.110.251.215:8090',  //测试线上
+    //target: 'http://39.108.216.210:8090',  //测试线上
     //target: 'http://127.0.0.1:8090',  //打包线上http://120.79.83.156/
 }

+ 11 - 26
src/utils/tools.js

@@ -1,29 +1,14 @@
-import { arrIndex, clog } from 'js-fast-way'
-import config from '~src/config/index'
-
-import { useAppStore } from '~src/store'
-const store = useAppStore()
-
-//控制台打印
-export const HcLog = (name, tips, data) => {
-    const title = store.barMenuName ?? ''
-    if (config.isLog === 'auto') {
-        if (import.meta.env.DEV) {
-            clog(title, name, tips, data)
+//动态加载线上js文件
+export const addDocumentsJs = () => {
+    return new Promise((resolve) => {
+        const script = document.createElement('script')
+        script.src = 'http://39.108.216.210:6831/web-apps/apps/api/documents/api.js'
+        script.type = 'text/javascript'
+        document.head.appendChild(script)
+        script.onload = () => {
+            resolve()
         }
-    } else if (config.isLog === true) {
-        clog(title, name, tips, data)
-    }
-}
-
-//取数组中的值
-export const getRowsValue = (arr, key, key2, value) => {
-    if (value) {
-        const index = arrIndex(arr, key, value)
-        return arr[index][key2]
-    } else {
-        return ''
-    }
+    })
 }
 
 //获取ID,并转为数字
@@ -108,4 +93,4 @@ export const setUrlHttps = (url) => {
 export const setTimeString = (str) => {
     if (!str) return str
     return str.replace(/-/g, '')
-}
+}

+ 15 - 15
vite.config.js

@@ -1,16 +1,16 @@
-import {defineConfig} from 'vite'
+import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
-import {resolve} from "path";
-import config from "./src/config";
+import { resolve } from 'path'
+import config from './src/config'
 
 // https://vitejs.dev/config/
 export default defineConfig({
     css: {
         preprocessorOptions: {
             scss: {
-                additionalData: `@import "./src/styles/app/_var.scss";`
-            }
-        }
+                additionalData: '@import "./src/styles/app/_var.scss";',
+            },
+        },
     },
     resolve: {
         alias: {
@@ -20,17 +20,17 @@ export default defineConfig({
             '~api': resolve(__dirname, './src/api/modules'),
             '~sto': resolve(__dirname, './src/store/modules'),
             '~uti': resolve(__dirname, './src/utils'),
-            '~style': resolve(__dirname, './src/styles/page')
-        }
+            '~style': resolve(__dirname, './src/styles/page'),
+        },
     },
     plugins: [
-        vue()
+        vue(),
     ],
     build: {
         rollupOptions: {
             output: {
                 manualChunks(id) {
-                    let libStr = '@vue,tailwindcss,element-plus,z-element-plus,echarts,vue-router,pinia,js-web-screen-shot,js-fast-way';
+                    let libStr = '@vue,tailwindcss,element-plus,z-element-plus,echarts,vue-router,pinia,js-web-screen-shot,js-fast-way'
                     const libs = libStr.split(',')
                     if (id.includes('node_modules')) {
                         const arr = id.toString().split('node_modules/')[1].split('/')
@@ -43,12 +43,12 @@ export default defineConfig({
                 },
                 chunkFileNames: 'static/js1/[name]-[hash].js',
                 entryFileNames: 'static/js2/[name]-[hash].js',
-                assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
+                assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
             },
             brotliSize: false, // 不统计
             target: 'esnext',
-            minify: 'esbuild' // 混淆器,terser构建后文件体积更小
-        }
+            minify: 'esbuild', // 混淆器,terser构建后文件体积更小
+        },
     },
     server: {
         ...config.vite,
@@ -58,7 +58,7 @@ export default defineConfig({
                 changeOrigin: true,
                 target: config.target,
                 rewrite: (path) => path.replace(new RegExp('^/api'), '/'),
-            }
-        }
+            },
+        },
     },
 })