"use strict"; const common_vendor = require("../../common/vendor.js"); const api_assessment = require("../../api/assessment.js"); const _sfc_main = { __name: "remind", setup(__props) { const source = common_vendor.ref(""); const assessmentId = common_vendor.ref(""); const loading = common_vendor.ref(true); const examInfo = common_vendor.ref({ position: "", // 测评岗位 questionTypes: "", // 题型描述 totalTime: 0, // 总时长(分钟) totalScore: 0, // 总分 passMark: 0, // 合格分 abilityPassDesc: "" // 各能力子合格描述 }); const firstExamLink = common_vendor.ref(""); common_vendor.onLoad(async (options) => { if (options.source) source.value = options.source; if (options.id) assessmentId.value = options.id; await loadExamInfo(); }); const loadExamInfo = async () => { loading.value = true; try { let data = null; if (assessmentId.value) { const res = await api_assessment.getAssessmentDetail(assessmentId.value); if (res.code === 200 && res.data) { data = res.data; } } if (!data) { const listRes = await api_assessment.getAssessmentList({ pageNum: 1, pageSize: 1 }); if (listRes.code === 200 && Array.isArray(listRes.rows) && listRes.rows.length > 0) { const detailRes = await api_assessment.getAssessmentDetail(listRes.rows[0].id); if (detailRes.code === 200 && detailRes.data) { data = detailRes.data; if (!assessmentId.value) { assessmentId.value = listRes.rows[0].id; common_vendor.index.__f__("log", "at pages/assessment/remind.vue:120", "使用兜底测评ID:", assessmentId.value); } } } } if (data) { examInfo.value.position = data.position || data.evaluationName || "—"; const abilityConfigs = Array.isArray(data.abilityConfigs) ? data.abilityConfigs : []; if (abilityConfigs.length > 0) { const totalTime = abilityConfigs.reduce((sum, c) => sum + (c.thirdExamTime || 0), 0); examInfo.value.totalTime = totalTime; const totalScore = abilityConfigs.reduce((sum, c) => sum + (c.thirdExamTotalScore || 0), 0); examInfo.value.totalScore = totalScore; const passMark = abilityConfigs.reduce((sum, c) => sum + (c.thirdExamPassMark || 0), 0); examInfo.value.passMark = passMark; if (abilityConfigs.length > 1) { const descs = abilityConfigs.map((c) => `${c.abilityName || c.thirdExamName || "能力"}及格${c.thirdExamPassMark || 0}分`); examInfo.value.abilityPassDesc = descs.join(","); } examInfo.value.questionTypes = "单选/多选/问答"; const firstConfig = abilityConfigs.find((c) => c && c.thirdExamLink); if (firstConfig) { firstExamLink.value = firstConfig.thirdExamLink; } } } } catch (err) { common_vendor.index.__f__("error", "at pages/assessment/remind.vue:163", "加载测评信息失败:", err); } finally { loading.value = false; } }; const startQuiz = async () => { try { if (!firstExamLink.value && !assessmentId.value) { common_vendor.index.showToast({ title: "未配置考试链接", icon: "none" }); return; } const userInfo = common_vendor.index.getStorageSync("userInfo") || {}; const studentId = userInfo.studentId; if (!studentId) { common_vendor.index.showToast({ title: "请先登录", icon: "none" }); return; } if (assessmentId.value) { try { common_vendor.index.showLoading({ title: "创建测评申请..." }); common_vendor.index.__f__("log", "at pages/assessment/remind.vue:192", "准备创建测评申请,evaluationId:", assessmentId.value, "studentId:", studentId); const applyRes = await api_assessment.createExamApply(assessmentId.value, studentId); common_vendor.index.__f__("log", "at pages/assessment/remind.vue:196", "测评申请创建结果:", applyRes); common_vendor.index.hideLoading(); if (applyRes.code !== 200) { common_vendor.index.showToast({ title: applyRes.msg || "创建测评申请失败", icon: "none" }); return; } common_vendor.index.__f__("log", "at pages/assessment/remind.vue:205", "测评申请创建成功,申请ID:", applyRes.data.id); } catch (apiError) { common_vendor.index.hideLoading(); common_vendor.index.__f__("error", "at pages/assessment/remind.vue:208", "创建测评申请失败:", apiError); common_vendor.index.__f__("warn", "at pages/assessment/remind.vue:210", "测评申请创建失败,但仍允许进入考试"); } } common_vendor.index.navigateTo({ url: `/pages/common/webview?mode=kaoshixing&assessmentId=${encodeURIComponent(assessmentId.value || "")}&fallbackUrl=${encodeURIComponent(firstExamLink.value || "")}` }); } catch (error) { common_vendor.index.__f__("error", "at pages/assessment/remind.vue:219", "打开考试链接失败:", error); common_vendor.index.showToast({ title: "打开考试链接失败", icon: "none" }); } }; return (_ctx, _cache) => { return common_vendor.e({ a: loading.value }, loading.value ? {} : common_vendor.e({ b: common_vendor.t(examInfo.value.position || "—"), c: examInfo.value.questionTypes }, examInfo.value.questionTypes ? { d: common_vendor.t(examInfo.value.questionTypes) } : {}, { e: examInfo.value.totalTime }, examInfo.value.totalTime ? { f: common_vendor.t(examInfo.value.totalTime) } : {}, { g: examInfo.value.passMark }, examInfo.value.passMark ? common_vendor.e({ h: common_vendor.t(examInfo.value.totalScore), i: common_vendor.t(examInfo.value.passMark), j: examInfo.value.abilityPassDesc }, examInfo.value.abilityPassDesc ? { k: common_vendor.t(examInfo.value.abilityPassDesc) } : {}) : {}), { l: common_vendor.o(startQuiz), m: loading.value }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9bbd684a"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/assessment/remind.js.map