@qxs-bns/components 0.0.40 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/es/package.json.mjs +1 -1
  2. package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
  3. package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
  4. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
  5. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
  6. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
  7. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs.map +1 -1
  8. package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
  9. package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
  10. package/lib/package.json.cjs +1 -1
  11. package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
  12. package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
  13. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
  14. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
  15. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
  16. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs.map +1 -1
  17. package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
  18. package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
  19. package/package.json +1 -1
  20. package/types/src/subject-action/index.d.ts +9 -0
  21. package/types/src/subject-action/index.d.ts.map +1 -1
  22. package/types/src/subject-action/src/subject-action.vue.d.ts +9 -0
  23. package/types/src/subject-action/src/subject-action.vue.d.ts.map +1 -1
  24. package/types/src/subject-list/src/components/SubjectPageEnd.vue.d.ts.map +1 -1
  25. package/types/src/subject-list/src/components/SubjectRichText.vue.d.ts.map +1 -1
  26. package/types/tsconfig.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),t=require("vue"),l=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),r=require("../../../subject-action/src/subject-action.vue.cjs"),n=require("../../../subject-layout/src/subject-layout.vue.cjs"),o=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.cjs"),i=require("@qxs-bns/utils");const s={class:"preview"},u={class:"title"},d={key:0},c={key:1},m={key:0},p=["innerHTML"],f={class:"preview-answer"},v={class:"order"},y={class:"order"},x={style:{flex:"1"}},C={class:"margin-bottom flex flex-items-center"},w={class:"margin-bottom answer-list"},h={class:"order"},k={key:0,class:"margin-bottom flex flex-items-center"},V={style:{flex:"1"}},g={key:1,class:"flex"},E={style:{flex:"1"}},N={key:2,class:"margin-bottom flex"},B={style:{flex:"1"}},S={class:"flex flex-justify-end"};var b=t.defineComponent({name:"QxsSubjectSingle",__name:"subject-single",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},type:{type:String,required:!0},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},answerList:{type:null,required:!1},leastAnswerCount:{type:Number,required:!1},analysis:{type:String,required:!1},examExpand:{type:String,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1},customId:{type:Number,required:!1},examId:{type:Number,required:!1},isKey:{type:Boolean,required:!0},answerCheckType:{type:Number,required:!0}},emits:["move","save","delete","edit","add","setRelation"],setup(b,{emit:T}){const q=b,R=T,A=t.useAttrs(),_=t.ref(0),j=t.ref(q.isKey),D=t.ref(1),I=t.ref(1),L=t.ref([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),M=t.ref(2),U=t.ref(""),z=t.ref(""),O=t.ref(!1),$=t.ref(""),K=t.ref(0),F=t.ref(!1),P=t.ref(""),G=t.computed((()=>"single"===q.type?"单选题":"multiple"===q.type?"多选题":"排序题")),H=t.ref([]),Q=t.computed((()=>{const e=[];for(let t=L.value.length;t>1;t--)e.push({label:`至少选择${t}项`,value:t});return e.reverse()}));function J(){q.isSave||L.value.push({title:"",isCorrect:!1,customAnswerId:i.setGuid()})}function W(){O.value=!1,$.value=""}function X(){if(!U.value)return void e.ElMessage.error("题目标题不能为空!");let t="",l=!1,a=0;if("multiple"===q.type||"single"===q.type?L.value.forEach(((e,r)=>{e.title?.trim()||(t+=`选项${String.fromCharCode(65+r)}未填写。`),e.isCorrect&&(l=!0,a++),e.relationType=e.resultItem?1:e.answerRelations?.length?2:null})):"sort"===q.type&&H.value.length&&(l=!0),t)return void e.ElMessage.error(t);if(new Set(L.value.map((e=>e.title))).size===L.value.length){if("multiple"===q.type){if(1===a)return void e.ElMessage.error("请至少设置两个支持选项");if(l&&a<M.value)return void e.ElMessage.error("至少选几项与支持选项数不符")}2!==D.value&&3!==D.value||l?R("save",{title:U.value,answers:L.value.map(((e,t)=>({...e,orderIndex:t+1}))),examExpand:H.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:z.value,isSetCorrectAnswer:l,leastAnswerCount:M.value,examRichTextContent:O.value?$.value:"",examAnswerRelationType:I.value,isKey:j.value,answerCheckType:D.value}):e.ElMessage.error("请设置支持选项")}else e.ElMessage.error("选项不能重复")}function Y(){L.value[_.value].resultItem=P.value||"",F.value=!1}function Z(){F.value=!1,P.value=""}function ee(e){j.value=e}function te(e){D.value=e}function le(e,t){R("add",e,t?q.examAnswerRelationType:null)}t.watch((()=>q.isEdit),(()=>{q.isEdit&&(K.value=(new Date).getTime())}));const ae=t.computed((()=>e=>{let t=0;return e.forEach((e=>{e.relationAnswers&&(t+=e.relationAnswers.length)})),t})),re=a.useNamespace("subject-single");return t.onMounted((function(){if(q.title&&(U.value=q.title),q.answerCheckType&&(D.value=q.answerCheckType),q.examAnswerRelationType&&(I.value=q.examAnswerRelationType),q.answerList&&q.answerList.length&&(L.value=q.answerList),q.leastAnswerCount&&(M.value=q.leastAnswerCount),q.examExpand&&q.examExpand){const e=q.examExpand.split(",");H.value=e.map((e=>{const t=q.answerList.find((t=>t.answerId?.toString()===e));return t?String.fromCharCode(65+t.orderIndex-1):e})).filter(Boolean)}q.analysis&&(z.value=q.analysis),q.examRichTextContent&&($.value=q.examRichTextContent,O.value=!0)})),(a,b)=>{const T=e.ElCheckbox,K=e.ElRadio,ne=e.ElInput,oe=e.ElOption,ie=e.ElSelect,se=e.ElIcon,ue=e.ElLink,de=e.ElButton,ce=e.ElDialog;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(re).e("single-exam"))},[t.createVNode(n.default,{"show-edit":a.isEdit},t.createSlots({preview:t.withCtx((()=>[t.createElementVNode("div",s,[t.createElementVNode("div",null,[t.createElementVNode("span",u,[t.createTextVNode(t.toDisplayString(a.orderIndex+1)+"."+t.toDisplayString(t.unref(U))+" ",1),"single"===a.type?(t.openBlock(),t.createElementBlock("span",d,"(单选题)")):["multiple","sort"].includes(a.type)?(t.openBlock(),t.createElementBlock("span",c," ("+t.toDisplayString(t.unref(G))+t.toDisplayString(t.unref(M)?`至少选${t.unref(M)}项${"sort"===a.type?"并排序":""}`:"")+") ",1)):t.createCommentVNode("v-if",!0)])]),t.unref(O)?(t.openBlock(),t.createElementBlock("div",m,[t.createElementVNode("div",{innerHTML:t.unref($)},null,8,p)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",f,["sort"===a.type?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(T,{key:l,class:"radio",disabled:!0},{default:t.withCtx((()=>[t.createElementVNode("span",v,t.toDisplayString(String.fromCharCode(65+l))+". ",1),t.createTextVNode(" "+t.toDisplayString(e.title),1)])),_:2},1024)))),128)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(K,{key:l,class:"radio",value:"disabled",disabled:""},{default:t.withCtx((()=>[t.createElementVNode("span",y,t.toDisplayString(String.fromCharCode(65+l))+". ",1),t.createTextVNode(" "+t.toDisplayString(e.title)+" "+t.toDisplayString(e.isCorrect?"(支持选项)":"")+" "+t.toDisplayString(1===t.unref(I)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+t.toDisplayString(2===t.unref(I)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:t.withCtx((()=>[a.showAction?(t.openBlock(),t.createBlock(r.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,isKey:t.unref(j),showOtherOption:"multiple"===q.type||"single"===q.type,examAnswerRelationType:q.examAnswerRelationType,answerCheckType:t.unref(D),onMoveUp:b[5]||(b[5]=e=>R("move","up")),onMoveDown:b[6]||(b[6]=e=>R("move","down")),onDelete:b[7]||(b[7]=e=>R("delete")),onSave:X,onEdit:b[8]||(b[8]=e=>R("edit")),onAdd:le,onOnShowRichText:b[9]||(b[9]=e=>O.value=!0),onSetKey:ee,onSetAnswerSetting:te},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):t.createCommentVNode("v-if",!0)])),_:2},[a.isEdit?{name:"edit",fn:t.withCtx((()=>[t.createElementVNode("div",{class:t.normalizeClass(["flex",[{"margin-bottom":t.unref(O)}]])},[b[12]||(b[12]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"题目:")],-1)),t.createElementVNode("div",x,[t.createVNode(ne,{modelValue:t.unref(U),"onUpdate:modelValue":b[0]||(b[0]=e=>t.isRef(U)?U.value=e:null),type:"textarea",rows:2,placeholder:`【${t.unref(G)}】请输入问题`,disabled:a.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),t.createElementVNode("div",C,[b[13]||(b[13]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"设置:")],-1)),["multiple","sort"].includes(a.type)?(t.openBlock(),t.createBlock(ie,{key:0,modelValue:t.unref(M),"onUpdate:modelValue":b[1]||(b[1]=e=>t.isRef(M)?M.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:a.isSave},{default:t.withCtx((()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Q),(e=>(t.openBlock(),t.createBlock(oe,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",w,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(L),((e,r)=>(t.openBlock(),t.createElementBlock("div",{key:r,class:"answer-item flex flex-items-center"},[t.createElementVNode("span",h,t.toDisplayString(String.fromCharCode(65+r))+".",1),t.createVNode(ne,{modelValue:e.title,"onUpdate:modelValue":t=>e.title=t,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+r)}`,disabled:a.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(a.type)?(t.openBlock(),t.createBlock(T,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":t=>e.isCorrect=t,class:t.normalizeClass([{"is-correct":e.isCorrect}]),disabled:a.isSave,style:{"margin-left":"10px"},onChange:t=>function(e,t){"single"===q.type?(t&&L.value.forEach((t=>{t!==e&&(t.isCorrect=!1)})),e.isCorrect=t):"multiple"===q.type&&(e.isCorrect=t)}(e,t)},{default:t.withCtx((()=>[...b[14]||(b[14]=[t.createTextVNode(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):t.createCommentVNode("v-if",!0),t.createVNode(se,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.CirclePlus),{class:t.normalizeClass([{disabled:a.isSave}]),onClick:J},null,8,["class"])])),_:1}),t.createVNode(se,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.Remove),{class:t.normalizeClass([{disabled:t.unref(L).length<3||a.isSave}]),onClick:e=>function(e){L.value.length<3||q.isSave||L.value.splice(e,1)}(r)},null,8,["class","onClick"])])),_:2},1024),1===t.unref(I)&&"sort"!==a.type?(t.openBlock(),t.createBlock(ue,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=r,_.value=t,P.value=L.value[t].resultItem||"",void(F.value=!0);var t}},{default:t.withCtx((()=>[t.createElementVNode("span",null,t.toDisplayString(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):t.createCommentVNode("v-if",!0),2===t.unref(I)&&"sort"!==a.type?(t.openBlock(),t.createBlock(ue,{key:2,type:"primary",class:"margin-left-10",onClick:t=>function(e){e.customAnswerId=e.examAnswerId||i.setGuid(),R("setRelation",q.customId,e)}(e)},{default:t.withCtx((()=>[t.createElementVNode("span",null,t.toDisplayString(e.answerRelations?.length?`关联了${t.unref(ae)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):t.createCommentVNode("v-if",!0)])))),128))]),"sort"===a.type?(t.openBlock(),t.createElementBlock("div",k,[b[15]||(b[15]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"排序答案:")],-1)),t.createElementVNode("div",V,[t.createVNode(ie,{modelValue:t.unref(H),"onUpdate:modelValue":b[2]||(b[2]=e=>t.isRef(H)?H.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:t.withCtx((()=>[t.createCommentVNode(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(oe,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):t.createCommentVNode("v-if",!0),a.showAnalysis?(t.openBlock(),t.createElementBlock("div",g,[b[16]||(b[16]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"解析:")],-1)),t.createElementVNode("div",E,[t.createVNode(ne,{modelValue:t.unref(z),"onUpdate:modelValue":b[3]||(b[3]=e=>t.isRef(z)?z.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):t.createCommentVNode("v-if",!0),t.unref(O)?(t.openBlock(),t.createElementBlock("div",N,[b[18]||(b[18]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"富文本:")],-1)),t.createElementVNode("div",B,[t.createVNode(o.default,t.mergeProps({"model-value":t.unref($),"onUpdate:modelValue":b[4]||(b[4]=e=>t.isRef($)?$.value=e:null)},t.unref(A),{style:{width:"100%"}}),null,16,["model-value"]),t.createElementVNode("div",S,[t.createVNode(ue,{type:"danger",onClick:W},{default:t.withCtx((()=>b[17]||(b[17]=[t.createTextVNode(" 删除富文本 ")]))),_:1})])])])):t.createCommentVNode("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),t.createVNode(ce,{modelValue:t.unref(F),"onUpdate:modelValue":b[11]||(b[11]=e=>t.isRef(F)?F.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:t.withCtx((()=>[t.createVNode(de,{class:"customize-button",type:"primary",plain:"",onClick:Z},{default:t.withCtx((()=>b[19]||(b[19]=[t.createTextVNode(" 取消 ")]))),_:1}),t.createVNode(de,{class:"customize-button",type:"primary",plain:"",onClick:Y},{default:t.withCtx((()=>b[20]||(b[20]=[t.createTextVNode(" 保存 ")]))),_:1})])),default:t.withCtx((()=>[(t.openBlock(),t.createBlock(o.default,t.mergeProps({key:t.unref(_),"model-value":t.unref(P),"onUpdate:modelValue":b[10]||(b[10]=e=>t.isRef(P)?P.value=e:null)},t.unref(A),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});exports.default=b;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),t=require("vue"),l=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),r=require("../../../subject-action/src/subject-action.vue.cjs"),n=require("../../../subject-layout/src/subject-layout.vue.cjs"),o=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.cjs"),i=require("@qxs-bns/utils");const s={class:"preview"},u={class:"title"},d={key:0},c={key:1},m={key:0},p=["innerHTML"],f={class:"preview-answer"},v={class:"order"},y={class:"order"},x={style:{flex:"1"}},C={class:"margin-bottom flex flex-items-center"},w={class:"margin-bottom answer-list"},h={class:"order"},k={key:0,class:"margin-bottom flex flex-items-center"},V={style:{flex:"1"}},g={key:1,class:"flex"},E={style:{flex:"1"}},N={key:2,class:"margin-bottom flex"},B={style:{flex:"1"}},S={class:"flex flex-justify-end"};var b=t.defineComponent({name:"QxsSubjectSingle",__name:"subject-single",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},type:{type:String,required:!0},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},answerList:{type:null,required:!1},leastAnswerCount:{type:Number,required:!1},analysis:{type:String,required:!1},examExpand:{type:String,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1},customId:{type:Number,required:!1},examId:{type:Number,required:!1},isKey:{type:Boolean,required:!0},answerCheckType:{type:Number,required:!0}},emits:["move","save","delete","edit","add","setRelation"],setup(b,{emit:T}){const R=b,q=T,A=t.useAttrs(),_=t.ref(0),j=t.ref(R.isKey),D=t.ref(1),I=t.ref(R.examAnswerRelationType),L=t.ref([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),M=t.ref(2),U=t.ref(""),z=t.ref(""),O=t.ref(!1),$=t.ref(""),K=t.ref(0),F=t.ref(!1),P=t.ref(""),G=t.computed((()=>"single"===R.type?"单选题":"multiple"===R.type?"多选题":"排序题")),H=t.ref([]),Q=t.computed((()=>{const e=[];for(let t=L.value.length;t>1;t--)e.push({label:`至少选择${t}项`,value:t});return e.reverse()}));function J(){R.isSave||L.value.push({title:"",isCorrect:!1,customAnswerId:i.setGuid()})}function W(){O.value=!1,$.value=""}function X(){if(!U.value)return void e.ElMessage.error("题目标题不能为空!");let t="",l=!1,a=0;if("multiple"===R.type||"single"===R.type?L.value.forEach(((e,r)=>{e.title?.trim()||(t+=`选项${String.fromCharCode(65+r)}未填写。`),e.isCorrect&&(l=!0,a++),e.relationType=e.resultItem?1:e.answerRelations?.length?2:null})):"sort"===R.type&&H.value.length&&(l=!0),t)return void e.ElMessage.error(t);if(new Set(L.value.map((e=>e.title))).size===L.value.length){if("multiple"===R.type){if(1===a)return void e.ElMessage.error("请至少设置两个支持选项");if(l&&a<M.value)return void e.ElMessage.error("至少选几项与支持选项数不符")}2!==D.value&&3!==D.value||l?q("save",{title:U.value,answers:L.value.map(((e,t)=>({...e,orderIndex:t+1}))),examExpand:H.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:z.value,isSetCorrectAnswer:l,leastAnswerCount:M.value,examRichTextContent:O.value?$.value:"",examAnswerRelationType:I.value,isKey:j.value,answerCheckType:D.value}):e.ElMessage.error("请设置支持选项")}else e.ElMessage.error("选项不能重复")}function Y(){L.value[_.value].resultItem=P.value||"",F.value=!1}function Z(){F.value=!1,P.value=""}function ee(e){j.value=e}function te(e){D.value=e}function le(e,t){q("add",e,t?R.examAnswerRelationType:null)}t.watch((()=>R.isEdit),(()=>{R.isEdit&&(K.value=(new Date).getTime())}));const ae=t.computed((()=>e=>{let t=0;return e.forEach((e=>{e.relationAnswers&&(t+=e.relationAnswers.length)})),t})),re=a.useNamespace("subject-single");return t.onMounted((function(){if(R.title&&(U.value=R.title),R.answerCheckType&&(D.value=R.answerCheckType),R.examAnswerRelationType&&(I.value=R.examAnswerRelationType),R.answerList&&R.answerList.length&&(L.value=R.answerList),R.leastAnswerCount&&(M.value=R.leastAnswerCount),R.examExpand&&R.examExpand){const e=R.examExpand.split(",");H.value=e.map((e=>{const t=R.answerList.find((t=>t.answerId?.toString()===e));return t?String.fromCharCode(65+t.orderIndex-1):e})).filter(Boolean)}R.analysis&&(z.value=R.analysis),R.examRichTextContent&&($.value=R.examRichTextContent,O.value=!0)})),(a,b)=>{const T=e.ElCheckbox,K=e.ElRadio,ne=e.ElInput,oe=e.ElOption,ie=e.ElSelect,se=e.ElIcon,ue=e.ElLink,de=e.ElButton,ce=e.ElDialog;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(re).e("single-exam"))},[t.createVNode(n.default,{"show-edit":a.isEdit},t.createSlots({preview:t.withCtx((()=>[t.createElementVNode("div",s,[t.createElementVNode("div",null,[t.createElementVNode("span",u,[t.createTextVNode(t.toDisplayString(a.orderIndex+1)+"."+t.toDisplayString(t.unref(U))+" ",1),"single"===a.type?(t.openBlock(),t.createElementBlock("span",d,"(单选题)")):["multiple","sort"].includes(a.type)?(t.openBlock(),t.createElementBlock("span",c," ("+t.toDisplayString(t.unref(G))+t.toDisplayString(t.unref(M)?`至少选${t.unref(M)}项${"sort"===a.type?"并排序":""}`:"")+") ",1)):t.createCommentVNode("v-if",!0)])]),t.unref(O)?(t.openBlock(),t.createElementBlock("div",m,[t.createElementVNode("div",{innerHTML:t.unref($)},null,8,p)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",f,["sort"===a.type?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(T,{key:l,class:"radio",disabled:!0},{default:t.withCtx((()=>[t.createElementVNode("span",v,t.toDisplayString(String.fromCharCode(65+l))+". ",1),t.createTextVNode(" "+t.toDisplayString(e.title),1)])),_:2},1024)))),128)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(K,{key:l,class:"radio",value:"disabled",disabled:""},{default:t.withCtx((()=>[t.createElementVNode("span",y,t.toDisplayString(String.fromCharCode(65+l))+". ",1),t.createTextVNode(" "+t.toDisplayString(e.title)+" "+t.toDisplayString(e.isCorrect?"(支持选项)":"")+" "+t.toDisplayString(1===t.unref(I)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+t.toDisplayString(2===t.unref(I)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:t.withCtx((()=>[a.showAction?(t.openBlock(),t.createBlock(r.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,isKey:t.unref(j),showOtherOption:"multiple"===R.type||"single"===R.type,examAnswerRelationType:R.examAnswerRelationType,answerCheckType:t.unref(D),onMoveUp:b[5]||(b[5]=e=>q("move","up")),onMoveDown:b[6]||(b[6]=e=>q("move","down")),onDelete:b[7]||(b[7]=e=>q("delete")),onSave:X,onEdit:b[8]||(b[8]=e=>q("edit")),onAdd:le,onOnShowRichText:b[9]||(b[9]=e=>O.value=!0),onSetKey:ee,onSetAnswerSetting:te},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):t.createCommentVNode("v-if",!0)])),_:2},[a.isEdit?{name:"edit",fn:t.withCtx((()=>[t.createElementVNode("div",{class:t.normalizeClass(["flex",[{"margin-bottom":t.unref(O)}]])},[b[12]||(b[12]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"题目:")],-1)),t.createElementVNode("div",x,[t.createVNode(ne,{modelValue:t.unref(U),"onUpdate:modelValue":b[0]||(b[0]=e=>t.isRef(U)?U.value=e:null),type:"textarea",rows:2,placeholder:`【${t.unref(G)}】请输入问题`,disabled:a.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),t.createElementVNode("div",C,[b[13]||(b[13]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"设置:")],-1)),["multiple","sort"].includes(a.type)?(t.openBlock(),t.createBlock(ie,{key:0,modelValue:t.unref(M),"onUpdate:modelValue":b[1]||(b[1]=e=>t.isRef(M)?M.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:a.isSave},{default:t.withCtx((()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Q),(e=>(t.openBlock(),t.createBlock(oe,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",w,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(L),((e,r)=>(t.openBlock(),t.createElementBlock("div",{key:r,class:"answer-item flex flex-items-center"},[t.createElementVNode("span",h,t.toDisplayString(String.fromCharCode(65+r))+".",1),t.createVNode(ne,{modelValue:e.title,"onUpdate:modelValue":t=>e.title=t,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+r)}`,disabled:a.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(a.type)?(t.openBlock(),t.createBlock(T,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":t=>e.isCorrect=t,class:t.normalizeClass([{"is-correct":e.isCorrect}]),disabled:a.isSave,style:{"margin-left":"10px"},onChange:t=>function(e,t){"single"===R.type?(t&&L.value.forEach((t=>{t!==e&&(t.isCorrect=!1)})),e.isCorrect=t):"multiple"===R.type&&(e.isCorrect=t)}(e,t)},{default:t.withCtx((()=>[...b[14]||(b[14]=[t.createTextVNode(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):t.createCommentVNode("v-if",!0),t.createVNode(se,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.CirclePlus),{class:t.normalizeClass([{disabled:a.isSave}]),onClick:J},null,8,["class"])])),_:1}),t.createVNode(se,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.Remove),{class:t.normalizeClass([{disabled:t.unref(L).length<3||a.isSave}]),onClick:e=>function(e){L.value.length<3||R.isSave||L.value.splice(e,1)}(r)},null,8,["class","onClick"])])),_:2},1024),1===t.unref(I)&&"sort"!==a.type?(t.openBlock(),t.createBlock(ue,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=r,_.value=t,P.value=L.value[t].resultItem||"",void(F.value=!0);var t}},{default:t.withCtx((()=>[t.createElementVNode("span",null,t.toDisplayString(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):t.createCommentVNode("v-if",!0),2===t.unref(I)&&"sort"!==a.type?(t.openBlock(),t.createBlock(ue,{key:2,type:"primary",class:"margin-left-10",onClick:t=>function(e){e.customAnswerId=e.examAnswerId||i.setGuid(),q("setRelation",R.customId,e)}(e)},{default:t.withCtx((()=>[t.createElementVNode("span",null,t.toDisplayString(e.answerRelations?.length?`关联了${t.unref(ae)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):t.createCommentVNode("v-if",!0)])))),128))]),"sort"===a.type?(t.openBlock(),t.createElementBlock("div",k,[b[15]||(b[15]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"排序答案:")],-1)),t.createElementVNode("div",V,[t.createVNode(ie,{modelValue:t.unref(H),"onUpdate:modelValue":b[2]||(b[2]=e=>t.isRef(H)?H.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:t.withCtx((()=>[t.createCommentVNode(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(L),((e,l)=>(t.openBlock(),t.createBlock(oe,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):t.createCommentVNode("v-if",!0),a.showAnalysis?(t.openBlock(),t.createElementBlock("div",g,[b[16]||(b[16]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"解析:")],-1)),t.createElementVNode("div",E,[t.createVNode(ne,{modelValue:t.unref(z),"onUpdate:modelValue":b[3]||(b[3]=e=>t.isRef(z)?z.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):t.createCommentVNode("v-if",!0),t.unref(O)?(t.openBlock(),t.createElementBlock("div",N,[b[18]||(b[18]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"富文本:")],-1)),t.createElementVNode("div",B,[t.createVNode(o.default,t.mergeProps({"model-value":t.unref($),"onUpdate:modelValue":b[4]||(b[4]=e=>t.isRef($)?$.value=e:null)},t.unref(A),{style:{width:"100%"}}),null,16,["model-value"]),t.createElementVNode("div",S,[t.createVNode(ue,{type:"danger",onClick:W},{default:t.withCtx((()=>b[17]||(b[17]=[t.createTextVNode(" 删除富文本 ")]))),_:1})])])])):t.createCommentVNode("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),t.createVNode(ce,{modelValue:t.unref(F),"onUpdate:modelValue":b[11]||(b[11]=e=>t.isRef(F)?F.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:t.withCtx((()=>[t.createVNode(de,{class:"customize-button",type:"primary",plain:"",onClick:Z},{default:t.withCtx((()=>b[19]||(b[19]=[t.createTextVNode(" 取消 ")]))),_:1}),t.createVNode(de,{class:"customize-button",type:"primary",plain:"",onClick:Y},{default:t.withCtx((()=>b[20]||(b[20]=[t.createTextVNode(" 保存 ")]))),_:1})])),default:t.withCtx((()=>[(t.openBlock(),t.createBlock(o.default,t.mergeProps({key:t.unref(_),"model-value":t.unref(P),"onUpdate:modelValue":b[10]||(b[10]=e=>t.isRef(P)?P.value=e:null)},t.unref(A),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});exports.default=b;
2
2
  //# sourceMappingURL=subject-single.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-single.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\nimport { setGuid } from '@qxs-bns/utils'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(1)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n } \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n // if (props.isKey) {\n // isKey.value = props.isKey\n // }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }} \n {{ item.isCorrect ? '(支持选项)' : '' }} \n {{ examAnswerRelationType === 1 ? (item.resultItem? '(已设置结果项)' : '(未设置结果项)' ) : ''}} \n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length? '(已设置关联)' : '(未设置关联)') : '' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :showOtherOption=\"props.type === 'multiple' || props.type === 'single'\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\" \n v-bind=\"attrs\"\n style=\"width: 100%;\" />\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","setGuid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"wrDAWA,MAAMA,EA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iB,MAAMgB,SAASsC,IACjBA,IAAWM,IACbN,EAAOrE,WAAY,EAAA,IAIzB2E,EAAG3E,UAAY4E,GACS,aAAfzF,EAAMuB,OAEfiE,EAAG3E,UAAY4E,EACjB,6hBArBF,SAAsBjC,GAChB7C,EAAQiB,MAAMC,OAAS,GAAK7B,EAAMkC,QAG9BvB,EAAAiB,MAAM8D,OAAOlC,EAAO,EAAC,gLAuJTV,IACpBxC,EAAasB,MAAQkB,EACrB1B,EAAWQ,MAAQjB,EAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,EAAgBS,OAAQ,GAH1B,IAAsBkB,kSApItB,SAAqBQ,GACdA,EAAAnB,eAAiBmB,EAAKqC,cAAgBvD,EAAAA,UACrClC,EAAA,cAAeF,EAAM4F,SAAUtC,EAAI"}
1
+ {"version":3,"file":"subject-single.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\nimport { setGuid } from '@qxs-bns/utils'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(props.examAnswerRelationType)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n } \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n // if (props.isKey) {\n // isKey.value = props.isKey\n // }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }} \n {{ item.isCorrect ? '(支持选项)' : '' }} \n {{ examAnswerRelationType === 1 ? (item.resultItem? '(已设置结果项)' : '(未设置结果项)' ) : ''}} \n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length? '(已设置关联)' : '(未设置关联)') : '' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :showOtherOption=\"props.type === 'multiple' || props.type === 'single'\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\" \n v-bind=\"attrs\"\n style=\"width: 100%;\" />\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","setGuid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"wrDAWA,MAAMA,EAAQC,EAoBRC,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAeC,MAAI,GACnBC,EAAQD,EAAAA,IAAIP,EAAMQ,OAClBC,EAAkBF,MAAI,GACtBG,EAAyBH,EAAAA,IAAIP,EAAMU,wBACnCC,EAAUJ,EAAAA,IAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,EAAmBP,MAAI,GACvBK,EAAQL,MAAI,IACZQ,EAAWR,MAAI,IACfS,EAAeT,OAAI,GACnBU,EAAWV,MAAI,IACfW,EAAYX,MAAI,GAChBY,EAAkBZ,OAAI,GACtBa,EAAab,MAAY,IACzBc,EAAmBC,EAAAA,UAAS,IACb,WAAftB,EAAMuB,KACD,MAEe,aAAfvB,EAAMuB,KACN,MAGA,QAILC,EAAYjB,EAAcA,IAAA,IAE1BkB,EAAqBH,EAAAA,UAAS,KAClC,MAAMI,EAAQ,GAEd,IA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M8E,YAAc9E,EAAM8E,WAAWjD,SACvClB,EAAQiB,MAAQ5B,EAAM8E,YAGpB9E,EAAMc,mBACRA,EAAiBc,MAAQ5B,EAAMc,kBAG7Bd,EAAM0D,YAEJ1D,EAAM0D,WAAY,CACpB,MAAMqB,EAAsB/E,EAAM0D,WAAWsB,MAAM,KAGnDxD,EAAUI,MAAQmD,EAAoB1B,KAAK4B,IACnC,MAAAC,EAASlF,EAAM8E,WAAWK,MAAM7B,GAAcA,EAAK8B,UAAUC,aAAeJ,IAClF,OAAOC,EAASlC,OAAOC,aAAa,GAAKiC,EAAOzB,WAAa,GAAKwB,CAAA,IACjEK,OAAOC,QAAO,CAIjBvF,EAAMe,WACRA,EAASa,MAAQ5B,EAAMe,UAGrBf,EAAM6D,sBACR5C,EAASW,MAAQ5B,EAAM6D,oBACvB7C,EAAaY,OAAQ,EACvB,2iJAlJO,SAAW4D,EAASC,GACR,WAAfzF,EAAMuB,MAEJkE,GACM9E,EAAAiB,MAAMgB,SAASsC,IACjBA,IAAWM,IACbN,EAAOrE,WAAY,EAAA,IAIzB2E,EAAG3E,UAAY4E,GACS,aAAfzF,EAAMuB,OAEfiE,EAAG3E,UAAY4E,EACjB,6hBArBF,SAAsBjC,GAChB7C,EAAQiB,MAAMC,OAAS,GAAK7B,EAAMkC,QAG9BvB,EAAAiB,MAAM8D,OAAOlC,EAAO,EAAC,gLAuJTV,IACpBxC,EAAasB,MAAQkB,EACrB1B,EAAWQ,MAAQjB,EAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,EAAgBS,OAAQ,GAH1B,IAAsBkB,kSApItB,SAAqBQ,GACdA,EAAAnB,eAAiBmB,EAAKqC,cAAgBvD,EAAAA,UACrClC,EAAA,cAAeF,EAAM4F,SAAUtC,EAAI"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qxs-bns/components",
3
3
  "type": "module",
4
- "version": "0.0.40",
4
+ "version": "0.0.41",
5
5
  "description": "Vue 3 Component Library",
6
6
  "license": "MIT",
7
7
  "homepage": "https://trry-hub.github.io/qxs-bns/",
@@ -20,6 +20,10 @@ declare const QxsSubjectAction: import("../withInstall").SFCWithInstall<import("
20
20
  type: NumberConstructor;
21
21
  default: null;
22
22
  };
23
+ showRichText: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
23
27
  pageEnd: {
24
28
  type: BooleanConstructor;
25
29
  default: boolean;
@@ -56,6 +60,10 @@ declare const QxsSubjectAction: import("../withInstall").SFCWithInstall<import("
56
60
  type: NumberConstructor;
57
61
  default: null;
58
62
  };
63
+ showRichText: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
59
67
  pageEnd: {
60
68
  type: BooleanConstructor;
61
69
  default: boolean;
@@ -77,6 +85,7 @@ declare const QxsSubjectAction: import("../withInstall").SFCWithInstall<import("
77
85
  answerCheckType: number;
78
86
  showOtherOption: boolean;
79
87
  examAnswerRelationType: number;
88
+ showRichText: boolean;
80
89
  pageEnd: boolean;
81
90
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>> & Record<string, any>;
82
91
  export { QxsSubjectAction };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/subject-action/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mGAAyB,CAAA;AAE/C,OAAO,EACL,gBAAgB,EACjB,CAAA;AAED,eAAe,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/components/src/subject-action/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mGAAyB,CAAA;AAE/C,OAAO,EACL,gBAAgB,EACjB,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -20,6 +20,10 @@ declare const _default: import("vue").DefineComponent<globalThis.ExtractPropType
20
20
  type: NumberConstructor;
21
21
  default: null;
22
22
  };
23
+ showRichText: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
23
27
  pageEnd: {
24
28
  type: BooleanConstructor;
25
29
  default: boolean;
@@ -56,6 +60,10 @@ declare const _default: import("vue").DefineComponent<globalThis.ExtractPropType
56
60
  type: NumberConstructor;
57
61
  default: null;
58
62
  };
63
+ showRichText: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
59
67
  pageEnd: {
60
68
  type: BooleanConstructor;
61
69
  default: boolean;
@@ -77,6 +85,7 @@ declare const _default: import("vue").DefineComponent<globalThis.ExtractPropType
77
85
  answerCheckType: number;
78
86
  showOtherOption: boolean;
79
87
  examAnswerRelationType: number;
88
+ showRichText: boolean;
80
89
  pageEnd: boolean;
81
90
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
82
91
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"subject-action.vue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAy3BA,wBAiCG"}
1
+ {"version":3,"file":"subject-action.vue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAk4BA,wBAqCG"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubjectPageEnd.vue.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/subject-list/src/components/SubjectPageEnd.vue"],"names":[],"mappings":"AAuDA,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAC;;;;;;;;;;;;;;AAsHF,wBAOG"}
1
+ {"version":3,"file":"SubjectPageEnd.vue.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/subject-list/src/components/SubjectPageEnd.vue"],"names":[],"mappings":"AAwDA,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAC;;;;;;;;;;;;;;AAwHF,wBAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubjectRichText.vue.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/subject-list/src/components/SubjectRichText.vue"],"names":[],"mappings":"AAsFA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAC;;;;;;;;;;;;;;AAgKF,wBAOG"}
1
+ {"version":3,"file":"SubjectRichText.vue.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/subject-list/src/components/SubjectRichText.vue"],"names":[],"mappings":"AAuFA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAC;;;;;;;;;;;;;;AAkKF,wBAOG"}