yangg 2 ay önce
ebeveyn
işleme
0a1c6b813a

+ 4 - 0
pages.json

@@ -28,6 +28,7 @@
 			"path": "pages/identity-verify/identity-verify",
 			"style": {
 				"navigationBarTitleText": ""
+				
 			}
 		},
 		{
@@ -40,6 +41,7 @@
 			"path": "pages/camera/camera",
 			"style": {
 				"navigationBarTitleText": "测试"
+				
 			}
 		},
 		{
@@ -53,6 +55,7 @@
 			"style" : 
 			{
 				"navigationBarTitleText" : "手部照片采集"
+				
 			}
 		},
 		{
@@ -67,6 +70,7 @@
 			"style" : 
 			{
 				"navigationBarTitleText" : ""
+				
 			}
 		}
 	],

+ 16 - 17
pages/camera/camera.vue

@@ -73,7 +73,7 @@
 							}" 
 							@click="selectOption(index)">
 							<!-- 使用字母标识 A、B、C、D、E 等 -->
-							<text class="option-prefix">{{ String.fromCharCode(65 + index) }}.</text>
+							<!-- <text class="option-prefix">{{ String.fromCharCode(65 + index) }}.</text> -->
 							<text class="option-text">{{ option.option_text || (typeof option === 'string' ? option : JSON.stringify(option)) }}</text>
 						</view>
 					</view>
@@ -387,6 +387,9 @@
 			},
 			
 			checkAnswer() {
+				// 如果已经显示结果,说明已经提交过答案,不再重复提交
+				if (this.showResult) return;
+				
 				clearInterval(this.timerInterval); // 停止计时
 				
 				// 确保当前问题存在
@@ -417,11 +420,6 @@
 				
 				// 保存当前题目的答案
 				this.saveAnswer();
-				
-				// 提交答案
-				this.submitCurrentAnswer().catch(error => {
-					console.error('提交答案失败:', error);
-				});
 			},
 
 			nextQuestion(data) {
@@ -445,7 +443,7 @@
 								// 否则进入下一题
 								this.goToNextQuestion();
 							}
-						}, 500); // 1秒后自动进入下一题
+						}, 500); // 0.5秒后自动进入下一题
 					}).catch(error => {
 						console.error('提交答案失败:', error);
 						// 即使提交失败也继续下一题
@@ -462,7 +460,7 @@
 					return;
 				}
 				
-				// 如果已经显示结果,点击"下一题"按钮时执行
+				// 如果已经显示结果,点击"下一题"按钮时直接执行
 				// 如果是最后一题,直接跳转到手部照片采集页面
 				if (this.currentQuestionIndex >= this.questions.length - 1) {
 					uni.navigateTo({
@@ -521,9 +519,12 @@
 
 			// 提交当前答案
 			async submitCurrentAnswer() {
-				if (!this.currentAnswer) return;
+				if (!this.currentAnswer || this.isSubmitting) return; // 如果正在提交或没有答案,则不执行
 				
 				try {
+					// 设置提交状态为true
+					this.isSubmitting = true;
+					
 					// 显示提交中提示
 					uni.showLoading({
 						title: '正在提交答案...'
@@ -554,11 +555,10 @@
 					
 					const submitData = {
 						job_id: JSON.parse(uni.getStorageSync('selectedJob')).id,
-						applicant_id: JSON.parse(uni.getStorageSync('userInfo')).id,//uni.getStorageSync('appId'), // 或者使用其他合适的ID
+						applicant_id: JSON.parse(uni.getStorageSync('userInfo')).id,
 						question_id: this.currentAnswer.questionId,
 						answer_content: answerContent,
 						answer_duration: this.currentAnswer.answerDuration || 0,
-						// 如果需要tenant_id,请在这里添加
 						tenant_id: 1
 					};
 					
@@ -569,16 +569,10 @@
 					
 					console.log('提交答案响应:', res);
 					
-					// 隐藏加载提示
-					uni.hideLoading();
-					
 					return res;
 					
 				} catch (error) {
 					console.error('提交答案失败:', error);
-					// 隐藏加载提示
-					uni.hideLoading();
-					
 					// 显示错误提示
 					uni.showToast({
 						title: '提交答案失败,请重试',
@@ -586,6 +580,11 @@
 					});
 					
 					throw error;
+				} finally {
+					// 隐藏加载提示
+					uni.hideLoading();
+					// 重置提交状态
+					this.isSubmitting = false;
 				}
 			},
 			

+ 3 - 6
pages/success/success.vue

@@ -36,17 +36,14 @@ export default {
   },
   methods: {
     goBack() {
-      uni.navigateBack({
-        delta: 1,
-        fail: () => {
-          uni.reLaunch({
+    
+          uni.switchTab({
             url: '/pages/index/index'
           });
         }
-      });
     }
   }
-}
+
 </script>
 
 <style>

+ 12 - 14
unpackage/dist/dev/mp-weixin/pages/camera/camera.js

@@ -204,6 +204,8 @@ const _sfc_main = {
       this.playAiSpeaking();
     },
     checkAnswer() {
+      if (this.showResult)
+        return;
       clearInterval(this.timerInterval);
       if (!this.currentQuestion) {
         console.error("当前问题不存在");
@@ -224,9 +226,6 @@ const _sfc_main = {
       }
       this.showResult = true;
       this.saveAnswer();
-      this.submitCurrentAnswer().catch((error) => {
-        console.error("提交答案失败:", error);
-      });
     },
     nextQuestion(data) {
       if (!this.showResult) {
@@ -301,9 +300,10 @@ const _sfc_main = {
     },
     // 提交当前答案
     async submitCurrentAnswer() {
-      if (!this.currentAnswer)
+      if (!this.currentAnswer || this.isSubmitting)
         return;
       try {
+        this.isSubmitting = true;
         common_vendor.index.showLoading({
           title: "正在提交答案..."
         });
@@ -325,26 +325,25 @@ const _sfc_main = {
         const submitData = {
           job_id: JSON.parse(common_vendor.index.getStorageSync("selectedJob")).id,
           applicant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
-          //uni.getStorageSync('appId'), // 或者使用其他合适的ID
           question_id: this.currentAnswer.questionId,
           answer_content: answerContent,
           answer_duration: this.currentAnswer.answerDuration || 0,
-          // 如果需要tenant_id,请在这里添加
           tenant_id: 1
         };
         console.log("提交数据:", submitData);
         const res2 = await this.$http.post(`${common_config.apiBaseUrl}/api/job/submit_answer`, submitData);
         console.log("提交答案响应:", res2);
-        common_vendor.index.hideLoading();
         return res2;
       } catch (error) {
         console.error("提交答案失败:", error);
-        common_vendor.index.hideLoading();
         common_vendor.index.showToast({
           title: "提交答案失败,请重试",
           icon: "none"
         });
         throw error;
+      } finally {
+        common_vendor.index.hideLoading();
+        this.isSubmitting = false;
       }
     },
     // 修改 goToNextQuestion 方法,添加 async 关键字
@@ -524,12 +523,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
   }, $options.currentQuestion.questionType !== 0 ? {
     l: common_vendor.f($options.currentQuestion.options, (option, index, i0) => {
       return {
-        a: common_vendor.t(String.fromCharCode(65 + index)),
-        b: common_vendor.t(option.option_text || (typeof option === "string" ? option : JSON.stringify(option))),
-        c: index,
-        d: ($options.currentQuestion.questionType === 1 ? $data.selectedOption === index : $data.selectedOptions.includes(index)) ? 1 : "",
-        e: $data.showResult && ($options.currentQuestion.questionType === 1 ? index === $options.currentQuestion.correctAnswer : $options.currentQuestion.correctAnswers.includes(index)) ? 1 : "",
-        f: common_vendor.o(($event) => $options.selectOption(index), index)
+        a: common_vendor.t(option.option_text || (typeof option === "string" ? option : JSON.stringify(option))),
+        b: index,
+        c: ($options.currentQuestion.questionType === 1 ? $data.selectedOption === index : $data.selectedOptions.includes(index)) ? 1 : "",
+        d: $data.showResult && ($options.currentQuestion.questionType === 1 ? index === $options.currentQuestion.correctAnswer : $options.currentQuestion.correctAnswers.includes(index)) ? 1 : "",
+        e: common_vendor.o(($event) => $options.selectOption(index), index)
       };
     })
   } : {}, {

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/camera/camera.wxml


+ 2 - 7
unpackage/dist/dev/mp-weixin/pages/success/success.js

@@ -13,13 +13,8 @@ const _sfc_main = {
   },
   methods: {
     goBack() {
-      common_vendor.index.navigateBack({
-        delta: 1,
-        fail: () => {
-          common_vendor.index.reLaunch({
-            url: "/pages/index/index"
-          });
-        }
+      common_vendor.index.switchTab({
+        url: "/pages/index/index"
       });
     }
   }

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor