Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	utils/config.ts
master
echo 1 month ago
parent
commit
230191f181
  1. 4
      package.json
  2. 2
      tsconfig.json
  3. 10
      utils/config.ts

4
package.json

@ -4,8 +4,8 @@
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"start": "expo start", "start": "expo start",
"android": "expo start --android", "android": "concurrently \"npm run proxy\" \"expo start --ios\"",
"ios": "expo start --ios", "ios": "concurrently \"npm run proxy\" \"expo start --ios\"",
"web": "expo start --web", "web": "expo start --web",
"proxy": "node scripts/proxy-server.js", "proxy": "node scripts/proxy-server.js",
"dev": "concurrently \"npm run proxy\" \"npm run start\"", "dev": "concurrently \"npm run proxy\" \"npm run start\"",

2
tsconfig.json

@ -6,5 +6,5 @@
"@/*": ["./*"] "@/*": ["./*"]
} }
}, },
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"] "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts", "utils/config.ts.local"]
} }

10
utils/config.ts

@ -51,9 +51,13 @@ export const getApiBaseUrl = (): string => {
return 'http://localhost:8086/api'; return 'http://localhost:8086/api';
} else { } else {
// iOS/Android 使用本机 IP // iOS/Android 使用本机 IP
// 从环境变量读取,避免多人开发时地址冲突 // ⚠ 重要:需要替换为你的本机 IP 地址
// 请在 .env.local 文件中配置 EXPO_PUBLIC_DEV_API_URL // 查看本机 IP:
return process.env.EXPO_PUBLIC_DEV_API_URL || 'http://192.168.1.100:8086/api'; // - Windows: ipconfig
// - Mac/Linux: ifconfig
// - 或者使用 Metro Bundler 显示的 IP
// process.env.APP_IP_ADDRESS 在 .env.development.local 中配置 自己本地创建,避免提交到代码库
return process.env.APP_IP_ADDRESS || 'http://192.168.1.100:8086/api';
} }
case 'staging': case 'staging':

Loading…
Cancel
Save