import wxRequest from "./utils/request"; App({ globalData: { baseUrl: "Https:// * * * * * *", / /}, formally onShow () {enclosing wxUpload ()}, wxLogin () {return new Promise ((resolve, reject) => { let access_token = wx.getStorageSync('access_token') if (access_token) { resolve() } else { wx.login({ success: (res) => { wxRequest(`user/Wxlogin? code=${res.code}`, "", "POST").then(res => { wx.setStorageSync('user', res.data.data.user) wx.setStorageSync('access_token', res.data.data.access_token) resolve(res) }).catch(err => { if (err.data.code == -201) { wx.reLaunch({ url: '.. /login/login', }) } }) } }) } }) }, wxUpload() { const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate((res) => { if (res.hasUpdate) { UpdateManager. OnUpdateReady (() = > {wx. ShowModal ({title: 'updates, content:' the new version is ready, need to restart the application ', showCancel: false, confirmColor: "#FF9829", success: (res) => { updateManager.applyUpdate() } }) }) updateManager.onUpdateFailed(() => { wx.showModal({ title: ConfirmColor: "#FF9829",})})}})},})Copy the code