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/p__RestFul__Edit__index.asy...

1 line
4.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[70928],{37513:function(e,n,t){t.r(n);var s=t(38416),r=t.n(s),i=t(17061),a=t.n(i),l=t(42122),u=t.n(l),d=t(17156),c=t.n(d),o=t(27424),f=t.n(o),p=t(70215),h=t.n(p),m=t(67294),x=t(88275),g=t(84519),v=t(91773),j=t(2453),Z=t(71230),y=t(15746),w=t(11486),b=t(96101),S=t(71577),_=t(7),k=t(55373),F=t(85893),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,i=e.dispatch,l=e.restful,d=h()(e,N),o=(0,m.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),p=f()(o,2),x=(p[0],p[1],(0,m.useState)(!0)),O=f()(x,2),P=(O[0],O[1]),V=d.match.params,C=v.Z.useForm(),D=f()(C,1)[0],I=(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 |用户组id1超级管理员2普通用户 |\n\n##### 备注 \n\n- 更多返回错误代码请看首页的错误代码描述\n\n\n\n欢迎使用'),L=f()(I,2),q=L[0],E=L[1];(0,m.useEffect)((function(){D.resetFields()}),[V.id]);var R=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,D.getFieldsValue();case 2:return t=e.sent,s="/api/restfuls.json",0!=V.id&&(s="/api/restfuls/".concat(V.id,".json")),e.next=7,(0,g.ZP)(s,{method:0!=V.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("添加成功"),d.history.push("/ch/rest/".concat(r.data.id)));case 9:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),T=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,i({type:"restful/getRestful"});case 2:if(0==V.id){e.next=8;break}return e.next=5,i({type:"restful/getRestfulDetail",payload:u()({},V)});case 5:n=e.sent,D.setFieldsValue({description:null==n?void 0:n.description,name:null==n?void 0:n.name}),(0,_.ag)()||d.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=l.restful)&&void 0!==e&&e.data&&D.setFieldsValue({parent_id:1*V.categoryId}),null!==(n=l.restfulDetail)&&void 0!==n&&n.description&&0!=V.id)&&E(null===(t=l.restfulDetail)||void 0===t?void 0:t.description)}),[l.restful,null===(n=l.restfulDetail)||void 0===n?void 0:n.description]),(0,m.useEffect)((function(){P(!0),T()}),[V.id]),(0,F.jsx)("section",{children:(0,F.jsx)("aside",{className:"edu-container mt30",children:(0,F.jsxs)(v.Z,{onFinish:R,form:D,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.Z,{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.Z.Option,{value:0,children:"根目录"},9999),null==l||null===(t=l.restful)||void 0===t||null===(s=t.data)||void 0===s?void 0:s.map((function(e,n){return(0,F.jsx)(b.Z.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:q,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"})]})})})}))}}]);