修复: 移除API地址硬编码,统一使用nginx代理
- 修复frontend/app.js中的localhost:40001硬编码 - 修复frontend/share.html中的localhost:40001硬编码 - 所有API请求现在统一通过nginx代理访问 - 支持任意端口号部署,无需修改前端代码
This commit is contained in:
@@ -4,10 +4,8 @@ createApp({
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// API配置
|
// API配置
|
||||||
// API配置 - 动态适配localhost或生产环境
|
// API配置 - 通过nginx代理访问
|
||||||
apiBase: window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
apiBase: window.location.protocol + '//' + window.location.host,
|
||||||
? 'http://localhost:40001'
|
|
||||||
: window.location.protocol + '//' + window.location.host,
|
|
||||||
|
|
||||||
// 用户状态
|
// 用户状态
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
|
|||||||
@@ -583,10 +583,8 @@
|
|||||||
createApp({
|
createApp({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// API配置 - 动态适配localhost或生产环境
|
// API配置 - 通过nginx代理访问
|
||||||
apiBase: window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
apiBase: window.location.protocol + '//' + window.location.host,
|
||||||
? 'http://localhost:40001'
|
|
||||||
: window.location.protocol + '//' + window.location.host,
|
|
||||||
shareCode: '',
|
shareCode: '',
|
||||||
password: '',
|
password: '',
|
||||||
needPassword: false,
|
needPassword: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user