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

508 lines
22 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[76737],{
/***/ 78586:
/*!************************************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/MisCollection/CollectionList/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 */ CollectionList; }
});
// 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__(65363);
// 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/button/index.js
var es_button = __webpack_require__(3113);
// 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/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__(27092);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/MisCollection/CollectionList/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var CollectionListmodules = ({"contentListWrap":"contentListWrap___i61gD","li":"li___gxMyq","bottom":"bottom___Dd6Ho","actionLeftItem":"actionLeftItem___fPOL6","questionTypeName":"questionTypeName___PLOrd","more":"more___cxQWQ","textBtn":"textBtn___RJoUd","line":"line___cIykK","b1":"b1___Ia8NJ","b2":"b2___auPd6","btn":"btn___zsCi9","navSty":"navSty___Y5_6J","practiceSty":"practiceSty___aoMRM","btn2":"btn2___qBe8c"});
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/Collection/Topic/index.tsx + 1 modules
var Topic = __webpack_require__(94142);
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__(13261);
// EXTERNAL MODULE: ./src/service/exercise.ts
var service_exercise = __webpack_require__(91810);
// 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/MisCollection/CollectionList/index.tsx
var _excluded = ["exercise", "globalSetting", "loading", "dispatch", "classroomList", "user", "match"];
var MisCollection = function MisCollection(_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)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
btn2Loading = _useState12[0],
setBtn2Loading = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(0),
_useState14 = slicedToArray_default()(_useState13, 2),
wrongCount = _useState14[0],
setWrongCount = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(20),
_useState16 = slicedToArray_default()(_useState15, 2),
problemsetCount = _useState16[0],
setProblemsetCount = _useState16[1];
var _useState17 = (0,_react_17_0_2_react.useState)([]),
_useState18 = slicedToArray_default()(_useState17, 2),
problemsetList = _useState18[0],
setProblemsetList = _useState18[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) {
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/* collectExerciseQuestion */.Kw)(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();
getQuestionSetting();
}, []);
var startWrongQuestion = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setBtn2Loading(true);
_context2.next = 3;
return (0,service_exercise/* exerciseQuestion */.zE)({
id: params.coursesId
});
case 3:
res = _context2.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0 && res !== null && res !== void 0 && res.exercise_id) {
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/").concat(res === null || res === void 0 ? void 0 : res.exercise_id, "/misCollection/practice"));
}
setBtn2Loading(false);
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function startWrongQuestion() {
return _ref3.apply(this, arguments);
};
}();
var getQuestionSetting = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res, _res$data3;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (0,service_exercise/* getWrongQuestionSetting */.jC)({
coursesId: params.coursesId
});
case 2:
res = _context3.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setWrongCount(res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.wrong_question_count);
}
case 4:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function getQuestionSetting() {
return _ref4.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: CollectionListmodules.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, {
href: "/classrooms/".concat(params.coursesId, "/misCollection"),
children: "\u9519\u9898\u96C6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
children: "\u9519\u9898\u5217\u8868"
})]
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mt30 mb30 ".concat(CollectionListmodules.navSty),
style: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
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: "\u9519\u9898\u5217\u8868"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CollectionListmodules.practiceSty,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: CollectionListmodules.btn2,
loading: btn2Loading,
onClick: function onClick() {
if (wrongCount > 0) {
startWrongQuestion();
} else {
message/* default */.ZP.info('暂无错题~');
}
},
children: "\u5F00\u59CB\u7EC3\u4E60"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CollectionListmodules.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: CollectionListmodules.li,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CollectionListmodules.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: CollectionListmodules.bottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "".concat(CollectionListmodules.actionLeftItem, " ").concat(CollectionListmodules.questionTypeName),
children: ["No.", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "".concat(CollectionListmodules.actionLeftItem, " ").concat(CollectionListmodules.questionTypeName),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(CollectionListmodules.tipLabel, " mr5"),
children: "\u9898\u578B"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: CollectionListmodules.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: CollectionListmodules.actionLeftItem,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(CollectionListmodules.tipLabel, " mr5"),
children: "\u96BE\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: CollectionListmodules.tipVal,
children: difficultyMapping[v.difficulty]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CollectionListmodules.more,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: CollectionListmodules.textBtn,
style: {
cursor: 'pointer'
},
onClick: function onClick() {
setCancleCollectVis(true);
setCancleId(v.id);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CollectionListmodules.line,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: CollectionListmodules.b1
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: CollectionListmodules.b2
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#E53333'
},
children: "\u79FB\u9664"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CollectionListmodules.line,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: CollectionListmodules.b1
}), /*#__PURE__*/(0,jsx_runtime.jsx)("b", {
className: CollectionListmodules.b2
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: CollectionListmodules.textBtn,
style: {
cursor: 'pointer'
},
onClick: function onClick() {
handleDetailClick(v.question_id);
},
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 _callee4() {
var bodyParams, res, updatedRefs;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
setBtnLoading(true);
bodyParams = {
course_wrong_question_id: cancleId
};
_context4.next = 4;
return (0,service_exercise/* removeWrongQuestion */.g8)(objectSpread2_default()({}, bodyParams));
case 4:
res = _context4.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 _context4.stop();
}
}, _callee4);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "\u786E\u8BA4\u8981\u5C06\u8BE5\u8BD5\u9898\u4ECE\u9519\u9898\u96C6\u4E2D\u79FB\u9664\u5417\uFF1F"
})
})]
});
};
/* harmony default export */ var CollectionList = ((0,_umi_production_exports.connect)(function (_ref6) {
var exercise = _ref6.exercise,
loading = _ref6.loading,
user = _ref6.user,
globalSetting = _ref6.globalSetting,
classroomList = _ref6.classroomList;
return {
classroomList: classroomList,
exercise: exercise,
globalSetting: globalSetting,
user: user,
loading: loading.effects
};
})(MisCollection));
/***/ })
}]);