123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <script>
- export default {
- globalData: {
- statusBarHeight: 0,
- navHeight: 44,
- navigationBarHeight: 0,
- },
- onLaunch: function() {
- this.update();
-
-
- this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
-
-
-
- const custom = wx.getMenuButtonBoundingClientRect()
-
-
-
- this.globalData.navigationBarHeight = custom.height + (custom.top - this.globalData.statusBarHeight) * 2
-
-
-
- this.globalData.navHeight = this.globalData.navigationBarHeight + this.globalData.statusBarHeight
-
-
-
-
-
- },
- onShow: function() {
-
- },
- onHide: function() {
-
-
-
-
-
-
-
-
-
-
- uni.removeStorage({
- key:'retailId',
- success: (e) => {
- console.log('App Hide removeStorage retailId success',e);
- },
- fail: (e) => {
- console.log('App Hide removeStorage retailId fail',e);
- }
- });
- uni.removeStorage({
- key:'scene',
- success: (e) => {
- console.log('App Hide removeStorage scene success',e);
- },
- fail: (e) => {
- console.log('App Hide removeStorage scene fail',e);
- }
- });
-
-
- },
- methods:{
- update() {
-
- if (uni.canIUse('getUpdateManager')) {
- const updateManager = uni.getUpdateManager()
-
- updateManager.onCheckForUpdate((res) => {
-
- if (res.hasUpdate) {
-
- uni.showModal({
- title: '更新提示',
- content: '检测到新版本,是否下载新版本并重启小程序?',
- success: (res) => {
- if (res.confirm) {
-
- this.downLoadUpdate(updateManager)
- } else if (res.cancel) {
-
- uni.showModal({
- title: '温馨提示~',
- content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
- showCancel: false,
- confirmText: "确定更新",
- success: (res) => {
- if (res.confirm) {
-
- this.downLoadUpdate(updateManager)
- }
- }
- })
- }
- }
- })
- }
- })
- } else {
-
- uni.showModal({
- title: '提示',
- content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
- })
- }
- },
-
- downLoadUpdate(updateManager) {
- uni.showLoading();
-
- updateManager.onUpdateReady(() => {
- uni.hideLoading()
-
- updateManager.applyUpdate()
- })
- updateManager.onUpdateFailed(() => {
-
- uni.showModal({
- title: '已经有新版本了哟~',
- content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
- })
- })
- },
- }
- }
- </script>
- <style lang="scss">
-
- @import "@/uni_modules/uview-ui/index.scss";
- @import "@/static/css/common.scss";
- </style>
|