闫增涛
2024-04-09 3d73fb33c46aada16a6060adcd4ea14bb33b6b2a
packageBookService/pages/bookServices/examination/examination.js
@@ -50,15 +50,6 @@
   * 生命周期函数--监听页面加载
   */
  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 =
@@ -199,6 +190,25 @@
        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();
        }
      },
    });
  },
@@ -441,8 +451,6 @@
  },
  // 提交逻辑
  submitPaper() {
    // 关闭退出页面监听
    wx.disableAlertBeforeUnload();
    this.setData({
      submitStatus: true,
      loading: true,
@@ -669,7 +677,6 @@
              let value = JSON.parse(res[0].value);
              // 有答题记录,得分赋值
              if (value) {
                wx.disableAlertBeforeUnload();
                this.setData({
                  submitStatus: true,
                });
@@ -1203,6 +1210,8 @@
          wx.showModal({
            title: "提示",
            content: "收藏夹暂无数据", //editable如果为true,这就是输入框的内容
            confirmColor: "#ff6c00",
            cancelColor: "#949494",
            editable: false, //是否显示输入框
            showCancel: false,
            success: (res) => {
@@ -1439,6 +1448,8 @@
          wx.showModal({
            title: "提示",
            content: "错题集暂无数据", //editable如果为true,这就是输入框的内容
            confirmColor: "#ff6c00",
            cancelColor: "#949494",
            editable: false, //是否显示输入框
            showCancel: false,
            success: (res) => {