From dfc0bf70e31f00ea0f807fbfa35014ab4b0d3f41 Mon Sep 17 00:00:00 2001 From: autosubmit Date: Wed, 27 Sep 2023 18:04:09 +0800 Subject: [PATCH] Auto Submit --- p__Classrooms__Lists__Video__index.async.js | 123 +++++++++++--------- 1 file changed, 66 insertions(+), 57 deletions(-) diff --git a/p__Classrooms__Lists__Video__index.async.js b/p__Classrooms__Lists__Video__index.async.js index 2ed12fb7d5..620d902c19 100644 --- a/p__Classrooms__Lists__Video__index.async.js +++ b/p__Classrooms__Lists__Video__index.async.js @@ -2151,8 +2151,11 @@ var TabMenu = __webpack_require__(15582); + + var MoveCatalog_TreeNode = tree_select/* default.TreeNode */.Z.TreeNode; var MoveCatalog_EditAttendance = function EditAttendance(_ref) { + var _detailLeftMenus$cour; var classroomList = _ref.classroomList, loading = _ref.loading, dispatch = _ref.dispatch; @@ -2163,6 +2166,22 @@ var MoveCatalog_EditAttendance = function EditAttendance(_ref) { var _Form$useForm = es_form/* default.useForm */.Z.useForm(), _Form$useForm2 = slicedToArray_default()(_Form$useForm, 1), form = _Form$useForm2[0]; + var Radios = function Radios(Values) { + var _Values$filter; + return Values === null || Values === void 0 ? void 0 : (_Values$filter = Values.filter(function (r) { + return r.category_name !== '未分配目录'; + })) === null || _Values$filter === void 0 ? void 0 : _Values$filter.map(function (v, index) { + return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { + children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, { + style: { + display: 'block' + }, + value: v.category_id, + children: v.category_name + }), Radios((v === null || v === void 0 ? void 0 : v.third_category) || [])] + }); + }); + }; return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, { centered: true, title: "\u79FB\u52A8\u5230", @@ -2173,51 +2192,9 @@ var MoveCatalog_EditAttendance = function EditAttendance(_ref) { bodyStyle: { minHeight: 200 }, - onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() { - var formValue, res; - return regeneratorRuntime_default()().wrap(function _callee$(_context) { - while (1) switch (_context.prev = _context.next) { - case 0: - _context.t0 = (objectSpread2_default()); - _context.t1 = {}; - _context.next = 4; - return form.validateFields(); - case 4: - _context.t2 = _context.sent; - formValue = (0, _context.t0)(_context.t1, _context.t2); - _context.next = 8; - return (0,fetch/* default */.ZP)("/api/courses/".concat(params.id, "/move_to_category.json"), { - method: 'post', - body: { - new_category_id: formValue.new_category_id, - video_ids: actionTabs.data.id - } - }); - case 8: - res = _context.sent; - if (res.status === 0) { - message/* default.success */.ZP.success('操作成功'); - dispatch({ - type: 'classroomList/setActionTabs', - payload: {} - }); - dispatch({ - type: 'classroomList/setUpdateData', - payload: Math.random() - }); - dispatch({ - type: 'classroomList/getClassroomLeftMenus', - payload: { - id: params === null || params === void 0 ? void 0 : params.id - } - }); - } - case 10: - case "end": - return _context.stop(); - } - }, _callee); - })), + onOk: function onOk() { + return form.submit(); + }, onCancel: function onCancel() { dispatch({ type: 'classroomList/setActionTabs', @@ -2229,6 +2206,48 @@ var MoveCatalog_EditAttendance = function EditAttendance(_ref) { initialValues: { // ['link']: actionTabs.data.link, }, + onFinish: /*#__PURE__*/function () { + var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(Values) { + var res; + return regeneratorRuntime_default()().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return (0,fetch/* default */.ZP)("/api/courses/".concat(params.id, "/move_to_category.json"), { + method: 'post', + body: objectSpread2_default()(objectSpread2_default()({}, Values), {}, { + video_ids: actionTabs.data.id + }) + }); + case 2: + res = _context.sent; + if (res.status === 0) { + message/* default.success */.ZP.success('操作成功'); + dispatch({ + type: 'classroomList/setActionTabs', + payload: {} + }); + dispatch({ + type: 'classroomList/setUpdateData', + payload: Math.random() + }); + dispatch({ + type: 'classroomList/getClassroomLeftMenus', + payload: { + id: params === null || params === void 0 ? void 0 : params.id + } + }); + } + case 4: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function (_x) { + return _ref2.apply(this, arguments); + }; + }(), children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, { label: "", name: "new_category_id", @@ -2237,19 +2256,9 @@ var MoveCatalog_EditAttendance = function EditAttendance(_ref) { message: '请输入!' }], children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, { - children: detailLeftMenus === null || detailLeftMenus === void 0 ? void 0 : detailLeftMenus.course_modules.filter(function (v) { + children: Radios(detailLeftMenus === null || detailLeftMenus === void 0 ? void 0 : (_detailLeftMenus$cour = detailLeftMenus.course_modules) === null || _detailLeftMenus$cour === void 0 ? void 0 : _detailLeftMenus$cour.filter(function (v) { return v.type === "video"; - })[0]['second_category'].filter(function (r) { - return r.category_name !== '未分配目录'; - }).map(function (v, k) { - return /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, { - style: { - display: 'block' - }, - value: v.category_id, - children: v.category_name - }); - }) + })[0]['second_category']) }) }) })