| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import common from '../../utils/util';
- import server from '../../utils/main';
- const app = getApp()
- Page({
- data: {
- version: app.globalData.version,
- FileUrl: app.globalData.fileUrl,
- },
- onLoad: function () {
- this.setData({
- Containnerheight: server.getWindowHeight(),
- });
- this.updateProgram();
- },
- updateProgram: function () {
- if (wx.canIUse("getUpdateManager")) {
- const updateManager = wx.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log(res.hasUpdate)
- });
- updateManager.onUpdateReady(function () {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function (res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- });
- });
- }
- },
- onShareAppMessage: function () {
- return {
- title: '',
- path: 'pages/index/index',
- success: function (res) {
- },
- fail: function (err) {
- console.log(err);
- },
- complete: function (res) {
- console.log(res);
- },
- }
- },
- })
|