123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_config = require("../../common/config.js");
- const _sfc_main = {
- data() {
- return {
- applicationData: null,
- // 存储API返回的原始数据
- candidateInfo: {
- name: "",
- idNumber: "",
- phoneNumber: "",
- score: 0,
- availabilityPeriod: "",
- onboardingTime: "",
- dimensions: {
- teamwork: "",
- learningAbility: "",
- attention: "",
- workAdaptability: "",
- serviceAwareness: ""
- },
- dimensionDetails: {
- teamwork: "",
- learningAbility: "",
- attention: "",
- workAdaptability: "",
- serviceAwareness: ""
- },
- duvAnalysis: [],
- interviewRecord: [],
- videoRecords: [],
- additionalInfo: {
- idVerification: "",
- phoneVerification: "",
- leftHandGestures: {
- passed: true,
- images: []
- },
- rightHandGestures: {
- passed: true,
- images: []
- },
- faceVerification: {
- passed: true,
- images: []
- }
- }
- },
- evaluationScore: 0,
- evaluationComments: "",
- dimensionLabels: {
- teamwork: "团队合作能力",
- learningAbility: "学习能力",
- attention: "细致严谨",
- workAdaptability: "工作适应性",
- serviceAwareness: "服务意识"
- }
- };
- },
- onLoad(options) {
- const id = options.id || 1;
- const tenant_id = options.tenant_id || 1;
- const application_id = options.application_id || 1;
- this.fetchApplicationDetail(id, tenant_id, application_id);
- },
- methods: {
- // 获取申请详情数据
- fetchApplicationDetail(id, tenant_id, application_id) {
- common_vendor.index.showLoading({
- title: "加载中..."
- });
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/api/job/application_detail?id=${id}&tenant_id=${tenant_id}&application_id=${application_id}`,
- method: "GET",
- success: (res) => {
- if (res.data && res.data.code === 2e3) {
- this.applicationData = res.data.data;
- this.processApiData();
- } else {
- common_vendor.index.showToast({
- title: "获取数据失败",
- icon: "none"
- });
- }
- },
- fail: () => {
- common_vendor.index.showToast({
- title: "网络请求失败",
- icon: "none"
- });
- },
- complete: () => {
- common_vendor.index.hideLoading();
- }
- });
- },
- // 处理API返回的数据,映射到现有数据结构
- processApiData() {
- if (!this.applicationData)
- return;
- const { application, applicant, position, interview_progress, posture_photos } = this.applicationData;
- this.candidateInfo.name = applicant.name || "";
- this.candidateInfo.idNumber = applicant.id || "";
- this.candidateInfo.phoneNumber = applicant.phone || "";
- if (application.comprehensive_score) {
- this.candidateInfo.score = application.comprehensive_score;
- } else if (application.ai_capability_scores) {
- const scores = Object.values(application.ai_capability_scores);
- this.candidateInfo.score = scores.length ? Math.round(scores.reduce((a, b) => a + b, 0) / scores.length) : 0;
- }
- if (application.ai_capability_scores) {
- const scoreMapping = {
- "专业性": "workAdaptability",
- "沟通能力": "teamwork",
- "技术匹配度": "learningAbility",
- "解决问题能力": "attention"
- };
- Object.entries(application.ai_capability_scores).forEach(([key, value]) => {
- const mappedKey = scoreMapping[key] || "serviceAwareness";
- let rating = "中等";
- if (value >= 80)
- rating = "优秀";
- else if (value < 65)
- rating = "欠佳";
- this.candidateInfo.dimensions[mappedKey] = rating;
- });
- }
- if (application.ai_analysis_details && application.ai_analysis_details.requirements_feedback) {
- const feedback = application.ai_analysis_details.requirements_feedback;
- Object.keys(this.candidateInfo.dimensionDetails).forEach((key) => {
- this.candidateInfo.dimensionDetails[key] = feedback;
- });
- }
- if (application.ai_overall_feedback) {
- this.candidateInfo.duvAnalysis = [
- {
- title: "综合评估",
- content: application.ai_overall_feedback,
- score: this.candidateInfo.score >= 70 ? "良好" : "需改进",
- type: this.candidateInfo.score >= 70 ? "positive" : "negative"
- }
- ];
- if (position) {
- this.candidateInfo.duvAnalysis.push({
- title: "职位匹配度",
- content: `应聘职位: ${position.title}, ${position.department}, ${position.location}`,
- score: "匹配",
- type: "positive"
- });
- }
- }
- if (interview_progress && interview_progress.length) {
- this.candidateInfo.interviewRecord = interview_progress.filter((item) => item.question_text).map((item) => {
- const answer = this.extractAnswerFromNotes(application.note, item.question_text);
- return {
- question: item.question_text,
- answer: answer || "未回答",
- analysis: "候选人回答简短,需进一步评估",
- score: "待评估",
- videoUrl: item.video_answer ? item.video_answer.video_url : null,
- thumbnail: "/images/video-placeholder.jpg"
- };
- });
- }
- const videoAnswers = interview_progress.filter((item) => item.video_answer && item.video_answer.video_url);
- if (videoAnswers.length) {
- this.candidateInfo.videoRecords = [
- {
- category: "面试视频",
- videos: videoAnswers.map((item) => ({
- url: item.video_answer.video_url,
- thumbnail: "/images/thumbnail1.jpg",
- description: item.question_text
- }))
- }
- ];
- }
- if (posture_photos && posture_photos.length) {
- const leftHandPhotos = posture_photos.filter((p) => p.description.includes("left") && !p.description.includes("face"));
- const rightHandPhotos = posture_photos.filter((p) => p.description.includes("right") && !p.description.includes("face"));
- const facePhotos = posture_photos.filter((p) => !p.description.includes("left") && !p.description.includes("right"));
- this.candidateInfo.additionalInfo.leftHandGestures.images = leftHandPhotos.map((p) => p.photo_url);
- this.candidateInfo.additionalInfo.rightHandGestures.images = rightHandPhotos.map((p) => p.photo_url);
- this.candidateInfo.additionalInfo.faceVerification.images = facePhotos.map((p) => p.photo_url);
- }
- this.candidateInfo.additionalInfo.idVerification = "通过";
- this.candidateInfo.additionalInfo.phoneVerification = "通过";
- },
- // 从面试记录中提取答案
- extractAnswerFromNotes(notes, question) {
- if (!notes)
- return "";
- const pattern = new RegExp(`问题 ${question}:\\s*([^\\n]+)`, "i");
- const match = notes.match(pattern);
- return match ? match[1].trim() : "";
- },
- // 格式化日期
- formatDate(dateString) {
- if (!dateString)
- return "";
- try {
- const date = new Date(dateString);
- return date.toLocaleString("zh-CN", {
- year: "numeric",
- month: "2-digit",
- day: "2-digit",
- hour: "2-digit",
- minute: "2-digit",
- second: "2-digit"
- });
- } catch (e) {
- return dateString;
- }
- },
- handleSubmit() {
- if (this.evaluationScore === 0 || !this.evaluationComments.trim()) {
- common_vendor.index.showToast({
- title: "请完成所有必填项",
- icon: "none"
- });
- return;
- }
- common_vendor.index.showToast({
- title: "评估已提交",
- icon: "success"
- });
- },
- scrollToTop() {
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- },
- handleShare() {
- common_vendor.index.showToast({
- title: "分享链接已复制",
- icon: "success"
- });
- },
- handleDownload() {
- common_vendor.index.showToast({
- title: "报告下载中...",
- icon: "loading"
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- var _a, _b;
- return {
- a: common_vendor.t($data.candidateInfo.idNumber || "未知"),
- b: common_vendor.t($options.formatDate((_b = (_a = $data.applicationData) == null ? void 0 : _a.application) == null ? void 0 : _b.create_datetime)),
- c: $data.candidateInfo.additionalInfo.faceVerification.images[0],
- d: common_vendor.t($data.candidateInfo.name),
- e: common_vendor.t($data.candidateInfo.phoneNumber),
- f: common_vendor.t($data.candidateInfo.score),
- g: common_vendor.t($data.candidateInfo.idNumber),
- h: common_vendor.t($data.candidateInfo.availabilityPeriod),
- i: common_vendor.t($data.candidateInfo.onboardingTime),
- j: common_vendor.f($data.candidateInfo.dimensions, (value, key, i0) => {
- return {
- a: common_vendor.t($data.dimensionLabels[key]),
- b: common_vendor.t(value),
- c: value === "欠佳" ? 1 : "",
- d: value === "优秀" ? 1 : "",
- e: value === "中等" ? 1 : "",
- f: common_vendor.t($data.candidateInfo.dimensionDetails[key]),
- g: key
- };
- }),
- k: common_vendor.f($data.candidateInfo.duvAnalysis, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: common_vendor.t(item.score),
- c: item.type === "positive" ? 1 : "",
- d: item.type === "negative" ? 1 : "",
- e: item.type === "neutral" ? 1 : "",
- f: common_vendor.t(item.content),
- g: index
- };
- }),
- l: common_vendor.f($data.candidateInfo.interviewRecord, (record, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(record.question),
- b: common_vendor.t(record.answer),
- c: common_vendor.t(record.analysis),
- d: record.videoUrl
- }, record.videoUrl ? {
- e: record.videoUrl,
- f: record.thumbnail
- } : {}, {
- g: common_vendor.t(record.score),
- h: index
- });
- }),
- m: common_vendor.f($data.candidateInfo.videoRecords, (category, index, i0) => {
- return {
- a: common_vendor.t(category.category),
- b: common_vendor.f(category.videos, (video, vIndex, i1) => {
- return {
- a: video.url,
- b: video.thumbnail,
- c: common_vendor.t(video.description),
- d: vIndex
- };
- }),
- c: index
- };
- }),
- n: common_vendor.t($data.candidateInfo.additionalInfo.idVerification),
- o: common_vendor.t($data.candidateInfo.additionalInfo.phoneVerification),
- p: common_vendor.f($data.candidateInfo.additionalInfo.leftHandGestures.images, (image, index, i0) => {
- return {
- a: image,
- b: index
- };
- }),
- q: common_vendor.f($data.candidateInfo.additionalInfo.rightHandGestures.images, (image, index, i0) => {
- return {
- a: image,
- b: index
- };
- }),
- r: common_vendor.f($data.candidateInfo.additionalInfo.faceVerification.images, (image, index, i0) => {
- return {
- a: image,
- b: index
- };
- })
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|