40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
// 接口基础配置
|
|
|
|
// 环境地址配置
|
|
const ENV_CONFIG = {
|
|
trial: 'https://smartguest.bmser.com:8091',
|
|
// develop: 'https://192.168.123.76:8080'
|
|
develop: 'https://10.50.13.191:8091'
|
|
}
|
|
|
|
// 自动判断当前运行环境
|
|
function getBaseUrl() {
|
|
const accountInfo = wx.getAccountInfoSync()
|
|
const envVersion = accountInfo.miniProgram.envVersion
|
|
// release = 正式版, develop = 开发版, trial = 体验版
|
|
return envVersion === 'trial' ? ENV_CONFIG.trial : ENV_CONFIG.develop
|
|
}
|
|
|
|
const BASE_URL = getBaseUrl()
|
|
|
|
// API 路径配置
|
|
const API = {
|
|
LOGIN: '/api/wx-mini/login',
|
|
APPOINTMENT_LATEST: '/api/wx-mini/appointment/latest',
|
|
APPOINTMENT_LIST: '/api/wx-mini/appointment/list',
|
|
APPOINTMENT_CREATE: '/api/wx-mini/appointment/create',
|
|
APPOINTMENT_CANCEL: '/api/wx-mini/appointment/cancel',
|
|
APPOINTMENT_DETAIL: '/api/wx-mini/appointment/detail',
|
|
WXACODE: '/api/wx-mini/wxacode',
|
|
PERSON_SELECTOR: '/api/wx-mini/appointment/person/selector',
|
|
DEPARTMENT_SELECTOR: '/api/wx-mini/appointment/department/selector',
|
|
NOTIFY_HOST: '/visitor/notify-host'
|
|
}
|
|
|
|
console.log('[config] 当前环境:', wx.getAccountInfoSync().miniProgram.envVersion, 'BASE_URL:', BASE_URL)
|
|
|
|
module.exports = {
|
|
BASE_URL,
|
|
API
|
|
}
|