24 lines
768 B
JavaScript
24 lines
768 B
JavaScript
// 平台标识 - 使用条件编译替代 process.env
|
|
// #ifdef MP-WEIXIN
|
|
export const PLATFORM = 'mp-weixin';
|
|
// #endif
|
|
// #ifdef MP-KUAISHOU
|
|
export const PLATFORM = 'mp-kuaishou';
|
|
// #endif
|
|
|
|
// 基础URL - 使用全局配置
|
|
export const BASE_URL = (() => {
|
|
// 开发环境
|
|
if (PLATFORM === 'mp-weixin') {
|
|
const accountInfo = uni.getAccountInfoSync();
|
|
const env = accountInfo.miniProgram.envVersion || 'release';
|
|
|
|
// 根据微信环境返回不同URL
|
|
if (env === 'develop') return 'http://127.0.0.1:7777/a-pan/forestage';
|
|
if (env === 'trial') return 'http://127.0.0.1:7777/a-pan/forestage';
|
|
return 'https://api.hellobin.top/a-pan/forestage';
|
|
}
|
|
|
|
// 快手小程序环境
|
|
return 'https://api.example.com/a-pan/forestage';
|
|
})(); |