58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
App({
|
|
towxml: require('/towxml/index'),
|
|
globalData: {
|
|
userInfo: null
|
|
},
|
|
onLaunch() {
|
|
const updateManager = wx.getUpdateManager()
|
|
updateManager.onCheckForUpdate(function (res) {
|
|
console.log('检查更新');
|
|
// 请求完新版本信息的回调
|
|
})
|
|
updateManager.onUpdateReady(function () {
|
|
wx.showModal({
|
|
title: '更新提示',
|
|
content: '新版本已经准备好,是否重启应用?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
updateManager.applyUpdate()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
updateManager.onUpdateFailed(function () {
|
|
// 新的版本下载失败
|
|
wx.showModal({
|
|
title: '更新提示',
|
|
content: '新版本下载失败',
|
|
showCancel: false
|
|
})
|
|
})
|
|
},
|
|
})
|
|
! function () {
|
|
//获取页面配置并进行页面分享配置
|
|
var PageTmp = Page
|
|
Page = function (pageConfig) {
|
|
//全局开启分享
|
|
pageConfig = Object.assign({
|
|
onShareAppMessage: function () {
|
|
return {
|
|
title: "分享标题",
|
|
path: "/pages/home/index",
|
|
imageUrl: ""
|
|
};
|
|
},
|
|
onShareTimeline() {
|
|
return {
|
|
title: "分享标题",
|
|
path: "/pages/home/index",
|
|
};
|
|
}
|
|
}, pageConfig);
|
|
PageTmp(pageConfig);
|
|
}
|
|
}();
|
|
|