27 lines
643 B
TypeScript
27 lines
643 B
TypeScript
/**
|
|
* 环境配置
|
|
*/
|
|
declare const wx: WechatMiniprogram.Wx;
|
|
|
|
function isDev(): boolean {
|
|
try {
|
|
const accountInfo = typeof wx.getAccountInfoSync === 'function'
|
|
? wx.getAccountInfoSync()
|
|
: null;
|
|
if (accountInfo?.miniProgram?.envVersion === 'develop') {
|
|
return true;
|
|
}
|
|
|
|
const info = (wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync()) as any;
|
|
return info.platform === 'devtools';
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export const API_BASE_URL: string = isDev()
|
|
? 'http://localhost:8085/api/v1'
|
|
: 'https://api.danyang-match.example.com/api/v1';
|
|
|
|
export const IS_DEV: boolean = isDev();
|