import Config from "../../model/config"; import Api from "../../model/api"; import { toast } from "../../utils/utils"; import updateManager from "../../model/update-manager"; Page({ data: { info: {}, miniProgram: {}, version: '0', url:Config.BASE_URL, isProd:false, }, async onLoad(options) { const res = await Api.getHelpInfo(Config.APP_ID, true) const accountInfo = wx.getAccountInfoSync(); this.setData({ info: res.data, miniProgram: accountInfo.miniProgram, version: Config.VERSION_CODE, isProd:__wxConfig.envVersion == 'release' //trial体验版 release线上版 develop开发版 }) }, handleUpgrade(){ let oldVersion = this.data.version || this.data.miniProgram.version || ''; let newVersion = this.data.info.appVersion || ''; if(oldVersion.trim() === newVersion.trim()) { toast('已是最新版本!'); return; } updateManager.update({loading: true, hasUpdate: true}); } })