|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[57027],{47247:function(e,n,t){t.d(n,{Z:function(){return w}});var r=t(7557),s=t.n(r),i=t(41498),o=t.n(i),l=t(82242),a=t.n(l),c=t(79800),u=t.n(c),d=t(39647),p=t.n(d),h=t(59301),m=t(8591),x=t(53326),f=t(95237),j=t(98242),v=t(21884),g=t(22102),y="tip___bHEXo",b=t(37712),Z=["ButtonText","ButtonOptions","uploadProps","showTip"],w=function(e){var n,t,r,i=e.ButtonText,l=e.ButtonOptions,c=e.uploadProps,d=e.showTip,w=p()(e,Z),_=(0,h.useState)(null),k=u()(_,2),C=k[0],I=k[1],S=a()(a()({maxCount:1,accept:"image/*",withCredentials:!0,beforeUpload:function(e){if(!("image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type))return m.ZP.error("您上传的不是JPEG/PNG/JPG类型文件"),x.Z.LIST_IGNORE;var n=e.size/1024/1024;return 0!=n||(m.ZP.error("".concat(e.name," 图片无法上传。").concat(0==n?"文件内容不能为空":"超过图片大小限制(2MB)")),x.Z.LIST_IGNORE)},onChange:function(e){var n;(["uploading","done","removed"].includes(e.file.status)&&I(e.file),"done"==e.file.status)&&(null==w||w.onChange(null===(n=e.file)||void 0===n||null===(n=n.response)||void 0===n?void 0:n.id))},action:"".concat(j.Z.API_SERVER,"/api/attachments.json")},c||{}),{},{onRemove:(t=o()(s()().mark((function e(n){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:T(),(null==c?void 0:c.onRemove)&&(null==c||c.onRemove(n));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}),T=function(){I(null),null==w||w.onChange()};return(0,h.useEffect)((function(){(null==w?void 0:w.value)&&I({response:{id:null==w?void 0:w.value}})}),[null==w?void 0:w.value]),(0,b.jsx)("div",{id:(null==w?void 0:w.scrollId)||"",children:null!=C&&null!==(n=C.response)&&void 0!==n&&n.id?(0,b.jsxs)(f.Z,{align:"middle",justify:"center",style:{position:"relative",width:400,backgroundColor:"#f4f3f4"},children:[(0,b.jsx)("img",{src:j.Z.API_SERVER+"/api/attachments/"+(null==C||null===(r=C.response)||void 0===r?void 0:r.id),alt:"avatar",style:{width:"100%"}}),(0,b.jsx)("div",{style:{position:"absolute",right:"-6px",top:"-6px",cursor:"pointer",width:16,height:16,borderRadius:"50%",backgroundColor:"#fff"},children:(0,b.jsx)(v.Z,{onClick:o()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:T();case 1:case"end":return e.stop()}}),e)}))),style:{fontSize:"16px",color:"red"}})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(x.Z,a()(a()({},S),{},{children:(0,b.jsx)(g.op,a()(a()({style:a()({borderRadius:"2px"},null==l?void 0:l.style)},l),{},{children:i}))})),d&&(0,b.jsx)("span",{className:y,children:"(建议上传尺寸为472*266的图片)"})]})})}},57027:function(e,n,t){t.d(n,{Z:function(){return A}});var r=t(82242),s=t.n(r),i=t(7557),o=t.n(i),l=t(41498),a=t.n(l),c=t(39647),u=t.n(c),d=t(59301),p=t(43418),h=t(8591),m=t(78241),x=t(24650),f=t(95237),j=t(43604),v=t(51945),g=t(47247),y=t(37205),b=t.n(y),Z=t(79800),w=t.n(Z),_=t(24905),k=t(6848),C=t(57809),I=t(88522),S=t(3113),T=t(26724),L=t.n(T),P=t(61186),N=t.n(P),F=t(22365),O=t(71374),R=t(25600),E=t(58228),q=t(37712),z=(0,E.connect)((function(e){return{classroomList:e.classroomList,loading:e.loading}}))((function(e){var n,t,r=e.classroomList,i=(e.loading,e.dispatch),l=(0,E.useParams)(),c=r.actionTabs,u=(0,d.useState)([]),f=w()(u,2),j=f[0],g=f[1],y=(0,d.useState)(!0),Z=w()(y,2),T=Z[0],P=Z[1],z=(0,d.useState)(!1),D=w()(z,2),V=D[0],A=D[1],B=m.Z.useForm(),H=w()(B,1)[0],G=(0,d.useState)([]),M=w()(G,2),Y=M[0],U=M[1],J=(0,d.useState)(0),Q=w()(J,2),W=Q[0],X=Q[1],K=(0,d.useState)([]),$=w()(K,2),ee=$[0],ne=$[1],te=(0,d.useState)(!0),re=w()(te,2),se=re[0],ie=re[1];(0,d.useRef)();(0,d.useEffect)((function(){"添加成员"===r.actionTabs.key&&(ie(!0),oe())}),[r.actionTabs.key]);var oe=function(){var e=a()(o()().mark((function e(){var n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"classroomList/getSchoolList",payload:{}});case 2:n=e.sent,g(n.map((function(e){return{value:e}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),le=function(){var e=a()(o()().mark((function e(){var n,t,r,i,a=arguments;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=a.length>0&&void 0!==a[0]&&a[0])&&!T||V){e.next=11;break}return r=H.getFieldValue(),A(!0),X(n?1:W+1),e.next=7,(0,F.nQ)(s()({page:n?1:W+1,container_id:l.coursesId,container_type:1,school_name:null==r?void 0:r.school_name,keyword:null==r?void 0:r.keyword},r));case 7:i=e.sent,U(n?b()(i.users):[].concat(b()(Y),b()(i.users))),A(!1),(null===(t=i.users)||void 0===t?void 0:t.length)<10&&P(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!=ee){e.next=4;break}h.ZP.error("请选择人数"),e.next=9;break;case 4:return console.log(l),e.next=7,(0,R.ZP)("/api/core_subjects/".concat(l.coreId,"/add_members.json"),{method:"post",body:{user_ids:ee.map((function(e){return e}))}});case 7:0===e.sent.status&&(h.ZP.success("添加成功"),i({type:"classroomList/setActionTabs",payload:{}}),i({type:"coreCurriculum/getCoreSubjectDetail",payload:{id:l.coreId}}));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=[{title:"",dataIndex:"added",width:40,ellipsis:!0,render:function(e,n){return(0,q.jsx)(_.Z,{value:n.numid,checked:ee.includes(String(n.numid)),disabled:!!e})}},{title:"姓名",width:100,ellipsis:!0,dataIndex:"username",render:function(e,n){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)(E.Link,{className:"bold c-black",to:"/users/".concat(n.login),target:"_blank",children:e||"--"})})}},{title:"手机",width:100,dataIndex:"phone",ellipsis:!0,render:function(e){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)("span",{children:e||"--"})})}},{title:"邮箱",dataIndex:"email",width:100,ellipsis:!0,render:function(e){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)("span",{children:e||"--"})})}},{title:"学号/工号",width:100,dataIndex:"student_number",ellipsis:!0,render:function(e){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)("span",{children:e||"--"})})}},{title:"学校/单位",width:150,dataIndex:"school_name",ellipsis:!0,render:function(e){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)("span",{children:e||"--"})})}},{title:"最后登录时间",dataIndex:"last_login_on",width:140,ellipsis:!0,render:function(e){return(0,q.jsx)(k.Z,{placement:"bottom",title:e,children:(0,q.jsx)("span",{children:N()(e).format("YYYY-MM-DD HH:mm")})})}},{title:"状态",dataIndex:"added",width:80,render:function(e){if(1===e)return(0,q.jsx)("span",{className:"c-green",children:"已添加"})}}];return(0,q.jsxs)(p.Z,{centered:!0,title:"添加成员",open:"添加成员"===r.actionTabs.key,okText:"确定",cancelText:"取消",width:1100,zIndex:1e3,bodyStyle:{minHeight:200},onOk:a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ae();case 1:case"end":return e.stop()}}),e)}))),onCancel:function(){ne([]),i({type:"classroomList/setActionTabs",payload:{}})},children:[(0,q.jsxs)(m.Z,{layout:"inline",form:H,initialValues:{school_name:"",keyword:"",search_type:"1"},className:"mt10",children:[(0,q.jsx)(m.Z.Item,{name:"search_type",label:"搜索类型",children:(0,q.jsxs)(C.default,{style:{width:90},children:[(0,q.jsx)(C.default.Option,{value:"1",children:"姓名"}),(0,q.jsx)(C.default.Option,{value:"2",children:"手机号"}),(0,q.jsx)(C.default.Option,{value:"3",children:"邮箱"})]})}),(0,q.jsx)(m.Z.Item,{name:"keyword",label:"搜索内容:",children:(0,q.jsx)(x.Z,{allowClear:!0,style:{width:250},size:"middle",defaultValue:(null===(n=c.selectArrs)||void 0===n?void 0:n.category_name)||(null===(t=c.selectArrs)||void 0===t?void 0:t.name)})}),(0,q.jsx)(m.Z.Item,{name:"school_name",label:"单位:",children:(0,q.jsx)(I.Z,{options:j,style:{width:390},size:"middle",placeholder:"请输入单位名称",filterOption:function(e,n){return-1!==n.value.toUpperCase().indexOf(e.toUpperCase())}})}),(0,q.jsx)(m.Z.Item,{children:(0,q.jsx)(S.ZP,{htmlType:"submit",type:"primary",size:"middle",onClick:function(){return function(){var e;if(""===(null===(e=H.getFieldValue())||void 0===e?void 0:e.keyword))return U([]),void h.ZP.error("请输入搜索内容");ie(!1),P(!0),A(!1),ne([]),setTimeout((function(){le(!0)}),200)}()},children:"搜索"})})]}),se&&(0,q.jsxs)("div",{className:"tc font16 c-light-black mt40 pb30",children:[(0,q.jsx)("img",{src:O.RL,width:"100",alt:""}),(0,q.jsx)("br",{}),(0,q.jsx)("p",{className:"mt20",children:"请搜索要添加的人员"})]}),!se&&""==Y&&!V&&(0,q.jsxs)("div",{className:"tc font16 c-light-black mt40 pb30",children:[(0,q.jsx)("img",{src:O.z3,width:"100",alt:""}),(0,q.jsx)("br",{}),(0,q.jsx)("p",{className:"mt20",children:"暂时还没有相关数据哦!"})]}),(!se&&""!=Y||V)&&(0,q.jsxs)("section",{children:[(0,q.jsx)("div",{className:"flexd-table-header mt20",children:(0,q.jsx)(v.Z,{pagination:!1,dataSource:[],columns:ce})}),(0,q.jsx)("div",{style:{maxHeight:260,overflow:"auto"},children:(0,q.jsx)(L(),{initialLoad:!1,pageStart:1,threshold:20,loadMore:function(e){le()},hasMore:T,useWindow:!1,children:(0,q.jsx)(v.Z,{loading:V,showHeader:!1,pagination:!1,dataSource:Y,columns:ce,onRow:function(e){return{onClick:function(e){e.currentTarget.querySelector("input").disabled||function(e){e=String(e);var n=ee.indexOf(e);n<0?ee.push(e):ee.splice(n,1),ne(b()(ee))}(e.currentTarget.querySelector("input").value)}}}})})})]})]})})),D=t(97600),V=["handleFinish","form","dispatch","user","coreCurriculum"],A=(0,E.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum,user:e.user}}))((function(e){var n,t=e.handleFinish,r=e.form,i=e.dispatch,l=(e.user,e.coreCurriculum),c=u()(e,V),d=l.CoreDetail,y=(0,E.useParams)(),b=[{title:"姓名",dataIndex:"user_name",key:"user_name"},{title:"学校",dataIndex:"school_name",key:"school_name"},{title:"身份",dataIndex:"role",key:"role",width:80,render:function(e,n){return(0,q.jsx)("span",{children:"1"==e?"管理员":"成员"})}},{title:"操作",render:function(e,n){return(0,q.jsx)(q.Fragment,{children:!(null!=n&&n.is_current_user)&&(0,q.jsxs)(q.Fragment,{children:["1"==(null==n?void 0:n.role)&&((null==d?void 0:d.is_core_subject_admin)||(0,D.Ny)())&&(0,q.jsx)("span",{style:{marginLeft:10,cursor:"pointer",color:"blue"},onClick:a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:p.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",title:"撤销管理员",content:"是否确认将成员撤销管理员?",onOk:function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.ZP)("/api/core_subjects/".concat(y.coreId,"/set_admin.json"),{method:"post",body:{user_id:null==n?void 0:n.user_id,operation:"revoke"}});case 2:0==(null==(t=e.sent)?void 0:t.status)&&(h.ZP.success("成功撤销管理员"),i({type:"coreCurriculum/getCoreSubjectDetail",payload:{id:y.coreId}}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)}))),children:"撤销管理员"}),"2"==(null==n?void 0:n.role)&&((null==d?void 0:d.is_core_subject_admin)||(0,D.Ny)())&&(0,q.jsx)("span",{style:{marginLeft:10,cursor:"pointer",color:"blue"},onClick:a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:p.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",title:"设为管理员",content:"是否确认将成员设为管理员?",onOk:function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.ZP)("/api/core_subjects/".concat(y.coreId,"/set_admin.json"),{method:"post",body:{user_id:null==n?void 0:n.user_id,operation:"set"}});case 2:0==(null==(t=e.sent)?void 0:t.status)&&(h.ZP.success("成功设为管理员"),i({type:"coreCurriculum/getCoreSubjectDetail",payload:{id:y.coreId}}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)}))),children:"设为管理员"}),((null==d?void 0:d.is_core_subject_admin)||(0,D.Ny)())&&(0,q.jsx)("span",{style:{marginLeft:10,cursor:"pointer",color:"blue"},onClick:a()(o()().mark((function e(){return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:p.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",title:"移除成员",content:"是否确认将成员移除?",onOk:function(){var e=a()(o()().mark((function e(){var t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.ZP)("/api/core_subjects/".concat(y.coreId,"/remove_members.json"),{method:"post",body:{user_id:null==n?void 0:n.user_id}});case 2:0==(null==(t=e.sent)?void 0:t.status)&&(h.ZP.success("移除成功"),i({type:"coreCurriculum/getCoreSubjectDetail",payload:{id:y.coreId}}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)}))),children:"移除成员"})]})})}}];return(0,q.jsxs)(p.Z,s()(s()({},c),{},{destroyOnClose:!0,centered:!0,width:1200,children:[(0,q.jsxs)(m.Z,{form:r,size:"large",initialValues:{},layout:"vertical",style:{maxHeight:"calc(100vh - 200px)"},onValuesChange:function(e){},onFinish:t,children:[(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"name",label:"课程名称",rules:[{required:!0,message:"请输入课程名称"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入课程名称",maxLength:50,showCount:!0})}),(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"name_en",label:"课程英文名称",rules:[{required:!0,message:"请输入课程英文名称"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入课程英文名称",maxLength:50,showCount:!0})}),(0,q.jsxs)(f.Z,{gutter:20,children:[(0,q.jsx)(j.Z,{flex:1,children:(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"adminer",label:"负责人(中文)",rules:[{required:!0,message:"请输入负责人"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入负责人",maxLength:10,showCount:!0})})}),(0,q.jsx)(j.Z,{flex:1,children:(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"adminer_en",label:"负责人(英文)",rules:[{required:!0,message:"请输入负责人"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入负责人",maxLength:100,showCount:!0})})})]}),(0,q.jsxs)(f.Z,{gutter:20,children:[(0,q.jsx)(j.Z,{flex:1,children:(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"leading_unit",label:"牵头单位(中文)",rules:[{required:!0,message:"请输入牵头单位"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入牵头单位",maxLength:20,showCount:!0})})}),(0,q.jsx)(j.Z,{flex:1,children:(0,q.jsx)(m.Z.Item,{htmlFor:null,name:"leading_unit_en",label:"牵头单位(英文)",rules:[{required:!0,message:"请输入牵头单位"}],children:(0,q.jsx)(x.Z,{placeholder:"请输入牵头单位",maxLength:500,showCount:!0})})})]}),(0,q.jsxs)(f.Z,{gutter:20,children:[(0,q.jsxs)(j.Z,{span:9,children:[(0,q.jsx)(m.Z.Item,{name:"cover_id",label:"列表封面图",rules:[{required:!0,message:"请上传列表封面图"}],children:(0,q.jsx)(g.Z,{ButtonText:"上传图片"})}),(0,q.jsx)(m.Z.Item,{name:"detail_pic_id",label:"课程详情图",children:(0,q.jsx)(g.Z,{ButtonText:"上传图片"})})]}),"新建核心课程"!=(null==c?void 0:c.title)&&(0,q.jsxs)(j.Z,{span:15,style:{position:"relative"},children:[(0,q.jsx)(m.Z.Item,{name:"users_id",label:"课程成员",children:(0,q.jsx)(v.Z,{columns:b,scroll:{y:200},dataSource:null==l||null===(n=l.CoreDetail)||void 0===n?void 0:n.members,bordered:!0,pagination:!1})}),((null==d?void 0:d.is_core_subject_admin)||(0,D.Ny)())&&(0,q.jsx)("div",{onClick:function(){i({type:"classroomList/setActionTabs",payload:{key:"添加成员"}})},style:{position:"absolute",right:"10px",top:"10px",cursor:"pointer",color:"blue"},children:"添加成员"})]})]})]}),(0,q.jsx)(z,{})]}))}))}}]); |