|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8999],{
|
|
|
|
|
|
/***/ 73243:
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/pages/Three/index.tsx + 5 modules ***!
|
|
|
\***********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// ESM COMPAT FLAG
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"default": function() { return /* binding */ pages_Three; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
|
|
|
var slicedToArray = __webpack_require__(79800);
|
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/menu/index.js + 11 modules
|
|
|
var menu = __webpack_require__(20834);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/layout/index.js
|
|
|
var layout = __webpack_require__(44000);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
|
var message = __webpack_require__(8591);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var modal = __webpack_require__(43418);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/popover/index.js
|
|
|
var popover = __webpack_require__(60324);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(67390);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var Threemodules = ({"flex_box_center":"flex_box_center___GfbI9","flex_space_between":"flex_space_between___m14JJ","flex_box_vertical_center":"flex_box_vertical_center___IKGDg","flex_box_center_end":"flex_box_center_end___JZxvM","flex_box_column":"flex_box_column___WnVa8","SubMentItem":"SubMentItem___P0LXo","MenuItem":"MenuItem___p91mQ","wrp":"wrp___kMQ4i","classroomInfo":"classroomInfo___rb1qC","title":"title___AQndp","titleLeft":"titleLeft___K7c9u","titleRight":"titleRight___BUODH","classroomUser":"classroomUser___NkYxe","headPic":"headPic___RD_it","teacherInfo":"teacherInfo___Gyj_W","classroomDesc":"classroomDesc___ng_AB","classroomDescBg":"classroomDescBg___Dz_DM","joinCouses":"joinCouses___U2D0G","bg":"bg___IcypX","leftMenus":"leftMenus___fF5qD","titleSelected":"titleSelected___Rqtd8","menuText":"menuText___jhrfq","totalCount":"totalCount___fqkbl","actions":"actions___NAYZl","task_count":"task_count___a1sYB","container":"container___djeCS","leftMenuActions":"leftMenuActions___lRhBF"});
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(35325);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(80184);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
|
|
|
var ExclamationCircleOutlined = __webpack_require__(87169);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/PlusSquareOutlined.js + 1 modules
|
|
|
var PlusSquareOutlined = __webpack_require__(43531);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(13277);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(10249);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/Model/AddModel.tsx
|
|
|
|
|
|
|
|
|
|
|
|
//新增弹窗
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Addmodel(_ref) {
|
|
|
var user = _ref.user,
|
|
|
CategoryId = _ref.CategoryId,
|
|
|
IsShow = _ref.IsShow,
|
|
|
setIsShow = _ref.setIsShow,
|
|
|
dispatch = _ref.dispatch,
|
|
|
init = _ref.init;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
CategoryName = _useState2[0],
|
|
|
setCategoryName = _useState2[1];
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: CategoryId ? '新建三级类目' : '新建二级类目',
|
|
|
width: 424,
|
|
|
onCancel: function onCancel() {
|
|
|
setIsShow(false);
|
|
|
},
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (CategoryName) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.error('栏目名不能为空');
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
_context.next = 5;
|
|
|
return (0,fetch/* default */.ZP)("/api/programas.json", {
|
|
|
method: 'post',
|
|
|
body: {
|
|
|
name: CategoryName,
|
|
|
parent_id: CategoryId
|
|
|
}
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.info('创建成功');
|
|
|
setIsShow(false);
|
|
|
setCategoryName('');
|
|
|
init();
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
open: IsShow,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
value: CategoryName,
|
|
|
onChange: function onChange(e) {
|
|
|
return setCategoryName(e.target.value);
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",
|
|
|
maxLength: 10
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var AddModel = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var user = _ref3.user;
|
|
|
return {
|
|
|
user: user
|
|
|
};
|
|
|
})(Addmodel));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/Model/UpdateNameModel.tsx
|
|
|
|
|
|
|
|
|
|
|
|
//修改弹窗
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function UpdateNameModel_Addmodel(_ref) {
|
|
|
var user = _ref.user,
|
|
|
CategoryId = _ref.CategoryId,
|
|
|
name = _ref.name,
|
|
|
IsShow = _ref.IsShow,
|
|
|
setIsShow = _ref.setIsShow,
|
|
|
dispatch = _ref.dispatch,
|
|
|
init = _ref.init;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
CategoryName = _useState2[0],
|
|
|
setCategoryName = _useState2[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
setCategoryName(name);
|
|
|
}, [name]);
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
|
|
|
title: '目录重命名',
|
|
|
width: 424,
|
|
|
onCancel: function onCancel() {
|
|
|
setIsShow(false);
|
|
|
},
|
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (CategoryName) {
|
|
|
_context.next = 3;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.error('栏目名不能为空');
|
|
|
return _context.abrupt("return");
|
|
|
case 3:
|
|
|
_context.next = 5;
|
|
|
return (0,fetch/* default */.ZP)("/api/programas/".concat(CategoryId, "/rename.json"), {
|
|
|
method: 'put',
|
|
|
body: {
|
|
|
name: CategoryName,
|
|
|
id: CategoryId
|
|
|
}
|
|
|
});
|
|
|
case 5:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.info('修改成功');
|
|
|
setIsShow(false);
|
|
|
setCategoryName('');
|
|
|
init();
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})),
|
|
|
open: IsShow,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
value: CategoryName,
|
|
|
onChange: function onChange(e) {
|
|
|
return setCategoryName(e.target.value);
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",
|
|
|
maxLength: 10
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var UpdateNameModel = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var user = _ref3.user;
|
|
|
return {
|
|
|
user: user
|
|
|
};
|
|
|
})(UpdateNameModel_Addmodel));
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
|
|
|
var RenderHtml = __webpack_require__(36707);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/Item/SeeItem.tsx
|
|
|
//新增弹窗
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Seeitem(_ref) {
|
|
|
var _ItemData$attachment, _ItemData$attachment2, _ItemData$attachment3, _ItemData$attachment4;
|
|
|
var user = _ref.user,
|
|
|
ItemData = _ref.ItemData,
|
|
|
setIssee = _ref.setIssee,
|
|
|
dispatch = _ref.dispatch,
|
|
|
init = _ref.init;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
style: {
|
|
|
textAlign: 'right'
|
|
|
},
|
|
|
children: (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
onClick: function onClick() {
|
|
|
return setIssee(false);
|
|
|
},
|
|
|
children: "\u7F16\u8F91"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
|
|
|
value: ItemData.content
|
|
|
}), (ItemData === null || ItemData === void 0 || (_ItemData$attachment = ItemData.attachment) === null || _ItemData$attachment === void 0 ? void 0 : _ItemData$attachment.id) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
|
href: ItemData === null || ItemData === void 0 || (_ItemData$attachment2 = ItemData.attachment) === null || _ItemData$attachment2 === void 0 ? void 0 : _ItemData$attachment2.url,
|
|
|
target: "_self",
|
|
|
download: ItemData === null || ItemData === void 0 || (_ItemData$attachment3 = ItemData.attachment) === null || _ItemData$attachment3 === void 0 ? void 0 : _ItemData$attachment3.title,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
color: '#29BD8B'
|
|
|
},
|
|
|
className: "font-14 color-green iconfont icon-fujian mr8"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#000000'
|
|
|
},
|
|
|
children: ItemData === null || ItemData === void 0 || (_ItemData$attachment4 = ItemData.attachment) === null || _ItemData$attachment4 === void 0 ? void 0 : _ItemData$attachment4.title
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var SeeItem = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var user = _ref2.user;
|
|
|
return {
|
|
|
user: user
|
|
|
};
|
|
|
})(Seeitem));
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
|
|
|
var upload = __webpack_require__(54580);
|
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
|
var markdown_editor = __webpack_require__(49731);
|
|
|
// EXTERNAL MODULE: ./src/service/competitions.ts
|
|
|
var competitions = __webpack_require__(94414);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/Item/UpdateItem.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新增弹窗
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function UpItem(_ref) {
|
|
|
var user = _ref.user,
|
|
|
ItemData = _ref.ItemData,
|
|
|
setIssee = _ref.setIssee,
|
|
|
CategoryId = _ref.CategoryId,
|
|
|
dispatch = _ref.dispatch,
|
|
|
init = _ref.init;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
defaultFileList = _useState2[0],
|
|
|
setDefaultFileList = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(ItemData.content),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
defaultcontent = _useState4[0],
|
|
|
setDefaultcontent = _useState4[1];
|
|
|
function getdata() {
|
|
|
var _ItemData$attachments;
|
|
|
var data = [];
|
|
|
ItemData === null || ItemData === void 0 || (_ItemData$attachments = ItemData.attachments) === null || _ItemData$attachments === void 0 || _ItemData$attachments.map(function (item) {
|
|
|
var tt = {
|
|
|
uid: item === null || item === void 0 ? void 0 : item.id,
|
|
|
name: item.title,
|
|
|
response: {
|
|
|
id: item.id
|
|
|
}
|
|
|
};
|
|
|
data.push(tt);
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
var uploadProps = {
|
|
|
name: 'file',
|
|
|
multiple: true,
|
|
|
action: env/* default */.Z.API_SERVER + '/api/attachments.json',
|
|
|
defaultFileList: getdata(),
|
|
|
onRemove: function onRemove(e) {
|
|
|
(0,competitions/* deletAttachments */.y8)({
|
|
|
id: e.uid
|
|
|
});
|
|
|
},
|
|
|
onChange: function onChange(info) {
|
|
|
console.log('info', info);
|
|
|
var status = info.file.status;
|
|
|
if (status !== 'uploading') {}
|
|
|
if (status === 'removed') {
|
|
|
setDefaultFileList(info.fileList);
|
|
|
}
|
|
|
if (status === 'done') {
|
|
|
setDefaultFileList(info.fileList);
|
|
|
message/* default */.ZP.success("".concat(info.file.name, " \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"));
|
|
|
} else if (status === 'error') {
|
|
|
message/* default */.ZP.error("".concat(info.file.name, " \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"));
|
|
|
}
|
|
|
},
|
|
|
beforeUpload: function beforeUpload(file) {
|
|
|
var isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
if (!isLt150M) {
|
|
|
message/* default */.ZP.info("文件大小必须小于150MB");
|
|
|
}
|
|
|
return isLt150M;
|
|
|
}
|
|
|
};
|
|
|
function updateItem() {
|
|
|
return _updateItem.apply(this, arguments);
|
|
|
} //获取对应文件列表
|
|
|
function _updateItem() {
|
|
|
_updateItem = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
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/programas/".concat(CategoryId, "/update_content.json"), {
|
|
|
method: 'put',
|
|
|
body: {
|
|
|
id: CategoryId,
|
|
|
content: defaultcontent,
|
|
|
attachment_id: getitemid(defaultFileList)
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res) {
|
|
|
message/* default */.ZP.info('提交成功');
|
|
|
setIssee(true);
|
|
|
//刷新
|
|
|
//getrightdatas(MenuItem);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return _updateItem.apply(this, arguments);
|
|
|
}
|
|
|
function getitemid(itemlist) {
|
|
|
var data;
|
|
|
itemlist && itemlist.map(function (item) {
|
|
|
data = item.response.id;
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
|
defaultValue: defaultcontent,
|
|
|
onChange: function onChange(e) {
|
|
|
return setDefaultcontent(e);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(upload/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, uploadProps), {}, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "uploadBtn",
|
|
|
children: "\u4E0A\u4F20\u9644\u4EF6"
|
|
|
}), "(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"]
|
|
|
})), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
style: {
|
|
|
marginTop: '10px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
style: {
|
|
|
width: '90px'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
return updateItem();
|
|
|
},
|
|
|
children: "\u63D0\u4EA4"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
style: {
|
|
|
marginLeft: '30px',
|
|
|
width: '90px'
|
|
|
},
|
|
|
type: "primary",
|
|
|
onClick: function onClick() {
|
|
|
return setIssee(true);
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
})]
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var UpdateItem = ((0,_umi_production_exports.connect)(function (_ref2) {
|
|
|
var user = _ref2.user;
|
|
|
return {
|
|
|
user: user
|
|
|
};
|
|
|
})(UpItem));
|
|
|
;// CONCATENATED MODULE: ./src/pages/Three/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SubMenu = menu/* default */.Z.SubMenu;
|
|
|
var Content = layout/* default */.Z.Content,
|
|
|
Sider = layout/* default */.Z.Sider;
|
|
|
function Three(_ref) {
|
|
|
var _globalSetting$settin;
|
|
|
var user = _ref.user,
|
|
|
dispatch = _ref.dispatch,
|
|
|
globalSetting = _ref.globalSetting;
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
LeftMenuList = _useState2[0],
|
|
|
setLeftMenuList = _useState2[1];
|
|
|
//是否显示
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
IsShowModel = _useState4[0],
|
|
|
setIsShowModel = _useState4[1];
|
|
|
//初始数据
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
CategoryList = _useState6[0],
|
|
|
setCategoryList = _useState6[1];
|
|
|
//二级目录id
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
CategoryId = _useState8[0],
|
|
|
setCategoryId = _useState8[1];
|
|
|
//修改目录名称
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
UpdateShow = _useState10[0],
|
|
|
setUpdateShow = _useState10[1];
|
|
|
//二级目录名称
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
UpdateName = _useState12[0],
|
|
|
setUpdateName = _useState12[1];
|
|
|
//内容
|
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(''),
|
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
|
ItemCount = _useState14[0],
|
|
|
setItemCount = _useState14[1];
|
|
|
//查看还是编辑
|
|
|
var _useState15 = (0,_react_17_0_2_react.useState)(true),
|
|
|
_useState16 = slicedToArray_default()(_useState15, 2),
|
|
|
IsSee = _useState16[0],
|
|
|
setIsSee = _useState16[1];
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
//获取初始数据
|
|
|
init();
|
|
|
}, []);
|
|
|
console.log('globalSetting', globalSetting);
|
|
|
|
|
|
//获取数据
|
|
|
function init() {
|
|
|
return _init.apply(this, arguments);
|
|
|
}
|
|
|
function _init() {
|
|
|
_init = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var result;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
_context3.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/programas.json", {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 2:
|
|
|
result = _context3.sent;
|
|
|
if (result) {
|
|
|
setCategoryList(result === null || result === void 0 ? void 0 : result.programas);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return _init.apply(this, arguments);
|
|
|
}
|
|
|
var actionClick = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(key, val, type) {
|
|
|
var res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.t0 = key;
|
|
|
_context2.next = _context2.t0 === 1 ? 3 : _context2.t0 === 2 ? 6 : _context2.t0 === 3 ? 10 : _context2.t0 === 4 ? 15 : 17;
|
|
|
break;
|
|
|
case 3:
|
|
|
setCategoryId(val === null || val === void 0 ? void 0 : val.id);
|
|
|
setIsShowModel(true);
|
|
|
return _context2.abrupt("break", 17);
|
|
|
case 6:
|
|
|
setCategoryId(val === null || val === void 0 ? void 0 : val.id);
|
|
|
setUpdateShow(true);
|
|
|
setUpdateName(val === null || val === void 0 ? void 0 : val.name);
|
|
|
return _context2.abrupt("break", 17);
|
|
|
case 10:
|
|
|
_context2.next = 12;
|
|
|
return (0,fetch/* default */.ZP)("/api/programas/".concat(val === null || val === void 0 ? void 0 : val.id, "/top.json"), {
|
|
|
method: 'post',
|
|
|
body: {
|
|
|
id: val === null || val === void 0 ? void 0 : val.id
|
|
|
}
|
|
|
});
|
|
|
case 12:
|
|
|
res = _context2.sent;
|
|
|
if (res.status === 0) {
|
|
|
init();
|
|
|
}
|
|
|
return _context2.abrupt("break", 17);
|
|
|
case 15:
|
|
|
confirm( /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
|
children: ["\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u662F\u5426\u786E\u8BA4\u5220\u9664?"]
|
|
|
}), /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
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/programas/".concat(val === null || val === void 0 ? void 0 : val.id, ".json"), {
|
|
|
method: 'delete',
|
|
|
body: {
|
|
|
id: val === null || val === void 0 ? void 0 : val.id
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.info('删除成功');
|
|
|
init();
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
})));
|
|
|
return _context2.abrupt("break", 17);
|
|
|
case 17:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function actionClick(_x, _x2, _x3) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var confirm = function confirm(content, okCb) {
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
title: '提示',
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}),
|
|
|
content: content,
|
|
|
okText: '确认',
|
|
|
onOk: function onOk() {
|
|
|
return okCb();
|
|
|
},
|
|
|
cancelText: '取消'
|
|
|
});
|
|
|
};
|
|
|
var _content = function content(val, type) {
|
|
|
// type 1是顶层目录,2是二级目录
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: Threemodules.leftMenuActions,
|
|
|
children: [type === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(1, val, type);
|
|
|
},
|
|
|
children: "\u65B0\u5EFA"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(2, val, type);
|
|
|
},
|
|
|
children: "\u91CD\u547D\u540D"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(3, val, type);
|
|
|
},
|
|
|
children: "\u7F6E\u9876"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
|
className: "current",
|
|
|
onClick: function onClick() {
|
|
|
return actionClick(4, val, type);
|
|
|
},
|
|
|
children: "\u5220\u9664"
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
//获取单个item的数据
|
|
|
function getItem() {
|
|
|
return _getItem.apply(this, arguments);
|
|
|
}
|
|
|
function _getItem() {
|
|
|
_getItem = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var result;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
_context4.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/programas/".concat(CategoryId, "/content.json"), {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
id: CategoryId
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
result = _context4.sent;
|
|
|
if (result) {
|
|
|
setItemCount(result);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
return _getItem.apply(this, arguments);
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
marginBottom: '40px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
style: {
|
|
|
width: '100%'
|
|
|
},
|
|
|
src: env/* default */.Z.IMG_SERVER + "/".concat(globalSetting === null || globalSetting === void 0 || (_globalSetting$settin = globalSetting.setting) === null || _globalSetting$settin === void 0 ? void 0 : _globalSetting$settin.shixun_banner_url)
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "edu-container minH500",
|
|
|
style: {
|
|
|
display: 'flex',
|
|
|
width: '1200px'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Sider, {
|
|
|
width: 244,
|
|
|
className: Threemodules.leftMenus,
|
|
|
style: {
|
|
|
background: 'none',
|
|
|
marginTop: '20px',
|
|
|
height: 'auto'
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z, {
|
|
|
mode: "inline",
|
|
|
children: [CategoryList === null || CategoryList === void 0 ? void 0 : CategoryList.map(function (item, index) {
|
|
|
if ((item === null || item === void 0 ? void 0 : item.children.length) > 0) {
|
|
|
var _item$children;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(SubMenu, {
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font16",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: item.name
|
|
|
}), !(0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)(popover/* default */.Z, {
|
|
|
placement: "right",
|
|
|
content: function content() {
|
|
|
return _content(item, 1);
|
|
|
},
|
|
|
trigger: "hover",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: ["iconfont icon-sandian", Threemodules.actions].join(" ")
|
|
|
})
|
|
|
})]
|
|
|
}),
|
|
|
children: item === null || item === void 0 || (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map(function (val, k) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z.Item, {
|
|
|
className: Threemodules === null || Threemodules === void 0 ? void 0 : Threemodules.SubMentItem,
|
|
|
onClick: function onClick() {
|
|
|
setCategoryId(val === null || val === void 0 ? void 0 : val.id);
|
|
|
CategoryId = val === null || val === void 0 ? void 0 : val.id;
|
|
|
getItem();
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
'flex': '1'
|
|
|
},
|
|
|
children: val === null || val === void 0 ? void 0 : val.name
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)(popover/* default */.Z, {
|
|
|
placement: "right",
|
|
|
content: function content() {
|
|
|
return _content(val, 2);
|
|
|
},
|
|
|
trigger: "hover",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: ["iconfont icon-sandian", Threemodules.actions].join(" ")
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
})
|
|
|
});
|
|
|
} else {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z.Item, {
|
|
|
className: Threemodules === null || Threemodules === void 0 ? void 0 : Threemodules.SubMentItem,
|
|
|
onClick: function onClick() {
|
|
|
setCategoryId(item === null || item === void 0 ? void 0 : item.id);
|
|
|
CategoryId = item === null || item === void 0 ? void 0 : item.id;
|
|
|
getItem();
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
'flex': '1'
|
|
|
},
|
|
|
children: item === null || item === void 0 ? void 0 : item.name
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsx)(popover/* default */.Z, {
|
|
|
placement: "right",
|
|
|
content: function content() {
|
|
|
return _content(item, 1);
|
|
|
},
|
|
|
trigger: "hover",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: ["iconfont icon-sandian", Threemodules.actions].join(" ")
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default */.Z.Item, {
|
|
|
onClick: function onClick() {
|
|
|
setCategoryId('');
|
|
|
CategoryId = '';
|
|
|
setIsShowModel(true);
|
|
|
},
|
|
|
style: {
|
|
|
color: '#0152d9',
|
|
|
fontSize: '16px',
|
|
|
height: '40px',
|
|
|
display: 'flex',
|
|
|
alignItems: 'center'
|
|
|
},
|
|
|
icon: /*#__PURE__*/(0,jsx_runtime.jsx)(PlusSquareOutlined/* default */.Z, {
|
|
|
style: {
|
|
|
color: "#0152d9",
|
|
|
fontSize: '16px'
|
|
|
}
|
|
|
}),
|
|
|
children: "\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
width: '937px',
|
|
|
marginLeft: '17px',
|
|
|
background: '#fff',
|
|
|
padding: '20px'
|
|
|
},
|
|
|
children: [IsSee && /*#__PURE__*/(0,jsx_runtime.jsx)(SeeItem, {
|
|
|
ItemData: ItemCount,
|
|
|
setIssee: setIsSee
|
|
|
}), IsSee === false && /*#__PURE__*/(0,jsx_runtime.jsx)(UpdateItem, {
|
|
|
ItemData: ItemCount,
|
|
|
setIssee: setIsSee,
|
|
|
CategoryId: CategoryId
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AddModel, {
|
|
|
CategoryId: CategoryId,
|
|
|
IsShow: IsShowModel,
|
|
|
setIsShow: setIsShowModel,
|
|
|
init: init
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UpdateNameModel, {
|
|
|
CategoryId: CategoryId,
|
|
|
name: UpdateName,
|
|
|
IsShow: UpdateShow,
|
|
|
setIsShow: setUpdateShow,
|
|
|
init: init
|
|
|
})]
|
|
|
});
|
|
|
}
|
|
|
/* harmony default export */ var pages_Three = ((0,_umi_production_exports.connect)(function (_ref4) {
|
|
|
var user = _ref4.user,
|
|
|
globalSetting = _ref4.globalSetting;
|
|
|
return {
|
|
|
user: user,
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(Three));
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |