|
@@ -19,6 +19,10 @@ Page({
|
|
|
title: "MAC地址",
|
|
|
name: "4b:45:12:5a:9y:3g",
|
|
|
}, ],
|
|
|
+ isUpdated: true,
|
|
|
+ showModal: false, // 控制模态框显示隐藏
|
|
|
+ progress: 0, // 进度条初始值
|
|
|
+ showInfo: true
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -42,6 +46,52 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
+ // 在需要弹窗的地方调用该函数
|
|
|
+ toUpdate() {
|
|
|
+ var that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: '有新固件可升级',
|
|
|
+ content: '提升体验,操作更流畅',
|
|
|
+ showCancel: true,
|
|
|
+ cancelText: '取消',
|
|
|
+ confirmText: '确定',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定');
|
|
|
+ that.showUpgradeProgress();
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 显示升级进度条模态框
|
|
|
+ showProgressModal: function () {
|
|
|
+ var that = this;
|
|
|
+ that.setData({
|
|
|
+ showModal: true
|
|
|
+ });
|
|
|
+
|
|
|
+ // 模拟更新进度
|
|
|
+ let interval = setInterval(() => {
|
|
|
+ var progress = that.data.progress;
|
|
|
+ if (progress < 100) {
|
|
|
+ console.log("gassdfadfasdfaf====" + progress);
|
|
|
+ that.setData({
|
|
|
+ progress: progress + 1,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ clearInterval(interval);
|
|
|
+ // 更新完成后关闭模态框
|
|
|
+ that.setData({
|
|
|
+ showModal: false,
|
|
|
+ progress: 0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|