|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[64144],{11122:function(e,r,t){t.r(r),t.d(r,{default:function(){return F}});var n=t(7557),l=t.n(n),o=t(41498),i=t.n(o),a=t(39647),s=t.n(a),c=t(59301),u=t(7880),d=t(66104),p=t(3113),m=t(82242),f=t.n(m),b=t(79800),g=t.n(b),v=t(98135),h=t(78241),y=t(19842),x=t(54449),j=t(5112),O="flexRow___ymwya",C="main___tW9GZ",_="formWrap___aSCTU",S="duration___p7z6e",w=t(37712),k=v.Z.TextArea,E=function(e,r){var t,n=e.courseOptions,o=e.disciplinesData,a=e.isEdit,s=e.editData,u=h.Z.useForm(),d=g()(u,1)[0],p=(0,c.useState)({}),m=g()(p,2),b=m[0],E=m[1];(0,c.useImperativeHandle)(r,(function(){return{onSubmit:P}})),(0,c.useEffect)((function(){if(s&&a){var e=s||{},r=e.duration,t=e.name,n=e.discipline,l=e.sub_discipline,o=(e.tag_disciplines,e.difficulty),i=e.exam_notes;d.setFieldsValue({course:[null==n?void 0:n.id,null==l?void 0:l.id]}),d.setFieldsValue({duration:r}),d.setFieldsValue({name:t}),d.setFieldsValue({difficulty:o}),d.setFieldsValue({exam_notes:i}),E({course:[null==n?void 0:n.id,null==l?void 0:l.id],difficulty:o,duration:r,name:t})}}),[s,o]),(0,c.useEffect)((function(){var e,r;o&&d.setFieldsValue({course:[null==o||null===(e=o.new_checked)||void 0===e?void 0:e.discipline_id,null==o||null===(r=o.new_checked)||void 0===r?void 0:r.sub_discipline_id]})}),[o]);var P=function(){var e=i()(l()().mark((function e(){var r,t,n,o,i;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.validateFields();case 2:return r=d.getFieldsValue()||{},t=null==r?void 0:r.course,n=g()(t,2),o=n[0],i=n[1],e.abrupt("return",f()(f()({},r),{},{discipline_id:o,sub_discipline_id:i}));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)("div",{className:C,children:(0,w.jsxs)(h.Z,{form:d,className:_,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(e){E(f()({},d.getFieldsValue()))},children:[(0,w.jsx)(h.Z.Item,{label:"方向&课程:",name:"course",labelCol:{span:5},wrapperCol:{span:5},rules:[{required:!0,message:"请选择方向&课程"}],children:(0,w.jsx)(y.Z,{placeholder:"请选择...",options:n})}),(0,w.jsx)(h.Z.Item,{name:"name",label:"试卷名称:",rules:[{required:!0,message:"不能为空"}],children:(0,w.jsx)(v.Z,{maxLength:60,placeholder:"请输入名称,最大限制60个字符",addonAfter:"".concat((null===(t=b.name)||void 0===t?void 0:t.length)||0,"/60")})}),(0,w.jsxs)("div",{className:O,children:[(0,w.jsx)(h.Z.Item,{name:"duration",label:"答题时长:",children:(0,w.jsx)(x.Z,{min:0,step:.1})}),(0,w.jsx)("span",{className:S,children:" 分钟"})]}),(0,w.jsx)(h.Z.Item,{label:"难度:",name:"difficulty",rules:[{required:!0,message:"请选择难度"}],children:(0,w.jsxs)(j.ZP.Group,{children:[(0,w.jsx)(j.ZP.Button,{value:1,children:"简单"}),(0,w.jsx)(j.ZP.Button,{value:2,children:"适中"}),(0,w.jsx)(j.ZP.Button,{value:3,children:"困难"})]})}),(0,w.jsx)(h.Z.Item,{label:"考试须知:",name:"exam_notes",children:(0,w.jsx)(k,{rows:4,maxLength:300})})]})})})},P=(0,c.forwardRef)(E),N="bg___HxqEy",Z="button___NLzyX",I="buttonFixed___cs7vc",$="buttonWrap___eLVCl",T=["problemsetPreview","user","globalSetting","loading","dispatch"],F=(0,u.connect)((function(e){var r=e.problemsetPreview,t=e.user,n=e.loading;return{problemsetPreview:r,user:t,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){var r=e.problemsetPreview,t=(e.user,e.globalSetting,e.loading),n=e.dispatch,o=(s()(e,T),(0,c.useRef)());(0,c.useEffect)((function(){return n({type:"globalSetting/footerToggle",payload:!1}),function(){n({type:"globalSetting/footerToggle",payload:!0})}}),[]),(0,c.useEffect)((function(){n({type:"problemsetPreview/getEditDisciplines",payload:{source:"question"}})}),[]);var a=function(){var e=i()(l()().mark((function e(){var r,t,i;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=o.current)||void 0===r?void 0:r.onSubmit();case 2:return t=e.sent,e.next=5,n({type:"problemsetPreview/newPreviewProblemset",payload:t});case 5:0===(i=e.sent).status&&u.history.replace("/paperlibrary/see/".concat(i.exam_id));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,w.jsxs)("section",{className:N,children:[(0,w.jsxs)(d.Z,{className:"mb20 mt30",separator:">",children:[(0,w.jsx)(d.Z.Item,{href:"/problemset",children:"试题库"}),(0,w.jsx)(d.Z.Item,{children:"新增试卷"})]}),(0,w.jsx)(P,{ref:o,courseOptions:r.courseOptions,disciplinesData:r.disciplinesData}),(0,w.jsx)("div",{className:I,children:(0,w.jsxs)("div",{className:$,children:[(0,w.jsx)(p.ZP,{size:"middle",className:"".concat(Z," mr20"),onClick:function(){return u.history.push("/problemset/preview")},children:"取消"}),(0,w.jsx)(p.ZP,{size:"middle",type:"primary",className:"".concat(Z," mr20"),onClick:a,loading:t["problemsetPreview/newPreviewProblemset"],children:"完成"})]})})]})}))},66104:function(e,r,t){t.d(r,{Z:function(){return N}});var n=t(92310),l=t.n(n),o=t(55401),i=t(87147),a=t(59301),s=t(92343),c=t(36355),u=t(43501),d=t(91857);const p=e=>{let{children:r}=e;const{getPrefixCls:t}=a.useContext(c.E_),n=t("breadcrumb");return a.createElement("li",{className:`${n}-separator`,"aria-hidden":"true"},""===r?r:r||"/")};p.__ANT_BREADCRUMB_SEPARATOR=!0;var m=p,f=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)r.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(t[n[l]]=e[n[l]])}return t};function b(e,r,t,n){if(null==t)return null;const{className:o,onClick:s}=r,c=f(r,["className","onClick"]),u=Object.assign(Object.assign({},(0,i.Z)(c,{data:!0,aria:!0})),{onClick:s});return void 0!==n?a.createElement("a",Object.assign({},u,{className:l()(`${e}-link`,o),href:n}),t):a.createElement("span",Object.assign({},u,{className:l()(`${e}-link`,o)}),t)}function g(e,r){return(t,n,l,o,i)=>{if(r)return r(t,n,l,o);const a=function(e,r){if(void 0===e.title||null===e.title)return null;const t=Object.keys(r).join("|");return"object"==typeof e.title?e.title:String(e.title).replace(new RegExp(`:(${t})`,"g"),((e,t)=>r[t]||e))}(t,n);return b(e,t,a,i)}}var v=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)r.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(t[n[l]]=e[n[l]])}return t};const h=e=>{const{prefixCls:r,separator:t="/",children:n,menu:l,overlay:o,dropdownProps:i,href:s}=e;const c=(e=>{if(l||o){const t=Object.assign({},i);if(l){const e=l||{},{items:r}=e,n=v(e,["items"]);t.menu=Object.assign(Object.assign({},n),{items:null==r?void 0:r.map(((e,r)=>{var{key:t,title:n,label:l,path:o}=e,i=v(e,["key","title","label","path"]);let c=null!=l?l:n;return o&&(c=a.createElement("a",{href:`${s}${o}`},c)),Object.assign(Object.assign({},i),{key:null!=t?t:r,label:c})}))})}else o&&(t.overlay=o);return a.createElement(d.Z,Object.assign({placement:"bottom"},t),a.createElement("span",{className:`${r}-overlay-link`},e,a.createElement(u.Z,null)))}return e})(n);return null!=c?a.createElement(a.Fragment,null,a.createElement("li",null,c),t&&a.createElement(m,null,t)):null},y=e=>{const{prefixCls:r,children:t,href:n}=e,l=v(e,["prefixCls","children","href"]),{getPrefixCls:o}=a.useContext(c.E_),i=o("breadcrumb",r);return a.createElement(h,Object.assign({},l,{prefixCls:i}),b(i,l,t,n))};y.__ANT_BREADCRUMB_ITEM=!0;var x=y,j=t(17313),O=t(83116),C=t(37613);const _=e=>{const{componentCls:r,iconCls:t}=e;return{[r]:Object.assign(Object.assign({},(0,j.Wf)(e)),{color:e.itemColor,fontSize:e.fontSize,[t]:{fontSize:e.iconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},a:Object.assign({color:e.linkColor,transition:`color ${e.motionDurationMid}`,padding:`0 ${e.paddingXXS}px`,borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",marginInline:-e.marginXXS,"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover}},(0,j.Qy)(e)),"li:last-child":{color:e.lastItemColor},[`${r}-separator`]:{marginInline:e.separatorMargin,color:e.separatorColor},[`${r}-link`]:{[`\n > ${t} + span,\n > ${t} + a\n `]:{marginInlineStart:e.marginXXS}},[`${r}-overlay-link`]:{borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",padding:`0 ${e.paddingXXS}px`,marginInline:-e.marginXXS,[`> ${t}`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSizeIcon},"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover,a:{color:e.linkHoverColor}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${e.componentCls}-rtl`]:{direction:"rtl"}})}};var S=(0,O.Z)("Breadcrumb",(e=>{const r=(0,C.TS)(e,{});return[_(r)]}),(e=>({itemColor:e.colorTextDescription,lastItemColor:e.colorText,iconFontSize:e.fontSize,linkColor:e.colorTextDescription,linkHoverColor:e.colorText,separatorColor:e.colorTextDescription,separatorMargin:e.marginXS}))),w=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)r.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(t[n[l]]=e[n[l]])}return t};function k(e){const{breadcrumbName:r,children:t}=e,n=w(e,["breadcrumbName","children"]),l=Object.assign({title:r},n);return t&&(l.menu={items:t.map((e=>{var{breadcrumbName:r}=e,t=w(e,["breadcrumbName"]);return Object.assign(Object.assign({},t),{title:r})}))}),l}var E=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)r.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(t[n[l]]=e[n[l]])}return t};const P=e=>{const{prefixCls:r,separator:t="/",style:n,className:u,rootClassName:d,routes:p,items:f,children:b,itemRender:v,params:y={}}=e,x=E(e,["prefixCls","separator","style","className","rootClassName","routes","items","children","itemRender","params"]),{getPrefixCls:j,direction:O,breadcrumb:C}=a.useContext(c.E_);let _;const w=j("breadcrumb",r),[P,N]=S(w),Z=function(e,r){return(0,a.useMemo)((()=>e||(r?r.map(k):null)),[e,r])}(f,p);const I=g(w,v);if(Z&&Z.length>0){const e=[],r=f||p;_=Z.map(((n,l)=>{const{path:o,key:s,type:c,menu:u,overlay:d,onClick:p,className:f,separator:b,dropdownProps:g}=n,v=((e,r)=>{if(void 0===r)return r;let t=(r||"").replace(/^\//,"");return Object.keys(e).forEach((r=>{t=t.replace(`:${r}`,e[r])})),t})(y,o);void 0!==v&&e.push(v);const x=null!=s?s:l;if("separator"===c)return a.createElement(m,{key:x},b);const j={},O=l===Z.length-1;u?j.menu=u:d&&(j.overlay=d);let{href:C}=n;return e.length&&void 0!==v&&(C=`#/${e.join("/")}`),a.createElement(h,Object.assign({key:x},j,(0,i.Z)(n,{data:!0,aria:!0}),{className:f,dropdownProps:g,href:C,separator:O?"":t,onClick:p,prefixCls:w}),I(n,y,r,e,C))}))}else if(b){const e=(0,o.Z)(b).length;_=(0,o.Z)(b).map(((r,n)=>{if(!r)return r;const l=n===e-1;return(0,s.Tm)(r,{separator:l?"":t,key:n})}))}const $=l()(w,null==C?void 0:C.className,{[`${w}-rtl`]:"rtl"===O},u,d,N),T=Object.assign(Object.assign({},null==C?void 0:C.style),n);return P(a.createElement("nav",Object.assign({className:$,style:T},x),a.createElement("ol",null,_)))};P.Item=x,P.Separator=m;var N=P}}]); |