camera.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. <template>
  2. <view class="camera-container">
  3. <!-- 顶部相机区域 - 固定位置 -->
  4. <view class="fixed-camera-container">
  5. <view class="user-avatar">
  6. <camera v-if="!digitalHumanUrl" device-position="front" flash="auto" class="camera"
  7. :mode="mode" @error="handleCameraError"></camera>
  8. <web-view v-else-if="digitalHumanUrl" :src="digitalHumanUrl" class="digital-human-webview"></web-view>
  9. <image v-else src="/static/avatar.png" mode="aspectFill" class="avatar-image"></image>
  10. </view>
  11. </view>
  12. <!-- 主要内容区域 - 修改为流式布局 -->
  13. <scroll-view class="content-scroll" scroll-y="true" :scroll-into-view="currentScrollId" :scroll-with-animation="true">
  14. <view class="content">
  15. <!-- 测试内容区域 - 修改为流式布局,每个问题都显示 -->
  16. <view v-for="(question, qIndex) in questions" :key="question.id" :id="'question-'+qIndex" class="interview-content">
  17. <!-- 问题编号和进度 -->
  18. <view class="question-number">
  19. <text>{{qIndex + 1}}/{{questions.length}}</text>
  20. </view>
  21. <!-- 问题和选项区域 -->
  22. <view class="question-area">
  23. <view class="question-importance">
  24. <!-- <text v-if="currentQuestion.isImportant">重点题</text> -->
  25. <text class="question-type">{{question.questionTypeName}}</text>
  26. {{question.text}}<text class="question-type" v-if="question.is_required_correct">(红线题)</text>
  27. </view>
  28. <!-- 添加图片显示区域,仅在 question_form 为 3 时显示 -->
  29. <view class="question-image-container" v-if="question.questionType === 3 && question.imageUrl">
  30. <image :src="question.imageUrl" mode="widthFix" class="question-image"></image>
  31. </view>
  32. <view class="options">
  33. <!-- 渲染非开放问题 (questionType: 1, 2 或 3) -->
  34. <view
  35. v-if="question.questionType !== 0"
  36. v-for="(option, index) in question.options"
  37. :key="index"
  38. class="option-item"
  39. :class="{
  40. 'option-selected': isOptionSelected(question, qIndex, index),
  41. 'option-disabled': qIndex !== currentQuestionIndex
  42. }"
  43. @click="qIndex === currentQuestionIndex && selectOption(index)">
  44. <text class="option-text">{{ option.option_text || (typeof option === 'string' ? option : JSON.stringify(option)) }}</text>
  45. </view>
  46. </view>
  47. <!-- 添加当前题目的按钮 - 只在多选题时显示 -->
  48. <view class="question-button-container" v-if="qIndex === currentQuestionIndex && question.questionType === 2">
  49. <button class="next-button" @click="nextQuestion()"
  50. :disabled="selectedOptions.length === 0">
  51. {{"提交答案"}}
  52. </button>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 添加底部空白区域,确保内容不被固定按钮遮挡 -->
  57. <view class="bottom-space"></view>
  58. </view>
  59. </scroll-view>
  60. <!-- 面试结束弹窗 -->
  61. <view class="interview-end-modal" v-if="showEndModal">
  62. <view class="modal-content">
  63. <view class="modal-title">测试已完成</view>
  64. <!-- <view class="score-display">{{score}}/{{totalQuestions}}</view>
  65. <view class="modal-message">您在本次测试中答了{{score}}道题目,共{{totalQuestions}}道题目。</view> -->
  66. <view class="modal-buttons">
  67. <!-- <button type="default" class="modal-button" @click="restartTest">重新测试</button> -->
  68. <button type="primary" class="modal-button" @click="navigateToInterview">进入面试</button>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- AI面试结束页面 -->
  73. <view class="interview-complete-screen" v-if="interviewCompleted">
  74. <view class="digital-avatar-large">
  75. <image src="/static/avatar.png" mode="aspectFill" class="avatar-image-large"></image>
  76. </view>
  77. <view class="complete-message">AI面试已结束</view>
  78. <view class="complete-description">本次面试的全部环节已结束。非常感谢您的参与。</view>
  79. <button class="complete-button" @click="back">我知道了</button>
  80. </view>
  81. <!-- 在模板中添加一个测试按钮(开发时使用,发布前删除) -->
  82. <!-- <button @click="testEndScreen" style="position: absolute; top: 10px; right: 10px; z-index: 9999;">测试结束页</button> -->
  83. <!-- 添加加载状态 -->
  84. <view class="loading-container" v-if="loading">
  85. <uni-load-more status="loading" :contentText="{contentdown: '加载中...'}" />
  86. <text class="loading-text">正在加载面试题目...</text>
  87. </view>
  88. <!-- 添加加载错误提示 -->
  89. <view class="loading-container" v-if="!loading && loadError">
  90. <view class="error-container">
  91. <text class="error-message">加载面试题目失败</text>
  92. <button class="retry-button" @click="fetchInterviewData">重试</button>
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import { getInterviewList, getInterviewDetail,getQuestions } from '@/api/user.js';
  99. import { apiBaseUrl } from '@/common/config.js';
  100. export default {
  101. data() {
  102. return {
  103. cameraContext: null,
  104. devicePosition: 'front',
  105. interviewStarted: true,
  106. showEndModal: false,
  107. currentQuestionIndex: 0,
  108. currentStep: 1,
  109. stepTexts: ['测试准备', '回答问题', '测试结束'],
  110. progressWidth: 50,
  111. remainingTime: '00:27',
  112. selectedOption: null,
  113. selectedOptions: [],
  114. showResult: false,
  115. isAnswerCorrect: false,
  116. questions: [], // 改为空数组,将通过API获取
  117. interviewId: null, // 存储当前面试ID
  118. useVideo: false,
  119. timerInterval: null,
  120. score: 0,
  121. totalQuestions: 0,
  122. interviewCompleted: false,
  123. digitalHumanUrl: '', // 数字人URL
  124. loading: true, // 添加加载状态
  125. loadError: false, // 添加加载错误状态
  126. errorMessage: '', // 添加错误消息
  127. answers: [], // 存储用户的所有答案
  128. currentQuestionDetail: null, // 当前题目详情
  129. isSubmitting: false, // 是否正在提交答案
  130. openQuestionAnswer: '', // 存储开放问题的答案
  131. currentAnswer: null, // 存储当前答案以便提交
  132. questionStartTime: null, // 存储问题开始时间
  133. mode: 'normal', // 相机模式
  134. currentScrollId: 'question-0', // 当前滚动到的问题ID
  135. }
  136. },
  137. computed: {
  138. currentQuestion() {
  139. console.log(this.questions[this.currentQuestionIndex]);
  140. return this.questions[this.currentQuestionIndex];
  141. }
  142. },
  143. onLoad(options) {
  144. // 从路由参数中获取面试ID
  145. if (options && options.id) {
  146. this.interviewId = options.id;
  147. this.fetchInterviewData();
  148. } else {
  149. // 如果没有ID,可以获取面试列表并使用第一个
  150. this.fetchInterviewList();
  151. }
  152. },
  153. onReady() {
  154. // 创建相机上下文
  155. this.cameraContext = uni.createCameraContext();
  156. // 创建AI视频上下文
  157. if (this.useVideo) {
  158. this.aiVideoContext = uni.createVideoContext('aiInterviewer');
  159. }
  160. // 初始化数字人
  161. this.initDigitalHuman();
  162. },
  163. methods: {
  164. // 获取面试列表
  165. async fetchInterviewList() {
  166. try {
  167. this.loading = true;
  168. const res = await getQuestions({position_id:JSON.parse(uni.getStorageSync('selectedJob')).id,page:1,limit:999,tenant_id:1});
  169. console.log(res.items);
  170. // 使用第一个面试
  171. this.interviewId = res.items//[0].id;
  172. this.fetchInterviewData(res.items);
  173. } catch (error) {
  174. console.error('获取面试列表失败:', error);
  175. this.handleLoadError('获取面试列表失败');
  176. }
  177. },
  178. // 获取面试详情数据
  179. async fetchInterviewData(data) {
  180. try {
  181. this.loading = true;
  182. // const res = await getInterviewDetail({ id: this.interviewId });
  183. // console.log('API返回数据:', res);
  184. // 如果返回的是问题列表
  185. if (data && Array.isArray(data)) {
  186. // 处理多个问题,并过滤掉 question_form 为 0 的问题
  187. this.questions = data
  188. .filter(q => q.question_form !== 0) // 过滤掉开放问题
  189. .map((q, index) => ({
  190. id: q.id || index + 1,
  191. text: q.question || '未知问题',
  192. options: q.options || [],
  193. correctAnswer: q.correctAnswer || 0,
  194. isImportant: q.is_system || false,
  195. explanation: q.explanation || '',
  196. questionType: q.question_form,
  197. questionTypeName: q.question_form_name || '单选题',
  198. is_required_correct: q.is_required_correct || false,
  199. correctAnswers: q.correct_answers || [],
  200. difficulty: q.difficulty || 1,
  201. difficultyName: q.difficulty_name || '初级',
  202. imageUrl: q.question_image_url || '' // 添加图片URL字段
  203. }));
  204. } else {
  205. // 处理单个问题
  206. this.processInterviewData(res);
  207. }
  208. console.log(this.questions);
  209. // 设置总题目数
  210. this.totalQuestions = this.questions.length;
  211. /* // 启动倒计时
  212. if (this.questions.length > 0) {
  213. this.startTimer();
  214. } */
  215. } catch (error) {
  216. console.error('获取面试详情失败:', error);
  217. this.handleLoadError('获取面试详情失败');
  218. } finally {
  219. this.loading = false;
  220. }
  221. },
  222. // 处理面试数据
  223. processInterviewData(data) {
  224. // 清空现有问题列表
  225. this.questions = [];
  226. // 检查数据格式并处理
  227. if (data && data.question_form !== 0) { // 只处理非开放问题
  228. // 创建一个格式化的问题对象
  229. const formattedQuestion = {
  230. id: data.id || 1,
  231. text: data.question || '未知问题',
  232. options: data.options || [],
  233. correctAnswer: data.correctAnswer || 0,
  234. isImportant: data.is_system || false,
  235. explanation: data.explanation || '',
  236. questionType: data.question_form, // 1-单选题,2-多选题,3-看图答题
  237. questionTypeName: data.question_form_name || '单选题',
  238. is_required_correct: data.is_required_correct || false,
  239. correctAnswers: data.correct_answers || [],
  240. difficulty: data.difficulty || 1,
  241. difficultyName: data.difficulty_name || '初级',
  242. imageUrl: data.question_image_url || '' // 添加图片URL字段
  243. };
  244. // 添加到问题列表
  245. this.questions.push(formattedQuestion);
  246. // 设置总题目数
  247. this.totalQuestions = this.questions.length;
  248. /* // 启动倒计时
  249. this.startTimer(); */
  250. } else {
  251. this.handleLoadError('没有可用的选择题');
  252. }
  253. },
  254. // 处理加载错误
  255. handleLoadError(message) {
  256. this.loadError = true;
  257. this.loading = false;
  258. this.errorMessage = message || '加载失败';
  259. uni.showToast({
  260. title: message || '加载失败',
  261. icon: 'none',
  262. duration: 2000
  263. });
  264. },
  265. startTimer() {
  266. // 确保问题已加载
  267. if (this.questions.length === 0) return;
  268. // 记录开始时间
  269. this.questionStartTime = new Date();
  270. // 设置倒计时时间(秒)
  271. let seconds = 60; // 每题60秒,可以根据需要调整
  272. this.remainingTime = `01:00`;
  273. this.timerInterval = setInterval(() => {
  274. seconds--;
  275. if (seconds <= 0) {
  276. clearInterval(this.timerInterval);
  277. // 时间到,自动提交答案并进入下一题
  278. if (!this.showResult) {
  279. this.checkAnswer();
  280. // 短暂延迟后自动进入下一题
  281. setTimeout(() => {
  282. if (this.currentQuestionIndex < this.questions.length - 1) {
  283. this.goToNextQuestion();
  284. } else {
  285. // 如果是最后一题,显示结束模态框或跳转
  286. uni.navigateTo({
  287. url: '/pages/interview-question/interview-question'
  288. });
  289. }
  290. }, 1500); // 1.5秒后自动进入下一题
  291. }
  292. }
  293. // 格式化显示时间 (不再显示,但仍然计算用于内部逻辑)
  294. const min = Math.floor(seconds / 60).toString().padStart(2, '0');
  295. const sec = (seconds % 60).toString().padStart(2, '0');
  296. this.remainingTime = `${min}:${sec}`;
  297. }, 1000);
  298. },
  299. resetTimer() {
  300. clearInterval(this.timerInterval);
  301. /* this.startTimer(); */
  302. },
  303. selectOption(index) {
  304. if (this.showResult) return; // 已显示结果时不能再选择
  305. // 判断当前题目类型
  306. if (this.currentQuestion.questionType === 2) { // 多选题
  307. // 如果已经选中,则取消选中
  308. const optionIndex = this.selectedOptions.indexOf(index);
  309. if (optionIndex > -1) {
  310. this.selectedOptions.splice(optionIndex, 1);
  311. } else {
  312. // 否则添加到已选中数组
  313. this.selectedOptions.push(index);
  314. }
  315. // 多选题不自动提交,需要用户手动点击"进入下一题"按钮
  316. } else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3) { // 单选题或看图答题
  317. this.selectedOption = index;
  318. // 单选题自动提交答案并进入下一题
  319. this.playAiSpeaking();
  320. // 短暂延迟后提交答案,让用户看到选中效果
  321. setTimeout(() => {
  322. this.checkAnswer();
  323. this.saveAnswer();
  324. // 提交答案
  325. this.submitCurrentAnswer().then(() => {
  326. // 提交成功后,短暂延迟后自动进入下一题
  327. setTimeout(() => {
  328. // 如果是最后一题,跳转到面试页面
  329. if (this.currentQuestionIndex >= this.questions.length - 1) {
  330. uni.navigateTo({
  331. url: '/pages/interview-question/interview-question'
  332. });
  333. } else {
  334. // 否则进入下一题
  335. this.goToNextQuestion();
  336. }
  337. }, 800); // 0.8秒后自动进入下一题
  338. }).catch(error => {
  339. console.error('提交答案失败:', error);
  340. // 即使提交失败也继续下一题
  341. setTimeout(() => {
  342. if (this.currentQuestionIndex >= this.questions.length - 1) {
  343. uni.navigateTo({
  344. url: '/pages/interview-question/interview-question'
  345. });
  346. } else {
  347. this.goToNextQuestion();
  348. }
  349. }, 1000);
  350. });
  351. }, 500); // 0.5秒后提交答案
  352. }
  353. },
  354. checkAnswer() {
  355. // 如果已经显示结果,说明已经提交过答案,不再重复提交
  356. if (this.showResult) return;
  357. clearInterval(this.timerInterval); // 停止计时
  358. // 确保当前问题存在
  359. if (!this.currentQuestion) {
  360. console.error('当前问题不存在');
  361. return;
  362. }
  363. // 根据题目类型检查答案是否正确
  364. if (this.currentQuestion.questionType === 0) { // 开放问题
  365. // 开放问题没有标准答案,可以根据需要设置为正确或待评估
  366. this.isAnswerCorrect = true; // 或者设置为 null 表示待评估
  367. } else if (this.currentQuestion.questionType === 2) { // 多选题
  368. const sortedSelected = [...this.selectedOptions].sort();
  369. const sortedCorrect = [...this.currentQuestion.correctAnswers].sort();
  370. if (sortedSelected.length !== sortedCorrect.length) {
  371. this.isAnswerCorrect = false;
  372. } else {
  373. this.isAnswerCorrect = sortedSelected.every((value, index) => value === sortedCorrect[index]);
  374. }
  375. } else { // 单选题或看图答题 (questionType === 1 或 3)
  376. this.isAnswerCorrect = this.selectedOption === this.currentQuestion.correctAnswer;
  377. }
  378. // 显示结果
  379. this.showResult = true;
  380. // 保存当前题目的答案
  381. this.saveAnswer();
  382. },
  383. // 修改 nextQuestion 方法,只处理多选题
  384. nextQuestion() {
  385. // 确保当前是多选题
  386. if (this.currentQuestion.questionType !== 2) return;
  387. // 检查答案并提交
  388. this.checkAnswer();
  389. // 保存当前题目的答案
  390. this.saveAnswer();
  391. // 提交答案
  392. this.submitCurrentAnswer().then(() => {
  393. // 提交成功后,短暂延迟后自动进入下一题
  394. setTimeout(() => {
  395. // 如果是最后一题,跳转到面试页面
  396. if (this.currentQuestionIndex >= this.questions.length - 1) {
  397. uni.navigateTo({
  398. url: '/pages/interview-question/interview-question'
  399. });
  400. } else {
  401. // 否则进入下一题
  402. this.goToNextQuestion();
  403. }
  404. }, 500); // 0.5秒后自动进入下一题
  405. }).catch(error => {
  406. console.error('提交答案失败:', error);
  407. // 即使提交失败也继续下一题
  408. setTimeout(() => {
  409. if (this.currentQuestionIndex >= this.questions.length - 1) {
  410. uni.navigateTo({
  411. url: '/pages/interview-question/interview-question'
  412. });
  413. } else {
  414. this.goToNextQuestion();
  415. }
  416. }, 1000);
  417. });
  418. },
  419. // 保存当前题目的答案
  420. saveAnswer() {
  421. let answer;
  422. if (this.currentQuestion.questionType === 0) { // 开放问题
  423. answer = {
  424. questionId: this.currentQuestion.id,
  425. questionType: this.currentQuestion.questionType,
  426. answer: this.openQuestionAnswer,
  427. answerDuration: this.getAnswerDuration() // 添加答题时长
  428. };
  429. } else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3) { // 单选题或看图答题
  430. answer = {
  431. questionId: this.currentQuestion.id,
  432. questionType: this.currentQuestion.questionType,
  433. answer: this.selectedOption,
  434. answerDuration: this.getAnswerDuration() // 添加答题时长
  435. };
  436. } else { // 多选题
  437. answer = {
  438. questionId: this.currentQuestion.id,
  439. questionType: this.currentQuestion.questionType,
  440. answer: this.selectedOptions,
  441. answerDuration: this.getAnswerDuration() // 添加答题时长
  442. };
  443. }
  444. // 检查是否已存在该题目的答案,如果存在则更新
  445. const existingIndex = this.answers.findIndex(a => a.questionId === answer.questionId);
  446. if (existingIndex > -1) {
  447. this.answers[existingIndex] = answer;
  448. } else {
  449. this.answers.push(answer);
  450. }
  451. // 保存当前答案以便提交
  452. this.currentAnswer = answer;
  453. console.log('已保存答案:', this.answers);
  454. },
  455. // 获取答题时长(秒)
  456. getAnswerDuration() {
  457. // 这里假设每题默认30秒,根据剩余时间计算用时
  458. // 您可以根据实际情况调整计算逻辑
  459. const remainingTimeArr = this.remainingTime.split(':');
  460. const remainingSeconds = parseInt(remainingTimeArr[0]) * 60 + parseInt(remainingTimeArr[1]);
  461. return 30 - remainingSeconds; // 假设每题30秒
  462. },
  463. // 提交当前答案
  464. async submitCurrentAnswer() {
  465. if (!this.currentAnswer || this.isSubmitting) return; // 如果正在提交或没有答案,则不执行
  466. try {
  467. // 设置提交状态为true
  468. this.isSubmitting = true;
  469. // 显示提交中提示
  470. uni.showLoading({
  471. title: '正在提交答案...'
  472. });
  473. // 构建提交数据
  474. let answerContent = '';
  475. let answerOptions = [];
  476. if (this.currentAnswer.questionType === 0) {
  477. // 开放题直接使用文本答案
  478. answerContent = this.currentAnswer.answer;
  479. answerOptions = [];
  480. } else if (this.currentAnswer.questionType === 1 || this.currentAnswer.questionType === 3) {
  481. // 单选题或看图答题,获取选项ID而不是索引
  482. const selectedIndex = this.currentAnswer.answer;
  483. const selectedOption = this.currentQuestion.options[selectedIndex];
  484. console.log('selectedOption',selectedOption);
  485. const optionId = selectedOption.id ? selectedOption.id : selectedIndex;
  486. answerContent = optionId.toString();
  487. answerOptions = [optionId];
  488. } else if (this.currentAnswer.questionType === 2) {
  489. // 多选题,将选项ID数组转为逗号分隔的字符串
  490. const selectedIndices = this.currentAnswer.answer;
  491. const selectedOptionIds = selectedIndices.map(index => {
  492. const option = this.currentQuestion.options[index];
  493. // 使用选项的ID或其他唯一标识符
  494. return option.id ? option.id : index;
  495. });
  496. answerOptions = selectedOptionIds;
  497. }
  498. const submitData = {
  499. position_id: JSON.parse(uni.getStorageSync('selectedJob')).id,
  500. applicant_id: JSON.parse(uni.getStorageSync('userInfo')).id,
  501. job_position_question_id: this.currentAnswer.questionId,
  502. // answer_content: answerContent,
  503. answer_options: answerOptions,
  504. answer_duration: this.currentAnswer.answerDuration || 0,
  505. tenant_id: 1
  506. };
  507. console.log('提交数据:', submitData);
  508. // 调用API提交答案
  509. const res = await this.$http.post(`${apiBaseUrl}/api/job/submit_answer`, submitData);
  510. console.log('提交答案响应:', res);
  511. return res;
  512. } catch (error) {
  513. console.error('提交答案失败:', error);
  514. // 显示错误提示
  515. uni.showToast({
  516. title: '提交答案失败,请重试',
  517. icon: 'none'
  518. });
  519. throw error;
  520. } finally {
  521. // 隐藏加载提示
  522. uni.hideLoading();
  523. // 重置提交状态
  524. this.isSubmitting = false;
  525. }
  526. },
  527. // 修改 goToNextQuestion 方法,在切换到下一题时重置当前选项状态
  528. async goToNextQuestion() {
  529. // 重置状态
  530. this.showResult = false;
  531. // 重置当前选择状态,但不影响已保存的答案
  532. this.selectedOption = null;
  533. this.selectedOptions = [];
  534. this.openQuestionAnswer = ''; // 重置开放问题答案
  535. // 前往下一题
  536. this.currentQuestionIndex++;
  537. // 更新滚动ID,滚动到下一题
  538. this.currentScrollId = 'question-' + this.currentQuestionIndex;
  539. // 如果已经有下一题的详情,直接使用
  540. if (this.questions[this.currentQuestionIndex]) {
  541. // 更新进度
  542. this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
  543. // 重置计时器但不显示
  544. this.resetTimer();
  545. // 播放AI介绍下一题
  546. this.playAiSpeaking();
  547. setTimeout(() => {
  548. this.pauseAiSpeaking();
  549. }, 2000);
  550. return;
  551. }
  552. // 否则请求下一题详情
  553. try {
  554. this.loading = true;
  555. // 假设您有一个获取单个题目详情的API
  556. // const res = await getQuestionDetail({
  557. // interviewId: this.interviewId,
  558. // questionIndex: this.currentQuestionIndex
  559. // });
  560. // 模拟API调用
  561. await new Promise(resolve => setTimeout(resolve, 1000));
  562. const res = { /* 模拟的题目数据 */ };
  563. // 处理题目数据
  564. if (res) {
  565. const formattedQuestion = {
  566. id: res.id || this.currentQuestionIndex + 1,
  567. text: res.question || '未知问题',
  568. options: res.options || [],
  569. correctAnswer: res.correctAnswer || 0,
  570. isImportant: res.is_system || false,
  571. explanation: res.explanation || '',
  572. questionType: res.question_form || 1,
  573. questionTypeName: res.question_form_name || '单选题',
  574. is_required_correct: res.is_required_correct || false,
  575. correctAnswers: res.correct_answers || [],
  576. difficulty: res.difficulty || 1,
  577. difficultyName: res.difficulty_name || '初级'
  578. };
  579. // 添加到问题列表
  580. this.questions.push(formattedQuestion);
  581. }
  582. } catch (error) {
  583. console.error('获取题目详情失败:', error);
  584. uni.showToast({
  585. title: '获取题目失败,请重试',
  586. icon: 'none'
  587. });
  588. // 出错时回到上一题
  589. this.currentQuestionIndex--;
  590. } finally {
  591. this.loading = false;
  592. // 更新进度
  593. this.progressWidth = (this.currentQuestionIndex + 1) / this.questions.length * 100;
  594. // 重置计时器
  595. this.resetTimer();
  596. }
  597. },
  598. toggleSettings() {
  599. // 打开设置面板
  600. uni.showToast({
  601. title: '设置功能开发中',
  602. icon: 'none'
  603. });
  604. },
  605. back(target) {
  606. // 清除计时器
  607. if (this.timerInterval) {
  608. clearInterval(this.timerInterval);
  609. }
  610. // 如果指定了跳转目标
  611. if (target) {
  612. uni.navigateTo({
  613. url: target
  614. });
  615. return;
  616. }
  617. // 否则尝试返回上一页,如果失败则跳转到首页
  618. // try {
  619. // const pages = getCurrentPages();
  620. // if (pages.length > 1) {
  621. // uni.reLaunch({
  622. // url: '/pages/index/index'
  623. // });
  624. // } else {
  625. // // 如果当前是第一页,则跳转到首页
  626. // uni.reLaunch({
  627. // url: '/pages/index/index'
  628. // });
  629. // }
  630. // } catch (e) {
  631. // console.error('导航错误:', e);
  632. // // 出错时也跳转到首页
  633. // uni.reLaunch({
  634. // url: '/pages/index/index'
  635. // });
  636. // }
  637. },
  638. error(e) {
  639. // 相机错误事件
  640. console.error(e.detail);
  641. uni.showToast({
  642. title: '相机启动失败,请检查权限设置',
  643. icon: 'none'
  644. });
  645. },
  646. playAiSpeaking() {
  647. if (this.useVideo && this.aiVideoContext) {
  648. this.aiVideoContext.play();
  649. }
  650. // 触发数字人说话动画
  651. if (this.digitalHumanUrl) {
  652. // 假设当前问题的文本作为数字人要说的内容
  653. const speakText = this.currentQuestion ? this.currentQuestion.text : '';
  654. this.interactWithDigitalHuman(speakText);
  655. }
  656. },
  657. pauseAiSpeaking() {
  658. if (this.useVideo && this.aiVideoContext) {
  659. this.aiVideoContext.pause();
  660. }
  661. },
  662. // 修改 restartTest 方法,添加可选的跳转目标
  663. restartTest(target) {
  664. this.currentQuestionIndex = 0;
  665. this.score = 0;
  666. this.showEndModal = false;
  667. this.showResult = false;
  668. this.selectedOption = null;
  669. this.selectedOptions = [];
  670. this.resetTimer();
  671. // 如果指定了跳转目标
  672. if (target) {
  673. uni.navigateTo({
  674. url: target
  675. });
  676. }
  677. },
  678. // 在methods中添加测试方法
  679. testEndScreen() {
  680. this.interviewCompleted = true;
  681. this.showEndModal = false;
  682. },
  683. // 初始化数字人
  684. initDigitalHuman() {
  685. // 移除不可用的示例URL
  686. // this.digitalHumanUrl = 'https://your-digital-human-service.com/avatar?id=123';
  687. // 暂时不使用数字人服务,直接使用本地图片
  688. this.digitalHumanUrl = '';
  689. // 如果您有实际可用的数字人服务,可以在这里设置
  690. // 例如:this.digitalHumanUrl = 'https://your-actual-service.com/avatar';
  691. // 或者使用本地HTML文件(如果有的话)
  692. // this.digitalHumanUrl = '/hybrid/html/digital-human.html';
  693. },
  694. // 与数字人交互的方法
  695. interactWithDigitalHuman(message) {
  696. // 如果数字人是通过web-view加载的,可以使用postMessage与其通信
  697. const webview = this.$mp.page.$getAppWebview().children()[0];
  698. if (webview) {
  699. webview.evalJS(`receiveMessage('${message}')`);
  700. }
  701. },
  702. // 添加 navigateToInterview 方法
  703. navigateToInterview() {
  704. // 关闭模态框
  705. this.showEndModal = false;
  706. // 跳转到interview页面
  707. uni.navigateTo({
  708. url: '/pages/interview/interview',
  709. success: () => {
  710. console.log('成功跳转到interview页面');
  711. },
  712. fail: (err) => {
  713. console.error('跳转失败:', err);
  714. uni.showToast({
  715. title: '跳转失败,请手动返回首页',
  716. icon: 'none'
  717. });
  718. }
  719. });
  720. },
  721. // 添加 handleCameraError 方法
  722. handleCameraError(e) {
  723. console.error('相机错误:', e.detail);
  724. uni.showToast({
  725. title: '相机启动失败,请检查权限设置',
  726. icon: 'none'
  727. });
  728. },
  729. // 修改 isOptionSelected 方法,更精确地判断选项是否被选中
  730. isOptionSelected(question, qIndex, optionIndex) {
  731. // 获取该题的答案
  732. const answer = this.answers.find(a => a.questionId === question.id);
  733. // 如果是当前正在回答的题目
  734. if (qIndex === this.currentQuestionIndex) {
  735. if (question.questionType === 1 || question.questionType === 3) { // 单选题
  736. return this.selectedOption === optionIndex;
  737. } else if (question.questionType === 2) { // 多选题
  738. return this.selectedOptions.includes(optionIndex);
  739. }
  740. }
  741. // 如果是已回答过的题目,使用保存的答案
  742. else if (answer) {
  743. if (question.questionType === 1 || question.questionType === 3) { // 单选题
  744. return answer.answer === optionIndex;
  745. } else if (question.questionType === 2 && Array.isArray(answer.answer)) { // 多选题
  746. return answer.answer.includes(optionIndex);
  747. }
  748. }
  749. return false;
  750. },
  751. },
  752. // 添加生命周期钩子,确保在组件销毁时清除计时器
  753. beforeDestroy() {
  754. if (this.timerInterval) {
  755. clearInterval(this.timerInterval);
  756. }
  757. }
  758. }
  759. </script>
  760. <style>
  761. .camera-container {
  762. position: relative;
  763. width: 100%;
  764. height: 100vh;
  765. background-color: #ffffff;
  766. display: flex;
  767. flex-direction: column;
  768. overflow: hidden; /* 防止内容溢出 */
  769. }
  770. .header {
  771. height: 90rpx;
  772. /* background-color: #000000; */
  773. display: flex;
  774. align-items: center;
  775. padding: 0 30rpx;
  776. /* color: #ffffff; */
  777. }
  778. .back-button {
  779. width: 60rpx;
  780. height: 60rpx;
  781. display: flex;
  782. align-items: center;
  783. justify-content: center;
  784. }
  785. .title {
  786. flex: 1;
  787. text-align: center;
  788. font-size: 32rpx;
  789. font-weight: bold;
  790. }
  791. .controls {
  792. display: flex;
  793. gap: 30rpx;
  794. }
  795. .iconfont {
  796. font-size: 40rpx;
  797. }
  798. .content {
  799. flex: 1;
  800. display: flex;
  801. flex-direction: column;
  802. position: relative;
  803. padding: 50rpx 20rpx 0;
  804. }
  805. .progress-container {
  806. display: flex;
  807. flex-direction: column;
  808. justify-content: space-between;
  809. margin-bottom: 20rpx;
  810. }
  811. .progress-step {
  812. display: flex;
  813. align-items: center;
  814. margin-bottom: 10rpx;
  815. }
  816. .step-circle {
  817. width: 40rpx;
  818. height: 40rpx;
  819. border-radius: 50%;
  820. background-color: #e0e0e0;
  821. display: flex;
  822. align-items: center;
  823. justify-content: center;
  824. font-size: 24rpx;
  825. margin-right: 10rpx;
  826. }
  827. .step-circle.active {
  828. background-color: #ff9500;
  829. color: #ffffff;
  830. }
  831. .step-text {
  832. font-size: 24rpx;
  833. color: #666666;
  834. }
  835. .progress-bar {
  836. height: 10rpx;
  837. background-color: #e0e0e0;
  838. border-radius: 5rpx;
  839. overflow: hidden;
  840. margin-bottom: 20rpx;
  841. }
  842. .progress-fill {
  843. height: 100%;
  844. background-color: #00c853;
  845. transition: width 0.3s;
  846. }
  847. .interview-content {
  848. flex: 1;
  849. display: flex;
  850. flex-direction: column;
  851. margin-bottom: 40rpx;
  852. padding: 20rpx;
  853. border-bottom: 1px solid #eee;
  854. }
  855. .video-area {
  856. display: flex;
  857. /* flex-direction: column; */
  858. justify-content: space-between;
  859. height: auto;
  860. margin-bottom: 20rpx;
  861. }
  862. .video-camera {
  863. display: flex;
  864. flex-direction: row;
  865. align-items: center;
  866. justify-content: space-between;
  867. width: 65%;
  868. }
  869. .interviewer {
  870. background-color: #f5f5f5;
  871. display: flex;
  872. align-items: center;
  873. justify-content: center;
  874. position: relative;
  875. width: 48% !important;
  876. height: 300rpx;
  877. }
  878. .interviewer-video {
  879. width: 100%;
  880. height: 100%;
  881. object-fit: cover;
  882. }
  883. .interviewer-avatar {
  884. width: 80%;
  885. height: 80%;
  886. object-fit: contain;
  887. }
  888. .user-camera-container {
  889. width: 48%;
  890. height: 300rpx;
  891. border-radius: 10rpx;
  892. overflow: hidden;
  893. border: 4rpx solid #ffffff;
  894. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.2);
  895. }
  896. .question-area {
  897. flex: 1;
  898. display: flex;
  899. flex-direction: column;
  900. }
  901. .question-number {
  902. font-size: 28rpx;
  903. color: #666;
  904. margin-bottom: 20rpx;
  905. }
  906. .question-importance {
  907. background-color: #f9f9f9;
  908. padding: 20rpx;
  909. border-radius: 10rpx;
  910. margin-bottom: 20rpx;
  911. font-size: 28rpx;
  912. color: #333;
  913. }
  914. .question-importance text {
  915. color: #ff0000;
  916. /* margin-right: 10rpx; */
  917. }
  918. .options {
  919. display: flex;
  920. flex-direction: column;
  921. gap: 20rpx;
  922. margin-bottom: 30rpx;
  923. }
  924. .option-item {
  925. padding: 20rpx;
  926. background-color: #f5f5f5;
  927. border-radius: 10rpx;
  928. font-size: 28rpx;
  929. transition: all 0.3s;
  930. border: 1px solid #e0e0e0;
  931. display: flex;
  932. align-items: center;
  933. cursor: pointer; /* 添加指针样式 */
  934. }
  935. .option-item:active {
  936. transform: scale(0.98); /* 点击时轻微缩小效果 */
  937. opacity: 0.9;
  938. }
  939. .option-selected {
  940. background-color: #e6f7ff;
  941. border: 1px solid #1890ff;
  942. }
  943. /* 添加选中后的动画效果 */
  944. @keyframes selectedPulse {
  945. 0% { box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.4); }
  946. 70% { box-shadow: 0 0 0 10px rgba(24, 144, 255, 0); }
  947. 100% { box-shadow: 0 0 0 0 rgba(24, 144, 255, 0); }
  948. }
  949. .option-selected {
  950. animation: selectedPulse 1.5s ease-out;
  951. }
  952. .option-correct {
  953. background-color: #d4f7d4;
  954. border: 1px solid #52c41a;
  955. }
  956. .option-wrong {
  957. background-color: #fff1f0;
  958. border: 1px solid #ff4d4f;
  959. }
  960. .option-text {
  961. color: #333;
  962. }
  963. .timer-container {
  964. text-align: right;
  965. margin: 20rpx 0;
  966. }
  967. .timer-text {
  968. font-size: 24rpx;
  969. color: #666;
  970. background-color: #f0f0f0;
  971. padding: 6rpx 12rpx;
  972. border-radius: 6rpx;
  973. }
  974. .bottom-button-container {
  975. position: fixed;
  976. bottom: 50px;
  977. left: 5%;
  978. right: 0;
  979. padding: 20rpx;
  980. display: flex;
  981. justify-content: center;
  982. z-index: 10;
  983. }
  984. .bottom-button-wrapper {
  985. display: flex;
  986. width: 100%;
  987. justify-content: space-between;
  988. align-items: center;
  989. }
  990. .timer-display {
  991. font-size: 28rpx;
  992. color: #666;
  993. padding: 10rpx 20rpx;
  994. border-radius: 6rpx;
  995. }
  996. .next-button {
  997. background-color: #0039b3;
  998. color: #ffffff;
  999. border-radius: 10rpx;
  1000. font-size: 30rpx;
  1001. height: 80rpx;
  1002. line-height: 80rpx;
  1003. width: 90%;
  1004. text-align: center;
  1005. margin: 0;
  1006. }
  1007. .footer {
  1008. height: 100rpx;
  1009. background-color: #000000;
  1010. display: flex;
  1011. justify-content: space-between;
  1012. align-items: center;
  1013. padding: 0 30rpx;
  1014. color: #ffffff;
  1015. }
  1016. .timer {
  1017. font-size: 28rpx;
  1018. }
  1019. .next-step {
  1020. font-size: 28rpx;
  1021. }
  1022. .interview-end-modal {
  1023. position: fixed;
  1024. top: 0;
  1025. left: 0;
  1026. right: 0;
  1027. bottom: 0;
  1028. background-color: rgba(0, 0, 0, 0.5);
  1029. display: flex;
  1030. align-items: center;
  1031. justify-content: center;
  1032. z-index: 999;
  1033. }
  1034. .modal-content {
  1035. width: 80%;
  1036. background-color: #ffffff;
  1037. border-radius: 20rpx;
  1038. padding: 40rpx;
  1039. display: flex;
  1040. flex-direction: column;
  1041. align-items: center;
  1042. }
  1043. .modal-title {
  1044. font-size: 36rpx;
  1045. font-weight: bold;
  1046. margin-bottom: 30rpx;
  1047. }
  1048. .score-display {
  1049. font-size: 48rpx;
  1050. font-weight: bold;
  1051. color: #0039b3;
  1052. margin: 20rpx 0;
  1053. }
  1054. .modal-message {
  1055. font-size: 28rpx;
  1056. color: #666;
  1057. text-align: center;
  1058. margin-bottom: 40rpx;
  1059. }
  1060. .modal-buttons {
  1061. display: flex;
  1062. justify-content: space-between;
  1063. width: 100%;
  1064. margin-top: 20rpx;
  1065. }
  1066. .modal-button {
  1067. width: 45%;
  1068. }
  1069. @keyframes speaking {
  1070. 0% {
  1071. opacity: 0.8;
  1072. }
  1073. 50% {
  1074. opacity: 1;
  1075. }
  1076. 100% {
  1077. opacity: 0.8;
  1078. }
  1079. }
  1080. .speaking {
  1081. animation: speaking 1.5s infinite;
  1082. }
  1083. .digital-avatar {
  1084. display: flex;
  1085. flex-direction: row;
  1086. align-items: flex-start;
  1087. justify-content: space-between;
  1088. width: 100%;
  1089. margin-bottom: 20rpx;
  1090. }
  1091. .message-box {
  1092. width: 65%;
  1093. min-height: 120rpx;
  1094. background-color: #f5f5f5;
  1095. border-radius: 10rpx;
  1096. padding: 15rpx;
  1097. margin-right: 20rpx;
  1098. display: flex;
  1099. align-items: center;
  1100. }
  1101. .message-text {
  1102. font-size: 24rpx;
  1103. color: #333;
  1104. line-height: 1.5;
  1105. }
  1106. .user-avatar {
  1107. width: 110px;
  1108. height: 160px;
  1109. border-radius: 10rpx;
  1110. overflow: hidden;
  1111. }
  1112. .camera {
  1113. width: 100%;
  1114. height: 100%;
  1115. border-radius: 10rpx;
  1116. border: 2rpx solid #e0e0e0;
  1117. }
  1118. .avatar-image {
  1119. width: 100%;
  1120. height: 100%;
  1121. border-radius: 10rpx;
  1122. border: 2rpx solid #e0e0e0;
  1123. }
  1124. .digital-human-webview {
  1125. width: 100%;
  1126. height: 100%;
  1127. border-radius: 10rpx;
  1128. border: 2rpx solid #e0e0e0;
  1129. }
  1130. .interview-complete-screen {
  1131. position: fixed;
  1132. top: 0;
  1133. left: 0;
  1134. right: 0;
  1135. bottom: 0;
  1136. background-color: #f0f5ff;
  1137. display: flex;
  1138. flex-direction: column;
  1139. align-items: center;
  1140. justify-content: center;
  1141. z-index: 1000;
  1142. padding: 40rpx;
  1143. }
  1144. .digital-avatar-large {
  1145. width: 200rpx;
  1146. height: 200rpx;
  1147. margin-bottom: 60rpx;
  1148. }
  1149. .avatar-image-large {
  1150. width: 100%;
  1151. height: 100%;
  1152. border-radius: 30rpx;
  1153. }
  1154. .complete-message {
  1155. font-size: 40rpx;
  1156. font-weight: bold;
  1157. color: #333;
  1158. margin-bottom: 30rpx;
  1159. }
  1160. .complete-description {
  1161. font-size: 28rpx;
  1162. color: #666;
  1163. text-align: center;
  1164. margin-bottom: 80rpx;
  1165. line-height: 1.5;
  1166. }
  1167. .complete-button {
  1168. background-color: #0039b3;
  1169. color: #ffffff;
  1170. border-radius: 10rpx;
  1171. font-size: 32rpx;
  1172. padding: 20rpx 60rpx;
  1173. margin-top: 40rpx;
  1174. }
  1175. /* 添加加载状态样式 */
  1176. .loading-container {
  1177. position: absolute;
  1178. top: 0;
  1179. left: 0;
  1180. right: 0;
  1181. bottom: 0;
  1182. display: flex;
  1183. flex-direction: column;
  1184. align-items: center;
  1185. justify-content: center;
  1186. background-color: rgba(255, 255, 255, 0.9);
  1187. z-index: 100;
  1188. }
  1189. .loading-text {
  1190. margin-top: 20rpx;
  1191. font-size: 28rpx;
  1192. color: #666;
  1193. }
  1194. .error-container {
  1195. text-align: center;
  1196. }
  1197. .error-message {
  1198. font-size: 28rpx;
  1199. color: #ff4d4f;
  1200. margin-bottom: 30rpx;
  1201. }
  1202. .retry-button {
  1203. background-color: #0039b3;
  1204. color: #ffffff;
  1205. border-radius: 10rpx;
  1206. font-size: 28rpx;
  1207. padding: 10rpx 30rpx;
  1208. }
  1209. .question-type {
  1210. display: inline-block;
  1211. /* background-color: #0039b3; */
  1212. color: white;
  1213. font-size: 24rpx;
  1214. /* padding: 4rpx 5rpx; */
  1215. border-radius: 6rpx;
  1216. /* margin-right: 10rpx; */
  1217. }
  1218. /* 新增的开放问题样式 */
  1219. .open-question-container {
  1220. display: flex;
  1221. flex-direction: column;
  1222. width: 100%;
  1223. margin-bottom: 20rpx;
  1224. }
  1225. .open-question-input {
  1226. width: 100%;
  1227. height: 300rpx;
  1228. background-color: #f9f9f9;
  1229. border: 1px solid #e0e0e0;
  1230. border-radius: 10rpx;
  1231. padding: 20rpx;
  1232. font-size: 28rpx;
  1233. color: #333;
  1234. }
  1235. .word-count {
  1236. text-align: right;
  1237. font-size: 24rpx;
  1238. color: #999;
  1239. margin-top: 10rpx;
  1240. }
  1241. .option-prefix {
  1242. margin-right: 10rpx;
  1243. font-weight: bold;
  1244. color: #333;
  1245. min-width: 30rpx;
  1246. }
  1247. /* 新增的图片显示样式 */
  1248. .question-image-container {
  1249. width: 100%;
  1250. margin: 20rpx 0;
  1251. display: flex;
  1252. justify-content: center;
  1253. align-items: center;
  1254. }
  1255. .question-image {
  1256. width: 100%;
  1257. max-width: 600rpx;
  1258. border-radius: 10rpx;
  1259. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1260. }
  1261. /* 添加滚动视图样式 */
  1262. .content-scroll {
  1263. flex: 1;
  1264. height: calc(100vh - 200px); /* 只减去顶部相机的高度 */
  1265. margin-top: 10px;
  1266. }
  1267. /* 添加底部空白区域,防止内容被固定按钮遮挡 */
  1268. .bottom-space {
  1269. height: 50rpx; /* 减小底部空白区域 */
  1270. }
  1271. /* 添加流式布局相关样式 */
  1272. .interview-content {
  1273. margin-bottom: 40rpx;
  1274. padding: 20rpx;
  1275. border-bottom: 1px solid #eee;
  1276. }
  1277. .option-disabled {
  1278. opacity: 0.7;
  1279. pointer-events: none;
  1280. }
  1281. .question-button-container {
  1282. margin-top: 20rpx;
  1283. display: flex;
  1284. justify-content: center;
  1285. }
  1286. .bottom-timer-container {
  1287. display: none;
  1288. }
  1289. /* 添加固定相机容器样式 */
  1290. .fixed-camera-container {
  1291. position: sticky;
  1292. top: 0;
  1293. width: 100%;
  1294. padding: 20rpx;
  1295. background-color: #fff;
  1296. z-index: 10;
  1297. display: flex;
  1298. justify-content: flex-start;
  1299. border-bottom: 1px solid #eee;
  1300. }
  1301. .user-avatar {
  1302. width: 110px;
  1303. height: 160px;
  1304. border-radius: 10rpx;
  1305. overflow: hidden;
  1306. }
  1307. </style>