From e90c18770dfccded106c395c05dbc88d8fd99040 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 15 四月 2024 16:17:21 +0800
Subject: [PATCH] 答题器,详情页bug修改

---
 packageBookService/pages/bookServices/examination/examination.js |   60 ++++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js
index d5c4b7a..a819f70 100644
--- a/packageBookService/pages/bookServices/examination/examination.js
+++ b/packageBookService/pages/bookServices/examination/examination.js
@@ -75,7 +75,6 @@
       });
     }
     this.init();
-    console.log("浼犲弬", options);
   },
 
   /**
@@ -202,14 +201,15 @@
     // 姝e垯琛ㄨ揪寮忓尮閰�<source>鏍囩涓殑src灞炴�у��  
     var srcRegex = /<source\s+src="([^"]+)"/i;
     var srcTwo = /<audio\s+src="([^"]+)"/i;
+
     // 鎵ц姝e垯鍖归厤  
     var match = srcRegex.exec(htmlString);
     const local = srcTwo.exec(htmlString)
     // 濡傛灉鍖归厤鎴愬姛锛岃繑鍥炵涓�涓崟鑾风粍鐨勫唴瀹癸紙src灞炴�х殑鍊硷級  
     if (match && match[1]) {
-      return match[1];
+      return match[1].replace('../file', app.config.requestCtx + '/file');
     } else if (local && local[1]) {
-      return local[1]
+      return local[1].replace('../file', app.config.requestCtx + '/file')
     } else {
       // 濡傛灉娌℃湁鍖归厤鍒帮紝杩斿洖null  
       return null;
@@ -793,9 +793,6 @@
         },
       };
       await app.MG.store.getProductDetail(query).then((res) => {
-        if (!res.datas.cmsDatas[0].datas.length) return this.setData({
-          noData: true
-        })
         this.setData({
           total: res.datas.cmsDatas[0].datas.length,
         });
@@ -874,7 +871,7 @@
                 /\<img/gi,
                 '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
               )
-              .replace(/\<p/gi, '<p class="stem-rich-p"');
+              .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
           }
           // 閫夐」瀵屾枃鏈鐞�
           if (
@@ -887,7 +884,7 @@
               if (item.txt)
                 item.txt = item.txt
                 .replace(/\<img/gi, '<img class="option-rich-img"')
-                .replace(/\<p/gi, '<p class="stem-rich-p"');
+                .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
             });
           }
           // 瑙f瀽瀵屾枃鏈鐞�
@@ -906,7 +903,6 @@
             if (src) {
               questionObj.src = src
               questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
-              console.log('棰樺共', questionObj.stem.stemTxt);
             }
           }
           // 鑾峰彇鍥剧墖
@@ -987,7 +983,14 @@
       });
     }
     // 鏈夐鐩啀寮�濮嬪�掕鏃�
-    if (this.data.questionDataList.length) this.startCountdown();
+    if (this.data.questionDataList.length) {
+      // console.log(this.data.questionDataList);
+      this.startCountdown();
+    } else {
+      this.setData({
+        noData: true
+      })
+    }
     this.setData({
       loading: false,
     });
@@ -1388,7 +1391,7 @@
                 /\<img/gi,
                 '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
               )
-              .replace(/\<p/gi, '<p class="stem-rich-p"');
+              .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
           }
           // 閫夐」瀵屾枃鏈鐞�
           if (
@@ -1401,7 +1404,7 @@
               if (item.txt)
                 item.txt = item.txt
                 .replace(/\<img/gi, '<img class="option-rich-img"')
-                .replace(/\<p/gi, '<p class="stem-rich-p"');
+                .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
             });
           }
           // 瑙f瀽瀵屾枃鏈鐞�
@@ -1413,6 +1416,14 @@
               /\<img/gi,
               '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
             );
+          }
+          // 鍚姏棰樹慨鏀�
+          if (questionObj.questionType == 'singleChoice') {
+            const src = this.extractSourceSrc(questionObj.stem.stemTxt)
+            if (src) {
+              questionObj.src = src
+              questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
+            }
           }
           if (item.Embedded_QuestionBank_QuestionType == "judge") {
             questionObj.type = "鍒ゆ柇棰�";
@@ -1628,7 +1639,7 @@
               /\<img/gi,
               '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
             )
-            .replace(/\<p/gi, '<p class="stem-rich-p"');
+            .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
         }
         // 閫夐」瀵屾枃鏈鐞�
         if (
@@ -1641,7 +1652,7 @@
             if (item.txt)
               item.txt = item.txt
               .replace(/\<img/gi, '<img class="option-rich-img"')
-              .replace(/\<p/gi, '<p class="stem-rich-p"');
+              .replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
           });
         }
         // 瑙f瀽瀵屾枃鏈鐞�
@@ -1653,6 +1664,15 @@
             /\<img/gi,
             '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
           );
+        }
+        // 鍚姏棰樹慨鏀�
+        if (questionObj.questionType == 'singleChoice') {
+          const src = this.extractSourceSrc(questionObj.stem.stemTxt)
+          if (src) {
+            questionObj.src = src
+            questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
+            console.log('棰樺共', questionObj.stem.stemTxt);
+          }
         }
         if (item.Embedded_QuestionBank_QuestionType == "judge") {
           questionObj.type = "鍒ゆ柇棰�";
@@ -1889,7 +1909,7 @@
             questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(
               /\<img/gi,
               '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img"'
-            );
+            ).replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
           }
           // 閫夐」瀵屾枃鏈鐞�
           if (
@@ -1903,9 +1923,17 @@
                 item.txt = item.txt.replace(
                   /\<img/gi,
                   '<img class="option-rich-img"'
-                );
+                ).replace(/\<p/gi, '<p class="stem-rich-p"').replace('../file', app.config.requestCtx + '/file');
             });
           }
+          // 鍚姏棰樹慨鏀�
+          if (questionObj.questionType == 'singleChoice') {
+            const src = this.extractSourceSrc(questionObj.stem.stemTxt)
+            if (src) {
+              questionObj.src = src
+              questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
+            }
+          }
           // 鑾峰彇鍥剧墖
           if (
             questionObj.stemStyle == "Image" ||

--
Gitblit v1.9.1