diff --git a/app.js b/app.js index b377454..a170520 100644 --- a/app.js +++ b/app.js @@ -21,6 +21,7 @@ App({ nickName: "", //用户姓名 templateId: [], //订阅消息模板id ifshowtab: false, + version: "2.9.1" }, onLaunch: function () { let that = this diff --git a/index/index.js b/index/index.js index d47ba01..fb9b5f4 100644 --- a/index/index.js +++ b/index/index.js @@ -11,6 +11,7 @@ const QR = require("../utils/memberqrcode.js"); const util = require("../utils/util"); const bgColor = require("../utils/bgColor.js") let app = getApp(); +const updateManager = tt.getUpdateManager(); Page({ data: { userAvatarUrl: '', @@ -915,6 +916,27 @@ Page({ that.getCouponChannelList(that.data.businessKey) }, 1000) + setTimeout(() => { + console.log('onCheckForUpdate'); + updateManager.onCheckForUpdate(res => { + console.log(res, 'onCheckForUpdate'); + if (res.hasUpdate) { + updateManager.onUpdateReady((res) => { + tt.showModal({ + title: "更新提示", + content: "新版本已经准备就绪,是否重新进入小程序?", + success: (res) => { + if (res.confirm) { + // 新的版本已经下载好,应用新版本并重启 + updateManager.applyUpdate(); + } + }, + }); + }); + } + }); + }, 2500); + }, diff --git a/index/user.js b/index/user.js index 87d3cca..f84d40d 100644 --- a/index/user.js +++ b/index/user.js @@ -11,6 +11,7 @@ Page({ avatarUrl: "", nickName: "", mouldType: 1, + version: "" }, showPhoemBtn() { @@ -119,6 +120,13 @@ Page({ // }); }, onShow: function (options) { + const version = app.globalData.version + + if (version) { + this.setData({ + version + }) + } this.setData({ mouldType: app.globalData.mouldType diff --git a/index/user.ttml b/index/user.ttml index 9ec2e43..5cbeccf 100644 --- a/index/user.ttml +++ b/index/user.ttml @@ -83,7 +83,7 @@ - Version 2.8.6 + Version {{ version }} diff --git a/index/user.ttss b/index/user.ttss index 42840ab..41eebf9 100644 --- a/index/user.ttss +++ b/index/user.ttss @@ -1,4 +1,8 @@ /* d:\fumaolianke\ttFmC\tt富茂C\pages\user\user.ttss */ +page { + padding-bottom: 0; +} + .BoxBg { /* background-image: url("https://formall.oss-accelerate.aliyuncs.com/douyin_ifomall/imgData/userBg.png"); */ /* background-size: 100% auto; */ @@ -244,7 +248,7 @@ button { .version { position: absolute; - bottom: 0; + bottom: 100rpx; right: 5%; color: #ffffffb9; } \ No newline at end of file diff --git a/pages2/shopSelect/shopSelect.less b/pages2/shopSelect/shopSelect.less index d9b51b9..49bda05 100644 --- a/pages2/shopSelect/shopSelect.less +++ b/pages2/shopSelect/shopSelect.less @@ -43,7 +43,7 @@ page { margin-bottom: 30rpx; padding: 25rpx 25rpx 25rpx 25rpx; box-sizing: border-box !important; - background-color: #f3f3f3; + background-color: #fffffff8; border: 1px solid #0000002d; border-radius: 12rpx; // box-shadow: #00000036 0px 1px 2px 2px; diff --git a/pages2/shopSelect/shopSelect.ttss b/pages2/shopSelect/shopSelect.ttss index 16fb9b7..47a7998 100644 --- a/pages2/shopSelect/shopSelect.ttss +++ b/pages2/shopSelect/shopSelect.ttss @@ -40,7 +40,7 @@ page .continer .selectShop .shopList .item { margin-bottom: 30rpx; padding: 25rpx 25rpx 25rpx 25rpx; box-sizing: border-box !important; - background-color: #f3f3f3; + background-color: #fffffff8; border: 1px solid #0000002d; border-radius: 12rpx; }