Browse Source

修改多选

yangg 2 months ago
parent
commit
7a882ee06d

+ 213 - 182
pages/camera/camera.vue

@@ -488,11 +488,31 @@
 				this.submitCurrentAnswer().then(() => {
 					// 提交成功后,短暂延迟后自动进入下一题
 					setTimeout(() => {
-						// 如果是最后一题,跳转到面试页面
+						// 如果是最后一题,检查是否是最后一组题目
 						if (this.currentQuestionIndex >= this.questions.length - 1) {
-							uni.navigateTo({
-								url: '/pages/interview-question/interview-question'
-							});
+							if (this.currentGroupIndex < this.questionGroups.length - 1) {
+								// 如果还有下一组题目,显示继续按钮
+								this.showContinueButton = true;
+								
+								// 使用延时确保按钮渲染完成后再滚动
+								setTimeout(() => {
+									// 先重置 scrollTop,然后再设置新值,强制触发更新
+									this.scrollTop = 0;
+									
+									// 使用 nextTick 确保视图已更新
+									this.$nextTick(() => {
+										// 延迟设置新的滚动位置
+										setTimeout(() => {
+											this.scrollTop = 10000; // 一个足够大的值
+										}, 100);
+									});
+								}, 200);
+							} else {
+								// 如果是最后一组的最后一题,跳转到面试页面
+								uni.navigateTo({
+									url: '/pages/interview-question/interview-question'
+								});
+							}
 						} else {
 							// 否则进入下一题
 							this.goToNextQuestion();
@@ -503,9 +523,20 @@
 					// 即使提交失败也继续下一题
 					setTimeout(() => {
 						if (this.currentQuestionIndex >= this.questions.length - 1) {
-							uni.navigateTo({
-								url: '/pages/interview-question/interview-question'
-							});
+							if (this.currentGroupIndex < this.questionGroups.length - 1) {
+								// 如果还有下一组题目,显示继续按钮
+								this.showContinueButton = true;
+								
+								// 滚动到底部
+								setTimeout(() => {
+									this.scrollTop = 10000;
+								}, 200);
+							} else {
+								// 如果是最后一组的最后一题,跳转到面试页面
+								uni.navigateTo({
+									url: '/pages/interview-question/interview-question'
+								});
+							}
 						} else {
 							this.goToNextQuestion();
 						}
@@ -513,181 +544,6 @@
 				});
 			},
 
-			// 保存当前题目的答案
-			saveAnswer() {
-				let answer;
-				
-				if (this.currentQuestion.questionType === 0) { // 开放问题
-					answer = {
-						questionId: this.currentQuestion.id,
-						questionType: this.currentQuestion.questionType,
-						answer: this.openQuestionAnswer,
-						answerDuration: this.getAnswerDuration() // 添加答题时长
-					};
-				} else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3 || this.currentQuestion.questionType === 4) { // 单选题、看图答题或类型4题目
-					answer = {
-						questionId: this.currentQuestion.id,
-						questionType: this.currentQuestion.questionType,
-						answer: this.selectedOption,
-						answerDuration: this.getAnswerDuration() // 添加答题时长
-					};
-				} else { // 多选题
-					answer = {
-						questionId: this.currentQuestion.id,
-						questionType: this.currentQuestion.questionType,
-						answer: this.selectedOptions,
-						answerDuration: this.getAnswerDuration() // 添加答题时长
-					};
-				}
-				
-				// 检查是否已存在该题目的答案,如果存在则更新
-				const existingIndex = this.answers.findIndex(a => a.questionId === answer.questionId);
-				if (existingIndex > -1) {
-					this.answers[existingIndex] = answer;
-				} else {
-					this.answers.push(answer);
-				}
-				
-				// 保存当前答案以便提交
-				this.currentAnswer = answer;
-				
-				console.log('已保存答案:', this.answers);
-			},
-			
-			// 获取答题时长(秒)
-			getAnswerDuration() {
-				// 这里假设每题默认30秒,根据剩余时间计算用时
-				// 您可以根据实际情况调整计算逻辑
-				const remainingTimeArr = this.remainingTime.split(':');
-				const remainingSeconds = parseInt(remainingTimeArr[0]) * 60 + parseInt(remainingTimeArr[1]);
-				return 30 - remainingSeconds; // 假设每题30秒
-			},
-
-			// 提交当前答案
-			async submitCurrentAnswer() {
-				if (!this.currentAnswer || this.isSubmitting) return; // 如果正在提交或没有答案,则不执行
-				
-				try {
-					// 设置提交状态为true
-					this.isSubmitting = true;
-					
-					// 显示提交中提示
-					uni.showLoading({
-						title: '正在提交答案...'
-					});
-					
-					// 构建提交数据
-					let answerContent = '';
-					let answerOptions = [];
-					if (this.currentAnswer.questionType === 0) {
-						// 开放题直接使用文本答案
-						answerContent = this.currentAnswer.answer;
-						answerOptions = [];
-					} else if (this.currentAnswer.questionType === 1 || this.currentAnswer.questionType === 3 || this.currentAnswer.questionType === 4) {
-						// 单选题或看图答题,获取选项ID而不是索引
-						const selectedIndex = this.currentAnswer.answer;
-						const selectedOption = this.currentQuestion.options[selectedIndex];
-						console.log('selectedOption',selectedOption);
-						const optionId = selectedOption.id ? selectedOption.id : selectedIndex;
-						answerContent = optionId.toString();
-						answerOptions = [optionId];
-					} else if (this.currentAnswer.questionType === 2) {
-						// 多选题,将选项ID数组转为逗号分隔的字符串
-						const selectedIndices = this.currentAnswer.answer;
-						const selectedOptionIds = selectedIndices.map(index => {
-							const option = this.currentQuestion.options[index];
-							// 使用选项的ID或其他唯一标识符
-							return option.id ? option.id : index;
-						});
-						answerOptions = selectedOptionIds;
-					}
-					
-					const submitData = {
-						position_id: JSON.parse(uni.getStorageSync('selectedJob')).id,
-						applicant_id: JSON.parse(uni.getStorageSync('userInfo')).id,
-						job_position_question_id: this.currentAnswer.questionId,
-						// answer_content: answerContent,
-						answer_options: answerOptions, 
-						answer_duration: this.currentAnswer.answerDuration || 0,
-						tenant_id:JSON.parse(uni.getStorageSync('userInfo')).tenant_id || 1
-					};
-					
-					console.log('提交数据:', submitData);
-					
-					// 调用API提交答案
-					const res = await this.$http.post(`${apiBaseUrl}/api/job/submit_answer`, submitData);
-					
-					console.log('提交答案响应:', res);
-					
-					return res;
-					
-				} catch (error) {
-					console.error('提交答案失败:', error);
-					// 显示错误提示
-					uni.showToast({
-						title: '提交答案失败,请重试',
-						icon: 'none'
-					});
-					
-					throw error;
-				} finally {
-					// 隐藏加载提示
-					uni.hideLoading();
-					// 重置提交状态
-					this.isSubmitting = false;
-				}
-			},
-			
-			// 修改 goToNextQuestion 方法
-			async goToNextQuestion() {
-				// 检查是否完成当前组的所有题目
-				if (this.currentQuestionIndex >= this.questions.length - 1) {
-					// 当前组的所有题目都已完成,显示继续按钮
-					this.showContinueButton = true;
-					
-					// 使用延时确保按钮渲染完成后再滚动
-					setTimeout(() => {
-						// 先重置 scrollTop,然后再设置新值,强制触发更新
-						this.scrollTop = 0;
-						
-						// 使用 nextTick 确保视图已更新
-						this.$nextTick(() => {
-							// 延迟设置新的滚动位置
-							setTimeout(() => {
-								this.scrollTop = 10000; // 一个足够大的值
-							}, 100);
-						});
-					}, 200);
-					return;
-				}
-				
-				// 如果还有下一题,继续下一题
-				this.currentQuestionIndex++;
-				this.currentScrollId = 'question-' + this.currentQuestionIndex;
-				
-				// 重置状态(只在非最后一题时重置)
-				this.showResult = false;
-				this.selectedOption = null;
-				this.selectedOptions = [];
-				this.openQuestionAnswer = '';
-				
-				// 如果有下一题的详情
-				if (this.questions[this.currentQuestionIndex]) {
-					// 更新进度
-					this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
-					
-					// 重置计时器
-					this.resetTimer();
-					
-					// 播放AI介绍下一题
-					this.playAiSpeaking();
-					
-					setTimeout(() => {
-						this.pauseAiSpeaking();
-					}, 2000);
-				}
-			},
-
 			toggleSettings() {
 				// 打开设置面板
 				uni.showToast({
@@ -953,6 +809,181 @@
 					});
 				}
 			},
+
+			// 保存当前题目的答案
+			saveAnswer() {
+				let answer;
+				
+				if (this.currentQuestion.questionType === 0) { // 开放问题
+					answer = {
+						questionId: this.currentQuestion.id,
+						questionType: this.currentQuestion.questionType,
+						answer: this.openQuestionAnswer,
+						answerDuration: this.getAnswerDuration() // 添加答题时长
+					};
+				} else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3 || this.currentQuestion.questionType === 4) { // 单选题、看图答题或类型4题目
+					answer = {
+						questionId: this.currentQuestion.id,
+						questionType: this.currentQuestion.questionType,
+						answer: this.selectedOption,
+						answerDuration: this.getAnswerDuration() // 添加答题时长
+					};
+				} else { // 多选题
+					answer = {
+						questionId: this.currentQuestion.id,
+						questionType: this.currentQuestion.questionType,
+						answer: this.selectedOptions,
+						answerDuration: this.getAnswerDuration() // 添加答题时长
+					};
+				}
+				
+				// 检查是否已存在该题目的答案,如果存在则更新
+				const existingIndex = this.answers.findIndex(a => a.questionId === answer.questionId);
+				if (existingIndex > -1) {
+					this.answers[existingIndex] = answer;
+				} else {
+					this.answers.push(answer);
+				}
+				
+				// 保存当前答案以便提交
+				this.currentAnswer = answer;
+				
+				console.log('已保存答案:', this.answers);
+			},
+
+			// 获取答题时长(秒)
+			getAnswerDuration() {
+				// 这里假设每题默认30秒,根据剩余时间计算用时
+				// 您可以根据实际情况调整计算逻辑
+				const remainingTimeArr = this.remainingTime.split(':');
+				const remainingSeconds = parseInt(remainingTimeArr[0]) * 60 + parseInt(remainingTimeArr[1]);
+				return 30 - remainingSeconds; // 假设每题30秒
+			},
+
+			// 提交当前答案
+			async submitCurrentAnswer() {
+				if (!this.currentAnswer || this.isSubmitting) return; // 如果正在提交或没有答案,则不执行
+				
+				try {
+					// 设置提交状态为true
+					this.isSubmitting = true;
+					
+					// 显示提交中提示
+					uni.showLoading({
+						title: '正在提交答案...'
+					});
+					
+					// 构建提交数据
+					let answerContent = '';
+					let answerOptions = [];
+					if (this.currentAnswer.questionType === 0) {
+						// 开放题直接使用文本答案
+						answerContent = this.currentAnswer.answer;
+						answerOptions = [];
+					} else if (this.currentAnswer.questionType === 1 || this.currentAnswer.questionType === 3 || this.currentAnswer.questionType === 4) {
+						// 单选题或看图答题,获取选项ID而不是索引
+						const selectedIndex = this.currentAnswer.answer;
+						const selectedOption = this.currentQuestion.options[selectedIndex];
+						console.log('selectedOption',selectedOption);
+						const optionId = selectedOption.id ? selectedOption.id : selectedIndex;
+						answerContent = optionId.toString();
+						answerOptions = [optionId];
+					} else if (this.currentAnswer.questionType === 2) {
+						// 多选题,将选项ID数组转为逗号分隔的字符串
+						const selectedIndices = this.currentAnswer.answer;
+						const selectedOptionIds = selectedIndices.map(index => {
+							const option = this.currentQuestion.options[index];
+							// 使用选项的ID或其他唯一标识符
+							return option.id ? option.id : index;
+						});
+						answerOptions = selectedOptionIds;
+					}
+					
+					const submitData = {
+						position_id: JSON.parse(uni.getStorageSync('selectedJob')).id,
+						applicant_id: JSON.parse(uni.getStorageSync('userInfo')).id,
+						job_position_question_id: this.currentAnswer.questionId,
+						// answer_content: answerContent,
+						answer_options: answerOptions, 
+						answer_duration: this.currentAnswer.answerDuration || 0,
+						tenant_id:JSON.parse(uni.getStorageSync('userInfo')).tenant_id || 1
+					};
+					
+					console.log('提交数据:', submitData);
+					
+					// 调用API提交答案
+					const res = await this.$http.post(`${apiBaseUrl}/api/job/submit_answer`, submitData);
+					
+					console.log('提交答案响应:', res);
+					
+					return res;
+					
+				} catch (error) {
+					console.error('提交答案失败:', error);
+					// 显示错误提示
+					uni.showToast({
+						title: '提交答案失败,请重试',
+						icon: 'none'
+					});
+					
+					throw error;
+				} finally {
+					// 隐藏加载提示
+					uni.hideLoading();
+					// 重置提交状态
+					this.isSubmitting = false;
+				}
+			},
+
+			// 修改 goToNextQuestion 方法
+			async goToNextQuestion() {
+				// 检查是否完成当前组的所有题目
+				if (this.currentQuestionIndex >= this.questions.length - 1) {
+					// 当前组的所有题目都已完成,显示继续按钮
+					this.showContinueButton = true;
+					
+					// 使用延时确保按钮渲染完成后再滚动
+					setTimeout(() => {
+						// 先重置 scrollTop,然后再设置新值,强制触发更新
+						this.scrollTop = 0;
+						
+						// 使用 nextTick 确保视图已更新
+						this.$nextTick(() => {
+							// 延迟设置新的滚动位置
+							setTimeout(() => {
+								this.scrollTop = 10000; // 一个足够大的值
+							}, 100);
+						});
+					}, 200);
+					return;
+				}
+				
+				// 如果还有下一题,继续下一题
+				this.currentQuestionIndex++;
+				this.currentScrollId = 'question-' + this.currentQuestionIndex;
+				
+				// 重置状态(只在非最后一题时重置)
+				this.showResult = false;
+				this.selectedOption = null;
+				this.selectedOptions = [];
+				this.openQuestionAnswer = '';
+				
+				// 如果有下一题的详情
+				if (this.questions[this.currentQuestionIndex]) {
+					// 更新进度
+					this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
+					
+					// 重置计时器
+					this.resetTimer();
+					
+					// 播放AI介绍下一题
+					this.playAiSpeaking();
+					
+					setTimeout(() => {
+						this.pauseAiSpeaking();
+					}, 2000);
+				}
+			},
 		},
 		// 添加生命周期钩子,确保在组件销毁时清除计时器
 		beforeDestroy() {

+ 151 - 132
unpackage/dist/dev/mp-weixin/pages/camera/camera.js

@@ -313,9 +313,21 @@ const _sfc_main = {
       this.submitCurrentAnswer().then(() => {
         setTimeout(() => {
           if (this.currentQuestionIndex >= this.questions.length - 1) {
-            common_vendor.index.navigateTo({
-              url: "/pages/interview-question/interview-question"
-            });
+            if (this.currentGroupIndex < this.questionGroups.length - 1) {
+              this.showContinueButton = true;
+              setTimeout(() => {
+                this.scrollTop = 0;
+                this.$nextTick(() => {
+                  setTimeout(() => {
+                    this.scrollTop = 1e4;
+                  }, 100);
+                });
+              }, 200);
+            } else {
+              common_vendor.index.navigateTo({
+                url: "/pages/interview-question/interview-question"
+              });
+            }
           } else {
             this.goToNextQuestion();
           }
@@ -324,141 +336,22 @@ const _sfc_main = {
         console.error("提交答案失败:", error);
         setTimeout(() => {
           if (this.currentQuestionIndex >= this.questions.length - 1) {
-            common_vendor.index.navigateTo({
-              url: "/pages/interview-question/interview-question"
-            });
+            if (this.currentGroupIndex < this.questionGroups.length - 1) {
+              this.showContinueButton = true;
+              setTimeout(() => {
+                this.scrollTop = 1e4;
+              }, 200);
+            } else {
+              common_vendor.index.navigateTo({
+                url: "/pages/interview-question/interview-question"
+              });
+            }
           } else {
             this.goToNextQuestion();
           }
         }, 1e3);
       });
     },
-    // 保存当前题目的答案
-    saveAnswer() {
-      let answer;
-      if (this.currentQuestion.questionType === 0) {
-        answer = {
-          questionId: this.currentQuestion.id,
-          questionType: this.currentQuestion.questionType,
-          answer: this.openQuestionAnswer,
-          answerDuration: this.getAnswerDuration()
-          // 添加答题时长
-        };
-      } else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3 || this.currentQuestion.questionType === 4) {
-        answer = {
-          questionId: this.currentQuestion.id,
-          questionType: this.currentQuestion.questionType,
-          answer: this.selectedOption,
-          answerDuration: this.getAnswerDuration()
-          // 添加答题时长
-        };
-      } else {
-        answer = {
-          questionId: this.currentQuestion.id,
-          questionType: this.currentQuestion.questionType,
-          answer: this.selectedOptions,
-          answerDuration: this.getAnswerDuration()
-          // 添加答题时长
-        };
-      }
-      const existingIndex = this.answers.findIndex((a) => a.questionId === answer.questionId);
-      if (existingIndex > -1) {
-        this.answers[existingIndex] = answer;
-      } else {
-        this.answers.push(answer);
-      }
-      this.currentAnswer = answer;
-      console.log("已保存答案:", this.answers);
-    },
-    // 获取答题时长(秒)
-    getAnswerDuration() {
-      const remainingTimeArr = this.remainingTime.split(":");
-      const remainingSeconds = parseInt(remainingTimeArr[0]) * 60 + parseInt(remainingTimeArr[1]);
-      return 30 - remainingSeconds;
-    },
-    // 提交当前答案
-    async submitCurrentAnswer() {
-      if (!this.currentAnswer || this.isSubmitting)
-        return;
-      try {
-        this.isSubmitting = true;
-        common_vendor.index.showLoading({
-          title: "正在提交答案..."
-        });
-        let answerContent = "";
-        let answerOptions = [];
-        if (this.currentAnswer.questionType === 0) {
-          answerContent = this.currentAnswer.answer;
-          answerOptions = [];
-        } else if (this.currentAnswer.questionType === 1 || this.currentAnswer.questionType === 3 || this.currentAnswer.questionType === 4) {
-          const selectedIndex = this.currentAnswer.answer;
-          const selectedOption = this.currentQuestion.options[selectedIndex];
-          console.log("selectedOption", selectedOption);
-          const optionId = selectedOption.id ? selectedOption.id : selectedIndex;
-          answerContent = optionId.toString();
-          answerOptions = [optionId];
-        } else if (this.currentAnswer.questionType === 2) {
-          const selectedIndices = this.currentAnswer.answer;
-          const selectedOptionIds = selectedIndices.map((index) => {
-            const option = this.currentQuestion.options[index];
-            return option.id ? option.id : index;
-          });
-          answerOptions = selectedOptionIds;
-        }
-        const submitData = {
-          position_id: JSON.parse(common_vendor.index.getStorageSync("selectedJob")).id,
-          applicant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
-          job_position_question_id: this.currentAnswer.questionId,
-          // answer_content: answerContent,
-          answer_options: answerOptions,
-          answer_duration: this.currentAnswer.answerDuration || 0,
-          tenant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1
-        };
-        console.log("提交数据:", submitData);
-        const res2 = await this.$http.post(`${common_config.apiBaseUrl}/api/job/submit_answer`, submitData);
-        console.log("提交答案响应:", res2);
-        return res2;
-      } catch (error) {
-        console.error("提交答案失败:", error);
-        common_vendor.index.showToast({
-          title: "提交答案失败,请重试",
-          icon: "none"
-        });
-        throw error;
-      } finally {
-        common_vendor.index.hideLoading();
-        this.isSubmitting = false;
-      }
-    },
-    // 修改 goToNextQuestion 方法
-    async goToNextQuestion() {
-      if (this.currentQuestionIndex >= this.questions.length - 1) {
-        this.showContinueButton = true;
-        setTimeout(() => {
-          this.scrollTop = 0;
-          this.$nextTick(() => {
-            setTimeout(() => {
-              this.scrollTop = 1e4;
-            }, 100);
-          });
-        }, 200);
-        return;
-      }
-      this.currentQuestionIndex++;
-      this.currentScrollId = "question-" + this.currentQuestionIndex;
-      this.showResult = false;
-      this.selectedOption = null;
-      this.selectedOptions = [];
-      this.openQuestionAnswer = "";
-      if (this.questions[this.currentQuestionIndex]) {
-        this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
-        this.resetTimer();
-        this.playAiSpeaking();
-        setTimeout(() => {
-          this.pauseAiSpeaking();
-        }, 2e3);
-      }
-    },
     toggleSettings() {
       common_vendor.index.showToast({
         title: "设置功能开发中",
@@ -635,6 +528,132 @@ const _sfc_main = {
           url: "/pages/interview-question/interview-question"
         });
       }
+    },
+    // 保存当前题目的答案
+    saveAnswer() {
+      let answer;
+      if (this.currentQuestion.questionType === 0) {
+        answer = {
+          questionId: this.currentQuestion.id,
+          questionType: this.currentQuestion.questionType,
+          answer: this.openQuestionAnswer,
+          answerDuration: this.getAnswerDuration()
+          // 添加答题时长
+        };
+      } else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3 || this.currentQuestion.questionType === 4) {
+        answer = {
+          questionId: this.currentQuestion.id,
+          questionType: this.currentQuestion.questionType,
+          answer: this.selectedOption,
+          answerDuration: this.getAnswerDuration()
+          // 添加答题时长
+        };
+      } else {
+        answer = {
+          questionId: this.currentQuestion.id,
+          questionType: this.currentQuestion.questionType,
+          answer: this.selectedOptions,
+          answerDuration: this.getAnswerDuration()
+          // 添加答题时长
+        };
+      }
+      const existingIndex = this.answers.findIndex((a) => a.questionId === answer.questionId);
+      if (existingIndex > -1) {
+        this.answers[existingIndex] = answer;
+      } else {
+        this.answers.push(answer);
+      }
+      this.currentAnswer = answer;
+      console.log("已保存答案:", this.answers);
+    },
+    // 获取答题时长(秒)
+    getAnswerDuration() {
+      const remainingTimeArr = this.remainingTime.split(":");
+      const remainingSeconds = parseInt(remainingTimeArr[0]) * 60 + parseInt(remainingTimeArr[1]);
+      return 30 - remainingSeconds;
+    },
+    // 提交当前答案
+    async submitCurrentAnswer() {
+      if (!this.currentAnswer || this.isSubmitting)
+        return;
+      try {
+        this.isSubmitting = true;
+        common_vendor.index.showLoading({
+          title: "正在提交答案..."
+        });
+        let answerContent = "";
+        let answerOptions = [];
+        if (this.currentAnswer.questionType === 0) {
+          answerContent = this.currentAnswer.answer;
+          answerOptions = [];
+        } else if (this.currentAnswer.questionType === 1 || this.currentAnswer.questionType === 3 || this.currentAnswer.questionType === 4) {
+          const selectedIndex = this.currentAnswer.answer;
+          const selectedOption = this.currentQuestion.options[selectedIndex];
+          console.log("selectedOption", selectedOption);
+          const optionId = selectedOption.id ? selectedOption.id : selectedIndex;
+          answerContent = optionId.toString();
+          answerOptions = [optionId];
+        } else if (this.currentAnswer.questionType === 2) {
+          const selectedIndices = this.currentAnswer.answer;
+          const selectedOptionIds = selectedIndices.map((index) => {
+            const option = this.currentQuestion.options[index];
+            return option.id ? option.id : index;
+          });
+          answerOptions = selectedOptionIds;
+        }
+        const submitData = {
+          position_id: JSON.parse(common_vendor.index.getStorageSync("selectedJob")).id,
+          applicant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
+          job_position_question_id: this.currentAnswer.questionId,
+          // answer_content: answerContent,
+          answer_options: answerOptions,
+          answer_duration: this.currentAnswer.answerDuration || 0,
+          tenant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1
+        };
+        console.log("提交数据:", submitData);
+        const res2 = await this.$http.post(`${common_config.apiBaseUrl}/api/job/submit_answer`, submitData);
+        console.log("提交答案响应:", res2);
+        return res2;
+      } catch (error) {
+        console.error("提交答案失败:", error);
+        common_vendor.index.showToast({
+          title: "提交答案失败,请重试",
+          icon: "none"
+        });
+        throw error;
+      } finally {
+        common_vendor.index.hideLoading();
+        this.isSubmitting = false;
+      }
+    },
+    // 修改 goToNextQuestion 方法
+    async goToNextQuestion() {
+      if (this.currentQuestionIndex >= this.questions.length - 1) {
+        this.showContinueButton = true;
+        setTimeout(() => {
+          this.scrollTop = 0;
+          this.$nextTick(() => {
+            setTimeout(() => {
+              this.scrollTop = 1e4;
+            }, 100);
+          });
+        }, 200);
+        return;
+      }
+      this.currentQuestionIndex++;
+      this.currentScrollId = "question-" + this.currentQuestionIndex;
+      this.showResult = false;
+      this.selectedOption = null;
+      this.selectedOptions = [];
+      this.openQuestionAnswer = "";
+      if (this.questions[this.currentQuestionIndex]) {
+        this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
+        this.resetTimer();
+        this.playAiSpeaking();
+        setTimeout(() => {
+          this.pauseAiSpeaking();
+        }, 2e3);
+      }
     }
   },
   // 添加生命周期钩子,确保在组件销毁时清除计时器

+ 1 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -8,7 +8,7 @@
     "urlCheck": false,
     "es6": true,
     "postcss": false,
-    "minified": false,
+    "minified": true,
     "newFeature": true,
     "bigPackageSizeSupport": true,
     "babelSetting": {