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__User__Detail__Shixuns__i...

1875 lines
84 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[18307],{
/***/ 82982:
/*!*****************************************!*\
!*** ./src/components/NoData/index.tsx ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/objectSpread2.js */ 42122);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 67294);
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 4977);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 71577);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
var noData = function noData(_ref) {
var img = _ref.img,
_ref$buttonProps = _ref.buttonProps,
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
_ref$styles = _ref.styles,
styles = _ref$styles === void 0 ? {} : _ref$styles,
customText = _ref.customText,
ButtonText = _ref.ButtonText,
ButtonClick = _ref.ButtonClick,
Buttonclass = _ref.Buttonclass,
ButtonTwo = _ref.ButtonTwo,
imgStyles = _ref.imgStyles,
_ref$loading = _ref.loading,
loading = _ref$loading === void 0 ? false : _ref$loading;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("section", {
className: "tc animated fadeIn",
style: _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, {
color: '#999',
margin: '100px auto',
visibility: loading ? 'hidden' : 'visible'
}), styles),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("img", {
src: img || _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__,
style: _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, imgStyles)
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p", {
className: "mt20 font14",
children: customText || '暂时还没有相关数据哦!'
}), ButtonText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_node_modules_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
className: Buttonclass,
onClick: ButtonClick
}, buttonProps), {}, {
children: ButtonText
})), ButtonTwo && ButtonTwo]
});
};
/* harmony default export */ __webpack_exports__["Z"] = (noData);
/***/ }),
/***/ 48358:
/*!*************************************************************!*\
!*** ./src/pages/User/Detail/Shixuns/index.tsx + 6 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 */ Detail_Shixuns; }
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(17061);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(42122);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(861);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(17156);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(27424);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(70215);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(88275);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 39 modules
var modal = __webpack_require__(72423);
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 4 modules
var message = __webpack_require__(2453);
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(83062);
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(21687);
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/index.js + 11 modules
var pagination = __webpack_require__(83338);
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
var input = __webpack_require__(79531);
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
var es_button = __webpack_require__(71577);
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 3 modules
var es_checkbox = __webpack_require__(84567);
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
var row = __webpack_require__(71230);
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
var col = __webpack_require__(15746);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Shixunsmodules = ({"flex_box_center":"flex_box_center___wA4I5","flex_space_between":"flex_space_between___r6nwi","flex_box_vertical_center":"flex_box_vertical_center___Wefy1","flex_box_center_end":"flex_box_center_end___Vp84k","flex_box_column":"flex_box_column___fcUbn","wrap":"wrap___MiRCb","midWrap":"midWrap___o5A2g","color999":"color999___kvLjS","orderWrap":"orderWrap___h5SIu","orderIconWrap":"orderIconWrap___IYG5m","orderAsc":"orderAsc___gyCKC","orderDesc":"orderDesc___wkX1B","color0152d9":"color0152d9___yLS1b","h10":"h10___T4vHk","cursorPointer":"cursorPointer___6JPpk","orderTextWrap":"orderTextWrap___oqfoU","cardWrap":"cardWrap___tGc2X","countWrap":"countWrap___MMe2I","colorFEB300":"colorFEB300___wW27n","modalContent":"modalContent___MMaQo","type":"type___EdWvO","group":"group___jtM4s","add":"add___rC163"});
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(82982);
// EXTERNAL MODULE: ./node_modules/antd/es/card/index.js + 4 modules
var card = __webpack_require__(4393);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(56088);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/components/Items/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Itemsmodules = ({"flex_box_center":"flex_box_center___fhaQT","flex_space_between":"flex_space_between___IKRgA","flex_box_vertical_center":"flex_box_vertical_center___lbozn","flex_box_center_end":"flex_box_center_end___pDq44","flex_box_column":"flex_box_column___RZzgu","wrap":"wrap___G5hQ4","createIconWrap":"createIconWrap___e9K9f","createIcon":"createIcon___koLsC","leftIcon":"leftIcon___y91Ne","rightIcon":"rightIcon___UQ4Fq","createTextWrap":"createTextWrap___fTr2V","createText":"createText___JMNOe","tagWrap":"tagWrap___rr9RH","tagName":"tagName___g6Ruo","tagJupyterWrap":"tagJupyterWrap___BkdHH","tagJupyterNameWrap":"tagJupyterNameWrap___Z6iCu","tagJupyterName":"tagJupyterName___reott","imgWrap":"imgWrap___xDlh5","cardBottom":"cardBottom___r9Ujh","bottomName":"bottomName___XyvlX","bottomCountProgressWrap":"bottomCountProgressWrap___vM84t","bottomCount":"bottomCount___K_YvT","action":"action___muO9d","colorFF8E02":"colorFF8E02___istLu","sign":"sign___pwX3C","bottomNameWrap":"bottomNameWrap___cWaZc"});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(59758);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(29427);
// EXTERNAL MODULE: ./src/components/ui-customization/Cards/ShixunList/img/Jupyter.png
var Jupyter = __webpack_require__(96908);
// EXTERNAL MODULE: ./src/components/ui-customization/Cards/ShixunList/img/JupyterLab.png
var JupyterLab = __webpack_require__(57177);
// EXTERNAL MODULE: ./src/components/ui-customization/Cards/ShixunList/img/unity.png
var unity = __webpack_require__(81378);
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(85893);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/components/Items/index.tsx
var Items = function Items(_ref) {
var data = _ref.data,
_ref$params = _ref.params,
params = _ref$params === void 0 ? {} : _ref$params,
user = _ref.user,
_ref$onCancelCollect = _ref.onCancelCollect,
onCancelCollect = _ref$onCancelCollect === void 0 ? function () {} : _ref$onCancelCollect,
_ref$onRemove = _ref.onRemove,
onRemove = _ref$onRemove === void 0 ? function () {} : _ref$onRemove;
return /*#__PURE__*/(0,jsx_runtime.jsx)(react.Fragment, {
children: data && data.map(function (item, key) {
var _user$userInfo, _item$schools;
return /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: Itemsmodules.wrap,
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _res$exercise;
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,shixuns/* existExercise */.Ee)({
id: item.identifier
});
case 2:
res = _context.sent;
if (!!(res !== null && res !== void 0 && (_res$exercise = res.exercise) !== null && _res$exercise !== void 0 && _res$exercise.length)) {
modal/* default.info */.Z.info({
title: "考试场景告知",
content: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u5F53\u524D\u5B9E\u8BAD\u5DF2\u88AB\u8003\u8BD5\u8C03\u7528\uFF0C\u4E14\u60A8\u6B63\u5728\u53C2\u52A0\u672C\u6B21\u8003\u8BD5\u3002\u8003\u8BD5\u573A\u666F\u4E0B\u5FC5\u987B\u4ECE\u8BD5\u5377\u4E2D\u8FDB\u5165\u5E76\u7B54\u9898\uFF0C\u5426\u5219\u7B54\u9898\u7ED3\u679C\u4E0D\u8BA1\u5165\u6210\u7EE9\u3002\u8BF7\u70B9\u51FB\u8BD5\u5377\u540D\u79F0\u8FDB\u5165\u8003\u8BD5\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: res === null || res === void 0 ? void 0 : res.exercise.map(function (v, k) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/classrooms/".concat(v.course_id, "/exercise/").concat(v.id, "/detail?random=").concat(v.random),
children: v.name
})
});
})
})
})]
})
});
} else {
(0,util/* openNewWindow */.xg)("/shixuns/".concat(item.identifier, "/challenges"));
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(card/* default */.Z, {
className: "animated fadeIn ".concat(Itemsmodules.cardWrap),
children: [params.category === "collect" && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Itemsmodules.action, " user-shixun-items"),
onClick: function onClick(e) {
e.stopPropagation();
onCancelCollect(item.id);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u53D6\u6D88\u6536\u85CF",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shoucang3 font24 mr5 ".concat(Itemsmodules.colorFF8E02)
})
})
}), params.category === "study" && params.username === ((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Itemsmodules.action, " user-shixun-items"),
onClick: function onClick(e) {
e.stopPropagation();
onRemove(item.identifier);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u79FB\u9664",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shanchu21 font24 mr5 c-white"
})
})
}), item.tag && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Itemsmodules.tagWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Itemsmodules.tagName,
children: item.tag
})
}), item.is_jupyter && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
className: Itemsmodules.sign,
src: Jupyter
}), item.is_jupyter_lab && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
className: Itemsmodules.sign,
src: JupyterLab
}), item.is_unity_3d && /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
className: Itemsmodules.sign,
src: unity
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Itemsmodules.imgWrap,
children: !(item !== null && item !== void 0 && item.cover_image_id) ? /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
alt: item.name,
src: "".concat(env/* default.IMG_SERVER */.Z.IMG_SERVER, "/").concat(item.image_url)
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
alt: item.name,
src: env/* default.API_SERVER */.Z.API_SERVER + "/api/attachments/" + (item === null || item === void 0 ? void 0 : item.cover_image_id)
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Itemsmodules.cardBottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: Itemsmodules.bottomNameWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
title: item.name,
className: Itemsmodules.bottomName,
children: item.name || '实践项目名称-未填写'
}), !!((_item$schools = item.schools) !== null && _item$schools !== void 0 && _item$schools.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u8BE5\u5B9E\u8DF5\u9879\u76EE\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-zhidinggongkai1 ml10 c-orange"
})
})]
}), !!item.challenges_count && /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Itemsmodules.bottomCountProgressWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
'width': "".concat(parseFloat(parseInt(item.finished_challenges_count) / parseInt(item.challenges_count)).toFixed(2) * 100, "%")
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: Itemsmodules.bottomCount,
children: ["\u5DF2\u5B8C\u6210 ", item.finished_challenges_count, " / ", item.challenges_count]
})]
})]
})]
})
}, item.id);
})
});
};
/* harmony default export */ var components_Items = (Items);
// EXTERNAL MODULE: ./node_modules/antd/es/dropdown/index.js + 1 modules
var dropdown = __webpack_require__(85418);
// EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 11 modules
var menu = __webpack_require__(68508);
// EXTERNAL MODULE: ./node_modules/antd/es/table/index.js + 90 modules
var table = __webpack_require__(63889);
// EXTERNAL MODULE: ./node_modules/@umijs/plugins/node_modules/dayjs/dayjs.min.js
var dayjs_min = __webpack_require__(94699);
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownOutlined.js + 1 modules
var DownOutlined = __webpack_require__(80882);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/components/Items/table.tsx
var table_Items = function Items(_ref) {
var data = _ref.data,
number = _ref.number,
params = _ref.params,
user = _ref.user,
isCurrent = _ref.isCurrent,
setParams = _ref.setParams,
getShixuns = _ref.getShixuns,
_ref$onCancelCollect = _ref.onCancelCollect,
onCancelCollect = _ref$onCancelCollect === void 0 ? function () {} : _ref$onCancelCollect,
_ref$onRemove = _ref.onRemove,
onRemove = _ref$onRemove === void 0 ? function () {} : _ref$onRemove,
_ref$setGroupIds = _ref.setGroupIds,
setGroupIds = _ref$setGroupIds === void 0 ? function () {} : _ref$setGroupIds,
_ref$setUnGrouplists = _ref.setUnGrouplists,
setUnGrouplists = _ref$setUnGrouplists === void 0 ? function () {} : _ref$setUnGrouplists;
var _useState = (0,react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
aa = _useState2[0],
setaa = _useState2[1];
(0,react.useEffect)(function () {
if (data) {
var datas = [];
data === null || data === void 0 ? void 0 : data.map(function (item, index) {
var ite = item;
ite.key = item.id;
datas.push(ite);
});
setaa([].concat(datas));
}
}, [data]);
var columns = [
// {
// title: '序号',
// dataIndex: 'index',
// key: 'index',
// width: 55,
// render: (text: number, item: any, index: number) => <span>{number + index + 1}</span>
// },
{
title: '实践项目名称',
dataIndex: 'name',
width: 236,
// ellipsis: true,
key: 'name',
sorter: true,
sortOrder: params.sort_by === 'name' ? params.sort_direction === 'desc' ? 'descend' : 'ascend' : null,
render: function render(text, item) {
var _item$schools;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: Itemsmodules.bottomNameWrap,
children: [!!((_item$schools = item.schools) !== null && _item$schools !== void 0 && _item$schools.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u8BE5\u5B9E\u8DF5\u9879\u76EE\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-zhidinggongkai1 mr5 c-orange translateY1 inline-block"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: text || '实践项目名称-未填写',
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: text || '实践项目名称-未填写'
})
})]
});
}
}, {
title: '管理员',
dataIndex: 'owner',
key: 'owner',
width: 100,
ellipsis: true,
render: function render(text) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: text || '--',
placement: "bottomLeft",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: text || '--'
})
});
}
}, {
title: '合作者',
dataIndex: 'members',
key: 'members',
width: 110,
ellipsis: true,
render: function render(text) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: text.join("、"),
placement: "bottomLeft",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: text.join("、")
})
});
}
},
// {
// title: '创建时间',
// dataIndex: 'created_at',
// key: 'created_at',
// sorter: true,
// sortOrder: params.sort_by === 'created_at'
// ? params.sort_direction === 'desc'
// ? 'descend'
// : 'ascend'
// : null,
// width: 106,
// render: (text: any) => <span className='c-grey-666'>{moment(text).format("YYYY-MM-DD")}</span>
// },
{
title: '最近修改',
dataIndex: 'updated_at',
width: 106,
key: 'updated_at',
sorter: true,
sortOrder: params.sort_by === 'updated_at' ? params.sort_direction === 'desc' ? 'descend' : 'ascend' : null,
render: function render(text) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-666",
children: dayjs_min_default()(text).format("YYYY-MM-DD")
});
}
}, {
title: '引用次数',
dataIndex: 'used_count',
width: 90,
sorter: true,
align: "center",
sortOrder: params.sort_by === 'used_count' ? params.sort_direction === 'desc' ? 'descend' : 'ascend' : null,
key: 'used_count',
render: function render(text) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-666",
children: text
});
}
},
// {
// title: '学习进度',
// dataIndex: 'created_at',
// key: 'created_at',
// align: "center",
// width: 80,
// render: (text: string, record: any) => <span className='c-grey-666'>{record.finished_challenges_count}/{record.challenges_count}</span>
// },
{
title: '操作',
dataIndex: 'name',
key: 'name',
width: 110,
align: 'right',
render: function render(text, item) {
var _item$groups, _user$userInfo;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "current-primary",
onClick: /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e) {
var _res$exercise;
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
e.stopPropagation();
_context.next = 3;
return (0,shixuns/* existExercise */.Ee)({
id: item.identifier
});
case 3:
res = _context.sent;
if (!!(res !== null && res !== void 0 && (_res$exercise = res.exercise) !== null && _res$exercise !== void 0 && _res$exercise.length)) {
modal/* default.info */.Z.info({
title: "考试场景告知",
content: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u5F53\u524D\u5B9E\u8BAD\u5DF2\u88AB\u8003\u8BD5\u8C03\u7528\uFF0C\u4E14\u60A8\u6B63\u5728\u53C2\u52A0\u672C\u6B21\u8003\u8BD5\u3002\u8003\u8BD5\u573A\u666F\u4E0B\u5FC5\u987B\u4ECE\u8BD5\u5377\u4E2D\u8FDB\u5165\u5E76\u7B54\u9898\uFF0C\u5426\u5219\u7B54\u9898\u7ED3\u679C\u4E0D\u8BA1\u5165\u6210\u7EE9\u3002\u8BF7\u70B9\u51FB\u8BD5\u5377\u540D\u79F0\u8FDB\u5165\u8003\u8BD5\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: res === null || res === void 0 ? void 0 : res.exercise.map(function (v, k) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/classrooms/".concat(v.course_id, "/exercise/").concat(v.id, "/detail?random=").concat(v.random),
children: v.name
})
}, k);
})
})
})]
})
});
} else {
(0,util/* openNewWindow */.xg)("/shixuns/".concat(item.identifier, "/challenges"));
}
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}(),
children: "\u8BE6\u60C5"
}), params.category != "study" && params.category != "collect" && isCurrent && (item === null || item === void 0 ? void 0 : (_item$groups = item.groups) === null || _item$groups === void 0 ? void 0 : _item$groups.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick(e) {
var _item$groups2;
e.stopPropagation();
if ((item === null || item === void 0 ? void 0 : (_item$groups2 = item.groups) === null || _item$groups2 === void 0 ? void 0 : _item$groups2.length) <= 0) {
message/* default.info */.ZP.info("\u8BE5\u5B9E\u8DF5\u9879\u76EE\u6682\u65E0\u76EE\u5F55");
return;
}
setUnGrouplists(item.groups, item.id);
},
className: "current-primary ml10",
children: "\u64A4\u9500\u76EE\u5F55"
}), params.category === "study" && ((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login) === params.username && /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
dropdownRender: function dropdownRender() {
var _item$groups3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default.Item */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick(e) {
e.stopPropagation();
modal/* default.confirm */.Z.confirm({
content: "是否确认删除",
onOk: function onOk() {
return onRemove(item.identifier);
}
});
},
className: "ml10 current",
children: "\u5220\u9664"
})
}), (item === null || item === void 0 ? void 0 : (_item$groups3 = item.groups) === null || _item$groups3 === void 0 ? void 0 : _item$groups3.length) > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default.Item */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick(e) {
var _item$groups4;
e.stopPropagation();
if ((item === null || item === void 0 ? void 0 : (_item$groups4 = item.groups) === null || _item$groups4 === void 0 ? void 0 : _item$groups4.length) <= 0) {
message/* default.info */.ZP.info("\u8BE5\u5B9E\u8DF5\u9879\u76EE\u6682\u65E0\u76EE\u5F55");
return;
}
setUnGrouplists(item.groups, item.id);
},
className: " current",
children: "\u64A4\u9500\u76EE\u5F55"
})
})]
});
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
onClick: function onClick(e) {
e.stopPropagation();
},
className: "c-blue current ml10",
children: ["\u66F4\u591A ", /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {})]
})
})
//
, params.category === "collect" && isCurrent && /*#__PURE__*/(0,jsx_runtime.jsx)(dropdown/* default */.Z, {
dropdownRender: function dropdownRender() {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(menu/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default.Item */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick(e) {
e.stopPropagation();
onCancelCollect(item.id);
},
className: "current",
children: "\u53D6\u6D88\u6536\u85CF"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(menu/* default.Item */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick(e) {
var _item$groups5;
e.stopPropagation();
if ((item === null || item === void 0 ? void 0 : (_item$groups5 = item.groups) === null || _item$groups5 === void 0 ? void 0 : _item$groups5.length) <= 0) {
message/* default.info */.ZP.info("\u8BE5\u5B9E\u8DF5\u9879\u76EE\u6682\u65E0\u76EE\u5F55");
return;
}
setUnGrouplists(item.groups, item.id);
},
className: " current",
children: "\u64A4\u9500\u76EE\u5F55"
})
})]
});
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
onClick: function onClick(e) {
e.stopPropagation();
},
className: "c-blue current ml10",
children: ["\u66F4\u591A ", /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {})]
})
})
// <span onClick={() => onCancelCollect(item.id)} className="current ml10">取消收藏</span>
]
});
}
}];
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: isCurrent ? /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
rowSelection: {
type: "checkbox",
columnWidth: 25,
onChange: function onChange(key, values) {
// console.log('-------',key,values);
setGroupIds(key);
}
},
onChange: function onChange(a, b, c) {
if (c.field) params.sort_by = c.field;
if (!c.order) params['sort_direction'] = 'asc';
if (c.order === 'ascend') params['sort_direction'] = 'asc';
if (c.order === 'descend') params['sort_direction'] = 'desc';
// if (!c.order) delete params['b_order'];
if (!c.order) params['sort_direction'] = 'asc';
setParams(params);
getShixuns(params);
},
onRow: function onRow(record) {
return {
onClick: function () {
var _onClick = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(e) {
var _res$exercise2;
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,shixuns/* existExercise */.Ee)({
id: record.identifier
});
case 2:
res = _context2.sent;
if (!!(res !== null && res !== void 0 && (_res$exercise2 = res.exercise) !== null && _res$exercise2 !== void 0 && _res$exercise2.length)) {
modal/* default.info */.Z.info({
title: "考试场景告知",
content: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u5F53\u524D\u5B9E\u8BAD\u5DF2\u88AB\u8003\u8BD5\u8C03\u7528\uFF0C\u4E14\u60A8\u6B63\u5728\u53C2\u52A0\u672C\u6B21\u8003\u8BD5\u3002\u8003\u8BD5\u573A\u666F\u4E0B\u5FC5\u987B\u4ECE\u8BD5\u5377\u4E2D\u8FDB\u5165\u5E76\u7B54\u9898\uFF0C\u5426\u5219\u7B54\u9898\u7ED3\u679C\u4E0D\u8BA1\u5165\u6210\u7EE9\u3002\u8BF7\u70B9\u51FB\u8BD5\u5377\u540D\u79F0\u8FDB\u5165\u8003\u8BD5\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: res === null || res === void 0 ? void 0 : res.exercise.map(function (v, k) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/classrooms/".concat(v.course_id, "/exercise/").concat(v.id, "/detail?random=").concat(v.random),
children: v.name
})
}, k);
})
})
})]
})
});
} else {
(0,util/* openNewWindow */.xg)("/shixuns/".concat(record.identifier, "/challenges"));
}
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
function onClick(_x2) {
return _onClick.apply(this, arguments);
}
return onClick;
}()
};
},
pagination: false,
dataSource: aa,
columns: columns
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
style: {
cursor: 'pointer'
},
onRow: function onRow(record) {
return {
onClick: function () {
var _onClick2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(e) {
var _res$exercise3;
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (0,shixuns/* existExercise */.Ee)({
id: record.identifier
});
case 2:
res = _context3.sent;
if (!!(res !== null && res !== void 0 && (_res$exercise3 = res.exercise) !== null && _res$exercise3 !== void 0 && _res$exercise3.length)) {
modal/* default.info */.Z.info({
title: "考试场景告知",
content: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u5F53\u524D\u5B9E\u8BAD\u5DF2\u88AB\u8003\u8BD5\u8C03\u7528\uFF0C\u4E14\u60A8\u6B63\u5728\u53C2\u52A0\u672C\u6B21\u8003\u8BD5\u3002\u8003\u8BD5\u573A\u666F\u4E0B\u5FC5\u987B\u4ECE\u8BD5\u5377\u4E2D\u8FDB\u5165\u5E76\u7B54\u9898\uFF0C\u5426\u5219\u7B54\u9898\u7ED3\u679C\u4E0D\u8BA1\u5165\u6210\u7EE9\u3002\u8BF7\u70B9\u51FB\u8BD5\u5377\u540D\u79F0\u8FDB\u5165\u8003\u8BD5\u3002"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: res === null || res === void 0 ? void 0 : res.exercise.map(function (v, k) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/classrooms/".concat(v.course_id, "/exercise/").concat(v.id, "/detail?random=").concat(v.random),
children: v.name
})
}, k);
})
})
})]
})
});
} else {
(0,util/* openNewWindow */.xg)("/shixuns/".concat(record.identifier, "/challenges"));
}
case 4:
case "end":
return _context3.stop();
}
}, _callee3);
}));
function onClick(_x3) {
return _onClick2.apply(this, arguments);
}
return onClick;
}()
};
},
pagination: false,
dataSource: aa,
columns: columns
})
});
};
/* harmony default export */ var Items_table = (table_Items);
// EXTERNAL MODULE: ./src/service/user.ts
var service_user = __webpack_require__(58839);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(84519);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/components/Group/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Groupmodules = ({"groupWrap":"groupWrap___AXrh6","directionItemWrap":"directionItemWrap___YnUMa","directionItem":"directionItem____jxOq","groupActionWrap":"groupActionWrap___xgw7Q","active":"active___AjCIl","directionContentWrap":"directionContentWrap___fsRsV","minWidth43":"minWidth43___cPjWW","minWidth48":"minWidth48___sqmWu","delete":"delete___eA60a"});
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/components/Group/index.tsx
var Group = function Group(_ref) {
var dispatch = _ref.dispatch,
_ref$isPreviewSelect = _ref.isPreviewSelect,
isPreviewSelect = _ref$isPreviewSelect === void 0 ? false : _ref$isPreviewSelect,
_ref$groupIds = _ref.groupIds,
groupIds = _ref$groupIds === void 0 ? [] : _ref$groupIds,
item_banks_groups = _ref.item_banks_groups,
_ref$getItem = _ref.getItem,
getItem = _ref$getItem === void 0 ? function () {} : _ref$getItem,
user = _ref.user,
_ref$onChangeGroup = _ref.onChangeGroup,
onChangeGroup = _ref$onChangeGroup === void 0 ? function () {} : _ref$onChangeGroup;
var value = (0,react.useRef)();
var handleDelete = function handleDelete(id) {
var _item_banks_groups$fi;
var findOriginValue = item_banks_groups === null || item_banks_groups === void 0 ? void 0 : (_item_banks_groups$fi = item_banks_groups.find(function (item) {
return item.id === id;
})) === null || _item_banks_groups$fi === void 0 ? void 0 : _item_banks_groups$fi.name;
modal/* default.confirm */.Z.confirm({
centered: true,
width: 424,
okText: '确定',
cancelText: '取消',
title: '删除目录',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "font14",
children: ["\u4F60\u6B63\u5728\u5220\u9664\u3010", findOriginValue, "\u3011\u76EE\u5F55\uFF0C\u672C\u64CD\u4F5C\u5C06\u5BFC\u81F4\u53EA\u52A0\u5165\u8BE5\u76EE\u5F55\u7684\u5B9E\u8BAD\u9879\u76EE\u91CD\u65B0\u5206\u914D\u5230\u3010\u672A\u52A0\u5165\u76EE\u5F55\u3011\u76EE\u5F55\u4E2D", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u786E\u8BA4\u5220\u9664\u5417\uFF1F"]
}),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _user$userInfo;
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/users/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login, "/user_setting_groups/").concat(id, ".json"), {
method: 'Delete'
});
case 2:
res = _context.sent;
(res === null || res === void 0 ? void 0 : res.status) === 0 && getItem();
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
};
var handleEdit = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(item) {
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
value.current = item.name;
modal/* default.confirm */.Z.confirm({
centered: true,
width: 424,
okText: '确定',
cancelText: '取消',
title: '编辑目录',
icon: null,
className: 'custom-modal-divider',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "font14",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
maxLength: 20,
placeholder: '请输入不超过20字的名称',
className: "mt10",
defaultValue: value.current,
onChange: function onChange(e) {
return value.current = e.target.value;
}
})
}),
onOk: function onOk() {
return new Promise( /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(resolve, reject) {
var _user$userInfo2;
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (value.current) {
_context2.next = 3;
break;
}
message/* default.info */.ZP.info('请输入目录名称');
return _context2.abrupt("return", reject());
case 3:
_context2.next = 5;
return (0,fetch/* default */.ZP)("/api/users/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login, "/user_setting_groups/").concat(item.id, ".json"), {
method: 'put',
body: {
name: value === null || value === void 0 ? void 0 : value.current
}
});
case 5:
res = _context2.sent;
(res === null || res === void 0 ? void 0 : res.status) === 0 && getItem();
resolve();
case 8:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x2, _x3) {
return _ref3.apply(this, arguments);
};
}());
}
});
case 2:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function handleEdit(_x) {
return _ref2.apply(this, arguments);
};
}();
return !!(item_banks_groups !== null && item_banks_groups !== void 0 && item_banks_groups.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Groupmodules.groupWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Groupmodules.minWidth43),
style: {
color: '#9096A3',
marginTop: 2,
marginRight: 6
},
children: "\u76EE\u5F55"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: "mb10 ".concat(Groupmodules.minWidth48, " ").concat(Groupmodules.directionItem, " ").concat(!(groupIds !== null && groupIds !== void 0 && groupIds.length) ? Groupmodules.active : ''),
onClick: function onClick() {
return onChangeGroup([]);
},
style: {
marginRight: 26
},
children: "\u5168\u90E8"
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Groupmodules.directionContentWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: "mb10 mr32 ".concat(Groupmodules.directionItem, " ").concat(groupIds !== null && groupIds !== void 0 && groupIds.includes(-1) ? Groupmodules.active : ''),
onClick: function onClick() {
return onChangeGroup([-1]);
},
children: "\u672A\u52A0\u5165\u76EE\u5F55"
}), item_banks_groups === null || item_banks_groups === void 0 ? void 0 : item_banks_groups.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Groupmodules.directionItemWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
onClick: function onClick() {
return onChangeGroup([item.id]);
},
className: "".concat(Groupmodules.directionItem, " mb10 ").concat(groupIds !== null && groupIds !== void 0 && groupIds.includes(item.id) ? Groupmodules.active : ''),
children: item.name
}, item.id), !isPreviewSelect && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Groupmodules.groupActionWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xiugai mr1 c-light-primary font15 current",
onClick: function onClick(e) {
e.stopPropagation();
handleEdit(item);
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shanchu4 mr1 c-red font15 current",
onClick: function onClick(e) {
e.stopPropagation();
handleDelete(item.id);
}
})]
})]
});
})]
})]
});
};
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
var ui_customization = __webpack_require__(35567);
// EXTERNAL MODULE: ./src/utils/authority.ts
var authority = __webpack_require__(7);
// EXTERNAL MODULE: ./src/components/ui-customization/reset.less?modules
var resetmodules = __webpack_require__(39132);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Shixuns/index.tsx
var _excluded = ["user", "userDetail", "globalSetting", "loading", "dispatch"];
var Shixuns = function Shixuns(_ref) {
var _user$userInfo2, _user$userInfo4, _GroupList$groups, _GroupList$groups2, _user$userInfo5, _GroupList$groups5;
var user = _ref.user,
userDetail = _ref.userDetail,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
var location = (0,_umi_production_exports.useLocation)();
var username = (0,react.useRef)();
var _useState = (0,react.useState)({}),
_useState2 = slicedToArray_default()(_useState, 2),
params = _useState2[0],
setParams = _useState2[1];
var _useState3 = (0,react.useState)(0),
_useState4 = slicedToArray_default()(_useState3, 2),
count = _useState4[0],
setCount = _useState4[1];
var _useState5 = (0,react.useState)([]),
_useState6 = slicedToArray_default()(_useState5, 2),
data = _useState6[0],
setData = _useState6[1];
var _useState7 = (0,react.useState)(),
_useState8 = slicedToArray_default()(_useState7, 2),
isCurrent = _useState8[0],
setIsCurrent = _useState8[1];
var _useState9 = (0,react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
showSearchText = _useState10[0],
setShowSearchText = _useState10[1];
var _useState11 = (0,react.useState)([{
label: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-juxingfenbu font14"
}),
value: 1
}, {
label: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-liebiaofenbu font14"
}),
value: 2
}]),
_useState12 = slicedToArray_default()(_useState11, 2),
plainOptions = _useState12[0],
setPlainOptions = _useState12[1];
var _useState13 = (0,react.useState)(parseInt(localStorage.getItem('ShixunShowType')) || 1),
_useState14 = slicedToArray_default()(_useState13, 2),
showType = _useState14[0],
setShowType = _useState14[1];
var _useState15 = (0,react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
isAdd = _useState16[0],
setIsAdd = _useState16[1]; //新增
var _useState17 = (0,react.useState)(false),
_useState18 = slicedToArray_default()(_useState17, 2),
AddGroup = _useState18[0],
setAddGroup = _useState18[1]; //加入目录
var _useState19 = (0,react.useState)(false),
_useState20 = slicedToArray_default()(_useState19, 2),
Ungroup = _useState20[0],
setUngroup = _useState20[1]; //撤销目录
var _useState21 = (0,react.useState)([]),
_useState22 = slicedToArray_default()(_useState21, 2),
GroupList = _useState22[0],
setGroupList = _useState22[1]; //目录数
var _useState23 = (0,react.useState)([]),
_useState24 = slicedToArray_default()(_useState23, 2),
item_banks_group_ids = _useState24[0],
setitem_banks_group_ids = _useState24[1];
var _useState25 = (0,react.useState)([]),
_useState26 = slicedToArray_default()(_useState25, 2),
groupids = _useState26[0],
setGroupIds = _useState26[1];
var _useState27 = (0,react.useState)(''),
_useState28 = slicedToArray_default()(_useState27, 2),
Addname = _useState28[0],
setAddname = _useState28[1];
var _useState29 = (0,react.useState)([]),
_useState30 = slicedToArray_default()(_useState29, 2),
checkedValues = _useState30[0],
setcheckedValues = _useState30[1];
var _useState31 = (0,react.useState)([]),
_useState32 = slicedToArray_default()(_useState31, 2),
UngroupValues = _useState32[0],
setUngroupValues = _useState32[1];
var _useState33 = (0,react.useState)([]),
_useState34 = slicedToArray_default()(_useState33, 2),
unGroupList = _useState34[0],
setUnGrouplist = _useState34[1];
var _useState35 = (0,react.useState)([]),
_useState36 = slicedToArray_default()(_useState35, 2),
unItemid = _useState36[0],
setUnItemid = _useState36[1];
(0,react.useEffect)(function () {
var _location$pathname$sp;
username.current = (_location$pathname$sp = location.pathname.split('/')) === null || _location$pathname$sp === void 0 ? void 0 : _location$pathname$sp[2];
var query = {
category: searchParams.get("category") || '',
status: searchParams.get("category") === 'manage' ? tagsTwo.map(function (item) {
return item.id;
}).includes(searchParams.get("status")) ? searchParams.get("status") : '' : searchParams.get("category") === "study" || searchParams.get("category") === "collect" ? tags.map(function (item) {
return item.id;
}).includes(searchParams.get("status")) ? searchParams.get("status") : '' : '',
page: 1,
per_page: 15,
sort_by: 'updated_at',
sort_direction: 'desc',
username: username.current,
search: '',
group_id: searchParams.get("group_id") || ''
};
setitem_banks_group_ids(searchParams.get("group_id") || '');
setParams(query);
getShixuns(query);
}, [location.pathname]);
(0,react.useEffect)(function () {
var _user$userInfo;
setIsCurrent(((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login) === username.current);
}, [(_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login, username.current]);
(0,react.useEffect)(function () {
var _user$userInfo3;
if ((_user$userInfo3 = user.userInfo) !== null && _user$userInfo3 !== void 0 && _user$userInfo3.login) getgroup();
}, [(_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.login]);
function getgroup() {
return _getgroup.apply(this, arguments);
}
function _getgroup() {
_getgroup = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8() {
var _user$userInfo9;
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
_context8.t0 = setGroupList;
_context8.next = 3;
return (0,fetch/* default */.ZP)("/api/users/".concat((_user$userInfo9 = user.userInfo) === null || _user$userInfo9 === void 0 ? void 0 : _user$userInfo9.login, "/user_setting_groups.json"), {
method: 'Get',
params: {
type: 'Shixun'
}
});
case 3:
_context8.t1 = _context8.sent;
(0, _context8.t0)(_context8.t1);
case 5:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return _getgroup.apply(this, arguments);
}
var handleChangeGroup = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(ids) {
var _window$location$href;
var res, _res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if ((_window$location$href = window.location.href.toString()) !== null && _window$location$href !== void 0 && _window$location$href.includes('group_id')) {
(0,util/* replaceParamVal */.jz)('group_id', (ids === null || ids === void 0 ? void 0 : ids.length) > 0 ? ids[0] : '');
} else {
window.history.replaceState(null, '', window.location.href.indexOf('?') > -1 ? window.location.href + "&group_id=".concat((ids === null || ids === void 0 ? void 0 : ids.length) > 0 ? ids[0] : '') : "?group_id=".concat((ids === null || ids === void 0 ? void 0 : ids.length) > 0 ? ids[0] : ''));
}
setitem_banks_group_ids(toConsumableArray_default()(ids));
params.page = 1;
params.group_id = '';
if (!((ids === null || ids === void 0 ? void 0 : ids.length) > 0)) {
_context.next = 11;
break;
}
_context.next = 7;
return dispatch({
type: 'userDetail/getShixuns',
payload: objectSpread2_default()(objectSpread2_default()({}, params), {}, {
group_id: ids[0]
})
});
case 7:
res = _context.sent;
if (res) {
setCount(res.count || 0);
setData(res.shixuns || []);
}
_context.next = 15;
break;
case 11:
_context.next = 13;
return dispatch({
type: 'userDetail/getShixuns',
payload: objectSpread2_default()({}, params)
});
case 13:
_res = _context.sent;
if (_res) {
setCount(_res.count || 0);
setData(_res.shixuns || []);
}
case 15:
case "end":
return _context.stop();
}
}, _callee);
}));
return function handleChangeGroup(_x) {
return _ref2.apply(this, arguments);
};
}();
var getShixuns = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(query) {
var clear,
res,
_res2,
_args2 = arguments;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
clear = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
if (!((item_banks_group_ids === null || item_banks_group_ids === void 0 ? void 0 : item_banks_group_ids.length) > 0)) {
_context2.next = 8;
break;
}
_context2.next = 4;
return dispatch({
type: 'userDetail/getShixuns',
payload: objectSpread2_default()(objectSpread2_default()({}, query), {}, {
group_id: clear ? null : item_banks_group_ids[0]
})
});
case 4:
res = _context2.sent;
if (res) {
setCount(res.count || 0);
setData(res.shixuns || []);
}
_context2.next = 12;
break;
case 8:
_context2.next = 10;
return dispatch({
type: 'userDetail/getShixuns',
payload: query
});
case 10:
_res2 = _context2.sent;
if (_res2) {
setCount(_res2.count || 0);
setData(_res2.shixuns || []);
}
case 12:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function getShixuns(_x2) {
return _ref3.apply(this, arguments);
};
}();
var handleChangeCategory = function handleChangeCategory(category) {
var _window$location$href2;
params.category = category;
params.status = '';
params.page = 1;
if ((_window$location$href2 = window.location.href.toString()) !== null && _window$location$href2 !== void 0 && _window$location$href2.includes('category')) {
(0,util/* replaceParamVal */.jz)('category', category);
(0,util/* replaceParamVal */.jz)('status', '');
} else {
window.history.replaceState(null, '', window.location.href.indexOf('?') > -1 ? window.location.href + "&category=".concat(category) : "?category=".concat(category));
}
setitem_banks_group_ids([]);
setParams(params);
getShixuns(params, true);
};
var handleChangeStatus = function handleChangeStatus(status) {
var _window$location$href3;
params.status = status;
params.page = 1;
if ((_window$location$href3 = window.location.href.toString()) !== null && _window$location$href3 !== void 0 && _window$location$href3.includes('status')) {
(0,util/* replaceParamVal */.jz)('status', status);
(0,util/* replaceParamVal */.jz)('group_id', '');
} else {
window.history.replaceState(null, '', window.location.href.indexOf('?') > -1 ? window.location.href + "&status=".concat(status) : "?status=".concat(status));
}
setParams(params);
getShixuns(params, true);
setitem_banks_group_ids([]);
};
var handleChangeOrder = function handleChangeOrder(sort_direction) {
params.sort_direction = sort_direction;
setParams(params);
getShixuns(params);
};
var handleChangeOrderField = function handleChangeOrderField(sort_by) {
params.sort_by = sort_by;
params.sort_direction = 'desc';
setParams(params);
getShixuns(params);
};
var handleChangePage = function handleChangePage(page, pageSize) {
params.page = page;
params.per_page = pageSize;
setParams(params);
getShixuns(params);
};
var handleSearch = function handleSearch(v) {
params.search = v;
params.page = 1;
setParams(params);
getShixuns(params);
};
var handleCancelCollect = function handleCancelCollect(id) {
modal/* default.confirm */.Z.confirm({
width: 416,
centered: true,
okText: '确定',
cancelText: '取消',
title: '取消收藏',
icon: null,
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc font14 ".concat(Shixunsmodules.modalContent),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-jingshi1 font14 mr5 ".concat(Shixunsmodules.colorFEB300)
}), "\u4F60\u786E\u5B9A\u8981\u53D6\u6D88\u6536\u85CF\u8BE5\u5B9E\u8DF5\u9879\u76EE\uFF1F"]
}),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (0,shixuns/* cancelCollect */.rs)({
container_id: id,
container_type: 'Shixun'
});
case 2:
res = _context3.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
message/* default.success */.ZP.success('已取消收藏');
getShixuns(params);
}
case 4:
case "end":
return _context3.stop();
}
}, _callee3);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
};
var handleRemove = function handleRemove(identifier) {
modal/* default.confirm */.Z.confirm({
width: 416,
centered: true,
okText: '确定',
cancelText: '取消',
title: '移除实践项目',
icon: null,
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc font14 ".concat(Shixunsmodules.modalContent),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-jingshi1 font14 mr5 ".concat(Shixunsmodules.colorFEB300)
}), "\u786E\u5B9A\u5C06\u8BE5\u5B9E\u8DF5\u9879\u76EE\u4ECE\u5B66\u4E60\u5217\u8868\u4E2D\u79FB\u9664\uFF1F"]
}),
onOk: function () {
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,service_user/* cancelShixun */.dE)({
identifier: identifier
});
case 2:
res = _context4.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
message/* default.success */.ZP.success('已移除');
getShixuns(params);
}
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
function onOk() {
return _onOk2.apply(this, arguments);
}
return onOk;
}()
});
};
var setGroupId = function setGroupId(ids) {
setGroupIds(toConsumableArray_default()(ids));
};
var setUnGrouplists = function setUnGrouplists(items, id) {
setUnGrouplist(toConsumableArray_default()(items));
setUnItemid([id]);
setUngroup(true);
};
var renderCategoryText = function renderCategoryText() {
var category = params.category == "collect" ? "共收藏" : "共参与";
var status = "";
if (params.category === "collect") {
status = "";
}
if (params.category === "manage") {
status = "发布";
}
if (params.category === "study") {
status = "学习";
}
if (!params.category) {
status = "实践项目";
}
return "".concat(category).concat(count, "\u4E2A").concat(status);
};
var renderOrderText = function renderOrderText() {
if (params.sort_by === 'updated_at') {
return '最新动态';
}
if (params.sort_by === 'created_at') {
return '语言类别';
}
if (params.sort_by === 'name') {
return '名称排序';
}
return '';
};
var tabs = [{
id: '',
name: '全部'
}, {
id: 'manage',
name: "".concat(isCurrent ? '我' : 'TA', "\u7BA1\u7406\u7684")
}, {
id: 'study',
name: "".concat(isCurrent ? '我' : 'TA', "\u5B66\u4E60\u7684")
}, {
id: 'collect',
name: "".concat(isCurrent ? '我' : 'TA', "\u6536\u85CF\u7684")
}];
var tags = [{
id: '',
name: '全部'
}, {
id: 'processing',
name: '未通关'
}, {
id: 'passed',
name: '已通关'
}];
var tagsTwo = [{
id: '',
name: '全部'
}, {
id: 'editing',
name: '编辑中'
}, {
id: 'applying',
name: '待审核'
}, {
id: 'published',
name: '已发布'
}, {
id: 'publiced',
name: '已公开'
}, {
id: 'closed',
name: '已关闭'
}];
var realTags = params.category === 'manage' ? tagsTwo : (params === null || params === void 0 ? void 0 : params.category) === "study" || (params === null || params === void 0 ? void 0 : params.category) === "collect" ? tags : [];
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Shixunsmodules.wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomTabs */.YG, {
value: params.category,
onChange: handleChangeCategory,
tabBarExtraContent: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomInput */.t7, {
style: {
width: 303
},
placeholder: "\u641C\u7D22\u5B9E\u8DF5\u9879\u76EE",
value: params.search,
onChange: handleSearch
}),
className: "mb25",
dataSource: tabs
}), isCurrent && !!params.category && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomTags */.qp, {
title: "\u72B6\u6001",
value: params.status,
onChange: handleChangeStatus,
dataSource: realTags,
titleWidth: 28
}), isCurrent && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Shixunsmodules.group,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Group, {
item_banks_groups: GroupList === null || GroupList === void 0 ? void 0 : GroupList.groups,
getItem: getgroup,
user: user,
groupIds: item_banks_group_ids,
onChangeGroup: handleChangeGroup
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Shixunsmodules.add,
style: {
border: (GroupList === null || GroupList === void 0 ? void 0 : (_GroupList$groups = GroupList.groups) === null || _GroupList$groups === void 0 ? void 0 : _GroupList$groups.length) <= 0 && 'none',
textAlign: (GroupList === null || GroupList === void 0 ? void 0 : (_GroupList$groups2 = GroupList.groups) === null || _GroupList$groups2 === void 0 ? void 0 : _GroupList$groups2.length) <= 0 && 'left'
},
onClick: function onClick() {
var _GroupList$groups3;
if ((GroupList === null || GroupList === void 0 ? void 0 : (_GroupList$groups3 = GroupList.groups) === null || _GroupList$groups3 === void 0 ? void 0 : _GroupList$groups3.length) === 20) {
message/* default.info */.ZP.info('目录数最大为20');
return;
}
setIsAdd(true);
},
children: "\u65B0\u5EFA\u76EE\u5F55"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Shixunsmodules.midWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* SuperiorSort */.cq, {
sortValue: params.sort_direction,
dropValue: params.sort_by,
onSort: handleChangeOrder,
onDrop: handleChangeOrderField
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Shixunsmodules.type,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: '图片模式',
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: showType === 1 ? "iconfont icon-fenbu ".concat(Shixunsmodules.cursorPointer, " ").concat(Shixunsmodules.color0152d9) : "iconfont icon-fenbu ".concat(Shixunsmodules.cursorPointer),
onClick: function onClick() {
setShowType(1);
localStorage.setItem('ShixunShowType', '1');
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Shixunsmodules.orderDesc,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: '列表模式',
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: showType === 2 ? "iconfont icon-fenbu-2 ".concat(Shixunsmodules.cursorPointer, " ").concat(Shixunsmodules.color0152d9, " ") : "iconfont icon-fenbu-2 ".concat(Shixunsmodules.cursorPointer),
onClick: function onClick() {
setShowType(2);
localStorage.setItem('ShixunShowType', '2');
}
})
})
})]
}), isCurrent && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: showType === 1 ? '请在列表模式中选中实训项目加入目录' : '请选择实践项目',
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
onClick: function onClick() {
var _GroupList$groups4;
if (showType === 1) {
return;
}
if ((groupids === null || groupids === void 0 ? void 0 : groupids.length) <= 0) {
message/* default.info */.ZP.info(showType === 1 ? '请在列表模式中选中实训项目加入目录' : '请选择实践项目');
return;
}
if ((GroupList === null || GroupList === void 0 ? void 0 : (_GroupList$groups4 = GroupList.groups) === null || _GroupList$groups4 === void 0 ? void 0 : _GroupList$groups4.length) <= 0) {
message/* default.info */.ZP.info('您尚未创建任何目录');
return;
}
setAddGroup(true);
},
style: {
marginLeft: 8,
color: showType === 1 ? '#00000040' : '#3061d0',
cursor: showType === 1 && 'no-drop'
},
children: "\u52A0\u5165\u76EE\u5F55"
})
}), !(((_user$userInfo5 = user.userInfo) === null || _user$userInfo5 === void 0 ? void 0 : _user$userInfo5.identity) === 'student' && !(0,authority/* isSuperAdmins */.Ny)()) && /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
style: {
marginLeft: 'auto'
},
className: Shixunsmodules.btn,
onClick: function onClick() {
return _umi_production_exports.history.push("/shixuns/new");
},
children: "\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(skeleton/* default */.Z, {
loading: loading['userDetail/getShixuns'],
active: true,
paragraph: {
rows: 5
},
children: [showType === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Shixunsmodules.cardWrap,
children: [!(data !== null && data !== void 0 && data.length) && (params.category || params.search) && /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_Items, {
data: data,
params: params,
user: user,
onRemove: handleRemove,
onCancelCollect: handleCancelCollect
})]
}), showType != 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "mt10",
style: {
minHeight: 400
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Items_table, {
number: (params.page - 1) * params.per_page,
onRemove: handleRemove,
user: user,
isCurrent: isCurrent,
onCancelCollect: handleCancelCollect,
setGroupIds: setGroupId,
setUnGrouplists: setUnGrouplists,
params: params,
data: data,
setParams: setParams,
getShixuns: getShixuns
})
}), count > 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Shixunsmodules.countWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100", "200"],
hideOnSinglePage: true,
total: count,
onChange: function onChange(page, pageSize) {
handleChangePage(page, pageSize);
},
pageSize: params.per_page,
current: params.page
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
open: isAdd,
title: '新建目录',
wrapClassName: resetmodules/* default.CustomCss */.Z.CustomCss,
onCancel: function onCancel() {
setIsAdd(false);
},
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
var _user$userInfo6;
var result;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return (0,fetch/* default */.ZP)("/api/users/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo6 = user.userInfo) === null || _user$userInfo6 === void 0 ? void 0 : _user$userInfo6.login, "/user_setting_groups.json"), {
method: 'post',
body: {
type: 'Shixun',
name: Addname
}
});
case 2:
result = _context5.sent;
if ((result === null || result === void 0 ? void 0 : result.status) === 0) {
message/* default.info */.ZP.info('创建目录成功');
setIsAdd(false);
setAddname('');
getgroup();
}
case 4:
case "end":
return _context5.stop();
}
}, _callee5);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
value: Addname,
onChange: function onChange(e) {
setAddname(e.target.value);
},
placeholder: "\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u4E2A\u5B57\u7684\u76EE\u5F55\u540D\u79F0",
maxLength: 20
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
open: AddGroup,
title: '加入目录',
onCancel: function onCancel() {
setAddGroup(false);
},
footer: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
textAlign: 'end'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
var _user$userInfo7;
var res;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
if (!((checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues.length) <= 0)) {
_context6.next = 3;
break;
}
message/* default.info */.ZP.info('请选择要加入的目录');
return _context6.abrupt("return");
case 3:
_context6.next = 5;
return (0,fetch/* default */.ZP)("/api/users/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo7 = user.userInfo) === null || _user$userInfo7 === void 0 ? void 0 : _user$userInfo7.login, "/user_setting_groups/join.json"), {
method: 'post',
body: {
type: 'Shixun',
group_ids: checkedValues,
item_ids: groupids
}
});
case 5:
res = _context6.sent;
(res === null || res === void 0 ? void 0 : res.status) === 0 && message/* default.info */.ZP.info('加入成功');
// getShixuns(params);
handleChangeGroup(item_banks_group_ids);
setcheckedValues([]);
setAddGroup(false);
setGroupIds([]);
case 11:
case "end":
return _context6.stop();
}
}, _callee6);
})),
children: "\u786E\u8BA4"
})
}),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u8BF7\u9009\u62E9\u9700\u8981\u52A0\u5165\u7684\u76EE\u5F55"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default.Group */.Z.Group, {
value: checkedValues,
onChange: function onChange(checkedValues) {
setcheckedValues(toConsumableArray_default()(checkedValues));
},
style: {
marginTop: "20px"
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
style: {
width: '400px'
},
children: GroupList === null || GroupList === void 0 ? void 0 : (_GroupList$groups5 = GroupList.groups) === null || _GroupList$groups5 === void 0 ? void 0 : _GroupList$groups5.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
span: 6,
style: {
marginTop: '10px'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
value: item.id,
style: {
fontSize: '14px'
},
children: item.name
})
});
})
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
open: Ungroup,
title: '撤销目录',
onCancel: function onCancel() {
setUngroup(false);
},
footer: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
textAlign: 'end'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7() {
var _user$userInfo8;
var res;
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
if (!((UngroupValues === null || UngroupValues === void 0 ? void 0 : UngroupValues.length) <= 0)) {
_context7.next = 3;
break;
}
message/* default.info */.ZP.info('请选择要撤销的目录');
return _context7.abrupt("return");
case 3:
_context7.next = 5;
return (0,fetch/* default */.ZP)("/api/users/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo8 = user.userInfo) === null || _user$userInfo8 === void 0 ? void 0 : _user$userInfo8.login, "/user_setting_groups/cancel.json"), {
method: 'post',
body: {
type: 'Shixun',
group_ids: UngroupValues,
item_ids: unItemid
}
});
case 5:
res = _context7.sent;
(res === null || res === void 0 ? void 0 : res.status) === 0 && message/* default.info */.ZP.info('撤销成功');
getShixuns(params);
setUngroupValues([]);
setUngroup(false);
setUnItemid([]);
case 11:
case "end":
return _context7.stop();
}
}, _callee7);
})),
children: "\u786E\u8BA4"
})
}),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u8BF7\u9009\u62E9\u9700\u8981\u64A4\u9500\u7684\u76EE\u5F55"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default.Group */.Z.Group, {
value: UngroupValues,
onChange: function onChange(checkedValues) {
setUngroupValues(toConsumableArray_default()(checkedValues));
},
style: {
marginTop: "20px"
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
style: {
width: '400px'
},
children: unGroupList === null || unGroupList === void 0 ? void 0 : unGroupList.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
span: 6,
style: {
marginTop: '10px'
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
value: item.id,
style: {
fontSize: '14px'
},
children: item.name
})
});
})
})
})]
})
})]
});
};
/* harmony default export */ var Detail_Shixuns = ((0,_umi_production_exports.connect)(function (_ref7) {
var user = _ref7.user,
userDetail = _ref7.userDetail,
loading = _ref7.loading,
globalSetting = _ref7.globalSetting;
return {
user: user,
userDetail: userDetail,
globalSetting: globalSetting,
loading: loading.effects
};
})(Shixuns));
/***/ }),
/***/ 39132:
/*!************************************************************!*\
!*** ./src/components/ui-customization/reset.less?modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
// extracted by mini-css-extract-plugin
/* harmony default export */ __webpack_exports__["Z"] = ({"flex_box_center":"flex_box_center___vG4eV","flex_space_between":"flex_space_between___qVVxe","flex_box_vertical_center":"flex_box_vertical_center___P8Z8s","flex_box_center_end":"flex_box_center_end___VMme3","flex_box_column":"flex_box_column___VMHwm","dropdownmenus":"dropdownmenus___oVzoj","popupClassNames":"popupClassNames___OcZq7","selectdown":"selectdown___mmcA8"});
/***/ })
}]);