xgj 2 dní pred
rodič
commit
57f876b225
3 zmenil súbory, kde vykonal 24 pridanie a 11 odobranie
  1. 21 0
      .env.development
  2. 3 3
      src/api/index.ts
  3. 0 8
      vite.config.ts

+ 21 - 0
.env.development

@@ -17,7 +17,28 @@ VITE_PWA = false
 # 开发环境接口地址
 VITE_API_URL = /api
 
+
 # 开发环境跨域代理,支持配置多个
 VITE_PROXY = [["/api","https://mcapi.mdfitnesscao.com"]]
 # VITE_PROXY = [["/api","https://www.fastmock.site/mock/f81e8333c1a9276214bcdbc170d9e0a0"]]
 # VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]
+
+
+# 项目本地运行端口号
+VITE_PORT = 8848
+
+# 开发环境读取配置文件路径
+VITE_PUBLIC_PATH = /
+
+# 开发环境路由历史模式
+VITE_ROUTER_HISTORY = "hash"
+
+ENV = 'development'
+
+# 开发环境请求接口
+VITE_APP_H5_DOMAIN = 'https://q.dev.mdfitnesscao.com'
+VITE_APP_DOMAIN = 'https://mcapi.mdfitnesscao.com'
+VITE_APP_DOMAIN_API = 'https://api.mdfitnesscao.com'
+VITE_APP_CHANNEL_API = 'https://mcapi.mdfitnesscao.com'
+VITE_APP_CHANNEL_DOMAIN = 'https://channel.dev.mdfitnesscao.com'
+VITE_APP_OSS_DOMAIN = 'https://oss.mdfitnesscao.com'

+ 3 - 3
src/api/index.ts

@@ -16,11 +16,11 @@ export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
 
 const config = {
   // 默认地址请求地址,可在 .env.** 文件中修改
-  baseURL: import.meta.env.VITE_API_URL as string,
+  baseURL: import.meta.env.VITE_APP_DOMAIN as string,
   // 设置超时时间
-  timeout: ResultEnum.TIMEOUT as number,
+  timeout: ResultEnum.TIMEOUT as number
   // 跨域时候允许携带凭证
-  withCredentials: true
+  // withCredentials: true
 };
 
 const axiosCanceler = new AxiosCanceler();

+ 0 - 8
vite.config.ts

@@ -37,14 +37,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
         }
       }
     },
-    server: {
-      host: "0.0.0.0",
-      port: viteEnv.VITE_PORT,
-      open: viteEnv.VITE_OPEN,
-      cors: true,
-      // Load proxy configuration from .env.development
-      proxy: createProxy(viteEnv.VITE_PROXY)
-    },
     plugins: createVitePlugins(viteEnv),
     esbuild: {
       pure: viteEnv.VITE_DROP_CONSOLE ? ["console.log", "debugger"] : []