Browse Source

Merge branch 'xj' of http://192.168.0.115:3000/bill/fuse-code into xj

xzw 1 năm trước cách đây
mục cha
commit
125f547064

+ 14 - 0
offline.html

@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>案件信息</title>
+    <script>window.offline = true</script>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.ts"></script>
+  </body>
+</html>

+ 1 - 0
package.json

@@ -6,6 +6,7 @@
   "scripts": {
     "dev": "vite",
     "build": " vite build",
+    "build-offline": " vite build ./ offline",
     "preview": "vite preview"
   },
   "dependencies": {

public/env-img/傍晚.jpg → public/env-img/bw.jpg


public/env-img/草地.jpg → public/env-img/cd.jpg


public/env-img/道路.jpg → public/env-img/dl.jpg


public/env-img/蓝天白云.jpg → public/env-img/ltby.jpg


public/env-img/乌云密布.jpg → public/env-img/wymb.jpg


public/env-img/夜空.jpg → public/env-img/yk.jpg


public/images/huimengmeng.jpg → public/images/hmm.jpg


BIN
public/images/image.png


public/images/lantianbaiyun.jpg → public/images/ltby.jpg


public/images/xingkong.jpg → public/images/xk.jpg


BIN
public/images/yj.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1686 - 0
public/package/data.json


BIN
public/package/resource/caseExtractDetail.doc


BIN
public/package/resource/caseInquest.doc


+ 0 - 1
src/api/floder.ts

@@ -13,7 +13,6 @@ export interface Floder {
 export type Floders = Floder[]
 
 addUnsetResErrorURLS('/fusion-xj/caseInquest/downDocx', '/fusion-xj/caseExtractDetail/downDocx')
-
 export const fetchFloders = async () => {
   const floders = await axios.get<Floders>(FLODER_LIST, { params: { caseId: params.caseId } })
   const otherFloders = [{

+ 2 - 3
src/api/instance.ts

@@ -1,12 +1,11 @@
 import { axiosFactory } from './setup'
 import { Message } from 'bill/index'
-import { showLoad, hideLoad } from '@/utils'
+import { showLoad, hideLoad } from '@/utils/loading'
 import * as URL from './constant'
 import { ResCode, ResCodeDesc } from './constant'
-import { appBackRoot, appType, baseURL, params } from '@/env'
+import { appBackRoot, baseURL, params } from '@/env'
 
 const instance = axiosFactory()
-
 export const {
   axios,
   addUnsetTokenURLS,

+ 86 - 0
src/api/offline.ts

@@ -0,0 +1,86 @@
+import { params as envParams } from "@/env";
+import { paramsToStr, strToParams } from "@/utils/params";
+import { AxiosInstance } from "axios";
+import Axios from 'axios'
+
+export const setOfflineAxios = (axios: AxiosInstance) => {
+  const data: {[key in string]: any} = {}
+  Axios.get('/package/data.json', {headers: { Accept: "application/json"}}).then(res => {
+    Object.assign(data, res.data)
+  })
+
+  // 流接口
+  const files = {
+    '/fusion-xj/caseExtractDetail/downDocx': '/package/resource/caseExtractDetail.doc',
+    '/fusion-xj/caseInquest/downDocx': '/package/resource/caseInquest.doc',
+  } as any
+
+
+  // 添加请求拦截器
+  axios.interceptors.request.use(
+    async function (config) {
+      const params = {...config.params}
+      let item = data[config.url!+ paramsToStr(params)] 
+      if (!item) {
+        delete params.caseId
+        item = data[config.url!+ paramsToStr(params)] 
+      }
+
+      if (item) {
+        throw {
+          isFakeResponse: true,
+            config,
+            response: {
+              data: item,
+              status: 200,
+              statusText: 'OK',
+              headers: {},
+              config: config,
+            }
+        }
+      } else if (files[config.url!]) {
+        const res = await Axios.get(files[config.url!], {responseType: 'blob'})
+        throw {
+          isFakeResponse: true,
+          response: {
+            data: res.data,
+            status: 200,
+            statusText: 'OK',
+            headers: {},
+            config: config,
+          },
+        }
+      } else {
+        console.error(config.url, '未在离线包中!')
+      }
+      return config
+    },
+    function (error) {
+      // 对请求错误做些什么
+      return Promise.reject(error);
+    }
+  );
+
+
+  // 添加响应拦截器
+  axios.interceptors.response.use(
+    function (response) {
+      if (!files[response.config.url!]) {
+        console.error(response.config.url + paramsToStr(response.config.params), '正在添加到离线包中!')
+        data[response.config.url+ paramsToStr(response.config.params)!] = response.data
+      }
+      // 对响应数据做点什么
+      return response;
+    },
+    err => {
+      if (err.isFakeResponse) {
+        return Promise.resolve(err.response);
+      }
+    }
+  );
+
+  (window as any).proxyData = () => {
+    console.log(data)
+    console.log(JSON.stringify(data))
+  };
+}

+ 7 - 6
src/api/setting-resource.ts

@@ -25,6 +25,7 @@ export const settingResourceTypeDesc = {
 
 export type SettingResource = {
   id?: string;
+  covre?: string
   resource: string;
   sys?: boolean
   scale?: number,
@@ -39,12 +40,12 @@ export const settingResources = ref<SettingResources>([]);
 export const fetchSettingResources = async () => {
   settingResources.value = [
     { sys: true, name: "无", backType: SettingResourceType.icon, resource: "icon-without" },
-    { sys: true, name: '蓝天白云', backType: SettingResourceType.envImage, resource: "./env-img/pic_ltby@2x.png", },
-    { sys: true, name: '乌云密布', backType: SettingResourceType.envImage, resource: "./env-img/pic_wymb@2x.png",},
-    { sys: true, name: '夜空', backType: SettingResourceType.envImage, resource: "./env-img/pic_yk@2x.png", },
-    { sys: true, name: '草地', backType: SettingResourceType.envImage, resource: "./env-img/pic_cd@2x.png", },
-    { sys: true, name: '道路', backType: SettingResourceType.envImage, resource: "./env-img/pic_dl@2x.png", },
-    { sys: true, name: '傍晚', backType: SettingResourceType.envImage, resource: "./env-img/pic_bw@2x.png", },
+    { sys: true, name: '蓝天白云', backType: SettingResourceType.envImage, covre:  "./env-img/pic_ltby@2x.png", resource: "./env-img/ltby.jpg", },
+    { sys: true, name: '乌云密布', backType: SettingResourceType.envImage, covre:  "./env-img/pic_wymb@2x.png", resource: "./env-img/wymb.jpg",},
+    { sys: true, name: '夜空', backType: SettingResourceType.envImage, covre:  "./env-img/pic_yk@2x.png", resource: "./env-img/yk.jpg", },
+    { sys: true, name: '草地', backType: SettingResourceType.envImage, covre:  "./env-img/pic_cd@2x.png", resource: "./env-img/cd.jpg", },
+    { sys: true, name: '道路', backType: SettingResourceType.envImage, covre:  "./env-img/pic_dl@2x.png", resource: "./env-img/dl.jpg", },
+    { sys: true, name: '傍晚', backType: SettingResourceType.envImage, covre:  "./env-img/pic_bw@2x.png", resource: "./env-img/bw.jpg", },
     { sys: true, name: '灰色', backType: SettingResourceType.color, resource: '#333333', },
     { sys: true, name: '黑色', backType: SettingResourceType.color, resource: '#000000', },
     { sys: true, name: '白色', backType: SettingResourceType.color, resource: '#ffffff', },

+ 9 - 4
src/api/setup.ts

@@ -1,7 +1,8 @@
 import Axios from 'axios'
 import { ResCode } from './constant'
 
-import type { AxiosResponse, AxiosRequestConfig } from 'axios'
+import type { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios'
+import { setOfflineAxios } from './offline'
 
 export type ResErrorHandler = <D, T extends ResData<D>>(response: AxiosResponse<T>, data?: T) => void
 export type ReqErrorHandler = <T>(err: Error, response: AxiosRequestConfig<T>) => void
@@ -11,8 +12,7 @@ export type Hook = {
   after?: (config: AxiosRequestConfig) => void
 }
 
-export const axiosFactory = () => {
-  const axiosRaw = Axios.create()
+export const axiosFactory = (axiosRaw: AxiosInstance = Axios.create()) => {
   const axiosConfig = {
     token: localStorage.getItem('fuseCodeToken'),
     unTokenSet: [] as string[],
@@ -25,7 +25,6 @@ export const axiosFactory = () => {
   }
 
 
-
   type AxiosConfig = typeof axiosConfig
   type ExponseApi<K extends keyof AxiosConfig> = 
     { set: (val: AxiosConfig[K]) => void } 
@@ -149,6 +148,12 @@ export const axiosFactory = () => {
     }
   )
 
+  if ((window as any).offline) {
+    setOfflineAxios(axiosRaw)
+  }
+
+
+
   axiosRaw.interceptors.response.use(
     (response: AxiosResponse<ResData<any>>) => {
       for (const hook of axiosConfig.hook) {

+ 6 - 2
src/main.ts

@@ -3,7 +3,7 @@ import './style.scss'
 import App from './app.vue'
 import Components from 'bill/index'
 import router from './router'
-import { appStyleImport, appType, params } from '@/env'
+import { appStyleImport, params } from '@/env'
 import { addHook, addUnsetTokenURLS, delHook, delUnsetTokenURLS } from '@/api'
 import { currentLayout, RoutesName } from './router';
 import * as URL from '@/api/constant'
@@ -40,7 +40,11 @@ watchEffect((onCleanup) => {
           URL.FLODER_LIST,
           URL.MODEL_SIGN,
           URL.CASE_INFO,
-          URL.AUTH_PWD
+          URL.AUTH_PWD,
+          '/fusion-xj/caseInquest/info',
+          '/fusion-xj/caseExtractDetail/info',
+          '/fusion-xj/caseInquest/downDocx',
+          '/fusion-xj/caseExtractDetail/downDocx'
         ]
       : [URL.AUTH_PWD]
       

+ 20 - 10
src/model/app.vue

@@ -66,16 +66,26 @@ export const Model = defineComponent({
         return setUrl("");
       }
       const type = scene.value.type;
-      const urls = {
-        [SceneType.SWKK]: `/swkk/spg.html?m=${scene.value.num}`,
-        [SceneType.SWKJ]: `/swkk/spg.html?m=${scene.value.num}`,
-        [SceneType.SWSS]: `/swss/index.html?m=${scene.value.num}`,
-        [SceneType.SWSSMX]: `/swkk/spg.html?m=${scene.value.num}`,
-        [SceneType.SWMX]: `index.html?caseId=${params.caseId}&app=${params.app}&modelId=${scene.value.num}&share=1#sign-model`,
-        [SceneType.SWYDSS]: `/swss/index.html?m=${scene.value.num}`,
-        [SceneType.SWYDMX]: `/swkk/spg.html?m=${scene.value.num}`,
-      };
-      setUrl(urls[type]);
+      const urls = !(window as any).offline
+        ? {
+            [SceneType.SWKK]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWKJ]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWSS]: `/swss/index.html?m=${scene.value.num}`,
+            [SceneType.SWSSMX]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWMX]: `index.html?caseId=${params.caseId}&app=${params.app}&modelId=${scene.value.num}&share=1#sign-model`,
+            [SceneType.SWYDSS]: `/swss/index.html?m=${scene.value.num}`,
+            [SceneType.SWYDMX]: `/swkk/spg.html?m=${scene.value.num}`,
+          }
+        : {
+            [SceneType.SWKK]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWKJ]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWSS]: `/swss/offline.html?m=${scene.value.num}`,
+            [SceneType.SWSSMX]: `/swkk/spg.html?m=${scene.value.num}`,
+            [SceneType.SWMX]: `offline.html?caseId=${params.caseId}&app=${params.app}&modelId=${scene.value.num}&share=1#sign-model`,
+            [SceneType.SWYDSS]: `/swss/offline.html?m=${scene.value.num}`,
+            [SceneType.SWYDMX]: `/swkk/spg.html?m=${scene.value.num}`,
+          };
+      setUrl(urls[type as SceneType]);
     });
 
     const fuseRef = ref<HTMLDivElement>();

+ 11 - 0
src/utils/params.ts

@@ -15,4 +15,15 @@ export const strToParams = (str: string) => {
   }
 
   return result
+}
+
+export const paramsToStr = (params: {[key in string]: string}) => {
+  
+  if (params && Object.keys(params).length > 0) {
+    const entitys = Object.entries(params)
+    entitys.sort((a, b) => a[0].localeCompare(b[0]))
+    return '?' + entitys.map(([k, v]) => `${k}=${v}`).join('&')
+  } else {
+    return ''
+  }
 }

+ 1 - 1
src/views/setting/index.vue

@@ -65,7 +65,7 @@
             @click="setting!.back !== back.resource && changeBack(back.resource, back.backType, setting!.openCompass, setting!.mapOpen, setting!.mapType, {scale: setting!.scale!, rotate: setting?.rotate!})"
           >
             <img
-              :src="back.resource"
+              :src="back.covre || back.resource"
               v-if="back.backType === 'img' || back.backType === 'bimg'"
             />
             <i

+ 13 - 0
vite.config.ts

@@ -5,6 +5,11 @@ import mkcert from 'vite-plugin-mkcert'
 
 import { resolve } from 'path'
 
+let app = "index";
+if (process.argv.length > 3) {
+  app = process.argv[process.argv.length - 1].trim();
+}
+
 const proxy = {
   '/local': {
     target: 'http://192.168.0.38:8808',
@@ -37,8 +42,16 @@ const proxy = {
   }
 }
 
+const input = {
+  [app]: resolve(__dirname, `${app}.html`),
+}
 // https://vitejs.dev/config/
 export default defineConfig({
+  build: {
+    rollupOptions:  {
+      input
+    },
+  },
   plugins: [vue(), mkcert() ],
   css: {
     preprocessorOptions: {