فهرست منبع

feat: 修改base为测试环境的目录

zhouyuhao 1 سال پیش
والد
کامیت
bb0159d21a
4فایلهای تغییر یافته به همراه16 افزوده شده و 15 حذف شده
  1. 1 1
      .env
  2. 1 1
      src/router/index.ts
  3. 3 2
      src/utils/axios.ts
  4. 11 11
      vite.config.ts

+ 1 - 1
.env

@@ -1,2 +1,2 @@
 VITE_API_HOST = 'http://localhost/api'
-VITE_BASE_URL = '/online_backend/'
+VITE_BASE_URL = '/k_new_online/'

+ 1 - 1
src/router/index.ts

@@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
 import { useUserStore } from '@/stores/modules/user'
 
 const router = createRouter({
-  history: createWebHistory(`/new/`),
+  history: createWebHistory(`/${import.meta.env.VITE_BASE_URL}/`),
   routes: [
     {
       path: '/',

+ 3 - 2
src/utils/axios.ts

@@ -45,8 +45,9 @@ class HttpAxios {
   }
 
   _requestInterceptors = (config: AxiosRequestConfig) => {
-    const _config = { timeout: this.timeout }
-    return { ...config, ..._config }
+    // const _config = { timeout: this.timeout }
+    // return { ...config, ..._config }
+    return config
   }
   /**
    * 返回拦截

+ 11 - 11
vite.config.ts

@@ -9,7 +9,7 @@ import IconsResolver from 'unplugin-icons/resolver'
 
 // https://vitejs.dev/config/
 export default defineConfig({
-  base: `/new/`,
+  base: `/${process.env.VITE_BASE_URL}/`,
   resolve: {
     alias: {
       '@': fileURLToPath(new URL('./src', import.meta.url))
@@ -59,15 +59,15 @@ export default defineConfig({
         rewrite: (path: string) => path.replace(/^\/api/, '')
       }
     }
-  },
-  build: {
-    assetsDir: 'assets',
-    rollupOptions: {
-      output: {
-        entryFileNames: `assets/[name].[hash].js`,
-        chunkFileNames: `assets/[name].[hash].js`,
-        assetFileNames: `assets/[name].[hash].[ext]`
-      }
-    }
   }
+  // build: {
+  //   assetsDir: 'assets',
+  //   rollupOptions: {
+  //     output: {
+  //       entryFileNames: `assets/[name].[hash].js`,
+  //       chunkFileNames: `assets/[name].[hash].js`,
+  //       assetFileNames: `assets/[name].[hash].[ext]`
+  //     }
+  //   }
+  // }
 })