修复: 移除API地址硬编码,统一使用nginx代理

- 修复frontend/app.js中的localhost:40001硬编码
- 修复frontend/share.html中的localhost:40001硬编码
- 所有API请求现在统一通过nginx代理访问
- 支持任意端口号部署,无需修改前端代码
This commit is contained in:
WanWanYun
2025-11-11 23:54:22 +08:00
parent 340e328b76
commit 2dc6323554
2 changed files with 4 additions and 8 deletions

View File

@@ -4,10 +4,8 @@ createApp({
data() {
return {
// API配置
// API配置 - 动态适配localhost或生产环境
apiBase: window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
? 'http://localhost:40001'
: window.location.protocol + '//' + window.location.host,
// API配置 - 通过nginx代理访问
apiBase: window.location.protocol + '//' + window.location.host,
// 用户状态
isLoggedIn: false,