// 配置信息 var config = {} const accountInfo = uni.getAccountInfoSync(); const envVersion = accountInfo.miniProgram.envVersion; console.log(accountInfo, envVersion, 'envVersionenvVersionenvVersion') uni.getSystemInfo({ success: function(res) { console.log(res, 'getSystemInfogetSystemInfogetSystemInfogetSystemInfo') if (res.uniPlatform === 'mp-weixin') { console.log(accountInfo, envVersion, '当前在微信开中运行当前在微信开中运行当前在微信开中运行当前在微信开中运行') // 在微信小程序中运行的逻辑 if (envVersion === 'develop') { // 开发版本 config = { // https://api.duanju.dududus.com 测试环境 // https://api.zhiyupa.com 正式环境 apiUrl: "https://api.duanju.dududus.com", staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com zystaticUrl: "", TabbarIndex: 2 } } else if (envVersion === 'trial') { //体验版 config = { apiUrl: "https://api.zhiyupa.com", staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com zystaticUrl: "", TabbarIndex: 2 } } else if (envVersion === 'release') { //正式版 config = { apiUrl: "https://api.zhiyupa.com", staticUrl: 'https://xjc.demo.hongcd.com/img/', //静态图片地址https://xjc.demo.hongcd.com zystaticUrl: "", TabbarIndex: 2 } } } else if (res.uniPlatform === 'web') { // 在H5环境中运行的逻辑 console.log('当前在H5环境中运行'); } } }); export default config