You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/3958.async.js

2 lines
26 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3958],{27599:function(Ee,ae){ae.Z={flex_box_center:"flex_box_center___JbEg0",flex_space_between:"flex_space_between___Kf6pN",flex_box_vertical_center:"flex_box_vertical_center___e4qgM",flex_box_center_end:"flex_box_center_end___p8QnY",flex_box_column:"flex_box_column___qCilW",wrap:"wrap___Gdnjm",modal:"modal___nL9rn",titleWrap:"titleWrap___ezuXc",required:"required___i8a7H",title:"title___FaxQL",colorGray:"colorGray___CO5Es",choiceWrap:"choiceWrap___pj0lT",answer:"answer___Aq1c0",activeAnswer:"activeAnswer___VIsVw",deleteIcon:"deleteIcon___Gsa5a",addIcon:"addIcon___Yr5Ku",editorWrap:"editorWrap____aGAd",htmlWrap:"htmlWrap___SKYBF",radio:"radio___wvdFS",color333:"color333___uuN3O",color999:"color999___prp8g",questionType:"questionType___FKxwP",questionChoices:"questionChoices___c0OQa",close_style:"close_style___NQVEE",save_style:"save_style___kq8NC",edit_title:"edit_title___W3elv",can_select_count:"can_select_count___F11WF"}},44020:function(Ee,ae,s){var e=s(59301),X=s(63144),K=s(8591),re=s(43418),G=s(6848),b=s(95237),p=s(43604),se=s(24905),ce=s(78673),ie=s(98135),w=s(57809),d=s(24096),B=s(27599),oe=s(73304),ee=Object.defineProperty,$=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,T=(u,n,i)=>n in u?ee(u,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[n]=i,z=(u,n)=>{for(var i in n||(n={}))ne.call(n,i)&&T(u,i,n[i]);if($)for(var i of $(n))U.call(n,i)&&T(u,i,n[i]);return u},I=(u,n)=>{var i={};for(var P in u)ne.call(u,P)&&n.indexOf(P)<0&&(i[P]=u[P]);if(u!=null&&$)for(var P of $(u))n.indexOf(P)<0&&U.call(u,P)&&(i[P]=u[P]);return i},g=(u,n,i)=>new Promise((P,x)=>{var y=t=>{try{l(i.next(t))}catch(F){x(F)}},S=t=>{try{l(i.throw(t))}catch(F){x(F)}},l=t=>t.done?P(t.value):Promise.resolve(t.value).then(y,S);l((i=i.apply(u,n)).next())});const Z=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_=(u,n)=>{var i=u,{problemset:P,globalSetting:x,loading:y,dispatch:S,onRef:l=()=>{},editData:t,editKey:F,callback:f,polls_status:te,isadd:R}=i,q=I(i,["problemset","globalSetting","loading","dispatch","onRef","editData","editKey","callback","polls_status","isadd"]);const[h,k]=(0,e.useState)([]),[Y,le]=(0,e.useState)(""),[C,r]=(0,e.useState)(!0),[v,W]=(0,e.useState)(!1),j=(0,X.useParams)(),[H,de]=(0,e.useState)(""),[ue,_e]=(0,e.useState)("");(0,e.useEffect)(()=>{var a,o,E,L,A,Q,D,V,fe;if(!((a=t==null?void 0:t.question)!=null&&a.question_title)){k([{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""}]),r(!0),le(""),W(!1);return}de((o=t==null?void 0:t.question)==null?void 0:o.max_choices),_e((E=t==null?void 0:t.question)==null?void 0:E.min_choices),le((L=t==null?void 0:t.question)==null?void 0:L.question_title),r(!!((A=t==null?void 0:t.question)!=null&&A.is_necessary)),k(R?(D=t==null?void 0:t.question)==null?void 0:D.question_answers.map(J=>({value:J,disabled:J==="\u5176\u5B83",placeholder:J==="\u5176\u5B83"?"\u65E0\u6CD5\u7F16\u8F91\uFF0C\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u7F16\u8F91":""})):(Q=t==null?void 0:t.question)==null?void 0:Q.answers.map(J=>({value:J.answer_text,disabled:J.answer_text==="\u5176\u5B83",placeholder:J.answer_text==="\u5176\u5B83"?"\u65E0\u6CD5\u7F16\u8F91\uFF0C\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u7F16\u8F91":""}))),W(!!((fe=(V=t==null?void 0:t.question)==null?void 0:V.answers)!=null&&fe.find(J=>J.answer_text==="\u5176\u5B83")))},[t]),(0,e.useImperativeHandle)(n,()=>({onSave:me}));const me=a=>g(void 0,null,function*(){var o;if(H&&!ue||!H&&ue){K.ZP.info('\u53EF\u9009\uFF1A\u6700\u5C0F\u548C\u6700\u5927\u9650\u5236\u987B\u540C\u65F6\u4E3A\u6570\u503C\u6216\u8005\u201C--"');return}if(ue>H){K.ZP.info("\u53EF\u9009\u7684\u6700\u5927\u9650\u5236\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u9650\u5236");return}if(!Y)return K.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),!1;v&&(h[h.length-1].value="\u5176\u5B83");const E=h.findIndex(Q=>!Q.value);if(E>-1)return K.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${Z[E]} \u9009\u9879\u7684\u5185\u5BB9`),!1;let L;const A={question_title:Y,question_type:2,insert_id:t.insert_id,is_necessary:Math.ceil(C),max_choices:H,min_choices:ue,question_answers:h.map(Q=>Q.value)};if((o=t.question)!=null&&o.id?L=yield(0,d.IU)(z({pollsId:t.question.id},A)):R?a?f("isadd",A,2):f("isadd",A):L=yield(0,d.MK)(z({pollsId:j.categoryId},A)),!R&&L.status===0){K.ZP.success("\u4FDD\u5B58\u6210\u529F"),f("edit",-1);const Q=yield S({type:"polls/editPolls",payload:z({},j)});if(a){A.answers=A.question_answers.map(V=>({answer_text:V}));const D=[...Q.poll_questions];D.splice(t==null?void 0:t.key,0,{insert_id:t==null?void 0:t.insert_id,question:z({},A)}).slice(),f("addContinue",[...D]),f("edit",t.key+1)}}}),m=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current font20",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current font20",id:"down"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],O=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],c=a=>g(void 0,null,function*(){var o,E;switch(a.id){case"del":let L;re.default.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk(){return g(this,null,function*(){var A;R?f("del",t.key):(yield(0,d.jy)({pollsId:(A=t==null?void 0:t.question)==null?void 0:A.id}),S({type:"polls/editPolls",payload:z({},j)}))})}});break;case"up":case"down":yield(0,d.wh)({pollsId:(o=t==null?void 0:t.question)==null?void 0:o.id,opr:a.id}),S({type:"polls/editPolls",payload:z({},j)});break;case"edit":f("edit",t.key);break;case"add":f("add",{type:2,key:t.key,insert_id:(E=t==null?void 0:t.question)==null?void 0:E.id,question_type:2});break}}),M=()=>{var a,o,E,L,A;let Q=(a=t.question)==null?void 0:a.min_choices;return e.createElement("aside",null,e.createElement("div",{className:B.Z.questionType},e.createElement("div",null,t.question.is_necessary>0&&e.createElement("span",{style:{color:"red",fontSize:"14px"}},"*"),e.createElement("span",{className:"font16",style:{color:"#3061D0"}},"\u3010\u591A\u9009\u3011"),e.createElement("span",{className:B.Z.can_select_count},Q?`\u53EF\u9009${(o=t==null?void 0:t.question)==null?void 0:o.min_choices}-${(E=t==null?void 0:t.question)==null?void 0:E.max_choices}\u9879`:null),e.createElement("span",{className:B.Z.edit_title},e.createElement("span",{style:{marginRight:"10px"}},"\u7B2C",t.key,"\u9898"),t.question.question_title)),!R&&m.map(function(D,V){return D.id==="up"&&t.key===1||D.id==="down"&&t.key===t.len?null:e.createElement(G.Z,{key:V,placement:"bottom",title:D.name},e.createElement("span",{onClick:()=>c(D),className:D.icon}))}),R&&O.map(function(D,V){return D.id==="up"&&t.key===1||D.id==="down"&&t.key===t.len?null:e.createElement(G.Z,{key:V,placement:"bottom",title:D.name},e.createElement("span",{onClick:()=>c(D),className:D.icon}))})),e.createElement("div",{className:B.Z.questionChoices},!R&&e.createElement("div",{className:B.Z.questionChoices},(L=t==null?void 0:t.question.answers)==null?void 0:L.map(function(D,V){return e.createElement(b.Z,null,e.createElement(p.Z,null,e.createElement(se.default,{key:V,disabled:!0})),e.createElement(p.Z,{flex:"1"},e.createElement("span",{className:"c-black font14 ml10"},D.answer_text)))})),R&&e.createElement("div",{className:B.Z.questionChoices},(A=t==null?void 0:t.question.question_answers)==null?void 0:A.map(function(D,V){return e.createElement(b.Z,null,e.createElement(p.Z,null,e.createElement(se.default,{key:V,disabled:!0})),e.createElement(p.Z,{flex:"1"},e.createElement("span",{className:"c-black font14 ml10"},D)))}))))},N=()=>e.createElement("aside",null,e.createElement("div",{className:B.Z.questionType},e.createElement("div",null,e.createElement("span",{className:"font16 c-blue"},"\u3010\u591A\u9009\u3011"),e.createElement("span",{className:"font16",style:{color:"#666666"}},"\u5FC5\u7B54"),e.createElement(ce.Z,{checked:!!C,onChange:a=>r(a),className:"ml10"}))),e.createElement("p",{className:B.Z.titleWrap},e.createElement(b.Z,{className:B.Z.choiceWrap,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,"\u6807\u9898")),e.createElement(p.Z,{className:B.Z.editorWrap,flex:"1"},e.createElement(ie.default,{style:{width:"1000px",height:"40px"},value:Y,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:a=>le(a.target.value)})))),h.map((a,o)=>{var E;let L=h.length-1;return e.createElement(b.Z,{className:B.Z.choiceWrap,key:o,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,v&&o===L?"\u5176\u5B83":"\u9009\u9879")),e.createElement(p.Z,{className:B.Z.editorWrap,flex:"1"},e.createElement(ie.default,{style:{width:"1000px",height:"40px"},placeholder:(E=a.placeholder)!=null?E:"",value:v&&o===L?"":h[o].value,disabled:!!a.disabled,onChange:A=>{h[o].value=A.target.value,k([...h])}})),e.createElement(p.Z,null,o>1&&e.createElement(G.Z,{title:"\u5220\u9664"},e.createElement("i",{className:`${B.Z.deleteIcon} iconfont icon-yichu1`,onClick:()=>{k(h.filter((A,Q)=>Q!==o)),a.disabled&&W(!1)}}))))}),e.createElement("p",{className:B.Z.titleWrap},e.createElement(b.Z,{className:B.Z.choiceWrap,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,"\u53EF\u9009")),e.createElement(p.Z,null,e.createElement(w.default,{value:ue||"",style:{width:183,height:"40px"},onChange:a=>_e(a)},e.createElement(w.default.Option,{value:""},"--"),h.map(function(a,o){return e.createElement(w.default.Option,{value:String(o+1)},o+1)})),e.createElement("span",{className:"ml10 mr10"},"-"),e.createElement(w.default,{style:{width:183,height:"40px"},value:H||"",onChange:a=>de(a)},e.createElement(w.default.Option,{value:""},"--"),h.map(function(a,o){return e.createElement(w.default.Option,{value:String(o+1)},o+1)})),e.createElement(G.Z,{title:"\u5B66\u751F\u7B54\u9898\u65F6\uFF0C\u7CFB\u7EDF\u5BF9\u5176\u9009\u62E9\u7684\u9009\u9879\u4E2A\u6570\u8FDB\u884C\u9650\u5236\uFF0C--\u8868\u793A\u4E0D\u9650\u5236"},e.createElement("i",{className:"iconfont icon-xiaowenhao1 font14",style:{marginLeft:"10px",color:"#3061D0",cursor:"pointer"}}))))),e.createElement("div",{style:{display:"flex",width:"1000px",margin:"20px 0 0 40px"}},te===1&&e.createElement(e.Fragment,null,e.createElement(oe.op,{style:{height:"38px"},onClick:()=>{let a=[...h];v?a.splice(a.length-1,0,{value:""}):a.push({value:""}),k([...a])}},"\u65B0\u589E\u9009\u9879"),!v&&e.createElement(oe.op,{style:{height:"38px",marginLeft:"20px"},onClick:()=>{k([...h,{disabled:!0,value:"",placeholder:"\u65E0\u6CD5\u7F16\u8F91\uFF01\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u5F55\u5165"}]),W(!0)}},"\u65B0\u589E\u5176\u5B83\u9009\u9879")),e.createElement("div",{className:B.Z.close_style,onClick:()=>{var a;if((a=t.question)!=null&&a.id){const o=h.findIndex(E=>!E.value);R&&o>-1?f("del",t.key):f("edit",-1)}else f("del",t.key)}},"\u53D6\u6D88"),e.createElement("div",{className:B.Z.save_style,onClick:()=>me()},"\u4FDD\u5B58")));return e.createElement("section",{className:B.Z.wrap},F!==t.key&&M(),F===t.key&&N())};ae.Z=(0,X.connect)(({problemset:u,loading:n,globalSetting:i})=>({problemset:u,globalSetting:i,loading:n.effects}),null,null,{forwardRef:!0})((0,e.forwardRef)(_))},58819:function(Ee,ae,s){var e=s(59301),X=s(63144),K=s(8591),re=s(43418),G=s(6848),b=s(95237),p=s(43604),se=s(5112),ce=s(78673),ie=s(98135),w=s(24096),d=s(27599),B=s(73304),oe=Object.defineProperty,ee=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,U=(_,u,n)=>u in _?oe(_,u,{enumerable:!0,configurable:!0,writable:!0,value:n}):_[u]=n,T=(_,u)=>{for(var n in u||(u={}))$.call(u,n)&&U(_,n,u[n]);if(ee)for(var n of ee(u))ne.call(u,n)&&U(_,n,u[n]);return _},z=(_,u)=>{var n={};for(var i in _)$.call(_,i)&&u.indexOf(i)<0&&(n[i]=_[i]);if(_!=null&&ee)for(var i of ee(_))u.indexOf(i)<0&&ne.call(_,i)&&(n[i]=_[i]);return n},I=(_,u,n)=>new Promise((i,P)=>{var x=l=>{try{S(n.next(l))}catch(t){P(t)}},y=l=>{try{S(n.throw(l))}catch(t){P(t)}},S=l=>l.done?i(l.value):Promise.resolve(l.value).then(x,y);S((n=n.apply(_,u)).next())});const g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Z=(_,u)=>{var n=_,{problemset:i,globalSetting:P,loading:x,dispatch:y,onRef:S=()=>{},editData:l,editKey:t,callback:F,isadd:f,polls_status:te}=n,R=z(n,["problemset","globalSetting","loading","dispatch","onRef","editData","editKey","callback","isadd","polls_status"]);const[q,h]=(0,e.useState)([]),[k,Y]=(0,e.useState)(""),[le,C]=(0,e.useState)(!0),[r,v]=(0,e.useState)(!1),W=(0,X.useParams)();(0,e.useEffect)(()=>{var m,O,c,M,N,a,o;if(!((m=l==null?void 0:l.question)!=null&&m.question_title)){h([{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""},{disabled:!1,value:""}]),C(!0),Y(""),v(!1);return}Y((O=l==null?void 0:l.question)==null?void 0:O.question_title),C(!!((c=l==null?void 0:l.question)!=null&&c.is_necessary)),h(f?(N=l==null?void 0:l.question)==null?void 0:N.question_answers.map(E=>({value:E,disabled:E==="\u5176\u5B83",placeholder:E==="\u5176\u5B83"?"\u65E0\u6CD5\u7F16\u8F91\uFF0C\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u7F16\u8F91":""})):(M=l==null?void 0:l.question)==null?void 0:M.answers.map(E=>({value:E.answer_text,disabled:E.answer_text==="\u5176\u5B83",placeholder:E.answer_text==="\u5176\u5B83"?"\u65E0\u6CD5\u7F16\u8F91\uFF0C\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u7F16\u8F91":""}))),v(!!((o=(a=l==null?void 0:l.question)==null?void 0:a.answers)!=null&&o.find(E=>E.answer_text==="\u5176\u5B83")))},[l]),(0,e.useImperativeHandle)(u,()=>({onSave:j}));const j=m=>I(void 0,null,function*(){var O;if(!k)return K.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),!1;r&&(q[q.length-1].value="\u5176\u5B83");const c=q.findIndex(a=>!a.value);if(c>-1)return K.ZP.info(`\u8BF7\u5148\u8F93\u5165 ${g[c]} \u9009\u9879\u7684\u5185\u5BB9`),!1;let M;const N={question_title:k,question_type:1,insert_id:l.insert_id,is_necessary:Math.ceil(le),question_answers:q.map(a=>a.value)};if((O=l.question)!=null&&O.id?(F("edit",-1),M=yield(0,w.IU)(T({pollsId:l.question.id},N))):f?m?F("isadd",N,1):F("isadd",N):M=yield(0,w.MK)(T({pollsId:W.categoryId},N)),!f){if(M.status===0){F("edit",-1),K.ZP.success("\u4FDD\u5B58\u6210\u529F");const a=yield y({type:"polls/editPolls",payload:T({},W)});if(m){N.answers=N.question_answers.map(E=>({answer_text:E}));const o=[...a.poll_questions];o.splice(l==null?void 0:l.key,0,{insert_id:l==null?void 0:l.insert_id,question:T({},N)}).slice(),F("addContinue",[...o]),F("edit",l.key+1)}}}}),H=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current font20",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current font20",id:"down"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],de=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],ue=m=>I(void 0,null,function*(){var O,c;switch(m.id){case"del":let M;re.default.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk(){return I(this,null,function*(){var N;f?F("del",l.key):(yield(0,w.jy)({pollsId:(N=l==null?void 0:l.question)==null?void 0:N.id}),y({type:"polls/editPolls",payload:T({},W)}))})}});break;case"up":case"down":yield(0,w.wh)({pollsId:(O=l==null?void 0:l.question)==null?void 0:O.id,opr:m.id}),y({type:"polls/editPolls",payload:T({},W)});break;case"edit":F("edit",l.key);break;case"add":F("add",{type:1,key:l.key,insert_id:(c=l==null?void 0:l.question)==null?void 0:c.id,question_type:1});break}}),_e=()=>{var m,O;return e.createElement("aside",null,e.createElement("div",{className:d.Z.questionType},e.createElement("div",null,l.question.is_necessary>0&&e.createElement("span",{style:{color:"red",fontSize:"14px"}},"*"),e.createElement("span",{className:"font16",style:{color:"#3061D0"}},"\u3010\u5355\u9009\u3011"),e.createElement("span",{className:d.Z.edit_title},e.createElement("span",{style:{marginRight:"10px"}},"\u7B2C",l.key,"\u9898"),l.question.question_title)),!f&&H.map(function(c,M){return c.id==="up"&&l.key===1||c.id==="down"&&l.key===l.len?null:e.createElement(G.Z,{key:M,placement:"bottom",title:c.name},e.createElement("span",{onClick:()=>ue(c),className:c.icon}))}),f&&de.map(function(c,M){return c.id==="up"&&l.key===1||c.id==="down"&&l.key===l.len?null:e.createElement(G.Z,{key:M,placement:"bottom",title:c.name},e.createElement("span",{onClick:()=>ue(c),className:c.icon}))})),!f&&e.createElement("div",{className:d.Z.questionChoices},(m=l==null?void 0:l.question.answers)==null?void 0:m.map(function(c,M){return e.createElement(b.Z,null,e.createElement(p.Z,null,e.createElement(se.ZP,{key:M,disabled:!0})),e.createElement(p.Z,{flex:"1"},e.createElement("span",{className:"c-black font14"},c.answer_text)))})),f&&e.createElement("div",{className:d.Z.questionChoices},(O=l==null?void 0:l.question.question_answers)==null?void 0:O.map(function(c,M){return e.createElement(b.Z,null,e.createElement(p.Z,null,e.createElement(se.ZP,{key:M,disabled:!0})),e.createElement(p.Z,{flex:"1"},e.createElement("span",{className:"c-black font14"},c)))})))},me=()=>e.createElement("aside",null,e.createElement("div",{className:d.Z.questionType},e.createElement("div",null,e.createElement("span",{className:"font16 c-blue"},"\u3010\u5355\u9009\u3011"),e.createElement("span",{className:"font16",style:{color:"#666666"}},"\u5FC5\u7B54"),e.createElement(ce.Z,{checked:!!le,onChange:m=>C(m),className:"ml10"}))),e.createElement("p",{className:d.Z.titleWrap},e.createElement(b.Z,{className:d.Z.choiceWrap,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,"\u6807\u9898")),e.createElement(p.Z,{className:d.Z.editorWrap},e.createElement(ie.default,{style:{width:"1000px",height:"40px"},value:k,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:m=>Y(m.target.value)})))),q.map((m,O)=>{var c;let M=q.length-1;return e.createElement(b.Z,{className:d.Z.choiceWrap,key:O,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,r&&O===M?"\u5176\u5B83":"\u9009\u9879")),e.createElement(p.Z,{className:d.Z.editorWrap,flex:"1"},e.createElement(ie.default,{style:{width:"1000px",height:"40px"},placeholder:(c=m.placeholder)!=null?c:"",value:r&&O===M?"":q[O].value,disabled:!!m.disabled,onChange:N=>{q[O].value=N.target.value,h([...q])}})),e.createElement(p.Z,null,O>1&&e.createElement(G.Z,{title:"\u5220\u9664"},e.createElement("i",{className:`${d.Z.deleteIcon} iconfont icon-yichu1`,onClick:()=>{h(q.filter((N,a)=>a!==O)),m.disabled&&v(!1)}}))))}),e.createElement("div",{style:{display:"flex",width:"1000px",margin:"20px 0 0 40px"}},te===1&&e.createElement(e.Fragment,null,e.createElement(B.op,{style:{height:"38px"},onClick:()=>{let m=[...q];r?m.splice(m.length-1,0,{value:""}):m.push({value:""}),h([...m])}},"\u65B0\u589E\u9009\u9879"),!r&&e.createElement(B.op,{style:{height:"38px",marginLeft:"20px"},onClick:()=>{h([...q,{disabled:!0,value:"",placeholder:"\u65E0\u6CD5\u7F16\u8F91\uFF01\u5C06\u7531\u53C2\u4E0E\u7B54\u9898\u7684\u4EBA\u624B\u52A8\u5F55\u5165"}]),v(!0)}},"\u65B0\u589E\u5176\u5B83\u9009\u9879")),e.createElement("div",{className:d.Z.close_style,onClick:()=>{var m;if((m=l.question)!=null&&m.id){const O=q.findIndex(c=>!c.value);f&&O>-1?F("del",l.key):F("edit",-1)}else F("del",l.key)}},"\u53D6\u6D88"),e.createElement("div",{className:d.Z.save_style,onClick:()=>j()},"\u4FDD\u5B58")));return e.createElement("section",{className:d.Z.wrap},t!==l.key&&_e(),t===l.key&&me())};ae.Z=(0,X.connect)(({problemset:_,loading:u,globalSetting:n})=>({problemset:_,globalSetting:n,loading:u.effects}),null,null,{forwardRef:!0})((0,e.forwardRef)(Z))},88484:function(Ee,ae,s){var e=s(59301),X=s(63144),K=s(8591),re=s(43418),G=s(6848),b=s(95237),p=s(43604),se=s(24905),ce=s(78673),ie=s(98135),w=s(24096),d=s(27599),B=Object.defineProperty,oe=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,ne=(I,g,Z)=>g in I?B(I,g,{enumerable:!0,configurable:!0,writable:!0,value:Z}):I[g]=Z,U=(I,g)=>{for(var Z in g||(g={}))ee.call(g,Z)&&ne(I,Z,g[Z]);if(oe)for(var Z of oe(g))$.call(g,Z)&&ne(I,Z,g[Z]);return I},T=(I,g,Z)=>new Promise((_,u)=>{var n=x=>{try{P(Z.next(x))}catch(y){u(y)}},i=x=>{try{P(Z.throw(x))}catch(y){u(y)}},P=x=>x.done?_(x.value):Promise.resolve(x.value).then(n,i);P((Z=Z.apply(I,g)).next())});const z=({problemset:I,globalSetting:g,loading:Z,dispatch:_,onRef:u=()=>{},editData:n,polls_status:i,editKey:P,isadd:x,callback:y},S)=>{const[l,t]=(0,e.useState)(""),[F,f]=(0,e.useState)(!0),te=(0,X.useParams)();(0,e.useEffect)(()=>{var C,r,v;if(!((C=n==null?void 0:n.question)!=null&&C.question_title)){f(!0),t("");return}t((r=n==null?void 0:n.question)==null?void 0:r.question_title),f(!!((v=n==null?void 0:n.question)!=null&&v.is_necessary))},[n]),(0,e.useImperativeHandle)(S,()=>({onSave:R}));const R=C=>T(void 0,null,function*(){var r;if(!l)return K.ZP.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),!1;let v;const W={question_title:l,question_type:3,insert_id:n.insert_id,is_necessary:Math.ceil(F)};if((r=n.question)!=null&&r.id?v=yield(0,w.IU)(U({pollsId:n.question.id},W)):x?C?y("isadd",W,3):y("isadd",W):v=yield(0,w.MK)(U({pollsId:te.categoryId},W)),!x&&v.status===0){K.ZP.success("\u4FDD\u5B58\u6210\u529F"),y("edit",-1);const j=yield _({type:"polls/editPolls",payload:U({},te)});if(C){const H=[...j.poll_questions];H.splice(n==null?void 0:n.key,0,{insert_id:n==null?void 0:n.insert_id,question:U({},W)}).slice(),y("addContinue",[...H]),y("edit",n.key+1)}}}),q=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u4E0A\u79FB",icon:"iconfont c-green ml30 icon-xiangshangyi current font20",id:"up"},{name:"\u4E0B\u79FB",icon:"iconfont c-green ml30 icon-xiangxiayi current font20",id:"down"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],h=[{name:"\u5220\u9664",icon:"iconfont c-red ml30 icon-shanchutimu current font20",id:"del"},{name:"\u590D\u5236\u9898\u578B",icon:"iconfont c-green ml30 icon-tianjia2 current font20",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-green ml30 icon-bianji-moren current font20",id:"edit"}],k=C=>T(void 0,null,function*(){var r,v;switch(C.id){case"del":let W;re.default.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u95EE\u9898\u5417\uFF1F",onOk(){return T(this,null,function*(){var j;x?y("del",n.key):(yield(0,w.jy)({pollsId:(j=n==null?void 0:n.question)==null?void 0:j.id}),_({type:"polls/editPolls",payload:U({},te)}))})}});break;case"up":case"down":yield(0,w.wh)({pollsId:(r=n==null?void 0:n.question)==null?void 0:r.id,opr:C.id}),_({type:"polls/editPolls",payload:U({},te)});break;case"edit":y("edit",n.key);break;case"add":y("add",{type:3,key:n.key,insert_id:(v=n==null?void 0:n.question)==null?void 0:v.id,question_type:3});break}}),Y=()=>{var C;return e.createElement("aside",null,e.createElement("div",{className:d.Z.questionType},e.createElement("div",null,n.question.is_necessary>0&&e.createElement("span",{style:{color:"red",fontSize:"14px"}},"*"),e.createElement("span",{className:"font16",style:{color:"#3061D0"}},"\u3010\u95EE\u7B54\u3011"),e.createElement("span",{className:d.Z.edit_title},e.createElement("span",{style:{marginRight:"10px"}},"\u7B2C",n.key,"\u9898"),n.question.question_title)),!x&&q.map(function(r,v){return r.id==="up"&&n.key===1||r.id==="down"&&n.key===n.len?null:e.createElement(G.Z,{key:v,placement:"bottom",title:r.name},e.createElement("span",{onClick:()=>k(r),className:r.icon}))}),x&&h.map(function(r,v){return r.id==="up"&&n.key===1||r.id==="down"&&n.key===n.len?null:e.createElement(G.Z,{key:v,placement:"bottom",title:r.name},e.createElement("span",{onClick:()=>k(r),className:r.icon}))})),e.createElement("div",{className:d.Z.questionChoices},(C=n==null?void 0:n.question.answers)==null?void 0:C.map(function(r,v){return e.createElement(b.Z,null,e.createElement(p.Z,null,e.createElement(se.default,{key:v,disabled:!0},e.createElement("span",{className:"c-black font14"},r.answer_text))))})))},le=()=>e.createElement("aside",null,e.createElement("div",{className:d.Z.questionType},e.createElement("div",null,e.createElement("span",{className:"font16 c-blue"},"\u3010\u95EE\u7B54\u3011"),e.createElement("span",{className:"font16",style:{color:"#666666"}},"\u5FC5\u7B54"),e.createElement(ce.Z,{checked:!!F,onChange:C=>f(C),className:"ml10"}))),e.createElement("p",{className:d.Z.titleWrap},e.createElement(b.Z,{className:d.Z.choiceWrap,gutter:[12,12]},e.createElement(p.Z,null,e.createElement("span",null,"\u6807\u9898")),e.createElement(p.Z,{className:d.Z.editorWrap,flex:"1"},e.createElement(ie.default,{style:{width:"1000px",height:"40px"},value:l,placeholder:"\u8BF7\u8F93\u5165\u9898\u76EE",onChange:C=>t(C.target.value)})))),e.createElement("div",{style:{display:"flex",width:"1000px",margin:"20px 0 0 40px"}},e.createElement("div",{className:d.Z.close_style,onClick:()=>{var C;(C=n.question)!=null&&C.id?x?l?y("edit",-1):y("del",n.key):y("edit",-1):y("del",n.key)}},"\u53D6\u6D88"),e.createElement("div",{className:d.Z.save_style,onClick:()=>R()},"\u4FDD\u5B58")));return e.createElement("section",{className:d.Z.wrap},P!==n.key&&Y(),P===n.key&&le())};ae.Z=(0,X.connect)(({problemset:I,loading:g,globalSetting:Z})=>({problemset:I,globalSetting:Z,loading:g.effects}),null,null,{forwardRef:!0})((0,e.forwardRef)(z))}}]);