UNPKG

cthep-ui-vue3

Version:

Vue 3 试题组件库

1,258 lines (1,257 loc) 2.43 MB
import { reactive as Xu, onMounted as ub, resolveComponent as ls, createElementBlock as Dt, openBlock as wt, createElementVNode as U, createCommentVNode as sa, toDisplayString as $r, createVNode as Eo, withCtx as $i, Fragment as ro, renderList as ao, createBlock as Nu, normalizeClass as tc, createTextVNode as Wn, normalizeStyle as ec, toRefs as qF, computed as fF, ref as pr, getCurrentInstance as jq, watch as Dm, unref as Qc, withDirectives as uR, withModifiers as Wq, vShow as GI, withKeys as qq, createStaticVNode as Gq, resolveDirective as Xq } from "vue"; import { Base64 as lR } from "js-base64"; import { fabric as Yq } from "fabric"; import { VueDraggable as Kq } from "vue-draggable-plus"; import { ElMessage as vF } from "element-plus"; import { uuid as ZI } from "vue-uuid"; import GF from "fast-xml-parser"; import dF from "crypto-js"; function Qq(qe) { for (var W = qe.length, re, lt; W > 0; ) re = Math.floor(Math.random() * W), lt = qe[W - 1], qe[W - 1] = qe[re], qe[re] = lt, W--; return qe; } function X7(qe) { let W = JSON.parse(JSON.stringify(qe)), re = W.indexOf("<img"); for (; re !== -1; ) { let lt = W.substring(re, W.indexOf(">", re + 1) + 1); if (lt.indexOf("mathTypeImage") !== -1) { let Ve = lt.indexOf('attribute="') + 11; W = W.replace( //将img替换成Base64转换后的值 lt, lR.decode( lt.substring( Ve, lt.indexOf('"', Ve + 1) ) ) ); } re = W.indexOf("<img", re + 1); } return W = W.replace(/mml:/g, ""), W; } function XF(qe) { return qe.subjectEditorValue && (qe.subjectEditorValue = X7(qe.subjectEditorValue)), qe.explainEditorValue && (qe.explainEditorValue = X7(qe.explainEditorValue)), qe.answerEditorValue && (qe.answerEditorValue = X7(qe.answerEditorValue)), ["dan_xuan", "duo_xuan", "pan_duan", "any_xuan", "tian_kong"].includes(qe.questionTypeBase) && qe.options.forEach((W) => { W.optionTextValue && (W.optionTextValue = X7(W.optionTextValue)), W.optionTipEditorValue && (W.optionTipEditorValue = X7(W.optionTipEditorValue)); }), ["zong_he"].includes(qe.questionTypeBase) && qe.subQuestionList.forEach((W) => { W = XF(W); }), qe; } const $f = (qe, W) => { const re = qe.__vccOpts || qe; for (const [lt, Ve] of W) re[lt] = Ve; return re; }, Zq = { class: "singChoice" }, Jq = { class: "tiBox" }, eG = { class: "tiNumber" }, tG = { class: "tiContent" }, nG = ["innerHTML"], rG = ["innerHTML"], aG = { key: 0 }, oG = { class: "answerTips" }, iG = { key: 0, class: "reAnswered", "aria-hidden": "true" }, uG = { key: 1, class: "reTrue", "aria-hidden": "true" }, sG = { key: 2, class: "reFalse", "aria-hidden": "true" }, lG = { class: "reckT" }, cG = { class: "solution analysis" }, fG = ["innerHTML"], vG = { class: "solutionTitle" }, dG = { style: { color: "#50ca45", "font-weight": "600" } }, mG = { class: "solutionTitle" }, gG = { style: { color: "#50ca45", "font-weight": "600" } }, hG = { __name: "SingChoice", props: { modelValue: { type: Object, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, background: { type: String, default: "#fffad6" }, isPreview: { type: Boolean, default: !0 } }, emits: ["SingChoiceEmit"], setup(qe, { emit: W }) { const re = qe, lt = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], Ve = Xu({ optionIndex: null, isRight: null, answer: null, qAnswer: null }), ke = (Ye) => { re.modelValue.options.forEach((Me, tt) => { (Me.optionIndex == Ye || !Me.optionIndex && tt == Ye - 1) && (Ve.isRight = Me.isAnswer), Me.isAnswer && (Ve.qAnswer = Me.optionIndex); }), re.modelValue.answers = Object.assign(re.modelValue.answers, { id: re.modelValue.id, questionUuid: re.modelValue.questionUuid, getScore: Ve.isRight ? re.modelValue.answers.score - 0 : 0, type: re.modelValue.questionTypeBase, answer: lt[Ye - 1], isRight: Ve.isRight, isAnswered: Ve.isRight != null ? "true" : "false" }); }; return ub(() => { }), (Ye, Me) => { const tt = ls("el-radio"), sn = ls("el-radio-group"); return wt(), Dt("div", Zq, [ U("section", Jq, [ U("span", eG, $r(re.modelValue.id) + ".", 1), U("div", tG, [ U("div", { class: "opImg tiganContent", innerHTML: re.modelValue.subjectEditorValue }, null, 8, nG), Eo(sn, { modelValue: re.modelValue.answers.optionIndex, "onUpdate:modelValue": Me[0] || (Me[0] = (fn) => re.modelValue.answers.optionIndex = fn), onChange: ke, class: "tiOption" }, { default: $i(() => [ (wt(!0), Dt(ro, null, ao(re.modelValue.options, (fn, Ft) => (wt(), Nu(tt, { key: Ft, disabled: re.restore || re.isPreview, value: fn.optionIndex ? fn.optionIndex : Ft + 1 }, { default: $i(() => [ U("span", { style: { display: "flex", "align-items": "center" }, class: tc(re.restore ? "isColor" : "") }, [ Wn($r(lt[Ft]) + ". ", 1), U("span", { innerHTML: fn.optionTextValue }, null, 8, rG) ], 2) ]), _: 2 }, 1032, ["disabled", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"]) ]), re.restore ? (wt(), Dt("div", aG, [ U("div", oG, [ re.modelValue.answers.isAnswered ? re.modelValue.answers.isRight ? (wt(), Dt("span", uG, Me[2] || (Me[2] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z", fill: "rgba(0,182,0,1)" }) ], -1), Wn("回答正确 ") ]))) : re.modelValue.answers.isRight ? sa("", !0) : (wt(), Dt("span", sG, Me[3] || (Me[3] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z", fill: "rgba(221,61,61,1)" }) ], -1), Wn("回答错误 ") ]))) : (wt(), Dt("span", iG, Me[1] || (Me[1] = [ U("b", { style: { color: "#ffffff", "padding-top": "5px", display: "inline-block" } }, "?", -1), Wn("本题未答 ") ]))) ]), U("section", { class: "reck", style: ec({ background: qe.background }) }, [ U("span", null, [ Me[4] || (Me[4] = Wn(" 参考答案:")), U("span", lG, $r(Array.isArray(re.modelValue.answers.qAnswer) ? re.modelValue.answers.qAnswer[0] : re.modelValue.answers.qAnswer), 1) ]), U("span", null, [ Me[5] || (Me[5] = Wn("我的答案:")), U("span", { class: tc(["reckT", re.modelValue.answers.isRight == !0 ? "standardTrue" : re.modelValue.answers.isRight == !1 ? "standardFalse" : "standardHalfTrue"]) }, $r(re.modelValue.answers.answer[0]), 3) ]) ], 4), U("section", cG, [ U("ul", null, [ U("li", null, [ Me[6] || (Me[6] = U("span", { class: "solutionTitle" }, "参考解析:", -1)), U("div", { class: "solutionBody jiexi", innerHTML: re.modelValue.explainEditorValue }, null, 8, fG) ]), U("li", null, [ U("span", vG, [ Me[7] || (Me[7] = Wn("本题得分:")), U("span", dG, $r(re.modelValue.answers.getScore), 1), Me[8] || (Me[8] = Wn("分")) ]) ]), U("li", null, [ U("span", mG, [ Me[9] || (Me[9] = Wn("本题满分:")), U("span", gG, $r(re.modelValue.answers.score), 1), Me[10] || (Me[10] = Wn("分")) ]) ]) ]) ]) ])) : sa("", !0) ]) ]); }; } }, YF = /* @__PURE__ */ $f(hG, [["__scopeId", "data-v-ff5bc43e"]]), pG = { class: "multipleChoice" }, bG = { class: "tiBox" }, yG = { class: "tiNumber" }, wG = { class: "tiContent" }, _G = ["innerHTML"], SG = { style: { display: "flex", "align-items": "flex-start", "vertical-align": "top" } }, CG = { class: "tiContentSpan" }, xG = ["innerHTML"], TG = { key: 0 }, kG = { class: "answerTips" }, EG = { key: 0, class: "reAnswered", "aria-hidden": "true" }, AG = { key: 1, class: "reTrue", "aria-hidden": "true" }, RG = { key: 2, class: "reFalse", "aria-hidden": "true" }, MG = { key: 3, class: "reHalfTrue", "aria-hidden": "true" }, OG = { key: 0, class: "reckT" }, BG = { key: 1, class: "reckT" }, DG = { key: 0 }, PG = { key: 1 }, LG = { class: "solution analysis" }, IG = ["innerHTML"], NG = { class: "solutionTitle" }, $G = { style: { color: "#50ca45", "font-weight": "600" } }, FG = { class: "solutionTitle" }, VG = { style: { color: "#50ca45", "font-weight": "600" } }, zG = { __name: "MultipleChoice", props: { modelValue: { type: Object, required: !0, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, background: { type: String, default: "#fffad6" }, isPreview: { type: Boolean, default: !0 } }, emits: ["update:modelValue"], setup(qe, { emit: W }) { const re = W, lt = qe, { modelValue: Ve } = qF(lt), ke = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], Ye = Xu({ isPartiallyCorrect: !1, score: 0 }), Me = fF(() => lt.modelValue.options.filter((ft) => ft.isAnswer).map((ft) => ke[ft.optionIndex - 1]).sort()), tt = fF(() => Me.value.length > 0 ? Number((lt.modelValue.answers.score / Me.value.length).toFixed(2)) : 0), sn = (ft, Ot) => { let Rt = 0, xe = !1; return ft.forEach((ue) => { Ot.includes(ue) ? Rt += tt.value : xe = !0; }), xe ? 0 : Rt; }, fn = (ft, Ot) => { const Rt = new Set(ft.sort()), xe = new Set(Ot); if (Rt.size !== xe.size) return !1; let ue = !1, Se = !0; return ft.forEach((ot) => { xe.has(ot) ? ue = !0 : Se = !1; }), Se ? !0 : ue ? "trueFalse" : !1; }, Ft = () => { const ft = [...lt.modelValue.answers.answerObj].sort(), Ot = Me.value; Ye.score = sn(ft, Ot); const Rt = fn(ft, Ot), xe = { ...lt.modelValue.answers, id: lt.modelValue.id, questionUuid: lt.modelValue.questionUuid, getScore: Ye.score, type: lt.modelValue.questionTypeBase, answer: ft, answerObj: ft, isAnswered: Rt != null ? "true" : "false", isRight: Rt }; re("update:modelValue", { ...lt.modelValue, answers: xe }); }; return (ft, Ot) => { const Rt = ls("el-checkbox"), xe = ls("el-checkbox-group"); return wt(), Dt("div", pG, [ U("section", bG, [ U("span", yG, $r(lt.modelValue.id) + ".", 1), U("div", wG, [ U("div", { class: "opImg tiganContent", style: { display: "flex", "align-items": "center", "flex-wrap": "wrap" }, innerHTML: lt.modelValue.subjectEditorValue }, null, 8, _G), Eo(xe, { modelValue: lt.modelValue.answers.answerObj, "onUpdate:modelValue": Ot[0] || (Ot[0] = (ue) => lt.modelValue.answers.answerObj = ue), onChange: Ft, class: "tiOption", disabled: lt.restore || lt.isPreview }, { default: $i(() => [ (wt(!0), Dt(ro, null, ao(lt.modelValue.options, (ue, Se) => (wt(), Nu(Rt, { key: Se, value: ue.optionIndex ? ke[ue.optionIndex - 1] : ke[Se] }, { default: $i(() => [ U("span", SG, [ U("span", CG, $r(ke[Se]) + ". ", 1), U("span", { innerHTML: ue.optionTextValue, class: "tiContentSpan", style: { display: "flex", "align-items": "center" } }, null, 8, xG) ]) ]), _: 2 }, 1032, ["value"]))), 128)) ]), _: 1 }, 8, ["modelValue", "disabled"]) ]), lt.restore ? (wt(), Dt("div", TG, [ U("div", kG, [ lt.modelValue.answers.isAnswered ? lt.modelValue.answers.isRight == !0 ? (wt(), Dt("span", AG, Ot[2] || (Ot[2] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z", fill: "rgba(0,182,0,1)" }) ], -1), Wn("回答正确 ") ]))) : lt.modelValue.answers.isRight == !1 ? (wt(), Dt("span", RG, Ot[3] || (Ot[3] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z", fill: "rgba(221,61,61,1)" }) ], -1), Wn("回答错误 ") ]))) : lt.modelValue.answers.isRight == "trueFalse" ? (wt(), Dt("span", MG, Ot[4] || (Ot[4] = [ U("svg", { t: "1668049716312", class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "7502", width: "20", height: "20" }, [ U("path", { d: "M863.3 296c-12.8-15.2-35.5-17.2-50.7-4.4L624.1 449.7l-64.7-77.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L569 496 379 655.4 215.9 461.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L345.9 728c7.4 8.8 18.1 13.2 28.8 12.8 8.6 0.3 17.4-2.4 24.6-8.4l216-181.3 74.1 88.3c12.8 15.2 35.5 17.2 50.7 4.4 15.2-12.8 17.2-35.5 4.4-50.7l-74.1-88.3 188.4-158.1C874 334 876 311.3 863.3 296z", "p-id": "7503", fill: "#FF8F49" }) ], -1), Wn("不完全正确 ") ]))) : sa("", !0) : (wt(), Dt("span", EG, Ot[1] || (Ot[1] = [ U("b", { style: { color: "#ffffff", "padding-top": "5px", display: "inline-block" } }, "?", -1), Wn("本题未答 ") ]))) ]), U("section", { class: "reck", style: ec({ background: qe.background }) }, [ U("span", null, [ U("span", null, [ Ot[5] || (Ot[5] = Wn(" 参考答案:")), Array.isArray(lt.modelValue.answers.qAnswer) ? (wt(), Dt("span", OG, [ (wt(!0), Dt(ro, null, ao(lt.modelValue.answers.qAnswer, (ue, Se) => (wt(), Dt("i", { key: Se }, $r(ue), 1))), 128)) ])) : (wt(), Dt("span", BG, [ U("i", null, $r(lt.modelValue.answers.qAnswer), 1) ])) ]) ]), U("span", null, [ Ot[6] || (Ot[6] = Wn("我的答案:")), U("span", { class: tc(["reckT", lt.modelValue.answers.isRight == !0 ? "standardTrue" : lt.modelValue.answers.isRight == !1 ? "standardFalse" : "standardHalfTrue"]) }, [ (wt(!0), Dt(ro, null, ao(lt.modelValue.answers.answerObj, (ue, Se) => (wt(), Dt("i", { key: Se }, [ Array.isArray(ue) ? (wt(), Dt("span", DG, [ (wt(!0), Dt(ro, null, ao(ue, (ot, fe) => (wt(), Dt("span", { key: fe }, $r(ot), 1))), 128)) ])) : (wt(), Dt("span", PG, $r(ue), 1)) ]))), 128)) ], 2) ]) ], 4), U("section", LG, [ U("ul", null, [ U("li", null, [ Ot[7] || (Ot[7] = U("span", { class: "solutionTitle" }, "参考解析:", -1)), U("div", { class: "solutionBody jiexi", innerHTML: lt.modelValue.explainEditorValue }, null, 8, IG) ]), U("li", null, [ U("span", NG, [ Ot[8] || (Ot[8] = Wn("本题得分:")), U("span", $G, $r(lt.modelValue.answers.getScore), 1), Ot[9] || (Ot[9] = Wn("分")) ]) ]), U("li", null, [ U("span", FG, [ Ot[10] || (Ot[10] = Wn("本题满分:")), U("span", VG, $r(lt.modelValue.answers.score), 1), Ot[11] || (Ot[11] = Wn("分")) ]) ]) ]) ]) ])) : sa("", !0) ]) ]); }; } }, KF = /* @__PURE__ */ $f(zG, [["__scopeId", "data-v-f20348af"]]), HG = { class: "multipleChoice" }, UG = { class: "tiBox" }, jG = { class: "tiNumber" }, WG = { class: "tiContent" }, qG = ["innerHTML"], GG = { style: { display: "flex", "align-items": "flex-start", "vertical-align": "top" } }, XG = { class: "tiContentSpan" }, YG = ["innerHTML"], KG = { key: 0 }, QG = { class: "answerTips" }, ZG = { key: 0, class: "reAnswered", "aria-hidden": "true" }, JG = { key: 1, class: "reTrue", "aria-hidden": "true" }, eX = { key: 2, class: "reFalse", "aria-hidden": "true" }, tX = { key: 3, class: "reHalfTrue", "aria-hidden": "true" }, nX = { key: 0, class: "reckT" }, rX = { key: 1, class: "reckT" }, aX = { key: 0 }, oX = { key: 1 }, iX = { class: "solution analysis" }, uX = ["innerHTML"], sX = { class: "solutionTitle" }, lX = { style: { color: "#50ca45", "font-weight": "600" } }, cX = { class: "solutionTitle" }, fX = { style: { color: "#50ca45", "font-weight": "600" } }, vX = { __name: "Nondirectional", props: { modelValue: { type: Object, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, background: { type: String, default: "#fffad6" }, isPreview: { type: Boolean, default: !0 } }, setup(qe) { const W = qe, re = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], lt = Xu({ optionIndex: null, isRight: null, answer: null, qAnswer: null, getScoreLs: 0 }), Ve = pr(!1), ke = () => { let Ye = []; lt.qAnswer = [], Ve.value = !0, lt.getScoreLs = 0, W.modelValue.options.forEach((tt) => { tt.isAnswer && Ye.push(re[tt.optionIndex - 1]); }); const Me = ((W.modelValue.answers.score - 0) / Ye.length).toFixed(2) - 0; W.modelValue.options.forEach((tt) => { W.modelValue.answers.answerObj.forEach((sn) => { tt.isAnswer ? sn === re[tt.optionIndex - 1] && (lt.getScoreLs += Me - 0) : sn === re[tt.optionIndex - 1] && (Ve.value = !1); }); }), W.modelValue.answers.answerObj.sort().toString() === Ye.sort().toString() ? (lt.isRight = !0, lt.getScoreLs = W.modelValue.answers.score - 0) : Ve.value ? lt.isRight = "trueFalse" : (lt.isRight = !1, lt.getScoreLs = 0), W.modelValue.answers = Object.assign(W.modelValue.answers, { id: W.modelValue.id, questionUuid: W.modelValue.questionUuid, getScore: lt.getScoreLs, type: W.modelValue.questionTypeBase, answer: W.modelValue.answers.answerObj, answerObj: W.modelValue.answers.answerObj, isAnswered: lt.isRight != null ? "true" : "false", isRight: lt.isRight }); }; return (Ye, Me) => { const tt = ls("el-checkbox"), sn = ls("el-checkbox-group"); return wt(), Dt("div", HG, [ U("section", UG, [ U("span", jG, $r(W.modelValue.id) + ".", 1), U("div", WG, [ U("div", { class: "opImg tiganContent", style: { display: "flex", "align-items": "center", "flex-wrap": "wrap" }, innerHTML: W.modelValue.subjectEditorValue }, null, 8, qG), Eo(sn, { modelValue: W.modelValue.answers.answerObj, "onUpdate:modelValue": Me[0] || (Me[0] = (fn) => W.modelValue.answers.answerObj = fn), onChange: ke, class: "tiOption", disabled: W.restore || W.isPreview }, { default: $i(() => [ (wt(!0), Dt(ro, null, ao(W.modelValue.options, (fn, Ft) => (wt(), Nu(tt, { key: Ft, value: fn.optionIndex ? re[fn.optionIndex - 1] : re[Ft] }, { default: $i(() => [ U("span", GG, [ U("span", XG, $r(re[Ft]) + ". ", 1), U("span", { innerHTML: fn.optionTextValue, class: "tiContentSpan", style: { display: "flex", "align-items": "center" } }, null, 8, YG) ]) ]), _: 2 }, 1032, ["value"]))), 128)) ]), _: 1 }, 8, ["modelValue", "disabled"]) ]), W.restore ? (wt(), Dt("div", KG, [ U("div", QG, [ W.modelValue.answers.isAnswered ? W.modelValue.answers.isRight == !0 ? (wt(), Dt("span", JG, Me[2] || (Me[2] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z", fill: "rgba(0,182,0,1)" }) ], -1), Wn("回答正确 ") ]))) : W.modelValue.answers.isRight == !1 ? (wt(), Dt("span", eX, Me[3] || (Me[3] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z", fill: "rgba(221,61,61,1)" }) ], -1), Wn("回答错误 ") ]))) : W.modelValue.answers.isRight == "trueFalse" ? (wt(), Dt("span", tX, Me[4] || (Me[4] = [ U("svg", { t: "1668049716312", class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "7502", width: "20", height: "20" }, [ U("path", { d: "M863.3 296c-12.8-15.2-35.5-17.2-50.7-4.4L624.1 449.7l-64.7-77.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L569 496 379 655.4 215.9 461.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L345.9 728c7.4 8.8 18.1 13.2 28.8 12.8 8.6 0.3 17.4-2.4 24.6-8.4l216-181.3 74.1 88.3c12.8 15.2 35.5 17.2 50.7 4.4 15.2-12.8 17.2-35.5 4.4-50.7l-74.1-88.3 188.4-158.1C874 334 876 311.3 863.3 296z", "p-id": "7503", fill: "#FF8F49" }) ], -1), Wn("不完全正确 ") ]))) : sa("", !0) : (wt(), Dt("span", ZG, Me[1] || (Me[1] = [ U("b", { style: { color: "#ffffff", "padding-top": "5px", display: "inline-block" } }, "?", -1), Wn("本题未答 ") ]))) ]), U("section", { class: "reck", style: ec({ background: qe.background }) }, [ U("span", null, [ U("span", null, [ Me[5] || (Me[5] = Wn(" 参考答案:")), Array.isArray(W.modelValue.answers.qAnswer) ? (wt(), Dt("span", nX, [ (wt(!0), Dt(ro, null, ao(W.modelValue.answers.qAnswer, (fn, Ft) => (wt(), Dt("i", { key: Ft }, $r(fn), 1))), 128)) ])) : (wt(), Dt("span", rX, [ U("i", null, $r(W.modelValue.answers.qAnswer), 1) ])) ]) ]), U("span", null, [ Me[6] || (Me[6] = Wn("我的答案:")), U("span", { class: tc(["reckT", W.modelValue.answers.isRight == !0 ? "standardTrue" : W.modelValue.answers.isRight == !1 ? "standardFalse" : "standardHalfTrue"]) }, [ (wt(!0), Dt(ro, null, ao(W.modelValue.answers.answerObj, (fn, Ft) => (wt(), Dt("i", { key: Ft }, [ Array.isArray(fn) ? (wt(), Dt("span", aX, [ (wt(!0), Dt(ro, null, ao(fn, (ft, Ot) => (wt(), Dt("span", { key: Ot }, $r(ft), 1))), 128)) ])) : (wt(), Dt("span", oX, $r(fn), 1)) ]))), 128)) ], 2) ]) ], 4), U("section", iX, [ U("ul", null, [ U("li", null, [ Me[7] || (Me[7] = U("span", { class: "solutionTitle" }, "参考解析:", -1)), U("div", { class: "solutionBody jiexi", innerHTML: W.modelValue.explainEditorValue }, null, 8, uX) ]), U("li", null, [ U("span", sX, [ Me[8] || (Me[8] = Wn("本题得分:")), U("span", lX, $r(W.modelValue.answers.getScore), 1), Me[9] || (Me[9] = Wn("分")) ]) ]), U("li", null, [ U("span", cX, [ Me[10] || (Me[10] = Wn("本题满分:")), U("span", fX, $r(W.modelValue.answers.score), 1), Me[11] || (Me[11] = Wn("分")) ]) ]) ]) ]) ])) : sa("", !0) ]) ]); }; } }, QF = /* @__PURE__ */ $f(vX, [["__scopeId", "data-v-a889ed4b"]]), dX = { class: "JudgmentalQuestion" }, mX = { class: "tiBox" }, gX = { class: "tiNumber" }, hX = { class: "tiContent" }, pX = ["innerHTML"], bX = { class: "tiContentSpan" }, yX = ["innerHTML"], wX = { key: 0 }, _X = { class: "answerTips" }, SX = { key: 0, class: "reAnswered", "aria-hidden": "true" }, CX = { key: 1, class: "reTrue", "aria-hidden": "true" }, xX = { key: 2, class: "reFalse", "aria-hidden": "true" }, TX = { key: 3, class: "reHalfTrue", "aria-hidden": "true" }, kX = { class: "reckT" }, EX = { class: "solution analysis" }, AX = ["innerHTML"], RX = { class: "solutionTitle" }, MX = { style: { color: "#50ca45", "font-weight": "600" } }, OX = { class: "solutionTitle" }, BX = { style: { color: "#50ca45", "font-weight": "600" } }, ZF = { __name: "JudgmentalQuestion", props: { modelValue: { type: Object, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, background: { type: String, default: "#fffad6" }, isPreview: { type: Boolean, default: !0 } }, setup(qe) { const W = qe, re = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], lt = Xu({ optionIndex: null, isRight: null, answer: null, qAnswer: null }), Ve = (ke) => { W.modelValue.options.forEach((Ye, Me) => { Me === ke && (lt.isRight = Ye.isAnswer), Ye.isAnswer && (lt.qAnswer = Ye.optionIndex); }), W.modelValue.answers = Object.assign(W.modelValue.answers, { id: W.modelValue.id, questionUuid: W.modelValue.questionUuid, getScore: lt.isRight ? W.modelValue.answers.score - 0 : 0, type: W.modelValue.questionTypeBase, answer: re[ke], isRight: lt.isRight, isAnswered: lt.isRight != null ? "true" : "false" }); }; return (ke, Ye) => { const Me = ls("el-radio"), tt = ls("el-radio-group"); return wt(), Dt("div", dX, [ U("section", mX, [ U("span", gX, $r(W.modelValue.id) + ".", 1), U("div", hX, [ U("div", { style: { display: "flex", "align-items": "center", "flex-wrap": "wrap" }, innerHTML: W.modelValue.subjectEditorValue, class: "tiganContent" }, null, 8, pX), Eo(tt, { modelValue: W.modelValue.answers.optionIndex, "onUpdate:modelValue": Ye[0] || (Ye[0] = (sn) => W.modelValue.answers.optionIndex = sn), onChange: Ve, disabled: W.restore || W.isPreview, class: "panduan tiOption" }, { default: $i(() => [ (wt(!0), Dt(ro, null, ao(W.modelValue.options, (sn, fn) => (wt(), Nu(Me, { key: fn, value: fn }, { default: $i(() => [ U("span", bX, $r(re[fn]) + ".", 1), U("span", { class: "tiContentSpan", innerHTML: sn.optionTextValue }, null, 8, yX) ]), _: 2 }, 1032, ["value"]))), 128)) ]), _: 1 }, 8, ["modelValue", "disabled"]) ]), W.restore ? (wt(), Dt("div", wX, [ U("div", _X, [ W.modelValue.answers.isAnswered ? W.modelValue.answers.isRight == !0 ? (wt(), Dt("span", CX, Ye[2] || (Ye[2] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z", fill: "rgba(0,182,0,1)" }) ], -1), Wn("回答正确 ") ]))) : W.modelValue.answers.isRight == !1 ? (wt(), Dt("span", xX, Ye[3] || (Ye[3] = [ U("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, [ U("path", { fill: "none", d: "M0 0h24v24H0z" }), U("path", { d: "M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z", fill: "rgba(221,61,61,1)" }) ], -1), Wn("回答错误 ") ]))) : W.modelValue.answers.isRight == "trueFalse" ? (wt(), Dt("span", TX, Ye[4] || (Ye[4] = [ U("svg", { t: "1668049716312", class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "7502", width: "20", height: "20" }, [ U("path", { d: "M863.3 296c-12.8-15.2-35.5-17.2-50.7-4.4L624.1 449.7l-64.7-77.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L569 496 379 655.4 215.9 461.1c-12.8-15.2-35.5-17.2-50.7-4.4-15.2 12.8-17.2 35.5-4.4 50.7L345.9 728c7.4 8.8 18.1 13.2 28.8 12.8 8.6 0.3 17.4-2.4 24.6-8.4l216-181.3 74.1 88.3c12.8 15.2 35.5 17.2 50.7 4.4 15.2-12.8 17.2-35.5 4.4-50.7l-74.1-88.3 188.4-158.1C874 334 876 311.3 863.3 296z", "p-id": "7503", fill: "#FF8F49" }) ], -1), Wn("不完全正确 ") ]))) : sa("", !0) : (wt(), Dt("span", SX, Ye[1] || (Ye[1] = [ U("b", { style: { color: "#ffffff", "padding-top": "5px", display: "inline-block" } }, "?", -1), Wn("本题未答 ") ]))) ]), U("section", { class: "reck", style: ec({ background: qe.background }) }, [ U("span", null, [ Ye[5] || (Ye[5] = Wn("参考答案:")), U("span", kX, $r(Array.isArray(W.modelValue.answers.qAnswer) ? W.modelValue.answers.qAnswer[0] : W.modelValue.answers.qAnswer), 1) ]), U("span", null, [ Ye[6] || (Ye[6] = Wn("我的答案:")), U("span", { class: tc(["reckT", W.modelValue.answers.isRight == !0 ? "standardTrue" : W.modelValue.answers.isRight == !1 ? "standardFalse" : "standardHalfTrue"]) }, $r(W.modelValue.answers.answer[0]), 3) ]) ], 4), U("section", EX, [ U("ul", null, [ U("li", null, [ Ye[7] || (Ye[7] = U("span", { class: "solutionTitle" }, "参考解析:", -1)), U("div", { class: "solutionBody jiexi", innerHTML: W.modelValue.explainEditorValue }, null, 8, AX) ]), U("li", null, [ U("span", RX, [ Ye[8] || (Ye[8] = Wn("本题得分:")), U("span", MX, $r(W.modelValue.answers.getScore), 1), Ye[9] || (Ye[9] = Wn("分")) ]) ]), U("li", null, [ U("span", OX, [ Ye[10] || (Ye[10] = Wn("本题满分:")), U("span", BX, $r(W.modelValue.answers.score), 1), Ye[11] || (Ye[11] = Wn("分")) ]) ]) ]) ]) ])) : sa("", !0) ]) ]); }; } }, DX = { class: "bodyStyle" }, PX = { class: "tigan" }, LX = ["innerHTML"], IX = ["id"], NX = { __name: "index", props: { modelValue: { questionJsonContent: [String, Object, Array], type: null } }, emits: ["update:modelValue"], setup(qe, { emit: W }) { const re = qe, lt = Xu({ arrayList: [] }), Ve = () => { if (re.modelValue.attachObject) { let ot = Object.keys(re.modelValue.attachObject); lt.arrayList = ot.reduce((fe, Et) => re.modelValue.attachObject[Et] && Object.prototype.toString.call(re.modelValue.attachObject[Et]) == "[object Array]" ? (re.modelValue.attachObject[Et].forEach((Ke) => { fe.push(Ke); }), fe) : re.modelValue.attachObject[Et] && Object.prototype.toString.call(re.modelValue.attachObject[Et]) == "[object Object]" ? (fe.push(re.modelValue.attachObject[Et]), fe) : void 0, []); } }; pr(0), pr(!1), pr(0), pr(0), pr(1), pr(0), pr(0), pr("rgba(255, 255, 255, 1)"), pr("rgba(59, 203, 133, 0.57)"); const { proxy: ke } = jq(); pr(ke.apiPath + "/api/oss/aliyun/upload"), pr(new Image()), pr(0), pr(!0), pr(0), pr(!1), Xu({ optionTextValue: "", fontSize: "" }); let Ye = pr(null), Me = pr(null); window.addEventListener("scroll", function() { Ye.value !== null && Me.value !== null && window.scrollTo(Ye.value, Me.value); }); const { canvas: tt, ctx: sn, canvasPic: fn, canvasHistory: Ft, fileList: ft } = qF(Xu({ canvas: null, // canvas dom对象 ctx: null, // canvas 2d对象 canvasPic: null, //画布照片实例 canvasHistory: [], // allAngList: [], fileList: [] })), Ot = W; Dm( () => re.modelValue, (ot, fe) => { Ot("update:modelValue", ot); }, { deep: !0 } ), pr(!1), pr(20), pr(null), pr(null); const Rt = pr(null); pr(0), pr(0), pr(0), pr(0), pr(0), pr(0), Xu({ imgScale: 1, // 标注的时候放大缩小倍数 isClick: !1, // 区域是否被点击了 x1: void 0, y1: void 0, x2: void 0, y2: void 0, // 拖拽需要用的标志位 moveX1: void 0, moveY1: void 0, moveX2: void 0, moveY2: void 0, //-------------------------- left: void 0, // x轴侧偏移量,相对于canvas上的值 top: void 0, // y轴偏移量,相对于canvas上的值 imgScale: 1, // 标注的时候放大缩小倍数 isClick: !1, // 区域是否被点击了 // 原始图片上的位置 originX1: void 0, originX2: void 0, originY1: void 0, originY2: void 0, color: void 0 // 上颜色用的的 }), pr(!1), pr([]), pr(!1), pr(void 0), pr(void 0), pr(!0); let xe = null; const ue = Xu({ width: 500, height: 500 }); Xu({ width: null, height: null }); function Se() { if (xe = new Yq.Canvas(`labelCanvas${re.modelValue.questionIndex}`, { width: ue.width, // canvas 宽 height: ue.height, backgroundColor: "#ffffff", transparentCorners: !0, fireRightClick: !0, // 启用右键,button的数字为3 stopContextMenu: !0 // 禁止默认右键菜单 }), xe.skipTargetFind = !0, xe.on("mouse:wheel", (ot) => { let fe = ot.e.deltaY, Et = xe.getZoom(); Et *= 0.999 ** fe, Et > 20 && (Et = 20), Et < 0.01 && (Et = 0.01), xe.zoomToPoint( { // 关键点 x: ot.e.offsetX, y: ot.e.offsetY }, Et ), ot.e.preventDefault(), ot.e.stopPropagation(); }), re.modelValue.maodianObject.str && re.modelValue.maodianObject.imgUrl) { const ot = JSON.parse(re.modelValue.maodianObject.str); ot.objects.forEach((fe, Et) => { fe.objects[1].text = String(Et + 1); }), xe.loadFromJSON( ot, xe.renderAll.bind(xe), function(fe, Et) { } ); } } return ub(() => { Se(), Ve(); }), (ot, fe) => (wt(), Dt("div", DX, [ U("div", PX, [ U("span", { class: "contentStyle", innerHTML: re.modelValue.subjectEditorValue }, null, 8, LX), U("div", { ref_key: "imgContainer", ref: Rt, class: "imgContainer" }, [ U("canvas", { ref_key: "canvas", ref: tt, id: "labelCanvas" + re.modelValue.questionIndex, width: "500", height: "500" }, null, 8, IX) ], 512) ]) ])); } }, $X = /* @__PURE__ */ $f(NX, [["__scopeId", "data-v-135d5ee5"]]), FX = { class: "tiBox tiBox3" }, VX = { class: "tiNumber" }, zX = { class: "tiContent maodianCentent" }, HX = ["for"], UX = { key: 0 }, jX = { class: "solution" }, WX = { style: { color: "#00b600", "margin-right": "5px", "margin-left": "5px" } }, qX = { key: 0 }, GX = { style: { color: "#766f6f" } }, XX = { class: "solutionTitle" }, YX = ["innerHTML"], KX = { class: "solutionTitle" }, QX = { style: { color: "#50ca45", "font-weight": "600" } }, ZX = { class: "solutionTitle" }, JX = { style: { color: "#50ca45", "font-weight": "600" } }, eY = { __name: "canvasMaoDian", props: { modelValue: { type: Object, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, isPreview: { type: Boolean, default: !0 } }, setup(qe) { const W = qe, re = Xu({ optionIndex: null, isRight: null, answer: null, qAnswer: null, answerObj: [] }), lt = Xu({ getScore: 0, isRight: !0, isAnswered: !1 }), Ve = (Ye = "") => { const Me = /<br>$/i, tt = Ye.replace(/^(\s*&nbsp;\s*)+|(\s*&nbsp;\s*)+$/g, "").trim(); return Me.test(tt) ? tt.replace(Me, "") : tt; }, ke = (Ye) => { lt.getScore = 0; let Me = (W.modelValue.answers.score - 0) / W.modelValue.options.length; re.answerObj = W.modelValue.options.reduce((fn, Ft) => { Ft.answer == Ft.optionTextValue ? Ft.isRight = !0 : Ft.equalAnswers.length ? Ft.isRight = Ft.equalAnswers.some( (Ot) => Ve(Ot.equalAnswerEditorValue) == Ve(Ft.answer) ) : Ft.isRight = !1, Ft.getScore = Ft.isRight ? (Me.toFixed(2) - 0).toFixed(2) : 0, Ft.score = Me.toFixed(2) - 0, Ft.isAnswered = Ft.answer != null, Ft.qAnswer = [], Ft.qAnswer.push(Ft.optionTextValue); let ft = { isRight: Ft.isRight, getScore: Ft.getScore, score: Ft.score, isAnswered: Ft.isAnswered, answer: Ft.answer, qAnswer: Ft.qAnswer }; return fn.push(ft), fn; }, []); let tt = W.modelValue.options.every((fn) => fn.isAnswered && fn.isRight), sn = 0; tt ? lt.getScore = W.modelValue.answers.score : re.answerObj.forEach((fn) => { lt.getScore += fn.getScore - 0, fn.isRight && (sn += 1), fn.isAnswered && (lt.isAnswered = !0); }), lt.isRight = sn == 0 ? !1 : sn == W.modelValue.options.length ? !0 : "trueFalse", W.modelValue.answers = Object.assign(W.modelValue.answers, { id: W.modelValue.id, questionUuid: W.modelValue.questionUuid, getScore: lt.getScore - 0, type: W.modelValue.questionTypeBase, isRight: lt.isRight, answerObj: re.answerObj, isAnswered: lt.isAnswered }); }; return (Ye, Me) => { const tt = ls("el-input"); return wt(), Dt("article", null, [ U("section", FX, [ U("span", VX, $r(W.modelValue.id) + ".", 1), U("div", zX, [ (wt(), Nu($X, { modelValue: W.modelValue, props: W.restore, key: W.modelValue.id + W.restore }, null, 8, ["modelValue", "props"])), U("div", null, [ (wt(!0), Dt(ro, null, ao(W.modelValue.options, (sn, fn) => (wt(), Dt("div", { key: fn, style: { "margin-right": "30px" } }, [ U("div", null, [ Eo(tt, { modelValue: sn.answer, "onUpdate:modelValue": (Ft) => sn.answer = Ft, id: sn.optionUuid, onBlur: (Ft) => ke(), disabled: W.restore || W.isPreview }, { prepend: $i(() => [ U("label", { for: sn.optionUuid }, "空" + $r(fn + 1), 9, HX) ]), _: 2 }, 1032, ["modelValue", "onUpdate:modelValue", "id", "onBlur", "disabled"]) ]) ]))), 128)) ]) ]) ]), W.restore ? (wt(), Dt("div", UX, [ U("section", jX, [ U("ul", null, [ U("li", null, [ Me[2] || (Me[2] = U("span", { class: "solutionTitle" }, "参考答案:", -1)), (wt(!0), Dt(ro, null, ao(W.modelValue.options, (sn, fn) => (wt(), Dt("div", { class: "solutionBody", key: fn }, [ U("span", null, [ Wn("区域" + $r(fn + 1) + ": ", 1), U("span", WX, $r(sn.optionTextValue), 1), sn.equalAnswers ? (wt(), Dt("span", qX, [ Me[0] || (Me[0] = Wn("(  等效答案: ")), (wt(!0), Dt(ro, null, ao(sn.equalAnswers, (Ft) => (wt(), Dt("span", null, $r(Ft.equalAnswerEditorValue) + "、  ", 1))), 256)), Me[1] || (Me[1] = Wn(" ) ")) ])) : sa("", !0) ]) ]))), 128)) ]), U("li", null, [ Me[3] || (Me[3] = U("span", { class: "solutionTitle" }, "我的答案:", -1)), (wt(!0), Dt(ro, null, ao(W.modelValue.answers.answerObj, (sn, fn) => (wt(), Dt("div", { class: "solutionBody", key: fn }, [ U("span", GX, [ Wn("区域" + $r(fn + 1) + ": ", 1), U("span", { style: { "margin-right": "5px", "margin-left": "5px" }, class: tc(W.modelValue.answers.isRight == !0 ? "standardTrue" : W.modelValue.answers.isRight == !1 ? "standardFalse" : "standardHalfTrue") }, $r(sn.answer), 3) ]) ]))), 128)) ]), U("li", null, [ U("span", XX, [ Me[4] || (Me[4] = Wn("参考解析: ")), U("div", { class: "solutionBody", innerHTML: W.modelValue.explainEditorValue }, null, 8, YX) ]) ]), U("li", null, [ U("span", KX, [ Me[5] || (Me[5] = Wn("本题得分:")), U("span", QX, $r(W.modelValue.answers.getScore), 1), Me[6] || (Me[6] = Wn("分")) ]) ]), U("li", null, [ U("span", ZX, [ Me[7] || (Me[7] = Wn("本题满分:")), U("span", JX, $r(W.modelValue.answers.score), 1), Me[8] || (Me[8] = Wn("分")) ]) ]) ]) ]) ])) : sa("", !0) ]); }; } }, JF = /* @__PURE__ */ $f(eY, [["__scopeId", "data-v-23d398df"]]), tY = { class: "tiBox tiBox3" }, nY = { class: "tiNumber" }, rY = { class: "tiContent" }, aY = ["innerHTML"], oY = { key: 0 }, iY = { class: "answerTips" }, uY = { key: 0, class: "reAnswered", "aria-hidden": "true" }, sY = { key: 1, class: "reTrue", "aria-hidden": "true" }, lY = { key: 2, class: "reFalse", "aria-hidden": "true" }, cY = { key: 3, class: "reHalfTrue", "aria-hidden": "true" }, fY = { class: "solution" }, vY = { class: "solutionBody" }, dY = { class: "solutionBody" }, mY = ["innerHTML"], gY = { class: "solutionTitle" }, hY = { style: { color: "#50ca45", "font-weight": "600" } }, pY = { class: "solutionTitle" }, bY = { style: { color: "#50ca45", "font-weight": "600" } }, yY = { __name: "rankingQuestion", props: { modelValue: { type: Object, default: () => ({}) }, keys: { type: Number, default: 0 }, restore: { type: Boolean, default: !1 }, background: { type: String, default: "#fffad6" }, isPreview: { type: Boolean, default: !0 } }, emits: ["rankingQuestionEmit"], setup(qe, { emit: W }) { const re = qe, lt = pr(!1), Ve = () => { lt.value = !0; let ke = !0, Ye = []; re.modelValue.options.map((Me, tt) => { Ye.push(Me.optionTextValue), Me.optionPaiXuValue - 0 != tt + 1 && (ke = !1); }), re.modelValue.answers = Object.assign(re.modelValue.answers, { id: re.modelValue.id, answer: Ye.join(","), answerObj: Ye, questionUuid: re.modelValue.questionUuid, getScore: ke ? re.modelValue.answers.score - 0 : 0, type: re.modelValue.questionTypeBase, isRight: ke,