From 32986b54a0e2661f7ad6ed79f3ef12c4289eace9 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 20 十二月 2024 17:52:52 +0800
Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master

---
 packageBookService/pages/bookServices/examination/questionOptions/index.js |  260 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 160 insertions(+), 100 deletions(-)

diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.js b/packageBookService/pages/bookServices/examination/questionOptions/index.js
index 54aed63..dfaa84d 100644
--- a/packageBookService/pages/bookServices/examination/questionOptions/index.js
+++ b/packageBookService/pages/bookServices/examination/questionOptions/index.js
@@ -1,4 +1,3 @@
-
 // pages/bookServices/examination/questionOptions/index.js
 Component({
   /**
@@ -11,15 +10,15 @@
     },
     questionDataList: {
       type: Array,
-      value: []
+      value: [],
     },
     cardList: {
       type: Array,
-      value: []
+      value: [],
     },
     subjectiveTotal: {
       type: Number,
-      value: 0
+      value: 0,
     },
     countdownTime: {
       type: Number,
@@ -27,23 +26,40 @@
     },
     answerType: {
       type: String,
-      value: ''
+      value: "",
     },
     subjectiveNum: {
       type: Number,
-      value: 0
+      value: 0,
     },
     subjectiveGrade: {
       type: Number,
-      value: 0
+      value: 0,
     },
     correctNum: {
       type: Number,
-      value: 0
+      value: 0,
     },
     submitStatus: {
       type: Boolean,
-      value: false
+      value: false,
+    },
+    mockSumTime: {
+      type: Number,
+      value: 0,
+    },
+    isNight: {
+      type: Boolean,
+      value: false,
+    },
+    showId: {
+      type: String
+    },
+    isShowDialog: {
+      type: Boolean
+    },
+    joinGroup:{
+      type:Boolean
     }
   },
 
@@ -56,23 +72,41 @@
     questionCardState: false,
     setUpPopup: false,
     testReportState: false,
-    sliderValue: 0,
-    useTime: ''
+    sliderValue: 36,
+    useTime: "",
+    radioItem: "daytime",
   },
   observers: {
-    "countdownTime": function (newValue, oldValue) {
-      if (this.properties.answerType == 'option') {
+    countdownTime: function (newValue, oldValue) {
+      if (this.properties.answerType == "option" || this.properties.answerType == 'interaction') {
         this.setData({
-          useTime: this.formatTime(2 * 60 * 60 * 1000 - this.properties.countdownTime)
-        })
+          useTime: this.formatTime(
+            2 * 60 * 60 * 1000 - this.properties.countdownTime
+          ),
+        });
+      } else if (this.properties.answerType == "mock") {
+        this.setData({
+          useTime: this.formatTime(
+            this.properties.mockSumTime - this.properties.countdownTime
+          ),
+        });
       }
-      if (newValue == 0 && (this.properties.answerType == 'option' || this.properties.answerType == 'mock')) {
-        this.timeout()
+      if (
+        newValue == 0 &&
+        (this.properties.answerType == "option" ||
+          this.properties.answerType == "mock") && !this.properties.submitStatus
+      ) {
+        this.timeout();
       }
     },
+    isShowDialog: function (newValue, oldValue) {
+      if (newValue)
+        this.setData({
+          testReportState: newValue,
+        });
+    }
   },
-  created() {
-  },
+  created() {},
 
   /**
    * 缁勪欢鐨勬柟娉曞垪琛�
@@ -82,61 +116,60 @@
     formatTime(ms) {
       const hours = Math.floor((ms / (1000 * 60 * 60)) % 24)
         .toString()
-        .padStart(2, '0')
+        .padStart(2, "0");
       const minutes = Math.floor((ms / (1000 * 60)) % 60)
         .toString()
-        .padStart(2, '0')
+        .padStart(2, "0");
       const seconds = Math.floor((ms / 1000) % 60)
         .toString()
-        .padStart(2, '0')
-      return `${hours}:${minutes}:${seconds}`
+        .padStart(2, "0");
+      return `${hours}:${minutes}:${seconds}`;
     },
     // 鍒ゆ柇鏄惁杈撳叆绛旀
     isHaveAnswer(data) {
-      if (typeof data == 'string') {
+      if (typeof data == "string") {
         data = data
-          .replace(/<[^>]*>/g, '')
-          .replace(/&nbsp;/g, '')
-          .trim()
+          .replace(/<[^>]*>/g, "")
+          .replace(/&nbsp;/g, "")
+          .trim();
         if (data.length) {
-          return true
+          return true;
         } else {
-          return false
+          return false;
         }
       } else {
-        const answer = data.find((item) => item.length > 0)
+        const answer = data.find((item) => item.length > 0);
         if (answer) {
-          return true
+          return true;
         } else {
-          return false
+          return false;
         }
       }
     },
     setCollect() {
-      var myEventDetail = {
-      }
+      var myEventDetail = {};
       var myEventOption = {
         bubbles: true,
         composed: true,
-      }
-      this.triggerEvent('setCollect', myEventDetail, myEventOption)
+      };
+      this.triggerEvent("setCollect", myEventDetail, myEventOption);
     },
     // 绛旈鍗℃寜閽�
     handlePopup() {
       this.setData({
-        questionCardState: true
-      })
+        questionCardState: true,
+      });
     },
     // 绛旈鍗¤烦杞鐩�
     goQuestion(e) {
       var myEventDetail = {
-        id: e.currentTarget.dataset.id
-      }
+        id: e.currentTarget.dataset.id,
+      };
       var myEventOption = {
         bubbles: true,
         composed: true,
-      }
-      this.triggerEvent('goQuestion', myEventDetail, myEventOption)
+      };
+      this.triggerEvent("goQuestion", myEventDetail, myEventOption);
     },
     // 绛旈鍗¢伄缃╁眰鐐瑰嚮
     onVisibleChange(e) {
@@ -147,117 +180,144 @@
     // 璁剧疆鎸夐挳
     setUpBtn() {
       this.setData({
-        setUpPopup: true
-      })
+        setUpPopup: true,
+      });
     },
     // 婊戝潡鍙樺寲
     onChangeSlider(e) {
-      console.log(e);
-      this.setData({
-        sliderValue: e.detail.value
-      })
+      const value = e.detail.value;
+      console.log(value);
+      this.triggerEvent("onChangeSlider", {
+        value
+      });
     },
     // 璁剧疆閬僵灞傜偣鍑�
     onSetUpChange(e) {
       this.setData({
-        setUpPopup: e.detail.visible
-      })
+        setUpPopup: e.detail.visible,
+      });
+    },
+    // 璁剧疆妯″紡鍒囨崲
+    onRadioChange(e) {
+      this.setData({
+        radioItem: e.detail.value,
+      });
+      const value = e.detail.value == "night" ? true : false;
+      this.triggerEvent("changeBGColor", {
+        value
+      });
     },
     // 閲嶅仛鎸夐挳
     resterBtn() {
       wx.showModal({
-        title: '鎻愮ず',
-        content: '鏄惁閲嶆柊寮�濮嬬瓟棰橈紵',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
-        editable: false,//鏄惁鏄剧ず杈撳叆妗�
+        title: "鎻愮ず",
+        content: "鏄惁閲嶆柊寮�濮嬬瓟棰橈紵", //editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
+        confirmColor: "#ff6c00",
+        cancelColor: "#949494",
+        editable: false, //鏄惁鏄剧ず杈撳叆妗�
         success: (res) => {
           if (res.confirm) {
-            this.restart()
+            this.restart();
           }
-        }
-      })
+        },
+      });
     },
     // 閲嶅仛浜嬩欢
     restart() {
-      var myEventDetail = {
-      }
+      var myEventDetail = {};
       var myEventOption = {
         bubbles: true,
         composed: true,
-      }
-      this.triggerEvent('restart', myEventDetail, myEventOption)
+      };
+      this.triggerEvent("restart", myEventDetail, myEventOption);
     },
 
     // 杩樻湁N閬撻鏈仛寮圭獥
     confrimPromptDialog() {
       wx.showModal({
-        title: '鎻愮ず',
-        content: `鎮ㄨ繕鏈� ${this.data.noReady}閬撻鏈瓟锛屾槸鍚︽彁浜わ紵`,//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
-        editable: false,//鏄惁鏄剧ず杈撳叆妗�
+        title: "鎻愮ず",
+        content: `鎮ㄨ繕鏈� ${this.data.noReady}閬撻鏈瓟锛屾槸鍚︽彁浜わ紵`, //editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
+        confirmColor: "#ff6c00",
+        cancelColor: "#949494",
+        editable: false, //鏄惁鏄剧ず杈撳叆妗�
         success: (res) => {
           if (res.confirm) {
-            this.submitPaper()
+            this.submitPaper();
           }
-        }
-      })
+        },
+      });
     },
     // 搴曢儴鎻愪氦鎸夐挳
     submitBtn() {
+      this.setData({
+        noReady: 0,
+      });
       // 鎴戠殑閿欓鍜屾敹钘�  鐩存帴璧版彁浜ら�昏緫
-      if (this.properties.answerType !== 'option' || this.properties.answerType !== 'option') {
-        return this.submitPaper()
-      }
-      this.properties.questionDataList.forEach(item => {
-        if (!this.isHaveAnswer(item.userAnswer)) {
-          this.setData({
-            noReady: this.data.noReady + 1
-          })
+      if (
+        this.properties.answerType == "collectQuestion" ||
+        this.properties.answerType == "errorQuestion"
+      ) {
+        this.submitPaper();
+        // wx.navigateBack();
+      } else if (
+        this.properties.answerType == "option" ||
+        this.properties.answerType == "mock" ||
+        this.properties.answerType == "interaction"
+      ) {
+        if (this.properties.submitStatus) return wx.navigateBack();
+        this.properties.questionDataList.forEach((item) => {
+          if (!this.isHaveAnswer(item.userAnswer)) {
+            this.setData({
+              noReady: this.data.noReady + 1,
+            });
+          }
+        });
+        // 鏈仛瀹岋紝鎵撳紑鎻愮ず寮圭獥
+        if (this.data.noReady > 0) {
+          this.confrimPromptDialog();
+        } else {
+          // 鍋氬畬浜嗙洿鎺ユ墽琛屾彁浜や簨浠�
+          this.submitPaper();
         }
-      })
-      // 鏈仛瀹岋紝鎵撳紑鎻愮ず寮圭獥
-      if (this.data.noReady > 0) {
-        this.confrimPromptDialog()
-      } else {
-        // 鍋氬畬浜嗙洿鎺ユ墽琛屾彁浜や簨浠�
-        this.submitPaper()
       }
     },
     // 鎻愪氦浜嬩欢
     submitPaper() {
-      var myEventDetail = {
-      }
+      var myEventDetail = {};
       var myEventOption = {
         bubbles: true,
         composed: true,
-      }
-      this.triggerEvent('submitPaper', myEventDetail, myEventOption)
+      };
+      this.triggerEvent("submitPaper", myEventDetail, myEventOption);
     },
     // 鎵撳紑娴嬭瘯鎶ュ憡寮圭獥
     openTestReportDialog() {
       this.setData({
-        testReportState: true
-      })
+        testReportState: true,
+      });
     },
     // 鍏抽棴娴嬭瘯鎶ュ憡寮圭獥
     closeTestReportDialog(e) {
       this.setData({
-        testReportState: false
-      })
+        testReportState: false,
+      });
     },
     // 娴嬭瘯鎶ュ憡寮圭獥鏌ョ湅绛旀瑙f瀽鎸夐挳
     viewAnswer() {
-      this.closeTestReportDialog()
+      this.closeTestReportDialog();
     },
     // 绛旈鏃堕棿鍒�
     timeout() {
       wx.showModal({
-        title: '鎻愮ず',
-        content: '绛旈鏃堕棿宸插埌',//editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
-        editable: false,//鏄惁鏄剧ず杈撳叆妗�
+        title: "鎻愮ず",
+        content: "绛旈鏃堕棿宸插埌", //editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭
+        confirmColor: "#ff6c00",
+        cancelColor: "#949494",
+        editable: false, //鏄惁鏄剧ず杈撳叆妗�
         showCancel: false,
-        success: (res) => {
-        }
-      })
-      this.submitPaper()
-    }
-  }
-})
+        success: (res) => {},
+      });
+      this.submitPaper();
+    },
+  },
+});
\ No newline at end of file

--
Gitblit v1.9.1