| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | // wx.enableAlertBeforeUnload({ |
| | | // message: "未提交,是否退出答题?", |
| | | // success: function (res) { |
| | | // console.log('确定', res); |
| | | // }, |
| | | // fail: function (err) { |
| | | // console.log("失败:", err); |
| | | // }, |
| | | // }); |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = |
| | |
| | | const oldVal = value; // 记录属性的旧值 |
| | | value = newVal; // 更新属性的值 |
| | | callback.call(context, newVal, oldVal); // 调用回调函数,传递新值和旧值 |
| | | }, |
| | | }); |
| | | }, |
| | | // 返回拦截 |
| | | beforeleave() { |
| | | wx.showModal({ |
| | | title: "提示", |
| | | content: "未提交,是否退出答题", |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | complete: (res) => { |
| | | if (res.cancel) { |
| | | } |
| | | if (res.confirm) { |
| | | this.setData({ |
| | | submitStatus: true, |
| | | }); |
| | | wx.navigateBack(); |
| | | } |
| | | }, |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | // 提交逻辑 |
| | | submitPaper() { |
| | | // 关闭退出页面监听 |
| | | wx.disableAlertBeforeUnload(); |
| | | this.setData({ |
| | | submitStatus: true, |
| | | loading: true, |
| | |
| | | let value = JSON.parse(res[0].value); |
| | | // 有答题记录,得分赋值 |
| | | if (value) { |
| | | wx.disableAlertBeforeUnload(); |
| | | this.setData({ |
| | | submitStatus: true, |
| | | }); |
| | |
| | | wx.showModal({ |
| | | title: "提示", |
| | | content: "收藏夹暂无数据", //editable如果为true,这就是输入框的内容 |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | editable: false, //是否显示输入框 |
| | | showCancel: false, |
| | | success: (res) => { |
| | |
| | | wx.showModal({ |
| | | title: "提示", |
| | | content: "错题集暂无数据", //editable如果为true,这就是输入框的内容 |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | editable: false, //是否显示输入框 |
| | | showCancel: false, |
| | | success: (res) => { |