Files

2 lines
10 KiB
JavaScript

import{_ as j}from"./index.76a66f15.js";/* empty css *//* empty css */import{e as R}from"./index.c314f49b.js";import{a$ as V,C as i,D as m,aJ as a,b2 as o,aG as w,b4 as k,b1 as d,aV as r,b3 as f,E,b5 as g,ch as J,bI as M,bJ as z,bF as H,bo as K,bs as W,bV as O,cj as Q,ck as X,cl as Y,cm as Z,cB as $,bt as ee,c4 as te,bK as oe,bL as ae,bP as se}from"./arco.f3c60d68.js";/* empty css */import"./chart.a626c034.js";import"./vue.7d1f2b31.js";/* empty css */const ue={components:{editor:R},computed:{pageTitle(){return{single:"\u7F16\u8F91\u5355\u9009\u9898",multiple:"\u7F16\u8F91\u591A\u9009\u9898",judge:"\u7F16\u8F91\u5224\u65AD\u9898",indefinite:"\u7F16\u8F91\u4E0D\u5B9A\u9879\u9009\u62E9\u9898",fillblank:"\u7F16\u8F91\u586B\u7A7A\u9898",essay:"\u7F16\u8F91\u95EE\u7B54\u9898"}[this.pageParams.type]||"\u7F16\u8F91\u9898\u76EE"}},data(){return{warehouseGroupList:[],groupLoading:!1,alphabet:["A","B","C","D","E","F","G","H","I","J","K","L"],form:{degree:2,type:"single",group_id:"",question:"",option:["",""],answer:0,analysis:""},optionMaxCount:10,installLoading:!0,submitLoading:!1,columns:[{title:"\u5E8F\u53F7",dataIndex:"no",slotName:"no"},{title:"\u5185\u5BB9",slotName:"content"},{title:"\u64CD\u4F5C",slotName:"operations"}],editSkuForm:{},editSkuIndex:"",pageParams:{id:0},modal:{course:!1,changeCourse:!1,skuEdit:!1},privilegeType:"",goodsList:{privilege_free_goods:[],privilege_discount_goods:[]}}},methods:{optionChange(n,t,l){this.form.option=n},optionAdd(){if(this.form.option.length>=this.optionMaxCount)return!1;this.form.option.push("")},optionDel(n){this.form.option.splice(n,1)},fillblankAdd(){this.form.answer.push([])},fillblankRemove(n){this.form.answer.splice(n,1),this.form.answer.length===0&&this.form.answer.push([])},handleSubmit({values:n,errors:t}){if(this.form.question==""||this.form.question=="<p></p>")return this.$message.warning("\u8BF7\u5B8C\u5584\u95EE\u9898\u5185\u5BB9"),!1;if(!["judge","fillblank","essay"].includes(this.pageParams.type)){if(this.form.option.length<2)return this.$message.warning("\u6700\u5C11\u8BBE\u7F6E\u4E24\u4E2A\u9009\u9879"),!1;for(var l in this.form.option)if(this.form.option[l]==""||this.form.option[l]=="<p></p>")return this.$message.warning("\u8BF7\u5B8C\u5584\u9009\u9879\u5185\u5BB9"),!1}if(this.pageParams.type=="fillblank"&&(!Array.isArray(this.form.answer)||this.form.answer.length==0))return this.$message.warning("\u8BF7\u81F3\u5C11\u8BBE\u7F6E\u4E00\u4E2A\u586B\u7A7A"),!1;var b={},e="admin/app/exam/warehouse_question/add";this.pageParams.id&&this.pageParams.id!=0&&(b.ids=this.pageParams.id,e="admin/app/exam/warehouse_question/edit"),b.row=this.form;var p=this;this.submitLoading=!0,this.$request.post(e,b).then(_=>{this.$message.success({content:_.msg,duration:1500}),p.back()}).catch(_=>{this.$message.error({content:_.msg})}).finally(()=>{this.submitLoading=!1})},getData(n){this.installLoading=!0;var t=this;this.$request.post("admin/app/exam/warehouse_question/detail",{id:n}).then(l=>{this.pageParams.type=l.data.type,this.form={type:l.data.type,question:l.data.question,option:l.data.option||[],group_id:l.data.group_id,degree:l.data.degree,answer:l.data.answer,analysis:l.data.analysis},this.form.type=="fillblank"?(!Array.isArray(this.form.answer)||this.form.answer.length==0)&&(this.form.answer=[[]]):this.form.type=="essay"?this.form.answer=this.form.answer||"":["multiple","indefinite"].includes(this.form.type)?this.form.answer=Array.isArray(this.form.answer)?this.form.answer:[]:this.form.answer=this.form.answer===""||this.form.answer===null||this.form.answer===void 0?0:parseInt(this.form.answer)}).catch(l=>{n!=0&&this.$message.error({content:"\u83B7\u53D6\u4FE1\u606F\u5931\u8D25",duration:1500,onClose:function(){t.back()}})}).finally(()=>{this.installLoading=!1})},back(){this.$router.push({name:"app.question_bank"})},checkInstall(){this.installLoading=!0,this.getWarehouseGroup(),this.pageParams.id!=0?this.getData(this.pageParams.id):(this.form.group_id=parseInt(this.pageParams.group),this.form.type=this.pageParams.type,["fillblank","essay"].includes(this.pageParams.type)&&(this.form.option=[]),this.pageParams.type=="multiple"||this.pageParams.type=="indefinite"?this.form.answer=[0]:this.pageParams.type=="fillblank"?this.form.answer=[[]]:this.pageParams.type=="essay"?this.form.answer="":this.form.answer=0,this.installLoading=!1)},getWarehouseGroup(){this.groupLoading=!0,this.$request.post("admin/app/exam/warehouse_group/index",{}).then(n=>{this.warehouseGroupList=n.data.rows}).finally(()=>{this.groupLoading=!1})}},mounted(){this.pageParams=this.$route.params,console.log("this.pageParams.group",this.pageParams.group),this.pageParams.group=="-"&&(this.pageParams.group=0),this.checkInstall()}};const ie={class:"container"},le={key:3,class:"fillblank-answer"},ne={class:"blank-header"},re={key:0,class:"fillblank-tip"},pe={class:"form-submit-btn"};function me(n,t,l,b,e,p){const _=J,x=M,D=z,y=H,F=V("editor"),h=K,A=V("icon-plus"),B=W,P=O,v=Q,C=X,L=Y,q=Z,U=$,I=ee,S=te,G=oe,T=ae,N=se;return i(),m("div",ie,[a(N,{style:{width:"100%"},tip:"\u52A0\u8F7D\u4E2D",loading:e.installLoading},{default:o(()=>[a(T,{bordered:!1},{default:o(()=>[a(_,{onBack:t[0]||(t[0]=s=>p.back()),style:{background:"var(--color-bg-2)",padding:"0 0 16px 0"},title:p.pageTitle},null,8,["title"]),a(G,{model:e.form,ref:"formRef",onSubmit:p.handleSubmit},{default:o(()=>[a(y,{label:"\u9898\u76EE\u5206\u7EC4"},{default:o(()=>[a(D,{style:{width:"320px"},"default-value":e.form.group_id,placeholder:"\u8BF7\u9009\u62E9\u5206\u7EC4",modelValue:e.form.group_id,"onUpdate:modelValue":t[1]||(t[1]=s=>e.form.group_id=s),loading:e.groupLoading},{default:o(()=>[(i(!0),m(w,null,k(e.warehouseGroupList,(s,u)=>(i(),d(x,{value:s.id},{default:o(()=>[r(f(s.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["default-value","modelValue","loading"])]),_:1}),a(y,{field:"title",label:"\u9898\u76EE"},{default:o(()=>[a(F,{height:"200px",width:"700px",modelValue:e.form.question,"onUpdate:modelValue":t[2]||(t[2]=s=>e.form.question=s)},null,8,["modelValue"])]),_:1}),["judge","fillblank","essay"].includes(e.pageParams.type)?g("",!0):(i(),d(y,{key:0,field:"title",label:"\u9009\u9879"},{default:o(()=>[a(B,{direction:"vertical",fill:""},{default:o(()=>[a(P,{pagination:!1,columns:e.columns,data:e.form.option,onChange:p.optionChange,draggable:{type:"handle",width:40}},{no:o(({rowIndex:s})=>[r(f(e.alphabet[s]),1)]),content:o(({record:s,rowIndex:u})=>[a(F,{modelValue:e.form.option[u],"onUpdate:modelValue":c=>e.form.option[u]=c,height:"200px",width:"700px"},null,8,["modelValue","onUpdate:modelValue"])]),operations:o(({record:s,rowIndex:u})=>[a(h,{onClick:c=>p.optionDel(u),style:{padding:"0"},type:"text",size:"small"},{default:o(()=>[...t[10]||(t[10]=[r(" \u5220\u9664 ",-1)])]),_:1},8,["onClick"])]),footer:o(()=>[a(B,null,{default:o(()=>[a(h,{type:"dashed",onClick:t[3]||(t[3]=s=>p.optionAdd())},{default:o(()=>[a(A),r("\u6DFB\u52A0("+f(e.form.option.length)+"/"+f(e.optionMaxCount)+")",1)]),_:1}),t[11]||(t[11]=E("span",null,"\u81F3\u591A\u6DFB\u52A010\u4E2A\u9009\u9879",-1))]),_:1})]),_:1},8,["columns","data","onChange"])]),_:1})]),_:1})),a(y,{field:"title",label:"\u7B54\u6848"},{extra:o(()=>[e.pageParams.type=="fillblank"?(i(),m("div",re,[a(I,{type:"secondary"},{default:o(()=>[...t[16]||(t[16]=[r(" \u8F93\u5165\u7B54\u6848\u540E\u70B9\u51FB\u56DE\u8F66\u952E\u4FDD\u5B58\uFF0C\u82E5\u4E00\u4E2A\u7A7A\u6709\u591A\u4E2A\u7B54\u6848\uFF0C\u53EF\u7EE7\u7EED\u8F93\u5165\u5E76\u70B9\u51FB\u56DE\u8F66\u952E\u4FDD\u5B58\uFF0C\u5B66\u5458\u7B54\u6848\u5339\u914D\u4EFB\u610F\u4E00\u4E2A\u5373\u7B97\u6B63\u786E\u3002 ",-1)])]),_:1})])):g("",!0)]),default:o(()=>[e.pageParams.type=="single"?(i(),d(C,{key:0,modelValue:e.form.answer,"onUpdate:modelValue":t[4]||(t[4]=s=>e.form.answer=s)},{default:o(()=>[(i(!0),m(w,null,k(e.form.option,(s,u)=>(i(),d(v,{value:u},{default:o(()=>[r(f(e.alphabet[u]),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])):g("",!0),e.pageParams.type=="judge"?(i(),d(C,{key:1,modelValue:e.form.answer,"onUpdate:modelValue":t[5]||(t[5]=s=>e.form.answer=s)},{default:o(()=>[a(v,{value:0},{default:o(()=>[...t[12]||(t[12]=[r("\u6B63\u786E",-1)])]),_:1}),a(v,{value:1},{default:o(()=>[...t[13]||(t[13]=[r("\u9519\u8BEF",-1)])]),_:1})]),_:1},8,["modelValue"])):g("",!0),e.pageParams.type=="multiple"||e.pageParams.type=="indefinite"?(i(),d(q,{key:2,modelValue:e.form.answer,"onUpdate:modelValue":t[6]||(t[6]=s=>e.form.answer=s)},{default:o(()=>[(i(!0),m(w,null,k(e.form.option,(s,u)=>(i(),d(L,{value:u},{default:o(()=>[r(f(e.alphabet[u]),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])):g("",!0),e.pageParams.type=="fillblank"?(i(),m("div",le,[(i(!0),m(w,null,k(e.form.answer,(s,u)=>(i(),m("div",{key:u,class:"blank-item"},[E("div",ne,[E("span",null,"\u7B2C"+f(u+1)+"\u7A7A",1),a(h,{onClick:c=>p.fillblankRemove(u),style:{padding:"0"},type:"text",size:"small"},{default:o(()=>[...t[14]||(t[14]=[r(" \u5220\u9664 ",-1)])]),_:1},8,["onClick"])]),a(U,{modelValue:e.form.answer[u],"onUpdate:modelValue":c=>e.form.answer[u]=c,placeholder:"\u8F93\u5165\u5907\u9009\u7B54\u6848\uFF0C\u6309\u56DE\u8F66\u6DFB\u52A0","allow-clear":""},null,8,["modelValue","onUpdate:modelValue"])]))),128)),a(h,{type:"dashed",onClick:p.fillblankAdd},{default:o(()=>[a(A),t[15]||(t[15]=r("\u6DFB\u52A0\u586B\u7A7A",-1))]),_:1},8,["onClick"])])):g("",!0),e.pageParams.type=="essay"?(i(),d(F,{key:4,height:"200px",width:"700px",modelValue:e.form.answer,"onUpdate:modelValue":t[7]||(t[7]=s=>e.form.answer=s)},null,8,["modelValue"])):g("",!0)]),_:1}),a(y,{field:"title",label:"\u89E3\u6790"},{default:o(()=>[a(F,{height:"200px",width:"700px",modelValue:e.form.analysis,"onUpdate:modelValue":t[8]||(t[8]=s=>e.form.analysis=s)},null,8,["modelValue"])]),_:1}),a(S,{offsetBottom:0},{default:o(()=>[E("div",pe,[a(B,null,{default:o(()=>[a(h,{onClick:t[9]||(t[9]=s=>p.back())},{default:o(()=>[...t[17]||(t[17]=[r("\u8FD4\u56DE",-1)])]),_:1}),a(h,{"html-type":"submit",type:"primary",loading:e.submitLoading},{default:o(()=>[...t[18]||(t[18]=[r("\u4FDD\u5B58",-1)])]),_:1},8,["loading"])]),_:1})])]),_:1})]),_:1},8,["model","onSubmit"])]),_:1})]),_:1},8,["loading"])])}const we=j(ue,[["render",me],["__scopeId","data-v-618f0037"]]);export{we as default};