refactor(config): 将环境配置文件从 TypeScript 转换为 JavaScript

- 移除 config/env.ts 文件并将环境配置转换为 config/env.js
- 更新 config/index.ts 中的导入路径以匹配新的 JavaScript 文件扩展名
- 修改 src/utils/server.ts 中的开发服务器 URL 配置
- 更新 tsconfig.json 的 include 配置移除 config 目录
- 调整环境配置中的 API 地址设置统一使用生产环境地址
- 更新 .workbuddy/expert-history.json 中的时间戳记录
This commit is contained in:
2026-04-03 20:17:23 +08:00
parent 6fb8be275a
commit 12917a4766
5 changed files with 9 additions and 9 deletions

View File

@@ -13,5 +13,5 @@
} }
] ]
}, },
"lastUpdated": 1775132225586 "lastUpdated": 1775141282813
} }

View File

@@ -2,21 +2,21 @@
// ============ 环境切换开关(修改这里即可切换环境)============ // ============ 环境切换开关(修改这里即可切换环境)============
// 可选值: 'development' | 'test' | 'production' // 可选值: 'development' | 'test' | 'production'
const CURRENT_ENV: 'production' = 'production' const CURRENT_ENV = 'production'
// =========================================================== // ===========================================================
export const ENV_CONFIG = { export const ENV_CONFIG = {
// 开发环境 // 开发环境
development: { development: {
API_BASE_URL: 'https://glt-dev-api.websoft.top/api', API_BASE_URL: 'https://glt-api.websoft.top/api',
SERVER_API_URL: 'https://glt-dev-server.websoft.top/api', SERVER_API_URL: 'https://glt-server.websoft.top/api',
APP_NAME: '开发环境', APP_NAME: '开发环境',
DEBUG: 'true', DEBUG: 'true',
}, },
// 测试环境 // 测试环境
test: { test: {
API_BASE_URL: 'https://glt-dev-api.websoft.top/api', API_BASE_URL: 'https://glt-api.websoft.top/api',
SERVER_API_URL: 'https://glt-dev-server.websoft.top/api', SERVER_API_URL: 'https://glt-server.websoft.top/api',
APP_NAME: '测试环境', APP_NAME: '测试环境',
DEBUG: 'true', DEBUG: 'true',
}, },

View File

@@ -2,7 +2,7 @@ import { defineConfig, type UserConfigExport } from '@tarojs/cli'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
import devConfig from './dev' import devConfig from './dev'
import prodConfig from './prod' import prodConfig from './prod'
import { getEnvConfig } from './env' import { getEnvConfig } from './env.js'
// import vitePluginImp from 'vite-plugin-imp' // import vitePluginImp from 'vite-plugin-imp'
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数

View File

@@ -7,7 +7,7 @@ export const TEMPLATE_ID = '10584';
// @ts-ignore // @ts-ignore
export const SERVER_API_URL = process.env.TARO_ENV === 'production' export const SERVER_API_URL = process.env.TARO_ENV === 'production'
? 'https://glt-server.websoft.top/api' ? 'https://glt-server.websoft.top/api'
: 'https://glt-dev-server.websoft.top/api'; : 'https://glt-server.websoft.top/api';
/** /**
* 保存用户信息到本地存储 * 保存用户信息到本地存储
* @param token * @param token

View File

@@ -37,6 +37,6 @@
}, },
"skipLibCheck": true "skipLibCheck": true
}, },
"include": ["./src", "./types", "./config"], "include": ["./src", "./types"],
"compileOnSave": false "compileOnSave": false
} }