"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([[70928],{ /***/ 60186: /*!******************************************!*\ !*** ./src/pages/RestFul/Edit/index.tsx ***! \******************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js */ 85573); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js */ 39647); /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ 59301); /* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! umi */ 48938); /* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/utils/fetch */ 1833); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 78241); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 8591); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 95237); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! antd */ 43604); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! antd */ 10249); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! antd */ 57809); /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! antd */ 3113); /* harmony import */ var _utils_authority__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/utils/authority */ 65241); /* harmony import */ var _components_markdown_editor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/markdown-editor */ 47043); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712); var _excluded = ["user", "globalSetting", "loading", "dispatch", "restful"]; var UserPage = function UserPage(_ref) { var _restful$restfulDetai3, _restful$restful2; var user = _ref.user, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, restful = _ref.restful, props = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_5___default()(_ref, _excluded); var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)({ content: "", message: "", status: 0, contacts: [], address: "", data: [] }), _useState2 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 2), data = _useState2[0], setData = _useState2[1]; var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(true), _useState4 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2), isLoading = _useState4[0], setIsLoading = _useState4[1]; var params = props.match.params; var _Form$useForm = antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z.useForm(), _Form$useForm2 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_Form$useForm, 1), form = _Form$useForm2[0]; var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_6__.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欢迎使用!"), _useState6 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2), defaultValue = _useState6[0], setDefaultValue = _useState6[1]; (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () { form.resetFields(); }, [params.id]); var onFinish = /*#__PURE__*/function () { var _ref2 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee(e) { var values, fetchUrl, res; return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return form.getFieldsValue(); case 2: values = _context.sent; fetchUrl = "/api/restfuls.json"; if (params.id != 0) { fetchUrl = "/api/restfuls/".concat(params.id, ".json"); } _context.next = 7; return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP)(fetchUrl, { method: params.id != 0 ? "put" : 'post', body: _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({ file_type: 0 }, values), {}, { parent_id: values.parent_id || "" }) }); case 7: res = _context.sent; if (res.status === 0) { antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP.success('添加成功'); props.history.push("/ch/rest/".concat(res.data.id)); } case 9: case "end": return _context.stop(); } }, _callee); })); return function onFinish(_x) { return _ref2.apply(this, arguments); }; }(); var getData = /*#__PURE__*/function () { var _ref3 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() { var res; return _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return dispatch({ type: "restful/getRestful" }); case 2: if (!(params.id != 0)) { _context2.next = 8; break; } _context2.next = 5; return dispatch({ type: "restful/getRestfulDetail", payload: _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_2___default()({}, params) }); case 5: res = _context2.sent; form.setFieldsValue({ description: res === null || res === void 0 ? void 0 : res.description, name: res === null || res === void 0 ? void 0 : res.name }); if (!(0,_utils_authority__WEBPACK_IMPORTED_MODULE_9__/* .isCommonSuperAdminOrOperation */ .ag)()) { props.history.replace("/403"); } case 8: case "end": return _context2.stop(); } }, _callee2); })); return function getData() { return _ref3.apply(this, arguments); }; }(); (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () { var _restful$restful, _restful$restfulDetai; if ((_restful$restful = restful.restful) !== null && _restful$restful !== void 0 && _restful$restful.data) { form.setFieldsValue({ parent_id: params.categoryId * 1 }); } if ((_restful$restfulDetai = restful.restfulDetail) !== null && _restful$restfulDetai !== void 0 && _restful$restfulDetai.description && params.id != 0) { var _restful$restfulDetai2; setDefaultValue((_restful$restfulDetai2 = restful.restfulDetail) === null || _restful$restfulDetai2 === void 0 ? void 0 : _restful$restfulDetai2.description); } }, [restful.restful, (_restful$restfulDetai3 = restful.restfulDetail) === null || _restful$restfulDetai3 === void 0 ? void 0 : _restful$restfulDetai3.description]); (0,react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(function () { setIsLoading(true); getData(); }, [params.id]); return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("section", { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("aside", { className: "edu-container mt30", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, { onFinish: onFinish, form: form, initialValues: _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_defineProperty_js__WEBPACK_IMPORTED_MODULE_0___default()({}, 'name', ""), children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { className: "mt30", children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { flex: "80px", className: "font14", children: "\u76EE\u5F55\u540D\u79F0\uFF1A" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z.Item, { name: "name", rules: [{ required: true, message: "请输入目录名称" }], children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z, { placeholder: "\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ", maxLength: 60 }) }) })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { className: "", children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { flex: "80px", className: "font14", children: "\u6240\u5C5E\u76EE\u5F55:" }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { flex: "1", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z.Item, { name: "parent_id", rules: [{ required: true, message: "所属目录" }], children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_17__["default"], { showSearch: true, style: { width: 200 }, placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55", optionFilterProp: "children", filterOption: function filterOption(input, option) { return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0; }, children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__["default"].Option, { value: 0, children: "\u6839\u76EE\u5F55" }, 9999), restful === null || restful === void 0 || (_restful$restful2 = restful.restful) === null || _restful$restful2 === void 0 || (_restful$restful2 = _restful$restful2.data) === null || _restful$restful2 === void 0 ? void 0 : _restful$restful2.map(function (item, key) { return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_17__["default"].Option, { value: item.id, children: item.title }, key); })] }) }) })] }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z.Item, { name: "description", rules: [{ required: true, message: "请输入目录名称" }], children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_markdown_editor__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { defaultValue: defaultValue, watch: true, height: 600 }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, { align: "middle", justify: "center", children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .Z, { children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_18__/* ["default"] */ .ZP, { style: { width: 130 }, size: 'middle', type: "primary", htmlType: "submit", children: "\u4FDD\u5B58" }) }) }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("div", { className: "mt40" })] }) }) }); }; /* harmony default export */ __webpack_exports__["default"] = ((0,umi__WEBPACK_IMPORTED_MODULE_7__.connect)(function (_ref5) { var user = _ref5.user, loading = _ref5.loading, globalSetting = _ref5.globalSetting, restful = _ref5.restful; return { user: user, globalSetting: globalSetting, restful: restful, loading: loading.models.index }; })(UserPage)); /***/ }) }]);