1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999 |
- <template>
- <view class="camera-container">
- <!-- 顶部相机区域 - 固定位置 -->
- <view class="fixed-camera-container">
- <view class="user-avatar" :class="{ 'camera-warning': showPageWarning }">
- <camera v-if="!digitalHumanUrl" device-position="front" flash="auto" class="camera"
- :mode="mode" @error="handleCameraError"></camera>
- <web-view v-else-if="digitalHumanUrl" :src="digitalHumanUrl" class="digital-human-webview"></web-view>
- <image v-else src="/static/avatar.png" mode="aspectFill" class="avatar-image"></image>
- </view>
- </view>
- <!-- 主要内容区域 - 修改为流式布局 -->
- <scroll-view class="content-scroll" scroll-y="true" :scroll-into-view="currentScrollId" :scroll-with-animation="true" :scroll-top="scrollTop">
- <view class="content">
- <!-- 测试内容区域 - 修改为流式布局,每个问题都显示 -->
- <view v-for="(question, qIndex) in questions" :key="question.id" :id="'question-'+qIndex" class="interview-content">
- <!-- 问题编号和进度 -->
- <view class="question-number">
- <text>{{qIndex + 1}}/{{questions.length}}</text>
- </view>
-
- <!-- 问题和选项区域 -->
- <view class="question-area">
- <view class="question-importance">
- <!-- <text v-if="currentQuestion.isImportant">重点题</text> -->
- <text class="question-type">{{question.questionTypeName}}</text>
- {{question.text}}<text class="question-type" v-if="question.is_required_correct">(红线题)</text>
- </view>
- <!-- 添加图片显示区域,仅在 question_form 为 3 时显示 -->
- <view class="question-image-container" v-if="question.questionType === 3 && question.imageUrl">
- <image :src="question.imageUrl" mode="widthFix" class="question-image"></image>
- </view>
- <view class="options">
- <!-- 渲染非开放问题 (questionType: 1, 2 或 3) -->
- <view
- v-if="question.questionType !== 0"
- v-for="(option, index) in question.options"
- :key="index"
- class="option-item"
- :class="{
- 'option-selected': isOptionSelected(question, qIndex, index),
- 'option-disabled': qIndex !== currentQuestionIndex
- }"
- @click="handleOptionClick(qIndex, index)">
- <text class="option-text">{{ option.option_text || (typeof option === 'string' ? option : JSON.stringify(option)) }}</text>
- </view>
- </view>
- <!-- 添加当前题目的按钮 - 只在多选题时显示 -->
- <view class="question-button-container" v-if="qIndex === currentQuestionIndex && question.questionType === 2">
- <button class="next-button" @click="nextQuestion()"
- :disabled="selectedOptions.length === 0">
- {{"下一题"}}
- </button>
- </view>
- </view>
- </view>
- <view class="continue-button-container" v-if="showContinueButton" id="continue-button">
- <button class="continue-button" @click="handleContinue">
- {{ currentGroupIndex < questionGroups.length - 1 ? '继续下一部分' : '完成测试' }}
- </button>
- </view>
- <!-- 添加底部锚点元素 -->
- <view id="bottom-anchor" style="height: 1px;"></view>
- <!-- 添加底部空白区域,确保内容不被固定按钮遮挡 -->
- <view class="bottom-space"></view>
- </view>
- </scroll-view>
-
- <!-- 面试结束弹窗 -->
- <view class="interview-end-modal" v-if="showEndModal">
- <view class="modal-content">
- <view class="modal-title">测试已完成</view>
- <!-- <view class="score-display">{{score}}/{{totalQuestions}}</view>
- <view class="modal-message">您在本次测试中答了{{score}}道题目,共{{totalQuestions}}道题目。</view> -->
- <view class="modal-buttons">
- <!-- <button type="default" class="modal-button" @click="restartTest">重新测试</button> -->
- <button type="primary" class="modal-button" @click="navigateToInterview">进入面试</button>
- </view>
- </view>
- </view>
- <!-- AI面试结束页面 -->
- <view class="interview-complete-screen" v-if="interviewCompleted">
- <view class="digital-avatar-large">
- <image src="/static/avatar.png" mode="aspectFill" class="avatar-image-large"></image>
- </view>
- <view class="complete-message">AI面试已结束</view>
- <view class="complete-description">本次面试的全部环节已结束。非常感谢您的参与。</view>
- <button class="complete-button" @click="back">我知道了</button>
- </view>
- <!-- 在模板中添加一个测试按钮(开发时使用,发布前删除) -->
- <!-- <button @click="testEndScreen" style="position: absolute; top: 10px; right: 10px; z-index: 9999;">测试结束页</button> -->
- <!-- 添加加载状态 -->
- <view class="loading-container" v-if="loading">
- <uni-load-more status="loading" :contentText="{contentdown: '加载中...'}" />
- <text class="loading-text">正在加载面试题目...</text>
- </view>
- <!-- 添加加载错误提示 -->
- <view class="loading-container" v-if="!loading && loadError">
- <view class="error-container">
- <text class="error-message">加载面试题目失败</text>
- <button class="retry-button" @click="fetchInterviewData">重试</button>
- </view>
- </view>
- <!-- 添加提示弹窗 -->
- <view class="prompt-modal" v-if="showPromptModal">
- <view class="prompt-content">
- <view class="prompt-title">温馨提示</view>
- <view class="prompt-text">
- 这部分是有关压力与情绪的测试,<text class="bold-text">所有问题没有绝对的"正确"或"错误"答案,只需结合您目前的状态选择最匹配的程度选项。</text>
- </view>
- <view class="prompt-text">
- 我们更关注您当下最真实的想法和感受。就像和朋友聊天一样,依据自己的主观意识如实回答即可。您的每一个回答都将被严格保密,仅用于帮助我们更深入地认识您,助力后续的职业发展规划。
- </view>
- <view class="prompt-text">
- 在开始前,不妨先做几个深呼吸,调整好状态。希望您能以轻松的心态完成检测!
- </view>
- <button class="prompt-button" @click="handlePromptConfirm">确定</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { getInterviewList, getInterviewDetail,getQuestions } from '@/api/user.js';
- import { apiBaseUrl,personDetectionWsUrl } from '@/common/config.js';
- export default {
- data() {
- return {
- cameraContext: null,
- devicePosition: 'front',
- interviewStarted: true,
- showEndModal: false,
- currentQuestionIndex: 0,
- currentStep: 1,
- stepTexts: ['测试准备', '回答问题', '测试结束'],
- progressWidth: 50,
- remainingTime: '00:27',
- selectedOption: null,
- selectedOptions: [],
- showResult: false,
- isAnswerCorrect: false,
- questions: [], // 改为空数组,将通过API获取
- interviewId: null, // 存储当前面试ID
- useVideo: false,
- timerInterval: null,
- score: 0,
- totalQuestions: 0,
- interviewCompleted: false,
- digitalHumanUrl: '', // 数字人URL
- loading: true, // 添加加载状态
- loadError: false, // 添加加载错误状态
- errorMessage: '', // 添加错误消息
- answers: [], // 存储用户的所有答案
- currentQuestionDetail: null, // 当前题目详情
- isSubmitting: false, // 是否正在提交答案
- openQuestionAnswer: '', // 存储开放问题的答案
- currentAnswer: null, // 存储当前答案以便提交
- questionStartTime: null, // 存储问题开始时间
- mode: 'normal', // 相机模式
- currentScrollId: 'question-0', // 当前滚动到的问题ID
- questionGroups: [], // 存储分组后的题目
- currentGroupIndex: 0, // 当前显示的组索引
- showContinueButton: false, // 是否显示继续按钮
- scrollToBottom: false, // 新增:是否需要滚动到底部
- scrollTop: 0, // 控制 scroll-view 的滚动位置
- _clickTimer: null,
- _isClicking: false,
- showPromptModal: false, // 添加新的数据属性
- personDetectionSocket: null, // WebSocket对象
- personDetectionInterval: null, // 定时器对象
- showCameraWarning: false, // 添加新的数据属性
- showPageWarning: false, // 添加新的数据属性
- }
- },
- computed: {
- currentQuestion() {
- console.log(this.questions[this.currentQuestionIndex]);
- return this.questions[this.currentQuestionIndex];
- }
- },
- onLoad(options) {
- // 从路由参数中获取面试ID
- if (options && options.id) {
- this.interviewId = options.id;
- this.fetchInterviewData();
- } else {
- // 如果没有ID,可以获取面试列表并使用第一个
- this.fetchInterviewList();
- }
- },
- onReady() {
- // 创建相机上下文
- this.cameraContext = uni.createCameraContext();
- // 创建AI视频上下文
- if (this.useVideo) {
- this.aiVideoContext = uni.createVideoContext('aiInterviewer');
- }
-
- // 初始化数字人
- this.initDigitalHuman();
- },
- mounted() {
- // 添加截屏监听
- uni.onUserCaptureScreen(() => {
- console.log('User captured screen');
- this.screenCaptureCount++;
-
- if (this.screenCaptureCount === 1) {
- uni.showModal({
- title: 'Warning',
- content: 'Screen capture detected. If you capture the screen again, your interview will be invalid.',
- showCancel: false,
- confirmText: 'OK'
- });
- } else if (this.screenCaptureCount >= 2) {
- uni.showModal({
- title: 'Interview Invalid',
- content: 'Your interview has been invalidated due to multiple screen captures. Please contact the recruiter for assistance.',
- showCancel: false,
- confirmText: 'OK',
- success: () => {
- this.invalidateInterview();
- }
- });
- }
- });
- },
- beforeDestroy() {
- // 移除截屏监听
- this.cleanupPersonDetectionWebSocket();
- },
- methods: {
- initPersonDetectionWebSocket() {
- if (this.personDetectionSocket) {
- this.cleanupPersonDetectionWebSocket();
- }
- try {
- this.personDetectionSocket = uni.connectSocket({
- url: `${personDetectionWsUrl}/ws/interview-room/room_${uni.getStorageSync('appId')}/${uni.getStorageSync('appId')}/`,
- success: () => {
- console.log('WebSocket connection initiated');
- },
- fail: (error) => {
- console.error('WebSocket connection failed:', error);
- }
- });
- this.personDetectionSocket.onOpen(() => {
- console.log('WebSocket connection opened');
- this.startPersonDetectionInterval();
- });
- this.personDetectionSocket.onError((error) => {
- console.error('WebSocket error:', error);
- this.cleanupPersonDetectionWebSocket();
- });
- this.personDetectionSocket.onClose(() => {
- console.log('WebSocket connection closed');
- this.cleanupPersonDetectionWebSocket();
- });
- this.personDetectionSocket.onMessage((res) => {
- try {
- const data = JSON.parse(res.data);
- console.log(data);
- if (data.type === 'person_detection_result') {
- this.handlePersonDetectionResult(data);
- }
- } catch (error) {
- console.error('Error parsing WebSocket message:', error);
- }
- });
- } catch (error) {
- console.error('Error initializing WebSocket:', error);
- this.cleanupPersonDetectionWebSocket();
- }
- },
- startPersonDetectionInterval() {
- if (this.personDetectionInterval) {
- clearInterval(this.personDetectionInterval);
- }
- this.personDetectionInterval = setInterval(() => {
- if (this.personDetectionSocket && this.cameraContext) {
- this.cameraContext.takePhoto({
- quality: 'low',
- success: (res) => {
- const tempFilePath = res.tempImagePath;
- uni.getFileSystemManager().readFile({
- filePath: tempFilePath,
- encoding: 'base64',
- success: (res) => {
- const base64Image = res.data;
- this.personDetectionSocket.send({
- data: JSON.stringify({
- type: 'person_detection',
- image_data: base64Image
- })
- });
- },
- fail: (error) => {
- console.error('Error reading image file:', error);
- }
- });
- },
- fail: (error) => {
- console.error('Error taking photo:', error);
- }
- });
- }
- }, 3000);
- },
- cleanupPersonDetectionWebSocket() {
- if (this.personDetectionInterval) {
- clearInterval(this.personDetectionInterval);
- this.personDetectionInterval = null;
- }
- if (this.personDetectionSocket) {
- try {
- this.personDetectionSocket.close();
- } catch (error) {
- console.error('Error closing WebSocket:', error);
- }
- this.personDetectionSocket = null;
- }
- },
- handlePersonDetectionResult(data) {
- console.log(data.data.detection.has_person);
- console.log(data.data.identity.status);//identity_verified
-
- // 首先检查是否有人
- /* if (!data.data.detection.has_person) {
- this.showPageWarning = true;
- uni.showToast({
- title: '请勿离开摄像头',
- icon: 'none',
- duration: 3000
- });
- // 添加震动反馈
- uni.vibrateShort({
- success: function () {
- console.log('Vibration successful');
- },
- fail: function (err) {
- console.error('Vibration failed:', err);
- }
- });
- setTimeout(() => {
- this.showPageWarning = false;
- }, 3000);
- }
- // 然后检查身份验证状态
- else */ if (data.data.identity.status !== "identity_verified") {
- this.showPageWarning = true;
- uni.showToast({
- title: data.data.identity.message,
- icon: 'none',
- duration: 3000
- });
- uni.vibrateLong({
- success: function () {
- console.log('Vibration successful');
- },
- fail: function (err) {
- console.error('Vibration failed:', err);
- }
- });
- setTimeout(() => {
- this.showPageWarning = false;
- }, 3000);
- }
- },
- // 添加作废面试的方法
- invalidateInterview() {
- // 停止录制(如果正在录制)
- if (this.isRecording) {
- this.stopRecordingAnswer();
- }
-
- // 清除所有计时器
- if (this.recordingTimer) {
- clearInterval(this.recordingTimer);
- }
-
- // 重置状态
- this.isRecording = false;
- this.showStopRecordingButton = false;
- this.showStartRecordingButton = false;
-
- // 显示作废提示
- // uni.showToast({
- // title: 'Interview invalidated',
- // icon: 'none',
- // duration: 2000
- // });
-
- // 延迟后返回上一页
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/index/index'
- });
- }, 500);
- const systemInfo = uni.getSystemInfoSync();
- const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith('mp-');
- if (isMiniProgram) {
- this.initPersonDetectionWebSocket();
- }
- },
- // 获取面试列表
- async fetchInterviewList() {
- try {
- this.loading = true;
- const res = await getQuestions({
- position_id:JSON.parse(uni.getStorageSync('selectedJob')).id,
- page:1,
- limit:999,
- tenant_id:JSON.parse(uni.getStorageSync('userInfo')).tenant_id || 1
- });
- console.log(res.items);
- // 使用第一个面试
- this.interviewId = res.items//[0].id;
-
- this.fetchInterviewData(res.items);
- } catch (error) {
- console.error('获取面试列表失败:', error);
- this.handleLoadError('获取面试列表失败');
- }
- },
-
- // 获取面试详情数据
- async fetchInterviewData(data) {
- try {
- this.loading = true;
- // const res = await getInterviewDetail({ id: this.interviewId });
- // console.log('API返回数据:', res);
-
- // 如果返回的是问题列表
- if (data && Array.isArray(data)) {
- const formattedQuestions = data
- .filter(q => q.question_form !== 0)
- .map((q, index) => ({
- id: q.id || index + 1,
- text: q.question || '未知问题',
- options: q.options || [],
- correctAnswer: q.correctAnswer || 0,
- isImportant: q.is_system || false,
- explanation: q.explanation || '',
- questionType: q.question_form,
- questionTypeName: q.question_form_name || '单选题',
- is_required_correct: q.is_required_correct || false,
- correctAnswers: q.correct_answers || [],
- difficulty: q.difficulty || 1,
- difficultyName: q.difficulty_name || '初级',
- imageUrl: q.question_image_url || '', // 添加图片URL字段
- category: q.category || 0, // 添加 category 字段
- }));
-
- // 处理题目分组
- this.processQuestionGroups(formattedQuestions);
- } else {
- // 处理单个问题
- this.processInterviewData(res);
- }
- console.log(this.questions);
- // 设置总题目数
- this.totalQuestions = this.questions.length;
-
- /* // 启动倒计时
- if (this.questions.length > 0) {
- this.startTimer();
- } */
- } catch (error) {
- console.error('获取面试详情失败:', error);
- this.handleLoadError('获取面试详情失败');
- } finally {
- this.loading = false;
- }
- },
-
- // 处理面试数据
- processInterviewData(data) {
- // 清空现有问题列表
- this.questions = [];
-
- // 检查数据格式并处理
- if (data && data.question_form !== 0) { // 只处理非开放问题
- // 创建一个格式化的问题对象
- const formattedQuestion = {
- id: data.id || 1,
- text: data.question || '未知问题',
- options: data.options || [],
- correctAnswer: data.correctAnswer || 0,
- isImportant: data.is_system || false,
- explanation: data.explanation || '',
- questionType: data.question_form, // 1-单选题,2-多选题,3-看图答题
- questionTypeName: data.question_form_name || '单选题',
- is_required_correct: data.is_required_correct || false,
- correctAnswers: data.correct_answers || [],
- difficulty: data.difficulty || 1,
- difficultyName: data.difficulty_name || '初级',
- imageUrl: data.question_image_url || '' // 添加图片URL字段
- };
-
- // 添加到问题列表
- this.questions.push(formattedQuestion);
-
- // 设置总题目数
- this.totalQuestions = this.questions.length;
-
- /* // 启动倒计时
- this.startTimer(); */
- } else {
- this.handleLoadError('没有可用的选择题');
- }
- },
-
- // 处理加载错误
- handleLoadError(message) {
- this.loadError = true;
- this.loading = false;
- this.errorMessage = message || '加载失败';
- uni.showToast({
- title: message || '加载失败',
- icon: 'none',
- duration: 2000
- });
- },
-
- startTimer() {
- // 确保问题已加载
- if (this.questions.length === 0) return;
-
- // 记录开始时间
- this.questionStartTime = new Date();
-
- // 设置倒计时时间(秒)
- let seconds = 60; // 每题60秒,可以根据需要调整
- this.remainingTime = `01:00`;
-
- this.timerInterval = setInterval(() => {
- seconds--;
- if (seconds <= 0) {
- clearInterval(this.timerInterval);
- // 时间到,自动提交答案并进入下一题
- if (!this.showResult) {
- this.checkAnswer();
- // 短暂延迟后自动进入下一题
- setTimeout(() => {
- if (this.currentQuestionIndex < this.questions.length - 1) {
- this.goToNextQuestion();
- } else {
- // 如果是最后一题,显示结束模态框或跳转
- uni.navigateTo({
- url: '/pages/interview-question/interview-question'
- });
- }
- }, 1500);
- }
- }
-
- // 格式化显示时间 (不再显示,但仍然计算用于内部逻辑)
- const min = Math.floor(seconds / 60).toString().padStart(2, '0');
- const sec = (seconds % 60).toString().padStart(2, '0');
- this.remainingTime = `${min}:${sec}`;
- }, 1000);
- },
- resetTimer() {
- clearInterval(this.timerInterval);
- /* this.startTimer(); */
- },
- selectOption(index) {
- // 如果是最后一题且已经显示继续按钮,不允许重复作答
- if (this.currentQuestionIndex === this.questions.length - 1 && this.showContinueButton) {
- uni.showToast({
- title: '该题目已完成,请继续下一部分',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- // 如果已经显示结果,不允许再次选择
- if (this.showResult) return;
-
- console.log('selectOption', index);
- // 判断当前题目类型
- if (this.currentQuestion.questionType === 2) {
- // 如果已经选中,则取消选中
- const optionIndex = this.selectedOptions.indexOf(index);
- if (optionIndex > -1) {
- this.selectedOptions.splice(optionIndex, 1);
- } else {
- // 否则添加到已选中数组
- this.selectedOptions.push(index);
- }
- // 多选题不自动提交,需要用户手动点击"提交答案"按钮
- } else if (this.currentQuestion.questionType === 1 || this.currentQuestion.questionType === 3 || this.currentQuestion.questionType === 4) {
- this.selectedOption = index;
- this.playAiSpeaking();
-
- setTimeout(() => {
- this.checkAnswer();
- this.saveAnswer();
-
- this.submitCurrentAnswer().then(() => {
- setTimeout(() => {
- this.goToNextQuestion();
- }, 800);
- }).catch(error => {
- console.error('提交答案失败:', error);
- setTimeout(() => {
- this.goToNextQuestion();
- }, 1000);
- });
- }, 500);
- } else {
- // 单选题逻辑
- this.selectedOption = index;
- // 保存答案到 answers 数组
- const answer = {
- questionId: this.currentQuestion.id,
- questionType: this.currentQuestion.questionType,
- answer: index
- };
- const existingIndex = this.answers.findIndex(a => a.questionId === answer.questionId);
- if (existingIndex > -1) {
- this.answers[existingIndex] = answer;
- } else {
- this.answers.push(answer);
- }
-
- this.playAiSpeaking();
-
- setTimeout(() => {
- this.checkAnswer();
- this.saveAnswer();
-
- this.submitCurrentAnswer().then(() => {
- setTimeout(() => {
- this.goToNextQuestion();
- }, 800);
- }).catch(error => {
- console.error('提交答案失败:', error);
- setTimeout(() => {
- this.goToNextQuestion();
- }, 1000);
- });
- }, 500);
- }
- },
-
- checkAnswer() {
- // 如果已经显示结果,说明已经提交过答案,不再重复提交
- if (this.showResult) return;
-
- clearInterval(this.timerInterval); // 停止计时
-
- // 确保当前问题存在
- if (!this.currentQuestion) {
- console.error('当前问题不存在');
- return;
- }
-
- // 根据题目类型检查答案是否正确
- if (this.currentQuestion.questionType === 0) {
- this.isAnswerCorrect = true;
- } else if (this.currentQuestion.questionType === 2) {
- const sortedSelected = [...this.selectedOptions].sort();
- const sortedCorrect = [...this.currentQuestion.correctAnswers].sort();
-
- if (sortedSelected.length !== sortedCorrect.length) {
- this.isAnswerCorrect = false;
- } else {
- this.isAnswerCorrect = sortedSelected.every((value, index) => value === sortedCorrect[index]);
- }
- } else {
- this.isAnswerCorrect = this.selectedOption === this.currentQuestion.correctAnswer;
- }
-
- // 显示结果
- this.showResult = true;
-
- // 保存当前题目的答案
- this.saveAnswer();
-
- // 如果是最后一题,确保状态被保存
- if (this.currentQuestionIndex === this.questions.length - 1) {
- this.$nextTick(() => {
- // 强制更新视图
- this.$forceUpdate();
- });
- }
- },
- // 修改 nextQuestion 方法,只处理多选题
- nextQuestion() {
- // 确保当前是多选题
- if (this.currentQuestion.questionType !== 2) return;
-
- // 检查答案并提交
- this.checkAnswer();
-
- // 保存当前题目的答案
- this.saveAnswer();
-
- // 提交答案
- this.submitCurrentAnswer().then(() => {
- // 提交成功后,短暂延迟后自动进入下一题
- setTimeout(() => {
- // 如果是最后一题,检查是否是最后一组题目
- if (this.currentQuestionIndex >= this.questions.length - 1) {
- 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();
- }
- }, 500); // 0.5秒后自动进入下一题
- }).catch(error => {
- console.error('提交答案失败:', error);
- // 即使提交失败也继续下一题
- setTimeout(() => {
- if (this.currentQuestionIndex >= this.questions.length - 1) {
- 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();
- }
- }, 1000);
- });
- },
- toggleSettings() {
- // 打开设置面板
- uni.showToast({
- title: '设置功能开发中',
- icon: 'none'
- });
- },
- back(target) {
- // 清除计时器
- if (this.timerInterval) {
- clearInterval(this.timerInterval);
- }
-
- // 如果指定了跳转目标
- if (target) {
- uni.navigateTo({
- url: target
- });
- return;
- }
-
- // 否则尝试返回上一页,如果失败则跳转到首页
- // try {
- // const pages = getCurrentPages();
- // if (pages.length > 1) {
- // uni.reLaunch({
- // url: '/pages/index/index'
- // });
- // } else {
- // // 如果当前是第一页,则跳转到首页
- // uni.reLaunch({
- // url: '/pages/index/index'
- // });
- // }
- // } catch (e) {
- // console.error('导航错误:', e);
- // // 出错时也跳转到首页
- // uni.reLaunch({
- // url: '/pages/index/index'
- // });
- // }
- },
- error(e) {
- // 相机错误事件
- console.error(e.detail);
- uni.showToast({
- title: '相机启动失败,请检查权限设置',
- icon: 'none'
- });
- },
- playAiSpeaking() {
- if (this.useVideo && this.aiVideoContext) {
- this.aiVideoContext.play();
- }
-
- // 触发数字人说话动画
- if (this.digitalHumanUrl) {
- // 假设当前问题的文本作为数字人要说的内容
- const speakText = this.currentQuestion ? this.currentQuestion.text : '';
- this.interactWithDigitalHuman(speakText);
- }
- },
- pauseAiSpeaking() {
- if (this.useVideo && this.aiVideoContext) {
- this.aiVideoContext.pause();
- }
- },
-
- // 修改 restartTest 方法,添加可选的跳转目标
- restartTest(target) {
- this.currentQuestionIndex = 0;
- this.score = 0;
- this.showEndModal = false;
- this.showResult = false;
- this.selectedOption = null;
- this.selectedOptions = [];
- this.resetTimer();
-
- // 如果指定了跳转目标
- if (target) {
- uni.navigateTo({
- url: target
- });
- }
- },
- // 在methods中添加测试方法
- testEndScreen() {
- this.interviewCompleted = true;
- this.showEndModal = false;
- },
- // 初始化数字人
- initDigitalHuman() {
- // 移除不可用的示例URL
- // this.digitalHumanUrl = 'https://your-digital-human-service.com/avatar?id=123';
-
- // 暂时不使用数字人服务,直接使用本地图片
- this.digitalHumanUrl = '';
-
- // 如果您有实际可用的数字人服务,可以在这里设置
- // 例如:this.digitalHumanUrl = 'https://your-actual-service.com/avatar';
-
- // 或者使用本地HTML文件(如果有的话)
- // this.digitalHumanUrl = '/hybrid/html/digital-human.html';
- },
-
- // 与数字人交互的方法
- interactWithDigitalHuman(message) {
- // 如果数字人是通过web-view加载的,可以使用postMessage与其通信
- const webview = this.$mp.page.$getAppWebview().children()[0];
- if (webview) {
- webview.evalJS(`receiveMessage('${message}')`);
- }
- },
- // 添加 navigateToInterview 方法
- navigateToInterview() {
- // 关闭模态框
- this.showEndModal = false;
-
- // 跳转到interview页面
- uni.navigateTo({
- url: '/pages/interview/interview',
- success: () => {
- console.log('成功跳转到interview页面');
- },
- fail: (err) => {
- console.error('跳转失败:', err);
- uni.showToast({
- title: '跳转失败,请手动返回首页',
- icon: 'none'
- });
- }
- });
- },
- // 添加 handleCameraError 方法
- handleCameraError(e) {
- console.error('相机错误:', e.detail);
- uni.showToast({
- title: '相机启动失败,请检查权限设置',
- icon: 'none'
- });
- },
- // 修改 isOptionSelected 方法
- isOptionSelected(question, qIndex, optionIndex) {
- // 获取该题的答案
- const answer = this.answers.find(a => a.questionId === question.id);
-
- // 如果是当前正在回答的题目
- if (qIndex === this.currentQuestionIndex) {
- if (question.questionType === 1 || question.questionType === 3 || question.questionType === 4) {
- return this.selectedOption === optionIndex;
- } else if (question.questionType === 2) {
- return this.selectedOptions.includes(optionIndex);
- }
- }
- // 如果是已回答过的题目,使用保存的答案
- else if (answer) {
- if (question.questionType === 1 || question.questionType === 3 || question.questionType === 4) {
- return answer.answer === optionIndex;
- } else if (question.questionType === 2 && Array.isArray(answer.answer)) {
- return answer.answer.includes(optionIndex);
- }
- }
-
- return false;
- },
- // 修改 handleOptionClick 方法
- handleOptionClick(qIndex, index) {
- // 如果点击的是已完成的题目
- if (qIndex < this.currentQuestionIndex) {
- uni.showToast({
- title: '该题目已完成,无法修改',
- icon: 'none',
- duration: 2000
- });
- return;
- }
-
- // 如果是最后一题且已经显示继续按钮,不允许重复作答
- if (qIndex === this.questions.length - 1 && this.showContinueButton) {
- uni.showToast({
- title: '该题目已完成,请继续下一部分',
- icon: 'none',
- duration: 2000
- });
- return;
- }
-
- // 如果点击的是还未到的题目
- if (qIndex > this.currentQuestionIndex) {
- // 查找第一个未完成的题目索引
- const firstUnansweredIndex = this.currentQuestionIndex;
- uni.showToast({
- title: `请先完成第 ${firstUnansweredIndex + 1} 题`,
- icon: 'none',
- duration: 2000
- });
-
- // 滚动到当前应该做的题目
- this.currentScrollId = 'question-' + firstUnansweredIndex;
- return;
- }
-
- // 防重复点击
- if (this._isClicking) {
- return;
- }
- this._isClicking = true;
-
- // 清除之前的计时器
- if (this._clickTimer) {
- clearTimeout(this._clickTimer);
- }
-
- try {
- // 如果是当前题目,调用选择逻辑
- this.selectOption(index);
-
- // 设置延时,防止快速重复点击
- this._clickTimer = setTimeout(() => {
- this._isClicking = false;
- }, 1000);
-
- } catch (error) {
- console.error('处理选项点击失败:', error);
- uni.showToast({
- title: '操作失败,请重试',
- icon: 'none'
- });
- this._isClicking = false;
- }
- },
- // 处理题目分组
- processQuestionGroups(questions) {
- // 创建两个分组
- const group1 = []; // category 为 5 的题目
- const group2 = []; // 其他题目
- // 对题目进行分类
- questions.forEach(q => {
- if (q.category === 5) {
- group1.push(q);
- } else {
- group2.push(q);
- }
- });
- // 按照要求的顺序组合题目组:先显示其他题目,再显示 category 为 5 的题目
- this.questionGroups = [group2, group1].filter(group => group.length > 0);
-
- // 设置当前显示的题目
- this.questions = this.questionGroups[0] || [];
- },
- // 处理继续按钮点击
- handleContinue() {
- if (this.currentGroupIndex < this.questionGroups.length - 1) {
- // 检查是否是第一组结束
- if (this.currentGroupIndex === 0) {
- this.showPromptModal = true; // 显示提示弹窗
- } else {
- this.proceedToNextGroup();
- }
- } else {
- // 所有组都完成了,跳转到下一个页面
- uni.navigateTo({
- url: '/pages/interview-question/interview-question'
- });
- }
- },
- // 添加新的方法处理弹窗确认
- handlePromptConfirm() {
- this.showPromptModal = false;
- this.proceedToNextGroup();
- },
- // 添加新的方法处理组切换逻辑
- proceedToNextGroup() {
- this.currentGroupIndex++;
- this.questions = this.questionGroups[this.currentGroupIndex];
- this.currentQuestionIndex = 0;
- this.showContinueButton = false;
- this.currentScrollId = 'question-0';
-
- // 重置滚动位置
- this.scrollTop = 0;
-
- // 重置相关状态
- this.selectedOption = null;
- this.selectedOptions = [];
- this.showResult = false;
- },
- // 保存当前题目的答案
- 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() {
- if (this.timerInterval) {
- clearInterval(this.timerInterval);
- }
- }
- }
- </script>
- <style>
- .camera-container {
- position: relative;
- width: 100%;
- height: 100vh;
- background-color: #ffffff;
- display: flex;
- flex-direction: column;
- overflow: hidden; /* 防止内容溢出 */
- }
- .header {
- height: 90rpx;
- /* background-color: #000000; */
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- /* color: #ffffff; */
- }
- .back-button {
- width: 60rpx;
- height: 60rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .title {
- flex: 1;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- }
- .controls {
- display: flex;
- gap: 30rpx;
- }
- .iconfont {
- font-size: 40rpx;
- }
- .content {
- flex: 1;
- display: flex;
- flex-direction: column;
- position: relative;
- padding: 50rpx 20rpx 0;
- }
- .progress-container {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin-bottom: 20rpx;
- }
- .progress-step {
- display: flex;
- align-items: center;
- margin-bottom: 10rpx;
- }
- .step-circle {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- background-color: #e0e0e0;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- margin-right: 10rpx;
- }
- .step-circle.active {
- background-color: #ff9500;
- color: #ffffff;
- }
- .step-text {
- font-size: 24rpx;
- color: #666666;
- }
- .progress-bar {
- height: 10rpx;
- background-color: #e0e0e0;
- border-radius: 5rpx;
- overflow: hidden;
- margin-bottom: 20rpx;
- }
- .progress-fill {
- height: 100%;
- background-color: #00c853;
- transition: width 0.3s;
- }
- .interview-content {
- flex: 1;
- display: flex;
- flex-direction: column;
- margin-bottom: 40rpx;
- padding: 20rpx;
- border-bottom: 1px solid #eee;
- }
- .video-area {
- display: flex;
- /* flex-direction: column; */
- justify-content: space-between;
- height: auto;
- margin-bottom: 20rpx;
- }
- .video-camera {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- width: 65%;
- }
- .interviewer {
- background-color: #f5f5f5;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- width: 48% !important;
- height: 300rpx;
- }
- .interviewer-video {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .interviewer-avatar {
- width: 80%;
- height: 80%;
- object-fit: contain;
- }
- .user-camera-container {
- width: 48%;
- height: 300rpx;
- border-radius: 10rpx;
- overflow: hidden;
- border: 4rpx solid #ffffff;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.2);
- }
- .question-area {
- flex: 1;
- display: flex;
- flex-direction: column;
- }
- .question-number {
- font-size: 28rpx;
- color: #666;
- margin-bottom: 20rpx;
- }
-
- .question-importance {
- background-color: #f9f9f9;
- padding: 20rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- font-size: 28rpx;
- color: #333;
- }
-
- .question-importance text {
- color: #ff0000;
- /* margin-right: 10rpx; */
- }
- .options {
- display: flex;
- flex-direction: column;
- gap: 20rpx;
- margin-bottom: 30rpx;
- }
- .option-item {
- padding: 20rpx;
- background-color: #f5f5f5;
- border-radius: 10rpx;
- font-size: 28rpx;
- transition: all 0.3s;
- border: 1px solid #e0e0e0;
- display: flex;
- align-items: center;
- cursor: pointer; /* 添加指针样式 */
- }
- .option-item:active {
- transform: scale(0.98); /* 点击时轻微缩小效果 */
- opacity: 0.9;
- }
- .option-selected {
- background-color: #e6f7ff;
- border: 1px solid #1890ff;
- }
- /* 添加选中后的动画效果 */
- @keyframes selectedPulse {
- 0% { box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.4); }
- 70% { box-shadow: 0 0 0 10px rgba(24, 144, 255, 0); }
- 100% { box-shadow: 0 0 0 0 rgba(24, 144, 255, 0); }
- }
- .option-selected {
- animation: selectedPulse 1.5s ease-out;
- }
-
- .option-correct {
- background-color: #d4f7d4;
- border: 1px solid #52c41a;
- }
-
- .option-wrong {
- background-color: #fff1f0;
- border: 1px solid #ff4d4f;
- }
- .option-text {
- color: #333;
- }
-
- .timer-container {
- text-align: right;
- margin: 20rpx 0;
- }
-
- .timer-text {
- font-size: 24rpx;
- color: #666;
- background-color: #f0f0f0;
- padding: 6rpx 12rpx;
- border-radius: 6rpx;
- }
- .bottom-button-container {
- position: fixed;
- bottom: 50px;
- left: 5%;
- right: 0;
- padding: 20rpx;
- display: flex;
- justify-content: center;
- z-index: 10;
- }
- .bottom-button-wrapper {
- display: flex;
- width: 100%;
- justify-content: space-between;
- align-items: center;
- }
- .timer-display {
- font-size: 28rpx;
- color: #666;
- padding: 10rpx 20rpx;
- border-radius: 6rpx;
- }
- .next-button {
- background-color: #0039b3;
- color: #ffffff;
- border-radius: 10rpx;
- font-size: 30rpx;
- height: 80rpx;
- line-height: 80rpx;
- width: 90%;
- text-align: center;
- margin: 0;
- }
- .footer {
- height: 100rpx;
- background-color: #000000;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- color: #ffffff;
- }
- .timer {
- font-size: 28rpx;
- }
- .next-step {
- font-size: 28rpx;
- }
- .interview-end-modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 999;
- }
- .modal-content {
- width: 80%;
- background-color: #ffffff;
- border-radius: 20rpx;
- padding: 40rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .modal-title {
- font-size: 36rpx;
- font-weight: bold;
- margin-bottom: 30rpx;
- }
- .score-display {
- font-size: 48rpx;
- font-weight: bold;
- color: #0039b3;
- margin: 20rpx 0;
- }
-
- .modal-message {
- font-size: 28rpx;
- color: #666;
- text-align: center;
- margin-bottom: 40rpx;
- }
-
- .modal-buttons {
- display: flex;
- justify-content: space-between;
- width: 100%;
- margin-top: 20rpx;
- }
-
- .modal-button {
- width: 45%;
- }
- @keyframes speaking {
- 0% {
- opacity: 0.8;
- }
- 50% {
- opacity: 1;
- }
- 100% {
- opacity: 0.8;
- }
- }
- .speaking {
- animation: speaking 1.5s infinite;
- }
- .digital-avatar {
- display: flex;
- flex-direction: row;
- align-items: flex-start;
- justify-content: space-between;
- width: 100%;
- margin-bottom: 20rpx;
- }
-
- .message-box {
- width: 65%;
- min-height: 120rpx;
- background-color: #f5f5f5;
- border-radius: 10rpx;
- padding: 15rpx;
- margin-right: 20rpx;
- display: flex;
- align-items: center;
- }
- .message-text {
- font-size: 24rpx;
- color: #333;
- line-height: 1.5;
- }
- .user-avatar {
- width: 110px;
- height: 160px;
- border-radius: 10rpx;
- overflow: hidden;
- }
- .camera {
- width: 100%;
- height: 100%;
- border-radius: 10rpx;
- border: 2rpx solid #e0e0e0;
- }
- .avatar-image {
- width: 100%;
- height: 100%;
- border-radius: 10rpx;
- border: 2rpx solid #e0e0e0;
- }
- .digital-human-webview {
- width: 100%;
- height: 100%;
- border-radius: 10rpx;
- border: 2rpx solid #e0e0e0;
- }
- .interview-complete-screen {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #f0f5ff;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- z-index: 1000;
- padding: 40rpx;
- }
- .digital-avatar-large {
- width: 200rpx;
- height: 200rpx;
- margin-bottom: 60rpx;
- }
- .avatar-image-large {
- width: 100%;
- height: 100%;
- border-radius: 30rpx;
- }
- .complete-message {
- font-size: 40rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 30rpx;
- }
- .complete-description {
- font-size: 28rpx;
- color: #666;
- text-align: center;
- margin-bottom: 80rpx;
- line-height: 1.5;
- }
- .complete-button {
- background-color: #0039b3;
- color: #ffffff;
- border-radius: 10rpx;
- font-size: 32rpx;
- padding: 20rpx 60rpx;
- margin-top: 40rpx;
- }
- /* 添加加载状态样式 */
- .loading-container {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- background-color: rgba(255, 255, 255, 0.9);
- z-index: 100;
- }
-
- .loading-text {
- margin-top: 20rpx;
- font-size: 28rpx;
- color: #666;
- }
-
- .error-container {
- text-align: center;
- }
-
- .error-message {
- font-size: 28rpx;
- color: #ff4d4f;
- margin-bottom: 30rpx;
- }
-
- .retry-button {
- background-color: #0039b3;
- color: #ffffff;
- border-radius: 10rpx;
- font-size: 28rpx;
- padding: 10rpx 30rpx;
- }
- .question-type {
- display: inline-block;
- /* background-color: #0039b3; */
- color: white;
- font-size: 24rpx;
- /* padding: 4rpx 5rpx; */
- border-radius: 6rpx;
- /* margin-right: 10rpx; */
- }
- /* 新增的开放问题样式 */
- .open-question-container {
- display: flex;
- flex-direction: column;
- width: 100%;
- margin-bottom: 20rpx;
- }
- .open-question-input {
- width: 100%;
- height: 300rpx;
- background-color: #f9f9f9;
- border: 1px solid #e0e0e0;
- border-radius: 10rpx;
- padding: 20rpx;
- font-size: 28rpx;
- color: #333;
- }
- .word-count {
- text-align: right;
- font-size: 24rpx;
- color: #999;
- margin-top: 10rpx;
- }
- .option-prefix {
- margin-right: 10rpx;
- font-weight: bold;
- color: #333;
- min-width: 30rpx;
- }
- /* 新增的图片显示样式 */
- .question-image-container {
- width: 100%;
- margin: 20rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .question-image {
- width: 100%;
- max-width: 600rpx;
- border-radius: 10rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
- }
- /* 添加滚动视图样式 */
- .content-scroll {
- flex: 1;
- height: calc(100vh - 200px); /* 只减去顶部相机的高度 */
- margin-top: 10px;
- }
- /* 添加底部空白区域,防止内容被固定按钮遮挡 */
- .bottom-space {
- height: 50rpx; /* 减小底部空白区域 */
- }
- /* 添加流式布局相关样式 */
- .interview-content {
- margin-bottom: 40rpx;
- padding: 20rpx;
- border-bottom: 1px solid #eee;
- }
-
- .option-disabled {
- opacity: 0.7;
- background-color: #f0f0f0;
- }
-
- .question-button-container {
- margin-top: 20rpx;
- display: flex;
- justify-content: center;
- }
-
- .bottom-timer-container {
- display: none;
- }
- /* 添加固定相机容器样式 */
- .fixed-camera-container {
- position: sticky;
- top: 0;
- width: 100%;
- padding: 20rpx;
- background-color: #fff;
- z-index: 10;
- display: flex;
- justify-content: flex-start;
- border-bottom: 1px solid #eee;
- }
- .camera-warning {
- animation: camera-warning-flash 1s ease-in-out infinite;
- border: 2px solid #ff0000;
- }
- @keyframes camera-warning-flash {
- 0% {
- border-color: #ff0000;
- box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
- }
- 50% {
- border-color: rgba(255, 0, 0, 0.3);
- box-shadow: 0 0 5px rgba(255, 0, 0, 0.4);
- }
- 100% {
- border-color: #ff0000;
- box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
- }
- }
-
- .user-avatar {
- width: 110px;
- height: 160px;
- border-radius: 10rpx;
- overflow: hidden;
- }
- /* 添加继续按钮样式 */
- .continue-button-container {
- display: flex;
- justify-content: center;
- padding: 20rpx;
- margin-top: 20rpx;
- }
- .continue-button {
- background-color: #0039b3;
- color: #ffffff;
- border-radius: 10rpx;
- font-size: 30rpx;
- height: 80rpx;
- line-height: 80rpx;
- width: 90%;
- text-align: center;
- }
- /* 添加新的样式 */
- .prompt-modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 1000;
- }
- .prompt-content {
- width: 85%;
- background-color: #ffffff;
- border-radius: 20rpx;
- padding: 40rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .prompt-title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 30rpx;
- }
- .prompt-text {
- font-size: 28rpx;
- color: #666;
- line-height: 1.6;
- margin-bottom: 20rpx;
- text-align: justify;
- }
- .bold-text {
- font-weight: bold;
- color: #333;
- }
- .prompt-button {
- background-color: #0039b3;
- color: #ffffff;
- border-radius: 10rpx;
- font-size: 30rpx;
- height: 80rpx;
- line-height: 80rpx;
- width: 60%;
- text-align: center;
- margin-top: 30rpx;
- }
- </style>
|