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

426 lines
18 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[5670],{
/***/ 87734:
/*!******************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/Collection/index.tsx + 1 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 */ Exercise_Collection; }
});
// 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/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// 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/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(39647);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(75936);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/breadcrumb/index.js + 6 modules
var breadcrumb = __webpack_require__(66104);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/pagination/index.js + 10 modules
var pagination = __webpack_require__(86859);
// 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/message/index.js + 4 modules
var message = __webpack_require__(8591);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Collection/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Collectionmodules = ({"contentListWrap":"contentListWrap___Ddghn","li":"li___wvr6Y","bottom":"bottom___OePHJ","actionLeftItem":"actionLeftItem___Hv4KU","tipLabel":"tipLabel___t7Ubm","tipVal":"tipVal___wipZz","questionTypeName":"questionTypeName___uMnDn","more":"more___GKswk","textBtn":"textBtn___zsrM5","line":"line___g8Y3f","b1":"b1___Hkokb","b2":"b2___bklGC"});
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Collection/Topic/index.tsx + 1 modules
var Topic = __webpack_require__(57966);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(50883);
// EXTERNAL MODULE: ./src/service/exercise.ts
var service_exercise = __webpack_require__(33571);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/Collection/index.tsx
var _excluded = ["exercise", "globalSetting", "loading", "dispatch", "classroomList", "user", "match"];
var Collection = function Collection(_ref) {
var _user$userInfo, _user$userInfo2;
var exercise = _ref.exercise,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
dispatch = _ref.dispatch,
classroomList = _ref.classroomList,
user = _ref.user,
match = _ref.match,
props = objectWithoutProperties_default()(_ref, _excluded);
var params = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
cancleCollectVis = _useState2[0],
setCancleCollectVis = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
btnLoading = _useState4[0],
setBtnLoading = _useState4[1];
var childRefs = (0,_react_17_0_2_react.useRef)({});
var course_id = user === null || user === void 0 || (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 || (_user$userInfo = _user$userInfo.course) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.course_id;
var _useState5 = (0,_react_17_0_2_react.useState)(''),
_useState6 = slicedToArray_default()(_useState5, 2),
cancleId = _useState6[0],
setCancleId = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)({
course_id: course_id || params.classId,
page: 1,
limit: 10
}),
_useState8 = slicedToArray_default()(_useState7, 2),
routeParams = _useState8[0],
setRouteParams = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
spinLoading = _useState10[0],
setSpinLoading = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(20),
_useState12 = slicedToArray_default()(_useState11, 2),
problemsetCount = _useState12[0],
setProblemsetCount = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)([]),
_useState14 = slicedToArray_default()(_useState13, 2),
problemsetList = _useState14[0],
setProblemsetList = _useState14[1];
var questionType = [{
type: 'SINGLE',
name: '单选题',
question_type: 0
}, {
type: 'MULTIPLE',
name: '多选题',
question_type: 1
}, {
type: 'JUDGMENT',
name: '判断题',
question_type: 2
}, {
type: 'PROGRAM',
name: '编程题',
question_type: 6
}, {
type: 'SUBJECTIVE',
name: '简答题',
question_type: 4
}, {
type: 'COMPLETION',
name: '填空题',
question_type: 3
}, {
type: 'COMBINATION',
name: '组合题',
question_type: 7
}, {
type: 'BPROGRAM',
name: '程序填空题',
question_type: 8
}];
var difficultyMapping = {
1: "简单",
2: "适中",
3: "困难"
};
var handleDetailClick = function handleDetailClick(id, isWarning) {
if (isWarning) {
return;
}
if (childRefs.current[id]) {
childRefs.current[id].expandDetail();
}
};
var getCollectionList = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, _res$data, _res$data2;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setSpinLoading(true);
_context.next = 3;
return (0,service_exercise/* getCollectQuestions */.BV)(objectSpread2_default()({}, routeParams));
case 3:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setProblemsetCount((res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.count) || 0);
setProblemsetList((res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list) || []);
}
setSpinLoading(false);
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getCollectionList() {
return _ref2.apply(this, arguments);
};
}();
(0,_react_17_0_2_react.useEffect)(function () {
getCollectionList();
}, [course_id]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: Collectionmodules.bg,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "edu-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("section", {
className: "animated fadeIn",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: "mt10",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(breadcrumb/* default */.Z, {
separator: ">",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
href: "/classrooms/".concat(params.coursesId, "/exercise"),
children: user === null || user === void 0 || (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 || (_user$userInfo2 = _user$userInfo2.course) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.course_name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
href: "/classrooms/".concat(params.coursesId, "/exercise"),
children: "\u5728\u7EBF\u8003\u8BD5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
children: "\u6536\u85CF\u5939"
})]
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30 mb30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "icon-font icon-fanhui-bishe font12 current",
onClick: function onClick() {
_umi_production_exports.history.back();
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
fontSize: '16px',
color: '#333333',
marginLeft: '10px'
},
children: "\u6536\u85CF\u5939"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Collectionmodules.contentListWrap,
children: problemsetCount !== 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
size: 'middle',
spinning: spinLoading,
children: [problemsetList.map(function (v, index) {
var _questionType$find;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Collectionmodules.li,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Collectionmodules.top,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Topic/* default */.Z, {
data: v,
selectIds: [],
onSelectCheckBox: function onSelectCheckBox() {},
showCheckbox: false,
ref: function ref(el) {
return childRefs.current[v.question_id] = el;
}
}, v.question_id)
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Collectionmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "".concat(Collectionmodules.actionLeftItem, " ").concat(Collectionmodules.questionTypeName),
children: ["No.", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "".concat(Collectionmodules.actionLeftItem, " ").concat(Collectionmodules.questionTypeName),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Collectionmodules.tipLabel, " mr5"),
children: "\u9898\u578B"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Collectionmodules.tipVal,
children: (_questionType$find = questionType.find(function (item) {
return item.question_type === v.question_type;
})) === null || _questionType$find === void 0 ? void 0 : _questionType$find.name
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: Collectionmodules.actionLeftItem,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Collectionmodules.tipLabel, " mr5"),
children: "\u96BE\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Collectionmodules.tipVal,
children: difficultyMapping[v.difficulty]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Collectionmodules.more,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Collectionmodules.textBtn,
style: {
cursor: 'pointer'
},
onClick: function onClick() {
setCancleCollectVis(true);
setCancleId(v.question_id);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Collectionmodules.line,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: Collectionmodules.b1
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: Collectionmodules.b2
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#E53333'
},
children: "\u53D6\u6D88\u6536\u85CF"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Collectionmodules.line,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: Collectionmodules.b1
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: Collectionmodules.b2
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: Collectionmodules.textBtn,
style: {
cursor: 'pointer'
},
onClick: function onClick() {
handleDetailClick(v.question_id, v.is_warning);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-chengxinkaoshishengming font14 mr5",
style: {
color: '#3061D0'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#3061D0'
},
children: "\u8BE6\u60C5"
})]
})]
})]
})]
}, index);
}), /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
defaultCurrent: 1,
defaultPageSize: 10,
current: (routeParams === null || routeParams === void 0 ? void 0 : routeParams.page) || 1,
showSizeChanger: false,
showQuickJumper: true
// hideOnSinglePage
,
total: problemsetCount,
showTotal: function showTotal(total) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "mr10",
children: ["\u5171", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-orange",
children: total
}), "\u6761\u6570\u636E"]
});
},
className: "mb20",
onChange: function onChange(current) {
routeParams.page = current;
setRouteParams(objectSpread2_default()({}, routeParams));
getCollectionList();
}
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
size: 'middle',
spinning: spinLoading,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NoData/* default */.Z, {})
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
title: "\u63D0\u793A",
open: cancleCollectVis,
maskClosable: false,
confirmLoading: btnLoading,
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
destroyOnClose: true,
onCancel: function onCancel() {
setCancleCollectVis(false);
},
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var bodyParams, res, updatedRefs;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setBtnLoading(true);
bodyParams = {
container_id: cancleId,
container_type: 'ExerciseQuestion',
course_id: course_id
};
_context2.next = 4;
return (0,service_exercise/* cancleCollectQuestion */._o)(objectSpread2_default()({}, bodyParams));
case 4:
res = _context2.sent;
if (res.status === 0) {
message/* default */.ZP.success('取消成功!');
updatedRefs = objectSpread2_default()({}, childRefs.current);
delete updatedRefs[cancleId]; // 清除已删除项的引用
childRefs.current = updatedRefs; // 更新引用对象
getCollectionList();
}
setBtnLoading(false);
setCancleCollectVis(false);
case 8:
case "end":
return _context2.stop();
}
}, _callee2);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "\u786E\u8BA4\u8981\u5C06\u8BE5\u8BD5\u9898\u53D6\u6D88\u6536\u85CF\u5417\uFF1F"
})
})]
});
};
/* harmony default export */ var Exercise_Collection = ((0,_umi_production_exports.connect)(function (_ref4) {
var exercise = _ref4.exercise,
loading = _ref4.loading,
user = _ref4.user,
globalSetting = _ref4.globalSetting,
classroomList = _ref4.classroomList;
return {
classroomList: classroomList,
exercise: exercise,
globalSetting: globalSetting,
user: user,
loading: loading.effects
};
})(Collection));
/***/ })
}]);