Browse Source

添加jmfire配置

bill 1 năm trước cách đây
mục cha
commit
b9e67f4aed
4 tập tin đã thay đổi với 20 bổ sung10 xóa
  1. 2 2
      src/api/instance.ts
  2. 14 0
      src/env/index.ts
  3. 2 2
      src/layout/show/slide-menu.vue
  4. 2 6
      src/main.ts

+ 2 - 2
src/api/instance.ts

@@ -3,7 +3,7 @@ import { Message } from 'bill/index'
 import { showLoad, hideLoad } from '@/utils'
 import * as URL from './constant'
 import { ResCode, ResCodeDesc } from './constant'
-import { appType, baseURL, params } from '@/env'
+import { appBackRoot, appType, baseURL, params } from '@/env'
 
 const instance = axiosFactory()
 
@@ -25,7 +25,7 @@ export const {
 } = instance
 
 const gotoLogin = () => {
-  const loginHref = import.meta.env.DEV ? 'http://localhost:5174' : (params.app === appType.fire ? '/fire' : '/criminal')
+  const loginHref = import.meta.env.DEV ? 'http://localhost:5174' : appBackRoot[params.app]
   location.href = loginHref + '?redirect=' + escape(location.href) + '#/login'
 }
 

+ 14 - 0
src/env/index.ts

@@ -46,8 +46,22 @@ params.share = Boolean(Number(params.share))
 params.single = Boolean(Number(params.single))
 export enum appType {
   fire = "1",
+  jmfire = "3",
   criminal = "2"
 }
+export const appStyleImport = {
+  [appType.fire]: () => import('./assets/style/fire.less'),
+  [appType.jmfire]: () => import('./assets/style/fire.less'),
+  [appType.criminal]: () => import('./assets/style/criminal.less'),
+}
+export const appBackRoot = {
+  [appType.fire]: "/fire",
+  [appType.jmfire]: "/jmfire",
+  [appType.criminal]: "/criminal"
+}
+export const routeIncludeFire = (type: appType) => 
+  [appType.fire, appType.jmfire].includes(type)
+
 export type Params = { 
   caseId: number,
   baseURL?: string,

+ 2 - 2
src/layout/show/slide-menu.vue

@@ -17,7 +17,7 @@ import { views, records, floders } from '@/store';
 import { computed } from 'vue';
 
 import type { RouteRaw } from '@/router'
-import { appType, params } from '@/env';
+import { appType, params, routeIncludeFire } from '@/env';
 
 export type MenuItem = {
   name: RoutesName,
@@ -36,7 +36,7 @@ const items = computed(() => {
       ...metas[RoutesName.summaryShow]
     }
   ]
-  if (params.app === appType.fire) {
+  if (routeIncludeFire(params.app)) {
     items.unshift({
       name: RoutesName.fireInfo,
       config: getRouteConfig(RoutesName.fireInfo),

+ 2 - 6
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 { appType, params } from '@/env'
+import { appStyleImport, appType, params } from '@/env'
 import { addHook, addUnsetTokenURLS, delHook, delUnsetTokenURLS } from '@/api'
 import { currentLayout, RoutesName } from './router';
 import * as URL from '@/api/constant'
@@ -14,11 +14,7 @@ app.use(Components)
 app.use(router)
 app.mount('#app')
 
-if (params.app === appType.fire) {
-  import('./assets/style/fire.less')
-} else {
-  import('./assets/style/criminal.less')
-}
+appStyleImport[params.app]()
 
 watchEffect((onCleanup) => {
   if ([RoutesName.show, RoutesName.signModel].includes(currentLayout.value!)) {