|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[70928],{53245:function(e,n,t){t.r(n);var s=t(22060),r=t.n(s),i=t(10574),a=t.n(i),l=t(26801),u=t.n(l),d=t(39343),c=t.n(d),o=t(11006),f=t.n(o),p=t(27161),h=t.n(p),m=t(59301),x=t(22211),g=t(15830),v=t(78241),j=t(8591),Z=t(95237),y=t(43604),w=t(1056),b=t(57809),S=t(3113),_=t(58696),k=t(22387),F=t(37712),N=["user","globalSetting","loading","dispatch","restful"];n.default=(0,x.connect)((function(e){var n=e.user,t=e.loading;return{user:n,globalSetting:e.globalSetting,restful:e.restful,loading:t.models.index}}))((function(e){e.user,e.globalSetting,e.loading;var n,t,s=e.dispatch,i=e.restful,l=h()(e,N),d=(0,m.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),o=f()(d,2),p=(o[0],o[1],(0,m.useState)(!0)),x=f()(p,2),O=(x[0],x[1]),P=l.match.params,V=v.Z.useForm(),C=f()(V,1)[0],D=(0,m.useState)('\n\n \n##### 简要描述\n\n- 用户注册接口\n\n##### 请求URL\n- ` http://xx.com/api/user/register `\n \n##### 请求方式\n- POST \n\n##### 参数\n\n|参数名|必选|类型|说明|\n|:---- |:---|:----- |----- |\n|username |是 |string |用户名 |\n|password |是 |string | 密码 |\n|name |否 |string | 昵称 |\n\n##### 返回示例 \n\n``` \n {\n "error_code": 0,\n "data": {\n "uid": "1",\n "username": "12154545",\n "name": "吴系挂",\n "groupid": 2 ,\n "reg_time": "1436864169",\n "last_login_time": "0",\n }\n }\n```\n\n##### 返回参数说明 \n\n|参数名|类型|说明|\n|:----- |:-----|----- |\n|groupid |int |用户组id,1:超级管理员;2:普通用户 |\n\n##### 备注 \n\n- 更多返回错误代码请看首页的错误代码描述\n\n\n\n欢迎使用!'),I=f()(D,2),L=I[0],q=I[1];(0,m.useEffect)((function(){C.resetFields()}),[P.id]);var E=function(){var e=c()(a()().mark((function e(n){var t,s,r;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C.getFieldsValue();case 2:return t=e.sent,s="/api/restfuls.json",0!=P.id&&(s="/api/restfuls/".concat(P.id,".json")),e.next=7,(0,g.ZP)(s,{method:0!=P.id?"put":"post",body:u()(u()({file_type:0},t),{},{parent_id:t.parent_id||""})});case 7:0===(r=e.sent).status&&(j.ZP.success("添加成功"),l.history.push("/ch/rest/".concat(r.data.id)));case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),R=function(){var e=c()(a()().mark((function e(){var n;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({type:"restful/getRestful"});case 2:if(0==P.id){e.next=8;break}return e.next=5,s({type:"restful/getRestfulDetail",payload:u()({},P)});case 5:n=e.sent,C.setFieldsValue({description:null==n?void 0:n.description,name:null==n?void 0:n.name}),(0,_.ag)()||l.history.replace("/403");case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,m.useEffect)((function(){var e,n,t;(null!==(e=i.restful)&&void 0!==e&&e.data&&C.setFieldsValue({parent_id:1*P.categoryId}),null!==(n=i.restfulDetail)&&void 0!==n&&n.description&&0!=P.id)&&q(null===(t=i.restfulDetail)||void 0===t?void 0:t.description)}),[i.restful,null===(n=i.restfulDetail)||void 0===n?void 0:n.description]),(0,m.useEffect)((function(){O(!0),R()}),[P.id]),(0,F.jsx)("section",{children:(0,F.jsx)("aside",{className:"edu-container mt30",children:(0,F.jsxs)(v.Z,{onFinish:E,form:C,initialValues:r()({},"name",""),children:[(0,F.jsxs)(Z.Z,{className:"mt30",children:[(0,F.jsx)(y.Z,{flex:"80px",className:"font14",children:"目录名称:"}),(0,F.jsx)(y.Z,{flex:"1",children:(0,F.jsx)(v.Z.Item,{name:"name",rules:[{required:!0,message:"请输入目录名称"}],children:(0,F.jsx)(w.Z,{placeholder:"请输入名称,最大限制60个字符 ",maxLength:60})})})]}),(0,F.jsxs)(Z.Z,{className:"",children:[(0,F.jsx)(y.Z,{flex:"80px",className:"font14",children:"所属目录:"}),(0,F.jsx)(y.Z,{flex:"1",children:(0,F.jsx)(v.Z.Item,{name:"parent_id",rules:[{required:!0,message:"所属目录"}],children:(0,F.jsxs)(b.default,{showSearch:!0,style:{width:200},placeholder:"请选择目录",optionFilterProp:"children",filterOption:function(e,n){return n.children.toLowerCase().indexOf(e.toLowerCase())>=0},children:[(0,F.jsx)(b.default.Option,{value:0,children:"根目录"},9999),null==i||null===(t=i.restful)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.map((function(e,n){return(0,F.jsx)(b.default.Option,{value:e.id,children:e.title},n)}))]})})})]}),(0,F.jsx)(v.Z.Item,{name:"description",rules:[{required:!0,message:"请输入目录名称"}],children:(0,F.jsx)(k.Z,{defaultValue:L,watch:!0,height:600})}),(0,F.jsx)(Z.Z,{align:"middle",justify:"center",children:(0,F.jsx)(y.Z,{children:(0,F.jsx)(S.ZP,{style:{width:130},size:"middle",type:"primary",htmlType:"submit",children:"保存"})})}),(0,F.jsx)("div",{className:"mt40"})]})})})}))}}]); |