xiongzhu 2 лет назад
Родитель
Сommit
b2132c925b
6 измененных файлов с 29 добавлено и 20 удалено
  1. 1 0
      .env.development
  2. 2 1
      .env.production
  3. 3 0
      .eslintrc.cjs
  4. 1 1
      index.html
  5. 1 1
      src/views/MainView.vue
  6. 21 17
      vite.config.js

+ 1 - 0
.env.development

@@ -1 +1,2 @@
+VITE_BASE_URL=/
 VITE_API_BASE_URL=http://localhost:3000/api

+ 2 - 1
.env.production

@@ -1 +1,2 @@
-VITE_API_BASE_URL=/api
+VITE_BASE_URL=/admin/
+VITE_API_BASE_URL=/api

+ 3 - 0
.eslintrc.cjs

@@ -9,5 +9,8 @@ module.exports = {
     },
     rules: {
         'no-unused-vars': 'off'
+    },
+    globals: {
+        process: true
     }
 }

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <link rel="icon" href="/favicon.ico">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>管理后台</title>
+    <title>ChatAdmin管理后台</title>
   </head>
   <body>
     <div id="app"></div>

+ 1 - 1
src/views/MainView.vue

@@ -2,7 +2,7 @@
     <ElContainer class="h-full">
         <ElAside class="bg-slate-100 dark:bg-zinc-800" v-if="!isMobile">
             <div class="h-16 px-4 flex items-center justify-center cursor-pointer">
-                <LogoSvg class="fill-black dark:fill-white" /><span class="pl-2 font-[sh]">CHILLGPT</span>
+                <span class="text-lg font-[sh]">ChatAdmin</span>
             </div>
             <SideMenu :default-active="activeMenu" :menus="menus" />
         </ElAside>

+ 21 - 17
vite.config.js

@@ -1,28 +1,32 @@
 import { fileURLToPath, URL } from 'node:url'
 
-import { defineConfig } from 'vite'
+import { defineConfig, loadEnv } from 'vite'
 import vue from '@vitejs/plugin-vue'
 import AutoImport from 'unplugin-auto-import/vite'
 import Components from 'unplugin-vue-components/vite'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
 
 // https://vitejs.dev/config/
-export default defineConfig({
-    plugins: [
-        vue(),
-        AutoImport({
-            resolvers: [ElementPlusResolver()]
-        }),
-        Components({
-            resolvers: [ElementPlusResolver()]
-        })
-    ],
-    resolve: {
-        alias: {
-            '@': fileURLToPath(new URL('./src', import.meta.url))
+export default defineConfig(({ command, mode }) => {
+    process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
+    return {
+        base: process.env.VITE_BASE_URL,
+        plugins: [
+            vue(),
+            AutoImport({
+                resolvers: [ElementPlusResolver()]
+            }),
+            Components({
+                resolvers: [ElementPlusResolver()]
+            })
+        ],
+        resolve: {
+            alias: {
+                '@': fileURLToPath(new URL('./src', import.meta.url))
+            }
+        },
+        server: {
+            host: '0.0.0.0'
         }
-    },
-    server: {
-        host: '0.0.0.0'
     }
 })