bzkf3 преди 2 години
родител
ревизия
4eeb0ab254
променени са 6 файла, в които са добавени 53 реда и са изтрити 10 реда
  1. 4 0
      components.d.ts
  2. 5 1
      package.json
  3. 13 0
      pnpm-lock.yaml
  4. 12 3
      src/router/index.ts
  5. 1 0
      tsconfig.node.json
  6. 18 6
      vite.config.ts

+ 4 - 0
components.d.ts

@@ -8,6 +8,7 @@ declare module '@vue/runtime-core' {
     AppLink: typeof import('./src/components/AppLink/index.vue')['default']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElCascader: typeof import('element-plus/es')['ElCascader']
+    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElDialog: typeof import('element-plus/es')['ElDialog']
@@ -28,6 +29,9 @@ declare module '@vue/runtime-core' {
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
+    ElTabPane: typeof import('element-plus/es')['ElTabPane']
+    ElTabs: typeof import('element-plus/es')['ElTabs']
+    ElTree: typeof import('element-plus/es')['ElTree']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     FileLink: typeof import('./src/components/FileLink/index.vue')['default']
     FileUpload: typeof import('./src/components/FileUpload/index.vue')['default']

+ 5 - 1
package.json

@@ -5,7 +5,10 @@
   "scripts": {
     "dev": "vite --host 0.0.0.0",
     "build": "vite build",
-    "check":"vue-tsc --noEmit",
+    "build:xdhq": "vite build",
+    "build:xdjy": "vite build",
+    "build:xdjx": "vite build",
+    "check": "vue-tsc --noEmit",
     "preview": "vite preview",
     "plop": "plop",
     "plopf": "plop --force"
@@ -28,6 +31,7 @@
   "devDependencies": {
     "@types/lodash-es": "^4.17.6",
     "@vitejs/plugin-vue": "^2.3.4",
+    "magic-string": "^0.30.0",
     "sass": "^1.56.1",
     "typescript": "^4.9.3",
     "unplugin-auto-import": "^0.8.8",

+ 13 - 0
pnpm-lock.yaml

@@ -10,6 +10,7 @@ specifiers:
   echarts: ^5.4.0
   element-plus: ^2.2.26
   lodash-es: ^4.17.21
+  magic-string: ^0.30.0
   plop: ^3.1.1
   print-js: ^1.6.0
   sass: ^1.56.1
@@ -43,6 +44,7 @@ dependencies:
 devDependencies:
   '@types/lodash-es': 4.17.6
   '@vitejs/plugin-vue': 2.3.4_vite@2.9.15+vue@3.2.45
+  magic-string: 0.30.0
   sass: 1.56.1
   typescript: 4.9.3
   unplugin-auto-import: 0.8.8_xbmdkanscfjoi4rlzcxf6weili
@@ -113,6 +115,10 @@ packages:
       '@floating-ui/core': 1.0.2
     dev: false
 
+  /@jridgewell/sourcemap-codec/1.4.14:
+    resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==}
+    dev: true
+
   /@nodelib/fs.scandir/2.1.5:
     resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
     engines: {node: '>= 8'}
@@ -1443,6 +1449,13 @@ packages:
       sourcemap-codec: 1.4.8
     dev: true
 
+  /magic-string/0.30.0:
+    resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==}
+    engines: {node: '>=12'}
+    dependencies:
+      '@jridgewell/sourcemap-codec': 1.4.14
+    dev: true
+
   /make-iterator/1.0.1:
     resolution: {integrity: sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==}
     engines: {node: '>=0.10.0'}

+ 12 - 3
src/router/index.ts

@@ -2,9 +2,18 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
 import { RouteRecordDetailRaw } from './routes.d';
 import { app_ready,app_routes } from '~/store/app';
 
-import localRoutes from './routes/xdjx';
-// import localRoutes from './routes/xdjy';
-// import localRoutes from './routes/xdhq';
+
+import localRoutes from
+// #ifdef
+'./routes/xdjx';
+// #endif
+// #ifdef
+'./routes/xdjy';
+// #endif
+// #ifdef
+'./routes/xdhq';
+// #endif
+
 
 const router = createRouter({
   history: createWebHashHistory(),

+ 1 - 0
tsconfig.node.json

@@ -7,5 +7,6 @@
   },
   "include": [
     "vite.config.ts",
+    "plugins/*.ts"
   ]
 }

+ 18 - 6
vite.config.ts

@@ -5,6 +5,7 @@ import WindiCss from 'vite-plugin-windicss';
 import AutoImport from 'unplugin-auto-import/vite'
 import Components from 'unplugin-vue-components/vite'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
+import ConditionalCompile from './plugins/vite-plugin-conditional-compile'
 
 // https://vitejs.dev/config/
 export default defineConfig(({ command }) => {
@@ -12,7 +13,7 @@ export default defineConfig(({ command }) => {
   const config: UserConfigExport = {
     // base:'/app/xdjx/',
     // base: '/app/xdjy/',
-    base: '/app/xdhq/',
+    // base: '/app/xdhq/',
     resolve: {
       alias: {
         '~': `${path.resolve(__dirname, 'src')}`,
@@ -29,6 +30,7 @@ export default defineConfig(({ command }) => {
       },
     },
     plugins: [
+      ConditionalCompile(),
       vue(),
       WindiCss(),
       AutoImport({
@@ -54,13 +56,23 @@ export default defineConfig(({ command }) => {
 
   }
 
-  if (command === 'serve') {
-    config.base = "/"
-  } else {
-
+  switch (command as string) {
+    case 'build:xdhq':
+      config.base = '/app/xdhq/'
+      break;
+    case 'build:xdjy':
+      config.base = '/app/xdjy/'
+      break;
+    case 'build:xdjx':
+      config.base = '/app/xdjx/'
+      break;
+    case 'serve':
+      config.base = '/'
+      break;
   }
 
-
+  console.log('config.base :>> ', config.base);
+  // console.log('config.env :>> ', config.env);
   return config
 }