123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <script>
- export default {
-
- onLaunch: function() {
- var self = this
-
- if (wx.canIUse('getUpdateManager')) {
- const updateManager = wx.getUpdateManager()
-
- updateManager.onCheckForUpdate(function(res) {
-
- if (res.hasUpdate) {
-
- wx.showModal({
- title: '更新提示',
- showCancel: false,
- confirmText: "确定更新",
- content: '检测到新版本,是否下载新版本并重启小程序?',
- success: function(res) {
- if (res.confirm) {
-
- self.downLoadAndUpdate(updateManager)
- } else if (res.cancel) {
-
- wx.showModal({
- title: '温馨提示~',
- content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
- showCancel: false,
- confirmText: "确定更新",
- success: function(res) {
- if (res.confirm) {
-
- self.downLoadAndUpdate(updateManager)
- }
- }
- })
- }
- }
- })
- }
- })
- } else {
-
- wx.showModal({
- title: '提示',
- content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
- showCancel: false
- })
- }
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods: {
- downLoadAndUpdate: function(updateManager) {
- var self = this
- wx.showLoading();
-
- updateManager.onUpdateReady(function() {
- wx.hideLoading()
-
- updateManager.applyUpdate()
- })
- updateManager.onUpdateFailed(function() {
-
- wx.hideLoading();
- wx.showModal({
- title: '已经有新版本了哟~',
- content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
- showCancel: false
- })
- })
- },
- },
- }
- </script>
- <style lang="scss">
- @import 'uview-ui/theme.scss';
- @import 'common/style/shop.scss';
- @import 'common/style/iconfont.css';
- @import 'common/style/new_iconfont.css';
- page {
- width: 100%;
- overflow-x: hidden;
- }
-
-
-
-
- view,
- text {
- font-family: pingfang;
- }
- </style>
|