topic.DgxYyN-O.js 11 KB

1
  1. import{a as G,aB as K,r as M,q as W,aj as Z,c as n,o as r,b as e,S as J,K as O,M as c,Q as d,R as m,a9 as Q,G as x}from"./vue.D1BjjNmv.js";import{S as X}from"./index.Bx06hV4z.js";import{_ as Y}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ee={class:"page-container"},se={class:"content-container"},te={class:"max-w-4xl mx-auto p-6"},oe={key:0,class:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative",role:"alert"},ae={class:"block sm:inline"},ie={key:1,class:"flex flex-col items-center justify-center py-12 bg-gray-50 rounded-lg"},ne={key:2,class:"space-y-4"},re={class:"mb-4"},de={class:"flex items-start space-x-2"},le={class:"bg-blue-100 text-blue-800 px-2 py-1 rounded text-sm"},ce={class:"bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm"},_e={class:"flex-1"},ue={class:"font-semibold text-gray-800"},pe={key:0,class:"mt-4"},ve={class:"bg-white p-4 rounded-lg"},he={key:0,class:"space-y-3"},ge={class:"flex items-center justify-between"},me={class:"flex-1"},xe={class:"text-gray-700"},fe={class:"flex items-center space-x-2"},ye={key:0,class:"text-green-500"},we={key:0,class:"text-blue-500"},be={class:"mt-4 flex justify-between items-center"},ke={class:"text-gray-600"},qe={key:0},je={key:1,class:"mt-4"},Ie={class:"flex space-x-4"},Le={class:"w-2/3"},Ve={class:"bg-white p-4 rounded-lg"},Be={class:"mb-4"},Ce={class:"flex items-start space-x-2"},Re={class:"flex-1"},Se={class:"text-gray-700"},Fe={class:"flex items-start space-x-2"},Me={class:"flex-1"},Qe={class:"text-gray-600 m-0"},Ne={class:"mt-1 text-blue-500"},$e={class:"w-1/3"},Ae={class:"video-container"},He=["src","poster"],Te={key:0,class:"mt-4 pl-8 border-l-2 border-gray-200"},Ue={class:"flex items-start space-x-2"},ze={class:"flex-1"},De={class:"font-medium text-gray-800"},Pe={class:"mt-2"},Ee={class:"flex space-x-4"},Ge={class:"w-2/3"},Ke={class:"bg-white p-4 rounded-lg"},We={class:"mb-4"},Ze={class:"flex items-start space-x-2"},Je={class:"flex-1"},Oe={class:"text-gray-700"},Xe={class:"flex items-start space-x-2"},Ye={class:"flex-1"},es={class:"text-gray-600 m-0"},ss={class:"mt-1 text-blue-500"},ts={key:0,class:"w-1/3"},os={class:"video-container"},as=["src","poster"],is={key:2,class:"mt-4"},ns={class:"grid grid-cols-2 gap-4"},rs={class:"bg-white p-4 rounded-lg"},ds={class:"aspect-w-16 aspect-h-9 rounded-lg overflow-hidden bg-gray-100"},ls=["src"],cs={class:"bg-white p-4 rounded-lg"},_s={key:0,class:"space-y-3"},us={class:"flex items-center justify-between"},ps={class:"flex-1"},vs={class:"text-gray-700"},hs={class:"flex items-center space-x-2"},gs={key:0,class:"text-green-500"},ms={class:"mt-4 flex justify-between items-center"},xs={class:"text-gray-600"},fs=G({__name:"topic",setup(ys){const N=K(),f=M([]),C=M(!0),R=M(""),p=M("data:image/svg+xml;base64,PHN2ZyB..."),D=i=>{const t=i.target;t&&(t.src=p.value,t.onerror=null)},A=i=>{const t=i.target;t&&(t.readyState>=1?T(t):t.addEventListener("loadedmetadata",()=>{T(t)}))},H=i=>{const t=i.target;t&&(t.poster=p.value,console.error("视频加载错误"))},P=async()=>{var i;C.value=!0;try{const t=N.query.id||"1",_=N.query.tenant_id||"1",s=N.query.applicationId||"1",v=await(await fetch(`https://backend.qicai321.com/api/job/application_detail?tenant_id=${X.get("tenant_id")}&application_id=${s}`)).json();if(v.code===2e3&&((i=v.data)!=null&&i.interview_progress)){const S=v.data.interview_progress.filter(o=>o.video_answer||o.answer_data).map(o=>{var u,h;const l={question:o.question_text||"未提供问题",answer:"",analysis:"",score:"",question_form:o.question_form,parent_question_id:o.parent_question_id,options:o.options,answer_data:o.answer_data,follow_up_questions:[],question_id:o.question_id};return o.video_answer&&(l.answer=o.video_answer.transcript||"",l.analysis=((u=o.video_answer.ai_analysis)==null?void 0:u.comment)||"",l.score=o.video_answer.ai_score?`${o.video_answer.ai_score}分`:"",l.videoUrl=o.video_answer.video_url||""),o.answer_data&&(l.answer=o.answer_data.text_answer||"",l.is_correct=((h=o.answer_data.selected_option_details)==null?void 0:h.some(F=>F.is_correct))||!1),o.question_form===3&&(l.question_image_url=o.question_image_url||""),l}),w=[],b=[];S.forEach(o=>{o.question_form===5&&o.parent_question_id?b.push(o):w.push(o)});const k=w.sort((o,l)=>{const u=h=>{switch(h){case 0:return 1;case 5:return 2;case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;default:return 99}};return u(o.question_form||-1)-u(l.question_form||-1)});[...b].reverse().forEach(o=>{const l=k.find(u=>u.question_form===0&&u.question_id===o.parent_question_id);l&&(l.follow_up_questions||(l.follow_up_questions=[]),l.follow_up_questions.unshift(o))}),f.value=k}else R.value=v.msg||"获取数据失败"}catch(t){console.error("获取面试记录失败:",t),R.value="获取数据失败,请稍后重试"}finally{C.value=!1}},T=i=>{const t=()=>{try{if(i.readyState>=2){const _=document.createElement("canvas");_.width=i.videoWidth||320,_.height=i.videoHeight||240;const s=_.getContext("2d");if(s){i.currentTime=.1,s.drawImage(i,0,0,_.width,_.height);const y=_.toDataURL("image/jpeg");i.poster=y,i.removeEventListener("loadeddata",t)}}}catch(_){console.error("捕获视频第一帧失败:",_),i.poster=p.value}};i.addEventListener("loadeddata",t),i.readyState>=2&&t(),i.addEventListener("error",()=>{console.error("视频加载失败"),i.poster=p.value}),setTimeout(()=>{(!i.poster||i.poster==="")&&(i.poster=p.value)},3e3)},E=i=>({0:"视频问答题(AI面试官提问)",1:"单选题(知识检测)",2:"多选题(综合选择)",3:"图片选择题(场景判断)",4:"问卷题(个性测评)",5:"开放问答题(追问互动)"})[i]||"未知题型";return W(()=>{P()}),(i,t)=>{const _=Z("a-spin");return r(),n("div",ee,[e("div",se,[e("div",te,[J(_,{spinning:C.value,tip:"加载中..."},{default:O(()=>[R.value?(r(),n("div",oe,[t[0]||(t[0]=e("strong",{class:"font-bold"},"错误!",-1)),e("span",ae,d(R.value),1)])):!C.value&&(!f.value||f.value.length===0)?(r(),n("div",ie,t[1]||(t[1]=[e("svg",{class:"w-16 h-16 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),e("h3",{class:"mt-4 text-lg font-medium text-gray-900"},"暂无面试记录",-1),e("p",{class:"mt-1 text-sm text-gray-500"},"当前没有任何面试记录数据",-1)]))):f.value.length>0?(r(),n("div",ne,[(r(!0),n(m,null,Q(f.value,(s,y)=>{var v,S,w,b,k,$,o,l,u,h,F,U;return r(),n("div",{key:y,class:"bg-gray-50 rounded-lg p-4"},[e("div",re,[e("div",de,[e("div",le,"第"+d(y+1)+"题",1),e("div",ce,d(E(s.question_form||0)),1),e("div",_e,[e("h3",ue,d(s.question),1)])]),s.question_form===1||s.question_form===2||s.question_form===4?(r(),n("div",pe,[e("div",ve,[s.options&&s.options.length>0?(r(),n("div",he,[(r(!0),n(m,null,Q(s.options,(a,q)=>{var j,I,L,V,g,z;return r(),n("div",{key:q,class:x(["p-3 rounded border",(I=(j=s.answer_data)==null?void 0:j.selected_option_details)!=null&&I.some(B=>B.id===a.id)?"border-blue-300 bg-blue-50":"border-gray-200"])},[e("div",ge,[e("div",me,[e("span",xe,d(a.option_text),1)]),e("div",fe,[s.question_form!==4?(r(),n(m,{key:0},[a.is_correct?(r(),n("span",ye,"✓ 正确答案")):c("",!0),(V=(L=s.answer_data)==null?void 0:L.selected_option_details)!=null&&V.some(B=>B.id===a.id)?(r(),n("span",{key:1,class:x(a.is_correct?"text-green-500":"text-red-500")},d(a.is_correct?"(已选 - 正确)":"(已选 - 错误)"),3)):c("",!0)],64)):(r(),n(m,{key:1},[(z=(g=s.answer_data)==null?void 0:g.selected_option_details)!=null&&z.some(B=>B.id===a.id)?(r(),n("span",we," (已选) ")):c("",!0)],64))])])],2)}),128))])):c("",!0),e("div",be,[e("div",ke," 候选人: "+d(((S=(v=s.answer_data)==null?void 0:v.selected_option_details)==null?void 0:S.map(a=>a.option_text).join(", "))||"未作答"),1),s.question_form!==4?(r(),n("div",qe,[e("span",{class:x(["px-3 py-1 rounded-full text-sm",(b=(w=s.answer_data)==null?void 0:w.selected_option_details)!=null&&b.every(a=>a.is_correct)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},d(($=(k=s.answer_data)==null?void 0:k.selected_option_details)!=null&&$.every(a=>a.is_correct)?"正确":"错误"),3)])):c("",!0)])])])):s.question_form===0||s.question_form===5?(r(),n("div",je,[e("div",Ie,[e("div",Le,[e("div",Ve,[e("div",Be,[e("div",Ce,[t[2]||(t[2]=e("div",{class:"bg-green-100 text-green-800 px-2 py-1 rounded text-sm"},"候选人",-1)),e("div",Re,[e("p",Se,d(s.answer),1)])])]),e("div",null,[e("div",Fe,[t[3]||(t[3]=e("div",{class:"bg-yellow-100 text-yellow-800 px-2 py-1 rounded text-sm"},"AI评分",-1)),e("div",Me,[e("p",Qe,d(s.analysis),1),e("div",Ne,"得分:"+d(s.score),1)])])])])]),e("div",$e,[e("div",Ae,[e("video",{class:"w-full h-full object-cover rounded-lg",controls:"",src:s.videoUrl,preload:"metadata",poster:p.value,onLoadeddata:A,onError:H}," 您的浏览器不支持视频播放。 ",40,He)])])]),s.follow_up_questions&&s.follow_up_questions.length>0?(r(),n("div",Te,[(r(!0),n(m,null,Q(s.follow_up_questions,(a,q)=>(r(),n("div",{key:q,class:"mb-4"},[e("div",Ue,[t[6]||(t[6]=e("div",{class:"bg-purple-100 text-purple-800 px-2 py-1 rounded text-sm"},"追问题",-1)),e("div",ze,[e("h4",De,d(a.question),1),e("div",Pe,[e("div",Ee,[e("div",Ge,[e("div",Ke,[e("div",We,[e("div",Ze,[t[4]||(t[4]=e("div",{class:"bg-green-100 text-green-800 px-2 py-1 rounded text-sm"},"候选人",-1)),e("div",Je,[e("p",Oe,d(a.answer),1)])])]),e("div",null,[e("div",Xe,[t[5]||(t[5]=e("div",{class:"bg-yellow-100 text-yellow-800 px-2 py-1 rounded text-sm"},"AI评分",-1)),e("div",Ye,[e("p",es,d(a.analysis),1),e("div",ss,"得分:"+d(a.score),1)])])])])]),a.videoUrl?(r(),n("div",ts,[e("div",os,[e("video",{class:"w-full h-full object-cover rounded-lg",controls:"",src:a.videoUrl,preload:"metadata",poster:p.value,onLoadeddata:A,onError:H}," 您的浏览器不支持视频播放。 ",40,as)])])):c("",!0)])])])])]))),128))])):c("",!0)])):s.question_form===3?(r(),n("div",is,[e("div",ns,[e("div",rs,[e("div",ds,[e("img",{src:s.question_image_url,alt:"题目图片",class:"w-full h-full object-contain",onError:D},null,40,ls)])]),e("div",cs,[s.options&&s.options.length>0?(r(),n("div",_s,[(r(!0),n(m,null,Q(s.options,(a,q)=>{var j,I,L,V;return r(),n("div",{key:q,class:x(["p-3 rounded border",(I=(j=s.answer_data)==null?void 0:j.selected_option_details)!=null&&I.some(g=>g.id===a.id)?"border-blue-300 bg-blue-50":"border-gray-200"])},[e("div",us,[e("div",ps,[e("span",vs,d(a.option_text),1)]),e("div",hs,[a.is_correct?(r(),n("span",gs,"✓ 正确答案")):c("",!0),(V=(L=s.answer_data)==null?void 0:L.selected_option_details)!=null&&V.some(g=>g.id===a.id)?(r(),n("span",{key:1,class:x(a.is_correct?"text-green-500":"text-red-500")},d(a.is_correct?"(已选 - 正确)":"(已选 - 错误)"),3)):c("",!0)])])],2)}),128))])):c("",!0),e("div",ms,[e("div",xs," 答案: "+d(((l=(o=s.answer_data)==null?void 0:o.selected_option_details)==null?void 0:l.map(a=>a.option_text).join(", "))||"未作答"),1),e("div",null,[e("span",{class:x(["px-3 py-1 rounded-full text-sm",(h=(u=s.answer_data)==null?void 0:u.selected_option_details)!=null&&h.every(a=>a.is_correct)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"])},d((U=(F=s.answer_data)==null?void 0:F.selected_option_details)!=null&&U.every(a=>a.is_correct)?"正确":"错误"),3)])])])])])):c("",!0)])])}),128))])):c("",!0)]),_:1},8,["spinning"])])])])}}}),qs=Y(fs,[["__scopeId","data-v-701588df"]]);export{qs as default};