@qxs-bns/components 0.0.45 → 0.0.46
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.
- package/es/_virtual/_plugin-vue_export-helper.mjs +1 -1
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +1 -1
- package/es/package.json.mjs +1 -1
- package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
- package/es/src/data-chart/src/components/card.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/empty.vue.mjs +1 -1
- package/es/src/data-chart/src/components/funnel.vue.mjs +1 -1
- package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/pie.vue.mjs +1 -1
- package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
- package/es/src/data-chart/src/components/scatter-simple.vue.mjs +1 -1
- package/es/src/data-chart/src/components/scatter.vue.mjs +1 -1
- package/es/src/data-chart/src/components/table.vue.mjs +1 -1
- package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
- package/es/src/data-chart/src/utils/config.mjs +1 -1
- package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
- package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
- package/es/src/photo-crop-tool/src/composables.mjs +1 -1
- package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
- package/es/src/subject-layout/src/subject-layout.vue.mjs +1 -1
- package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
- package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
- package/es/src/subject-type/src/subject-type.vue.mjs +1 -1
- package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
- package/es/src/withInstall.mjs +1 -1
- package/lib/_virtual/_plugin-vue_export-helper.cjs +1 -1
- package/lib/index.cjs +1 -1
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/src/components.cjs +1 -1
- package/lib/src/data-chart/index.cjs +1 -1
- package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/area.vue3.cjs +1 -1
- package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/card.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/empty.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/funnel.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/pie.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/scatter-simple.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/scatter.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
- package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
- package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
- package/lib/src/file-upload/index.cjs +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
- package/lib/src/fixed-action-bar/index.cjs +1 -1
- package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
- package/lib/src/image-upload/index.cjs +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
- package/lib/src/make-installer.cjs +1 -1
- package/lib/src/photo-crop-tool/index.cjs +1 -1
- package/lib/src/photo-crop-tool/src/composables.cjs +1 -1
- package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
- package/lib/src/subject-action/index.cjs +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
- package/lib/src/subject-layout/index.cjs +1 -1
- package/lib/src/subject-layout/src/subject-layout.vue.cjs +1 -1
- package/lib/src/subject-list/index.cjs +1 -1
- package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
- package/lib/src/subject-type/index.cjs +1 -1
- package/lib/src/subject-type/src/subject-type.vue.cjs +1 -1
- package/lib/src/tiny-mce-editor/index.cjs +1 -1
- package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
- package/lib/src/withInstall.cjs +1 -1
- package/package.json +2 -1
- package/theme-chalk/file-upload.css +1 -1
- package/theme-chalk/image-upload.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/subject-action.css +1 -1
- package/theme-chalk/subject-list.css +1 -1
- package/theme-chalk/subject-type.css +1 -1
- package/types/src/file-upload/src/file-upload.vue.d.ts.map +1 -1
- package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
- package/types/src/subject-action/src/subject-action.vue.d.ts.map +1 -1
- package/types/src/subject-list/src/components/subject-blank-fill.vue.d.ts.map +1 -1
- package/types/src/subject-list/src/components/subject-scale.vue.d.ts.map +1 -1
- package/types/src/subject-list/src/components/subject-single.vue.d.ts.map +1 -1
- package/types/src/subject-list/src/components/subject-text-fill.vue.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as
|
1
|
+
import{defineComponent as s,createElementBlock as t,openBlock as e,normalizeClass as o,unref as a,createCommentVNode as l,renderSlot as u,createElementVNode as i}from"vue";import{useNamespace as r}from"@qxs-bns/hooks";const d={key:0,class:"edit"};var c=s({name:"QxsSubjectLayout",__name:"subject-layout",props:{showEdit:{type:Boolean,required:!0}},setup(s){const c=r("subject-layout");return(s,r)=>(e(),t("div",{class:o(a(c).e("layout-exam"))},[l(' <div class="subject-layout"> '),u(s.$slots,"preview"),s.showEdit?(e(),t("div",d,[r[0]||(r[0]=i("div",{class:"triangle-up"},null,-1)),u(s.$slots,"edit")])):l("v-if",!0),u(s.$slots,"default"),l(" </div> ")],2))}});export{c as default};
|
2
2
|
//# sourceMappingURL=subject-layout.vue.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElRow as e}from"element-plus/es";import{defineComponent as t,onMounted as
|
1
|
+
import{ElRow as e}from"element-plus/es";import{defineComponent as t,onMounted as n,createElementBlock as o,openBlock as s,normalizeClass as a,unref as r,createVNode as i,withCtx as l,createElementVNode as u,toDisplayString as d}from"vue";import{useNamespace as p}from"@qxs-bns/hooks";import m from"../../../subject-action/src/subject-action.vue.mjs";var c=t({name:"QxsSubjectScale",__name:"SubjectPageEnd",props:{currentPageIndex:{type:Number,required:!0},totalPage:{type:Number,required:!0},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(t,{emit:c}){const x=t,y=c;n((function(){}));const v=p("subject-end");return(t,n)=>{const p=e;return s(),o("div",{class:a(r(v).e("end-exam"))},[i(p,{type:"flex",align:"middle"},{default:l((()=>[n[5]||(n[5]=u("span",{class:"auto-line"},null,-1)),u("span",null,"第"+d(x.currentPageIndex)+" / "+d(t.totalPage)+"页",1),n[6]||(n[6]=u("span",{class:"auto-line"},null,-1))])),_:1}),i(m,{"is-edit":!1,"is-set":t.isSet,pageEnd:!0,examAnswerRelationType:x.examAnswerRelationType,showOtherOption:!1,showRichText:!1,onMoveUp:n[0]||(n[0]=e=>y("move","up")),onMoveDown:n[1]||(n[1]=e=>y("move","down")),onDelete:n[2]||(n[2]=e=>y("delete")),onEdit:n[3]||(n[3]=e=>y("edit")),onAdd:n[4]||(n[4]=e=>y("add",e))},null,8,["is-set","examAnswerRelationType"])],2)}}});export{c as default};
|
2
2
|
//# sourceMappingURL=SubjectPageEnd.vue.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{defineComponent as e,useAttrs as t,ref as o,onMounted as i,createElementBlock as r,openBlock as n,normalizeClass as s,unref as d,createVNode as
|
1
|
+
import{defineComponent as e,useAttrs as t,ref as o,onMounted as i,createElementBlock as r,openBlock as n,normalizeClass as s,unref as d,createVNode as a,withCtx as l,createBlock as u,createCommentVNode as m,mergeProps as c,isRef as p,createElementVNode as v,createTextVNode as y,toDisplayString as x}from"vue";import{useNamespace as h}from"@qxs-bns/hooks";import{ElMessage as w}from"element-plus";import T from"../../../subject-action/src/subject-action.vue.mjs";import f from"../../../subject-layout/src/subject-layout.vue.mjs";import b from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const j={class:"preview"},q=["innerHTML"];var S=e({name:"QxsSubjectScale",__name:"SubjectRichText",props:{orderIndex:{type:Number,required:!0},richTextContent:{type:String,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(e,{emit:S}){const A=e,R=S,B=t(),C=o("");function E(){C.value?R("save",{richTextContent:C.value||""}):w.error("富文本内容不能为空!")}i((function(){A.richTextContent&&(C.value=A.richTextContent)}));const M=h("subject-scale");return(e,t)=>(n(),r("div",{class:s(d(M).e("scale-exam"))},[a(f,{"show-edit":e.isEdit},{preview:l((()=>[v("div",j,[y(x(e.orderIndex+1)+".",1),v("div",{innerHTML:d(C)},null,8,q)])])),edit:l((()=>[a(b,c({"model-value":d(C),"onUpdate:modelValue":t[0]||(t[0]=e=>p(C)?C.value=e:null)},d(B),{style:{width:"100%"}}),null,16,["model-value"])])),default:l((()=>[e.showAction?(n(),u(T,{key:0,"is-edit":e.isEdit,"is-set":e.isSet,examAnswerRelationType:A.examAnswerRelationType,showOtherOption:!1,showRichText:!1,onMoveUp:t[1]||(t[1]=e=>R("move","up")),onMoveDown:t[2]||(t[2]=e=>R("move","down")),onDelete:t[3]||(t[3]=e=>R("delete")),onSave:E,onEdit:t[4]||(t[4]=e=>R("edit")),onAdd:t[5]||(t[5]=e=>R("add",e))},null,8,["is-edit","is-set","examAnswerRelationType"])):m("v-if",!0)])),_:1},8,["show-edit"])],2))}});export{S as default};
|
2
2
|
//# sourceMappingURL=SubjectRichText.vue.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElInput as e,ElLink as l,ElCheckboxGroup as t,ElCheckbox as
|
1
|
+
import{ElInput as e,ElLink as l,ElCheckboxGroup as t,ElCheckbox as i,ElTag as a,ElButton as s,ElIcon as n}from"element-plus/es";import{defineComponent as o,useAttrs as r,ref as u,watch as d,onMounted as v,createElementBlock as c,openBlock as m,normalizeClass as f,unref as p,createVNode as x,withCtx as y,createBlock as w,createCommentVNode as g,createElementVNode as h,isRef as _,createTextVNode as b,Fragment as k,renderList as j,toDisplayString as A,mergeProps as C}from"vue";import{Plus as I}from"@element-plus/icons-vue";import{useNamespace as V}from"@qxs-bns/hooks";import{ElMessage as S}from"element-plus";import O from"../../../subject-action/src/subject-action.vue.mjs";import q from"../../../subject-layout/src/subject-layout.vue.mjs";import T from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const R={class:"preview"},B={class:"content"},U={class:"title"},L={key:0},E=["innerHTML"],M={key:1,class:"flex flex-wrap",style:{"margin-top":"10px",color:"#a8abb2"}},D={class:"flex"},H={style:{flex:"1"}},N={class:"flex flex-justify-end"},z={class:"margin-bottom flex flex-items-center"},F={class:"margin-bottom answer-list"},G={class:"label flex flex-justify-end"},J={class:"answer-tags"},K={key:0,class:"margin-bottom flex"},P={style:{flex:"1"}},Q={key:1,class:"margin-bottom flex"},W={style:{flex:"1"}},X={class:"flex flex-justify-end"};var Y=o({__name:"subject-blank-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(o,{emit:Y}){const Z=o,$=Y,ee=r(),le=u([]),te=u(""),ie=u(""),ae=u(!1),se=u(""),ne=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],oe=u(["isIgnoreCase"]);function re(){te.value+=" ______",le.value.push({title:"",tag:"",showInput:!1})}function ue(){ae.value=!1,se.value=""}function de(){te.value?le.value.length<1?S.error("至少添加一个填空符!"):$("save",{title:te.value.replaceAll(/ ______/g,"<filter></filter>"),answers:le.value.map((e=>({title:e.title,isCorrect:!0}))),analysis:ie.value,isSetCorrectAnswer:!0,examAnswerSettingBO:{isIgnoreCase:oe.value?.includes("isIgnoreCase"),isInOrder:oe.value?.includes("isInOrder")},examRichTextContent:ae.value?se.value:""}):S.error("题目标题不能为空!")}d((()=>te.value),(()=>{const[...e]=te.value.matchAll(/ ______/g);if(e.length!==le.value.length){const l=le.value.length-e.length;le.value.splice(le.value.length-l,l)}})),v((function(){Z.title&&(te.value=Z.title.replaceAll(/<filter><\/filter>/g," ______")),Z.answerList&&Z.answerList.length&&(le.value=Z.answerList),Z.examAnswerSettingVO&&(oe.value=oe.value.filter((e=>"isIgnoreCase"===e&&Z.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&Z.examAnswerSettingVO?.isInOrder))),Z.analysis&&(ie.value=Z.analysis),Z.examRichTextContent&&(se.value=Z.examRichTextContent,ae.value=!0)}));const ve=V("subject-blank-fill");return(o,r)=>{const u=e,d=l,v=i,V=t,S=a,Y=n,ce=s;return m(),c("div",{class:f(p(ve).e("blank-fill-exam"))},[x(q,{"show-edit":o.isEdit},{preview:y((()=>[h("div",R,[h("div",B,[h("span",U,A(o.orderIndex+1)+"."+A(p(te))+"(填空题)",1),p(ae)?(m(),c("div",L,[h("div",{innerHTML:p(se),class:"rich-text"},null,8,E)])):g("v-if",!0),p(le).some((e=>e.title))?(m(),c("div",M,[r[10]||(r[10]=h("span",{class:"title"},"正确答案:",-1)),(m(!0),c(k,null,j(p(le),((e,l)=>(m(),c("div",{key:l,class:"flex flex-wrap flex-items-center",style:{"margin-right":"10px"}},[h("span",null,"填空"+A(l+1)+":",1),h("span",null,A(e.title),1)])))),128))])):g("v-if",!0)])])])),edit:y((()=>[h("div",D,[r[11]||(r[11]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"题目:")],-1)),h("div",H,[x(u,{modelValue:p(te),"onUpdate:modelValue":r[0]||(r[0]=e=>_(te)?te.value=e:null),type:"textarea",rows:7,"show-word-limit":"",maxlength:"400",placeholder:"【填空题】请输入问题",disabled:o.isSave},null,8,["modelValue","disabled"])])]),h("div",N,[g(' <el-link\n v-if="!showRichText"\n type="primary"\n @click="showRichText = true"\n >\n 添加富文本\n </el-link> '),x(d,{class:"margin-left-10",type:"primary",disabled:o.isSave,onClick:re},{default:y((()=>r[12]||(r[12]=[b(" 插入填空符 ")]))),_:1},8,["disabled"])]),h("div",z,[r[13]||(r[13]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"答题设置:")],-1)),(m(),c(k,null,j(ne,(e=>x(V,{key:e.value,modelValue:p(oe),"onUpdate:modelValue":r[1]||(r[1]=e=>_(oe)?oe.value=e:null)},{default:y((()=>[x(v,{value:e.value,class:"margin-left-10"},{default:y((()=>[b(A(e.label),1)])),_:2},1032,["value"])])),_:2},1032,["modelValue"]))),64))]),h("div",F,[(m(!0),c(k,null,j(p(le),((e,l)=>(m(),c("div",{key:l,class:"answer-item flex flex-items-center"},[h("div",G,[h("span",null,"第"+A(l+1)+"空答案:",1)]),h("div",J,[(m(!0),c(k,null,j(e.title.split(","),(l=>(m(),c(k,{key:l},[l?(m(),w(S,{key:0,closable:"",onClose:t=>function(e,l){if(e){const t=l.title.split(","),i=t.findIndex((l=>l===e));i>-1&&(t.splice(i,1),l.title=t.join(","))}}(l,e)},{default:y((()=>[b(A(l),1)])),_:2},1032,["onClose"])):g("v-if",!0)],64)))),128)),o.isSave?g("v-if",!0):(m(),c(k,{key:0},[e.showInput?(m(),w(u,{key:0,modelValue:e.tag,"onUpdate:modelValue":l=>e.tag=l,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(m(),w(ce,{key:1,size:"small",onClick:l=>e.showInput=!0},{default:y((()=>[x(Y,null,{default:y((()=>[x(p(I))])),_:1}),h("span",null,A(e.title?"添加同义词":"添加答案"),1)])),_:2},1032,["onClick"]))],64))])])))),128))]),o.showAnalysis?(m(),c("div",K,[r[14]||(r[14]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"解析:")],-1)),h("div",P,[x(u,{modelValue:p(ie),"onUpdate:modelValue":r[2]||(r[2]=e=>_(ie)?ie.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):g("v-if",!0),p(ae)?(m(),c("div",Q,[r[16]||(r[16]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"富文本:")],-1)),h("div",W,[x(T,C({"model-value":p(se),"onUpdate:modelValue":r[3]||(r[3]=e=>_(se)?se.value=e:null)},p(ee),{style:{width:"100%"}}),null,16,["model-value"]),h("div",X,[x(d,{type:"danger",onClick:ue},{default:y((()=>r[15]||(r[15]=[b(" 删除富文本 ")]))),_:1})])])])):g("v-if",!0)])),default:y((()=>[o.showAction?(m(),w(O,{key:0,"is-edit":o.isEdit,"is-set":o.isSet,showOtherOption:!1,examAnswerRelationType:Z.examAnswerRelationType,onMoveUp:r[4]||(r[4]=e=>$("move","up")),onMoveDown:r[5]||(r[5]=e=>$("move","down")),onDelete:r[6]||(r[6]=e=>$("delete")),onSave:de,onEdit:r[7]||(r[7]=e=>$("edit")),onAdd:r[8]||(r[8]=e=>$("add",e)),onOnShowRichText:r[9]||(r[9]=e=>ae.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):g("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{Y as default};
|
2
2
|
//# sourceMappingURL=subject-blank-fill.vue.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subject-blank-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-blank-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Plus } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([])\n\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addBlank() {\n title.value += ' ______'\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\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\n if (answers.value.length < 1) {\n ElMessage.error('至少添加一个填空符!')\n return\n }\n\n emits('save', {\n title: title.value.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.value.map((item: any) => {\n return { title: item.title, isCorrect: true }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: true,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter((item: any) =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\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}\n\nwatch(() => title.value, () => {\n const [...matchs] = title.value.matchAll(/ ______/g)\n if (matchs.length !== answers.value.length) {\n const differ = answers.value.length - matchs.length\n answers.value.splice(answers.value.length - differ, differ)\n }\n})\n\nonMounted(init)\nconst ns = useNamespace('subject-blank-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('blank-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(填空题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div\n v-if=\"answers.some((item) => item.title)\"\n class=\"flex flex-wrap\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"flex flex-wrap flex-items-center\"\n style=\"margin-right: 10px;\"\n >\n <span>填空{{ index + 1 }}:</span>\n <span>{{ item.title }}</span>\n </div>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"7\"\n show-word-limit\n maxlength=\"400\"\n placeholder=\"【填空题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"flex flex-justify-end\">\n <!-- <el-link\n v-if=\"!showRichText\"\n type=\"primary\"\n @click=\"showRichText = true\"\n >\n 添加富文本\n </el-link> -->\n <el-link\n class=\"margin-left-10\"\n type=\"primary\"\n :disabled=\"isSave\"\n @click=\"addBlank\"\n >\n 插入填空符\n </el-link>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :value=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\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 <div class=\"label flex flex-justify-end\">\n <span>第{{ index + 1 }}空答案:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <el-tag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </el-tag>\n </template>\n <template v-if=\"!isSave\">\n <el-input\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <el-button\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <el-icon><Plus /></el-icon>\n <span>{{ item.title ? '添加同义词' : '添加答案' }}</span>\n </el-button>\n </template>\n </div>\n </div>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-end\">\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\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=\"type => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","showRichText","richText","checkList","label","value","isCheckList","addBlank","push","tag","showInput","deleteRichText","save","length","ElMessage","error","replaceAll","map","item","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","watch","matchs","matchAll","differ","splice","onMounted","answerList","examAnswerSettingVO","filter","ns","useNamespace","tags","split","index","findIndex","i","join"],"mappings":"+3DAQA,MAAMA,EAAQC,EAiBRC,EAAQC,EAERC,GAAQC,IAERC,GAAUC,EAIX,IAECC,GAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAeH,GAAI,GACnBI,GAAWJ,EAAI,IAEfK,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED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K,MAAQd,EAAMS,UAGrBT,EAAMkC,sBACRvB,GAASG,MAAQd,EAAMkC,oBACvBxB,GAAaI,OAAQ,EACvB,IAYI,MAAA8B,GAAKC,EAAa,g6DAvFf,SAAS3B,EAAaS,GAC7B,GAAIT,EAAK,CACP,MAAM4B,EAAOnB,EAAKnB,MAAMuC,MAAM,KACxBC,EAAQF,EAAKG,WAAWC,GAAcA,IAAMhC,IAC9C8B,GAAQ,IACLF,EAAAP,OAAOS,EAAO,GACdrB,EAAAnB,MAAQsC,EAAKK,KAAK,KACzB,CACF,+OAhBF,SAAsBxB,GACpBA,EAAKR,WAAY,EACbQ,EAAKT,MACPS,EAAKnB,MAAQmB,EAAKnB,MAAQ,CAACmB,EAAKnB,MAAOmB,EAAKT,KAAKiC,KAAK,KAAOxB,EAAKT,IAClES,EAAKT,IAAM,GACb"}
|
1
|
+
{"version":3,"file":"subject-blank-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-blank-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Plus } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([])\n\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addBlank() {\n title.value += ' ______'\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\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\n if (answers.value.length < 1) {\n ElMessage.error('至少添加一个填空符!')\n return\n }\n\n emits('save', {\n title: title.value.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.value.map((item: any) => {\n return { title: item.title, isCorrect: true }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: true,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter((item: any) =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\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}\n\nwatch(() => title.value, () => {\n const [...matchs] = title.value.matchAll(/ ______/g)\n if (matchs.length !== answers.value.length) {\n const differ = answers.value.length - matchs.length\n answers.value.splice(answers.value.length - differ, differ)\n }\n})\n\nonMounted(init)\nconst ns = useNamespace('subject-blank-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('blank-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(填空题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" class=\"rich-text\"/>\n </div>\n <div\n v-if=\"answers.some((item) => item.title)\"\n class=\"flex flex-wrap\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"flex flex-wrap flex-items-center\"\n style=\"margin-right: 10px;\"\n >\n <span>填空{{ index + 1 }}:</span>\n <span>{{ item.title }}</span>\n </div>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"7\"\n show-word-limit\n maxlength=\"400\"\n placeholder=\"【填空题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"flex flex-justify-end\">\n <!-- <el-link\n v-if=\"!showRichText\"\n type=\"primary\"\n @click=\"showRichText = true\"\n >\n 添加富文本\n </el-link> -->\n <el-link\n class=\"margin-left-10\"\n type=\"primary\"\n :disabled=\"isSave\"\n @click=\"addBlank\"\n >\n 插入填空符\n </el-link>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :value=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\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 <div class=\"label flex flex-justify-end\">\n <span>第{{ index + 1 }}空答案:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <el-tag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </el-tag>\n </template>\n <template v-if=\"!isSave\">\n <el-input\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <el-button\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <el-icon><Plus /></el-icon>\n <span>{{ item.title ? '添加同义词' : '添加答案' }}</span>\n </el-button>\n </template>\n </div>\n </div>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-end\">\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\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=\"type => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","showRichText","richText","checkList","label","value","isCheckList","addBlank","push","tag","showInput","deleteRichText","save","length","ElMessage","error","replaceAll","map","item","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","watch","matchs","matchAll","differ","splice","onMounted","answerList","examAnswerSettingVO","filter","ns","useNamespace","tags","split","index","findIndex","i","join"],"mappings":"+3DAQA,MAAMA,EAAQC,EAiBRC,EAAQC,EAERC,GAAQC,IAERC,GAAUC,EAIX,IAECC,GAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAeH,GAAI,GACnBI,GAAWJ,EAAI,IAEfK,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcR,EAAI,CAAC,iBAqBzB,SAASS,KACPR,GAAMM,OAAS,UACfR,GAAQQ,MAAMG,KAAK,CACjBT,MAAO,GACPU,IAAK,GACLC,WAAW,GACZ,CAGH,SAASC,KACPV,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EAAA,CAGnB,SAASO,KACFb,GAAMM,MAKPR,GAAQQ,MAAMQ,OAAS,EACzBC,EAAUC,MAAM,cAIlBtB,EAAM,OAAQ,CACZM,MAAOA,GAAMM,MAAMW,WAAW,WAAY,qBAC1CnB,QAASA,GAAQQ,MAAMY,KAAKC,IACnB,CAAEnB,MAAOmB,EAAKnB,MAAOoB,WAAW,MAEzCnB,SAAUA,GAASK,MACnBe,oBAAoB,EACpBC,oBAAqB,CACnBC,aAAchB,GAAYD,OAAOkB,SAAS,gBAC1CC,UAAWlB,GAAYD,OAAOkB,SAAS,cAEzCE,oBAAqBxB,GAAaI,MAAQH,GAASG,MAAQ,KApB3DS,EAAUC,MAAM,YAqBjB,CA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ElRadio as n}from"element-plus/es";import{defineComponent as i,useAttrs as o,ref as u,computed as r,onMounted as d,createElementBlock as c,openBlock as p,normalizeClass as v,unref as m,createVNode as f,withCtx as x,createBlock as y,createCommentVNode as h,createElementVNode as w,isRef as b,Fragment as g,renderList as j,toDisplayString as C,mergeProps as S,createTextVNode as k}from"vue";import{CirclePlus as V,Remove as q}from"@element-plus/icons-vue";import{useNamespace as T}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import L from"../../../subject-action/src/subject-action.vue.mjs";import A from"../../../subject-layout/src/subject-layout.vue.mjs";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const U={class:"preview"},M={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio flex-col"},B={style:{flex:"1"}},D={class:"answer flex"},H={class:"flex"},I={class:"answer-list flex-col"},N={class:"order"},$={class:"flex",style:{"margin-bottom":"20px"}},P={style:{flex:"1"}},z={key:0,class:"margin-bottom flex"},F={style:{flex:"1"}},G={class:"flex flex-justify-end"};var J=i({name:"QxsSubjectScale",__name:"subject-scale",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},rowTitle:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},scaleQuestionList:{type:null,required:!1},examRichTextContent:{type:String,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(i,{emit:J}){const K=i,W=J,X=o(),Y=u([{title:""},{title:""},{title:""},{title:""},{title:""}]),Z=u(""),ee=u(""),le=u(""),te=u(!1),ae=u(""),se=u([]),ne=r((()=>Math.ceil(24/(Y.value.length+1))));function ie(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,ae.value=""}function ue(){if(!Z.value)return void _.error("题目标题不能为空!");let e="";Y.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?_.error(e):le.value?(se.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:se.value,examRichTextContent:te.value?ae.value:""})):_.error("行标题不能为空!")}d((function(){K.title&&(Z.value=K.title),K.answerList&&K.answerList.length&&(Y.value=K.answerList),K.analysis&&(ee.value=K.analysis),K.scaleQuestionList&&(se.value=K.scaleQuestionList,le.value=se.value.join("\n")),K.examRichTextContent&&(ae.value=K.examRichTextContent,te.value=!0)}));const re=T("subject-scale");return(i,o)=>{const u=s,r=a,d=n,T=e,_=l,J=t;return p(),c("div",{class:v(m(re).e("scale-exam"))},[f(A,{"show-edit":i.isEdit},{preview:x((()=>[w("div",U,[w("div",null,[w("span",M,C(i.orderIndex+1)+"."+C(m(Z))+"(量表题)",1),m(te)?(p(),c("div",E,[w("div",{innerHTML:m(ae),class:"rich-text"},null,8,O)])):h("v-if",!0)]),w("div",Q,[f(r,{style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne)},null,8,["span"]),(p(!0),c(g,null,j(m(Y),(e=>(p(),y(u,{key:e.title,class:"flex flex-center",span:m(ne)},{default:x((()=>[w("span",null,C(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(p(!0),c(g,null,j(m(se),(e=>(p(),y(r,{key:e,style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne),class:"flex flex-center"},{default:x((()=>[w("span",null,C(e),1)])),_:2},1032,["span"]),(p(!0),c(g,null,j(m(Y).length,(e=>(p(),y(u,{key:e,class:"radio-item flex flex-center",span:m(ne)},{default:x((()=>[f(d,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:x((()=>[w("div",{class:v(["flex",[{"margin-bottom":m(te)}]])},[o[10]||(o[10]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"题目:")],-1)),w("div",B,[f(T,{modelValue:m(Z),"onUpdate:modelValue":o[0]||(o[0]=e=>b(Z)?Z.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:i.isSave},null,8,["modelValue","disabled"])])],2),w("div",D,[o[11]||(o[11]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"行标题:")],-1)),w("div",H,[f(T,{modelValue:m(le),"onUpdate:modelValue":o[1]||(o[1]=e=>b(le)?le.value=e:null),type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),w("div",I,[(p(!0),c(g,null,j(m(Y),((e,l)=>(p(),c("div",{key:l,class:"answer-item flex flex-items-center"},[w("span",N,C(String.fromCharCode(65+l))+".",1),f(T,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+l)}`,disabled:i.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),h(' <PlusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length === 5 }]"\n @click="addAnswer"\n />\n <MinusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length < 3 }]"\n @click="deleteAnswer(index)"\n /> '),f(_,{class:"icon"},{default:x((()=>[f(m(V),{class:v([{disabled:5===m(Y).length}]),onClick:ie},null,8,["class"])])),_:1}),f(_,{class:"icon"},{default:x((()=>[f(m(q),{class:v([{disabled:m(Y).length<3}]),onClick:e=>function(e){Y.value.length<3||Y.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),w("div",$,[o[12]||(o[12]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"解析:")],-1)),w("div",P,[f(T,{modelValue:m(ee),"onUpdate:modelValue":o[2]||(o[2]=e=>b(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),m(te)?(p(),c("div",z,[o[14]||(o[14]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"富文本:")],-1)),w("div",F,[f(R,S({"model-value":m(ae),"onUpdate:modelValue":o[3]||(o[3]=e=>b(ae)?ae.value=e:null)},m(X),{style:{width:"100%"}}),null,16,["model-value"]),w("div",G,[f(J,{type:"danger",onClick:oe},{default:x((()=>o[13]||(o[13]=[k(" 删除富文本 ")]))),_:1})])])])):h("v-if",!0)])),default:x((()=>[i.showAction?(p(),y(L,{key:0,"is-edit":i.isEdit,"is-set":i.isSet,showOtherOption:!1,examAnswerRelationType:K.examAnswerRelationType,onMoveUp:o[4]||(o[4]=e=>W("move","up")),onMoveDown:o[5]||(o[5]=e=>W("move","down")),onDelete:o[6]||(o[6]=e=>W("delete")),onSave:ue,onEdit:o[7]||(o[7]=e=>W("edit")),onAdd:o[8]||(o[8]=e=>W("add",e)),onOnShowRichText:o[9]||(o[9]=e=>te.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):h("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{J as default};
|
2
2
|
//# sourceMappingURL=subject-scale.vue.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subject-scale.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-scale.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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'\n\ndefineOptions({\n name: 'QxsSubjectScale',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n rowTitle?: string\n isEdit: boolean\n isSet: boolean\n scaleQuestionList?: any\n examRichTextContent?: string\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n}[]>([{\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst rowTitle = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst scaleQuestionList = ref<string[]>([])\nconst span = computed(() => Math.ceil(24 / (answers.value.length + 1)))\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\n return\n }\n answers.value.splice(index, 1)\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 answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n </div>\n <div class=\"answer-radio flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #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=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\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=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\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=\"(type: any) => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","rowTitle","showRichText","richText","scaleQuestionList","span","computed","Math","ceil","value","length","addAnswer","push","deleteRichText","save","ElMessage","error","msg","forEach","v","i","String","fromCharCode","split","filter","examRichTextContent","onMounted","answerList","join","ns","useNamespace","index","splice"],"mappings":"guDAWA,MAAMA,EAAQC,EAcRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAEX,CAAC,CACJC,MAAO,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oB,GAAKC,EAAa,khFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
|
1
|
+
{"version":3,"file":"subject-scale.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-scale.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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'\n\ndefineOptions({\n name: 'QxsSubjectScale',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n rowTitle?: string\n isEdit: boolean\n isSet: boolean\n scaleQuestionList?: any\n examRichTextContent?: string\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n}[]>([{\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst rowTitle = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst scaleQuestionList = ref<string[]>([])\nconst span = computed(() => Math.ceil(24 / (answers.value.length + 1)))\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\n return\n }\n answers.value.splice(index, 1)\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 answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" class=\"rich-text\"/>\n </div>\n </div>\n <div class=\"answer-radio flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #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=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\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=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\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=\"(type: any) => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","rowTitle","showRichText","richText","scaleQuestionList","span","computed","Math","ceil","value","length","addAnswer","push","deleteRichText","save","ElMessage","error","msg","forEach","v","i","String","fromCharCode","split","filter","examRichTextContent","onMounted","answerList","join","ns","useNamespace","index","splice"],"mappings":"guDAWA,MAAMA,EAAQC,EAcRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAEX,CAAC,CACJC,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,MAGHA,EAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAWH,EAAI,IACfI,GAAeJ,GAAI,GACnBK,GAAWL,EAAI,IACfM,GAAoBN,EAAc,IAClCO,GAAOC,GAAS,IAAMC,KAAKC,KAAK,IAAMX,EAAQY,MAAMC,OAAS,MACnE,SAASC,KACsB,IAAzBd,EAAQY,MAAMC,QAGlBb,EAAQY,MAAMG,KAAK,CACjBb,MAAO,IACR,CAUH,SAASc,KACPX,GAAaO,OAAQ,EACrBN,GAASM,MAAQ,EAAA,CAGnB,SAASK,KACH,IAACf,EAAMU,MAET,YADAM,EAAUC,MAAM,aAGlB,IAAIC,EAAM,GACVpB,EAAQY,MAAMS,SAAQ,CAACC,EAAGC,KACnBD,EAAEpB,QACLkB,GAAO,KAAKI,OAAOC,aAAa,GAAKF,SAAE,IAIvCH,EACFF,EAAUC,MAAMC,GAIbhB,GAASQ,OAKIL,GAAAK,MAAQR,GAASQ,MAAMc,MAAM,MAAMC,WAAYJ,IAEjE3B,EAAM,OAAQ,CACZM,MAAOA,EAAMU,MACbZ,QAASA,EAAQY,MACjBT,SAAUA,GAASS,MACnBL,kBAAmBA,GAAkBK,MACrCgB,oBAAqBvB,GAAaO,MAAQN,GAASM,MAAQ,MAX3DM,EAAUC,MAAM,WAYjB,CA0BHU,GAvBA,WACMnC,EAAMQ,QACRA,EAAMU,MAAQlB,EAAMQ,OAGlBR,EAAMoC,YAAcpC,EAAMoC,WAAWjB,SACvCb,EAAQY,MAAQlB,EAAMoC,YAGpBpC,EAAMS,WACRA,GAASS,MAAQlB,EAAMS,UAGrBT,EAAMa,oBACRA,GAAkBK,MAAQlB,EAAMa,kBAChCH,GAASQ,MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,oiFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElCheckbox as e,ElRadio as l,ElInput as t,ElSelect as i,ElOption as n,ElIcon as s,ElLink as a,ElDialog as o,ElButton as r,ElMessage as d}from"element-plus/es";import{defineComponent as u,useAttrs as m,ref as c,computed as p,watch as f,onMounted as y,createElementBlock as v,openBlock as x,normalizeClass as b,unref as w,createVNode as g,createSlots as h,withCtx as k,createBlock as C,createCommentVNode as V,createElementVNode as S,createTextVNode as q,toDisplayString as _,Fragment as j,renderList as A,isRef as T,mergeProps as U}from"vue";import{CirclePlus as R,Remove as B}from"@element-plus/icons-vue";import{useNamespace as $}from"@qxs-bns/hooks";import N from"../../../subject-action/src/subject-action.vue.mjs";import I from"../../../subject-layout/src/subject-layout.vue.mjs";import K from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as O}from"@qxs-bns/utils";const E={class:"preview"},M={class:"title"},z={key:0},D={key:1},L={key:0},H=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"order"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ie={style:{flex:"1"}},ne={class:"flex flex-justify-end"};var se=u({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(u,{emit:se}){const ae=u,oe=se,re=m(),de=c(0),ue=c(ae.isKey),me=c(1),ce=c(ae.examAnswerRelationType),pe=c([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),fe=c(2),ye=c(""),ve=c(""),xe=c(!1),be=c(""),we=c(0),ge=c(!1),he=c(""),ke=p((()=>"single"===ae.type?"单选题":"multiple"===ae.type?"多选题":"排序题")),Ce=c([]),Ve=p((()=>{const e=[];for(let l=pe.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Se(){ae.isSave||pe.value.push({title:"",isCorrect:!1,customAnswerId:O()})}function qe(){xe.value=!1,be.value=""}function _e(){if(!ye.value)return void d.error("题目标题不能为空!");if(!me.value)return void d.error("请选择答题设置");let e="",l=!1,t=0;if("multiple"===ae.type||"single"===ae.type?pe.value.forEach(((i,n)=>{i.title?.trim()||(e+=`选项${String.fromCharCode(65+n)}未填写。`),i.isCorrect&&(l=!0,t++),i.relationType=i.resultItem?1:i.answerRelations?.length?2:null})):"sort"===ae.type&&Ce.value.length&&(l=!0),e)return void d.error(e);if(new Set(pe.value.map((e=>e.title))).size===pe.value.length){if("multiple"===ae.type){if(1===t)return void d.error("请至少设置两个支持选项");if(l&&t<fe.value)return void d.error("至少选几项与支持选项数不符")}2!==me.value&&3!==me.value||l?oe("save",{title:ye.value,answers:pe.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:Ce.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:ve.value,isSetCorrectAnswer:l,leastAnswerCount:fe.value,examRichTextContent:xe.value?be.value:"",examAnswerRelationType:ce.value,isKey:ue.value,answerCheckType:me.value}):d.error("请设置支持选项")}else d.error("选项不能重复")}function je(){pe.value[de.value].resultItem=he.value||"",ge.value=!1}function Ae(){ge.value=!1,he.value=""}function Te(e){ue.value=e}function Ue(e){me.value=e}function Re(e,l){oe("add",e,l?ae.examAnswerRelationType:null)}f((()=>ae.isEdit),(()=>{ae.isEdit&&(we.value=(new Date).getTime())}));const Be=p((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),$e=$("subject-single");return y((function(){if(ae.title&&(ye.value=ae.title),ae.answerCheckType&&(me.value=ae.answerCheckType),ae.isKey&&(ue.value=ae.isKey),ae.examAnswerRelationType&&(ce.value=ae.examAnswerRelationType),ae.answerList&&ae.answerList.length&&(pe.value=ae.answerList),ae.leastAnswerCount&&(fe.value=ae.leastAnswerCount),ae.examExpand&&ae.examExpand){const e=ae.examExpand.split(",");Ce.value=e.map((e=>{const l=ae.answerList.find((l=>l.answerId?.toString()===e));return l?String.fromCharCode(65+l.orderIndex-1):e})).filter(Boolean)}ae.analysis&&(ve.value=ae.analysis),ae.examRichTextContent&&(be.value=ae.examRichTextContent,xe.value=!0)})),(d,u)=>{const m=e,c=l,p=t,f=n,y=i,$=s,se=a,we=r,Ne=o;return x(),v("div",{class:b(w($e).e("single-exam"))},[g(I,{"show-edit":d.isEdit},h({preview:k((()=>[S("div",E,[S("div",null,[S("span",M,[q(_(d.orderIndex+1)+"."+_(w(ye))+" ",1),"single"===d.type?(x(),v("span",z,"(单选题)")):["multiple","sort"].includes(d.type)?(x(),v("span",D," ("+_(w(ke))+_(w(fe)?`至少选${w(fe)}项${"sort"===d.type?"并排序":""}`:"")+") ",1)):V("v-if",!0)])]),w(xe)?(x(),v("div",L,[S("div",{innerHTML:w(be)},null,8,H)])):V("v-if",!0),S("div",Q,["sort"===d.type?(x(!0),v(j,{key:0},A(w(pe),((e,l)=>(x(),C(m,{key:l,class:"radio",disabled:!0},{default:k((()=>[S("span",F,_(String.fromCharCode(65+l))+". ",1),q(" "+_(e.title),1)])),_:2},1024)))),128)):(x(!0),v(j,{key:1},A(w(pe),((e,l)=>(x(),C(c,{key:l,class:"radio",value:"disabled",disabled:""},{default:k((()=>[S("span",G,_(String.fromCharCode(65+l))+". ",1),q(" "+_(e.title)+" "+_(e.isCorrect?"(支持选项)":"")+" "+_(1===w(ce)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+_(2===w(ce)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:k((()=>[d.showAction?(x(),C(N,{key:0,"is-edit":d.isEdit,"is-set":d.isSet,isKey:w(ue),showOtherOption:"multiple"===ae.type||"single"===ae.type,examAnswerRelationType:ae.examAnswerRelationType,answerCheckType:w(me),onMoveUp:u[5]||(u[5]=e=>oe("move","up")),onMoveDown:u[6]||(u[6]=e=>oe("move","down")),onDelete:u[7]||(u[7]=e=>oe("delete")),onSave:_e,onEdit:u[8]||(u[8]=e=>oe("edit")),onAdd:Re,onOnShowRichText:u[9]||(u[9]=e=>xe.value=!0),onSetKey:Te,onSetAnswerSetting:Ue},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):V("v-if",!0)])),_:2},[d.isEdit?{name:"edit",fn:k((()=>[S("div",{class:b(["flex",[{"margin-bottom":w(xe)}]])},[u[12]||(u[12]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"题目:")],-1)),S("div",J,[g(p,{modelValue:w(ye),"onUpdate:modelValue":u[0]||(u[0]=e=>T(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${w(ke)}】请输入问题`,disabled:d.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),S("div",P,[u[13]||(u[13]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"设置:")],-1)),["multiple","sort"].includes(d.type)?(x(),C(y,{key:0,modelValue:w(fe),"onUpdate:modelValue":u[1]||(u[1]=e=>T(fe)?fe.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:d.isSave},{default:k((()=>[(x(!0),v(j,null,A(w(Ve),(e=>(x(),C(f,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):V("v-if",!0)]),S("div",W,[(x(!0),v(j,null,A(w(pe),((e,l)=>(x(),v("div",{key:l,class:"answer-item flex flex-items-center"},[S("span",X,_(String.fromCharCode(65+l))+".",1),g(p,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:d.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(d.type)?(x(),C(m,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:b([{"is-correct":e.isCorrect}]),disabled:d.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ae.type?(l&&pe.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ae.type&&(e.isCorrect=l)}(e,l)},{default:k((()=>[...u[14]||(u[14]=[q(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):V("v-if",!0),g($,{class:"icon"},{default:k((()=>[g(w(R),{class:b([{disabled:d.isSave}]),onClick:Se},null,8,["class"])])),_:1}),g($,{class:"icon"},{default:k((()=>[g(w(B),{class:b([{disabled:w(pe).length<3||d.isSave}]),onClick:e=>function(e){pe.value.length<3||ae.isSave||pe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===w(ce)&&"sort"!==d.type?(x(),C(se,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,de.value=t,he.value=pe.value[t].resultItem||"",void(ge.value=!0);var t}},{default:k((()=>[S("span",null,_(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):V("v-if",!0),2===w(ce)&&"sort"!==d.type?(x(),C(se,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||O(),oe("setRelation",ae.customId,e)}(e)},{default:k((()=>[S("span",null,_(e.answerRelations?.length?`关联了${w(Be)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):V("v-if",!0)])))),128))]),"sort"===d.type?(x(),v("div",Y,[u[15]||(u[15]=S("div",{class:"label flex flex-justify-end"},[S("span",null,"排序答案:")],-1)),S("div",Z,[g(y,{modelValue:w(Ce),"onUpdate:modelValue":u[2]||(u[2]=e=>T(Ce)?Ce.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:k((()=>[V(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(x(!0),v(j,null,A(w(pe),((e,l)=>(x(),C(f,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):V("v-if",!0),d.showAnalysis?(x(),v("div",ee,[u[16]||(u[16]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"解析:")],-1)),S("div",le,[g(p,{modelValue:w(ve),"onUpdate:modelValue":u[3]||(u[3]=e=>T(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):V("v-if",!0),w(xe)?(x(),v("div",te,[u[18]||(u[18]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"富文本:")],-1)),S("div",ie,[g(K,U({"model-value":w(be),"onUpdate:modelValue":u[4]||(u[4]=e=>T(be)?be.value=e:null)},w(re),{style:{width:"100%"}}),null,16,["model-value"]),S("div",ne,[g(se,{type:"danger",onClick:qe},{default:k((()=>u[17]||(u[17]=[q(" 删除富文本 ")]))),_:1})])])])):V("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),g(Ne,{modelValue:w(ge),"onUpdate:modelValue":u[11]||(u[11]=e=>T(ge)?ge.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:k((()=>[g(we,{class:"customize-button",type:"primary",plain:"",onClick:Ae},{default:k((()=>u[19]||(u[19]=[q(" 取消 ")]))),_:1}),g(we,{class:"customize-button",type:"primary",plain:"",onClick:je},{default:k((()=>u[20]||(u[20]=[q(" 保存 ")]))),_:1})])),default:k((()=>[(x(),C(K,U({key:w(de),"model-value":w(he),"onUpdate:modelValue":u[10]||(u[10]=e=>T(he)?he.value=e:null)},w(re),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{se as default};
|
1
|
+
import{ElCheckbox as e,ElRadio as l,ElInput as t,ElSelect as a,ElOption as i,ElIcon as s,ElLink as n,ElDialog as r,ElButton as o,ElMessage as u}from"element-plus/es";import{defineComponent as d,useAttrs as m,ref as p,computed as c,watch as v,onMounted as y,createElementBlock as f,openBlock as x,normalizeClass as w,unref as h,createVNode as C,createSlots as g,withCtx as b,createBlock as k,createCommentVNode as S,createElementVNode as A,createTextVNode as V,toDisplayString as T,Fragment as q,renderList as R,isRef as j,mergeProps as I}from"vue";import{CirclePlus as _,Remove as E}from"@element-plus/icons-vue";import{useNamespace as U}from"@qxs-bns/hooks";import K from"../../../subject-action/src/subject-action.vue.mjs";import B from"../../../subject-layout/src/subject-layout.vue.mjs";import L from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as $}from"@qxs-bns/utils";const N={class:"preview"},O={class:"title"},z={key:0},M={key:1},D={key:0},H=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"label flex flex-justify-center"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ae={style:{flex:"1"}},ie={class:"flex flex-justify-end"};var se=d({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(d,{emit:se}){const ne=d,re=se,oe=m(),ue=p(0),de=p(ne.isKey),me=p(1),pe=p(ne.examAnswerRelationType),ce=p([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),ve=p(2),ye=p(""),fe=p(""),xe=p(!1),we=p(""),he=p(0),Ce=p(!1),ge=p(""),be=c((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),ke=p([]),Se=c((()=>{const e=[];for(let l=ce.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Ae(){ne.isSave||ce.value.push({title:"",isCorrect:!1,customAnswerId:$()})}function Ve(){xe.value=!1,we.value=""}function Te(){if(!ye.value)return void u.error("题目标题不能为空!");if(!me.value)return void u.error("请选择答题设置");let e="",l=!1,t=0;if("multiple"===ne.type||"single"===ne.type?ce.value.forEach(((a,i)=>{a.title?.trim()||(e+=`选项${String.fromCharCode(65+i)}未填写。`),a.isCorrect&&(l=!0,t++),a.relationType=a.resultItem?1:a.answerRelations?.length?2:null})):"sort"===ne.type&&ke.value.length&&(l=!0),e)return void u.error(e);if(new Set(ce.value.map((e=>e.title))).size===ce.value.length){if("multiple"===ne.type){if(1===t)return void u.error("请至少设置两个支持选项");if(l&&t<ve.value)return void u.error("至少选几项与支持选项数不符")}2!==me.value&&3!==me.value||l?re("save",{title:ye.value,answers:ce.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:ke.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:fe.value,isSetCorrectAnswer:l,leastAnswerCount:ve.value,examRichTextContent:xe.value?we.value:"",examAnswerRelationType:pe.value,isKey:de.value,answerCheckType:me.value}):u.error("请设置支持选项")}else u.error("选项不能重复")}function qe(){ce.value[ue.value].resultItem=ge.value||"",Ce.value=!1}function Re(){Ce.value=!1,ge.value=""}function je(e){de.value=e}function Ie(e){me.value=e}function _e(e,l){re("add",e,l?ne.examAnswerRelationType:null)}v((()=>ne.isEdit),(()=>{ne.isEdit&&(he.value=(new Date).getTime())}));const Ee=c((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),Ue=U("subject-single");return y((function(){if(ne.title&&(ye.value=ne.title),ne.answerCheckType&&(me.value=ne.answerCheckType),ne.isKey&&(de.value=ne.isKey),ne.examAnswerRelationType&&(pe.value=ne.examAnswerRelationType),ne.answerList&&ne.answerList.length&&(ce.value=ne.answerList),ne.leastAnswerCount&&(ve.value=ne.leastAnswerCount),ne.examExpand&&ne.examExpand){const e=ne.examExpand.split(",");ke.value=e.map((e=>{const l=ne.answerList.find((l=>l.answerId?.toString()===e));return l?String.fromCharCode(65+l.orderIndex-1):e})).filter(Boolean)}ne.analysis&&(fe.value=ne.analysis),ne.examRichTextContent&&(we.value=ne.examRichTextContent,xe.value=!0)})),(u,d)=>{const m=e,p=l,c=t,v=i,y=a,U=s,se=n,he=o,Ke=r;return x(),f("div",{class:w(h(Ue).e("single-exam"))},[C(B,{"show-edit":u.isEdit},g({preview:b((()=>[A("div",N,[A("div",null,[A("span",O,[V(T(u.orderIndex+1)+"."+T(h(ye))+" ",1),"single"===u.type?(x(),f("span",z,"(单选题)")):["multiple","sort"].includes(u.type)?(x(),f("span",M," ("+T(h(be))+T(h(ve)?`至少选${h(ve)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):S("v-if",!0)])]),h(xe)?(x(),f("div",D,[A("div",{innerHTML:h(we),class:"rich-text"},null,8,H)])):S("v-if",!0),A("div",Q,["sort"===u.type?(x(!0),f(q,{key:0},R(h(ce),((e,l)=>(x(),k(m,{key:l,class:"radio",disabled:!0},{default:b((()=>[A("span",F,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title),1)])),_:2},1024)))),128)):(x(!0),f(q,{key:1},R(h(ce),((e,l)=>(x(),k(p,{key:l,class:"radio",value:"disabled",disabled:""},{default:b((()=>[A("span",G,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title)+" "+T(e.isCorrect?"(支持选项)":"")+" "+T(1===h(pe)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+T(2===h(pe)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:b((()=>[u.showAction?(x(),k(K,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:h(de),showOtherOption:"multiple"===ne.type||"single"===ne.type,examAnswerRelationType:ne.examAnswerRelationType,answerCheckType:h(me),onMoveUp:d[5]||(d[5]=e=>re("move","up")),onMoveDown:d[6]||(d[6]=e=>re("move","down")),onDelete:d[7]||(d[7]=e=>re("delete")),onSave:Te,onEdit:d[8]||(d[8]=e=>re("edit")),onAdd:_e,onOnShowRichText:d[9]||(d[9]=e=>xe.value=!0),onSetKey:je,onSetAnswerSetting:Ie},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):S("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:b((()=>[A("div",{class:w(["flex",[{"margin-bottom":h(xe)}]])},[d[12]||(d[12]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"题目:")],-1)),A("div",J,[C(c,{modelValue:h(ye),"onUpdate:modelValue":d[0]||(d[0]=e=>j(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${h(be)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),A("div",P,[d[13]||(d[13]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(x(),k(y,{key:0,modelValue:h(ve),"onUpdate:modelValue":d[1]||(d[1]=e=>j(ve)?ve.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:b((()=>[(x(!0),f(q,null,R(h(Se),(e=>(x(),k(v,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):S("v-if",!0)]),A("div",W,[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),f("div",{key:l,class:"answer-item flex flex-items-center"},[A("span",X,T(String.fromCharCode(65+l))+".",1),C(c,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:u.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(u.type)?(x(),k(m,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:w([{"is-correct":e.isCorrect}]),disabled:u.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ne.type?(l&&ce.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ne.type&&(e.isCorrect=l)}(e,l)},{default:b((()=>[...d[14]||(d[14]=[V(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):S("v-if",!0),C(U,{class:"icon"},{default:b((()=>[C(h(_),{class:w([{disabled:u.isSave}]),onClick:Ae},null,8,["class"])])),_:1}),C(U,{class:"icon"},{default:b((()=>[C(h(E),{class:w([{disabled:h(ce).length<3||u.isSave}]),onClick:e=>function(e){ce.value.length<3||ne.isSave||ce.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===h(pe)&&"sort"!==u.type?(x(),k(se,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,ge.value=ce.value[t].resultItem||"",void(Ce.value=!0);var t}},{default:b((()=>[A("span",null,T(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):S("v-if",!0),2===h(pe)&&"sort"!==u.type?(x(),k(se,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||$(),re("setRelation",ne.customId,e)}(e)},{default:b((()=>[A("span",null,T(e.answerRelations?.length?`关联了${h(Ee)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):S("v-if",!0)])))),128))]),"sort"===u.type?(x(),f("div",Y,[d[15]||(d[15]=A("div",{class:"label flex flex-justify-end"},[A("span",null,"排序答案:")],-1)),A("div",Z,[C(y,{modelValue:h(ke),"onUpdate:modelValue":d[2]||(d[2]=e=>j(ke)?ke.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:b((()=>[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),k(v,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):S("v-if",!0),u.showAnalysis?(x(),f("div",ee,[d[16]||(d[16]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"解析:")],-1)),A("div",le,[C(c,{modelValue:h(fe),"onUpdate:modelValue":d[3]||(d[3]=e=>j(fe)?fe.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):S("v-if",!0),h(xe)?(x(),f("div",te,[d[18]||(d[18]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"富文本:")],-1)),A("div",ae,[C(L,I({"model-value":h(we),"onUpdate:modelValue":d[4]||(d[4]=e=>j(we)?we.value=e:null)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]),A("div",ie,[C(se,{type:"danger",onClick:Ve},{default:b((()=>d[17]||(d[17]=[V(" 删除富文本 ")]))),_:1})])])])):S("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),C(Ke,{modelValue:h(Ce),"onUpdate:modelValue":d[11]||(d[11]=e=>j(Ce)?Ce.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:b((()=>[C(he,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:b((()=>d[19]||(d[19]=[V(" 取消 ")]))),_:1}),C(he,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:b((()=>d[20]||(d[20]=[V(" 保存 ")]))),_:1})])),default:b((()=>[(x(),k(L,I({key:h(ue),"model-value":h(ge),"onUpdate:modelValue":d[10]||(d[10]=e=>j(ge)?ge.value=e:null)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{se as default};
|
2
2
|
//# sourceMappingURL=subject-single.vue.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subject-single.vue.mjs","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 // 答题设置必选\n if(!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\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\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\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":"8pEAWA,MAAMA,GAAQC,EAoBRC,GAAQC,GAERC,GAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,EAAIP,GAAMQ,OAClBC,GAAkBF,EAAI,GACtBG,GAAyBH,EAAIP,GAAMU,wBACnCC,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,GAAmBP,EAAI,GACvBK,GAAQL,EAAI,IACZQ,GAAWR,EAAI,IACfS,GAAeT,GAAI,GACnBU,GAAWV,EAAI,IACfW,GAAYX,EAAI,GAChBY,GAAkBZ,GAAI,GACtBa,GAAab,EAAY,IACzBc,GAAmBC,GAAS,IACb,WAAftB,GAAMuB,KACD,MAEe,aAAfvB,GAAMuB,KACN,MAGA,QAILC,GAAYjB,EAAc,IAE1BkB,GAAqBH,GAAS,KAClC,MAAMI,EAAQ,GAEd,IAAA,IAASC,EADMhB,GAAQiB,MAAMC,OACJF,EAAQ,EAAGA,IAClCD,EAAMI,KAAK,CACTC,MAAO,OAAOJ,KACdC,MAAOD,IAGX,OAAOD,EAAMM,SAAQ,IAEvB,SAASC,KACHjC,GAAMkC,QAGVvB,GAAQiB,MAAME,KAAK,CACjBlB,MAAO,GACPC,WAAW,EACXsB,eAAgBC,KACjB,CA+BH,SAASC,KACPrB,GAAaY,OAAQ,EACrBX,GAASW,MAAQ,EAAA,CAGnB,SAASU,KACH,IAAC1B,GAAMgB,MAET,YADAW,EAAUC,MAAM,aAIf,IAAC/B,GAAgBmB,MAElB,YADAW,EAAUC,MAAM,WAGlB,IAAIC,EAAM,GACNC,GAAqB,EACrBC,EAAqB,EAmBzB,GAlBmB,aAAf3C,GAAM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AMe,UAGrBf,GAAM6D,sBACR5C,GAASW,MAAQ5B,GAAM6D,oBACvB7C,GAAaY,OAAQ,EACvB,qpGAtJO,SAAW4D,EAASC,GACR,WAAfzF,GAAMuB,MAEJkE,GACM9E,GAAAiB,MAAMgB,SAASsC,IACjBA,IAAWM,IACbN,EAAOrE,WAAY,EAAA,IAIzB2E,EAAG3E,UAAY4E,GACS,aAAfzF,GAAMuB,OAEfiE,EAAG3E,UAAY4E,EACjB,gXArBF,SAAsBjC,GAChB7C,GAAQiB,MAAMC,OAAS,GAAK7B,GAAMkC,QAG9BvB,GAAAiB,MAAM8D,OAAOlC,EAAO,EAAC,qJA2JTV,IACpBxC,GAAasB,MAAQkB,EACrB1B,GAAWQ,MAAQjB,GAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,GAAgBS,OAAQ,GAH1B,IAAsBkB,yMAxItB,SAAqBQ,GACdA,EAAAnB,eAAiBmB,EAAKqC,cAAgBvD,IACrClC,GAAA,cAAeF,GAAM4F,SAAUtC,EAAI"}
|
1
|
+
{"version":3,"file":"subject-single.vue.mjs","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 // 答题设置必选\n if(!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\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\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\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\" class=\"rich-text\"/>\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=\"label flex flex-justify-center\">{{ 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 <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":"urEAWA,MAAMA,GAAQC,EAoBRC,GAAQC,GAERC,GAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,EAAIP,GAAMQ,OAClBC,GAAkBF,EAAI,GACtBG,GAAyBH,EAAIP,GAAMU,wBACnCC,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,GAAmBP,EAAI,GACvBK,GAAQL,EAAI,IACZQ,GAAWR,EAAI,IACfS,GAAeT,GAAI,GACnBU,GAAWV,EAAI,IACfW,GAAYX,EAAI,GAChBY,GAAkBZ,GAAI,GACtBa,GAAab,EAAY,IACzBc,GAAmBC,GAAS,IACb,WAAftB,GAAMuB,KACD,MAEe,aAAfvB,GAAMuB,KACN,MAG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-
import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as
|
1
|
+
import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as a,ElTag as i,ElButton as s,ElIcon as n,ElLink as o}from"element-plus/es";import{defineComponent as u,useAttrs as r,ref as d,onMounted as v,createElementBlock as m,openBlock as c,normalizeClass as p,unref as f,createVNode as x,withCtx as y,createBlock as w,createCommentVNode as g,createElementVNode as h,isRef as b,Fragment as V,renderList as k,createTextVNode as C,toDisplayString as S,mergeProps as j}from"vue";import{Plus as I,CirclePlus as O,Remove as A}from"@element-plus/icons-vue";import{useNamespace as q}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import T from"../../../subject-action/src/subject-action.vue.mjs";import E from"../../../subject-layout/src/subject-layout.vue.mjs";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const U={class:"preview"},B={class:"content"},L={class:"title"},M={key:0},D=["innerHTML"],H={class:"content flex flex-col"},N={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},z={class:"title"},$={class:"flex"},F={style:{flex:"1"},class:"margin-bottom"},G={class:"margin-bottom flex flex-items-center"},J={class:"flex"},K={style:{flex:"1"}},P={class:"margin-bottom answer-list"},Q={class:"label flex flex-justify-end"},W={class:"answer-tags"},X={class:"operation"},Y={key:0,class:"margin-bottom flex"},Z={style:{flex:"1"}},ee={key:1,class:"margin-bottom flex"},le={style:{flex:"1"}},te={class:"flex flex-justify-end"};var ae=u({__name:"subject-text-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examExpand:{type:String,required:!1},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(u,{emit:ae}){const ie=u,se=ae,ne=r(),oe=d([{title:"",tag:"",showInput:!1}]),ue=d(""),re=d(""),de=d(),ve=d(""),me=d(!1),ce=d(""),pe=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],fe=d(["isInOrder","isIgnoreCase"]);function xe(){oe.value.push({title:"",tag:"",showInput:!1})}function ye(){me.value=!1,ce.value=""}function we(){if(ue.value){if(de.value||ve.value){if(!de.value)return void _.error("请完善答题设置!");if(!ve.value)return void _.error("请输入问题正确答案!");if(oe.value.length!==de.value)return void _.error("关键词个数设置有误!");const e=[];if(oe.value.forEach(((l,t)=>{l.title||e.push(`关键词${t+1}未设置`)})),e.length>0)return void _.error(e.join(","))}se("save",{title:ue.value,answers:oe.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:re.value,isSetCorrectAnswer:!!ve.value,examExpand:ve.value,examAnswerSettingBO:{isIgnoreCase:fe.value?.includes("isIgnoreCase"),isInOrder:fe.value?.includes("isInOrder"),keywordCount:de.value},examRichTextContent:me.value?ce.value:""})}else _.error("题目标题不能为空!")}v((function(){ie.title&&(ue.value=ie.title),ie.answerList&&ie.answerList.length&&(oe.value=ie.answerList),ie.examAnswerSettingVO&&(fe.value=fe.value.filter((e=>"isIgnoreCase"===e&&ie.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&ie.examAnswerSettingVO?.isInOrder))),ie.examAnswerSettingVO?.keywordCount&&(de.value=ie.examAnswerSettingVO?.keywordCount),ie.examExpand&&(ve.value=ie.examExpand),ie.analysis&&(re.value=ie.analysis),ie.examRichTextContent&&(ce.value=ie.examRichTextContent,me.value=!0)}));const ge=q("subject-text-fill");return(u,r)=>{const d=a,v=e,q=l,_=t,ae=i,he=n,be=s,Ve=o;return c(),m("div",{class:p(f(ge).e("text-fill-exam"))},[x(E,{"show-edit":u.isEdit},{preview:y((()=>[h("div",U,[h("div",B,[h("span",L,S(u.orderIndex+1)+"."+S(f(ue))+"(问答题)",1),f(me)?(c(),m("div",M,[h("div",{innerHTML:f(ce),class:"rich-text"},null,8,D)])):g("v-if",!0),h("div",H,[f(oe).some((e=>e.title))?(c(!0),m(V,{key:0},k(f(oe),((e,l)=>(c(),w(d,{key:l,class:"radio",disabled:!0},{default:y((()=>[C(S(e.title),1)])),_:2},1024)))),128)):g("v-if",!0)]),f(ve)?(c(),m("div",N,[h("span",z,"正确答案:"+S(f(ve)),1)])):g("v-if",!0)])])])),edit:y((()=>[h("div",$,[r[12]||(r[12]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"题目:")],-1)),h("div",F,[x(v,{modelValue:f(ue),"onUpdate:modelValue":r[0]||(r[0]=e=>b(ue)?ue.value=e:null),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),h("div",G,[r[13]||(r[13]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"答题设置:")],-1)),r[14]||(r[14]=h("span",null,"共答对",-1)),x(q,{modelValue:f(de),"onUpdate:modelValue":r[1]||(r[1]=e=>b(de)?de.value=e:null),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),r[15]||(r[15]=h("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(c(),m(V,null,k(pe,(e=>x(_,{key:e.value,modelValue:f(fe),"onUpdate:modelValue":r[2]||(r[2]=e=>b(fe)?fe.value=e:null)},{default:y((()=>[x(d,{label:e.value,class:"margin-left-10"},{default:y((()=>[C(S(e.label),1)])),_:2},1032,["label"])])),_:2},1032,["modelValue"]))),64))]),h("div",J,[r[16]||(r[16]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"答案:")],-1)),h("div",K,[x(v,{modelValue:f(ve),"onUpdate:modelValue":r[3]||(r[3]=e=>b(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),h("div",P,[r[17]||(r[17]=h("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(c(!0),m(V,null,k(f(oe),((e,l)=>(c(),m("div",{key:l,class:"answer-item flex flex-items-center"},[h("div",Q,[h("span",null,"关键词"+S(l+1)+":",1)]),h("div",W,[(c(!0),m(V,null,k(e.title.split(","),(l=>(c(),m(V,{key:l},[l?(c(),w(ae,{key:0,closable:"",onClose:t=>function(e,l){if(e){const t=l.title.split(","),a=t.findIndex((l=>l===e));a>-1&&(t.splice(a,1),l.title=t.join(","))}}(l,e)},{default:y((()=>[C(S(l),1)])),_:2},1032,["onClose"])):g("v-if",!0)],64)))),128)),u.isSave?g("v-if",!0):(c(),m(V,{key:0},[e.showInput?(c(),w(v,{key:0,modelValue:e.tag,"onUpdate:modelValue":l=>e.tag=l,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(c(),w(be,{key:1,size:"small",onClick:l=>e.showInput=!0},{default:y((()=>[x(he,null,{default:y((()=>[x(f(I))])),_:1}),h("span",null,S(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),h("div",X,[x(he,{class:"icon"},{default:y((()=>[x(f(O),{class:p([{disabled:u.isSave}]),onClick:xe},null,8,["class"])])),_:1}),x(he,{class:"icon"},{default:y((()=>[x(f(A),{class:p([{disabled:f(oe).length<2||u.isSave}]),onClick:e=>function(e){oe.value.length<2||ie.isSave||oe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),u.showAnalysis?(c(),m("div",Y,[r[18]||(r[18]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"解析:")],-1)),h("div",Z,[x(v,{modelValue:f(re),"onUpdate:modelValue":r[4]||(r[4]=e=>b(re)?re.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):g("v-if",!0),f(me)?(c(),m("div",ee,[r[20]||(r[20]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"富文本:")],-1)),h("div",le,[x(R,j({"model-value":f(ce),"onUpdate:modelValue":r[5]||(r[5]=e=>b(ce)?ce.value=e:null)},f(ne),{style:{width:"100%"}}),null,16,["model-value"]),h("div",te,[x(Ve,{type:"danger",onClick:ye},{default:y((()=>r[19]||(r[19]=[C(" 删除富文本 ")]))),_:1})])])])):g("v-if",!0)])),default:y((()=>[u.showAction?(c(),w(T,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,showOtherOption:!1,examAnswerRelationType:ie.examAnswerRelationType,onMoveUp:r[6]||(r[6]=e=>se("move","up")),onMoveDown:r[7]||(r[7]=e=>se("move","down")),onDelete:r[8]||(r[8]=e=>se("delete")),onSave:we,onEdit:r[9]||(r[9]=e=>se("edit")),onAdd:r[10]||(r[10]=e=>se("add",e)),onOnShowRichText:r[11]||(r[11]=e=>me.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):g("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{ae as default};
|
2
2
|
//# sourceMappingURL=subject-text-fill.vue.mjs.map
|