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.
1629 lines
65 KiB
1629 lines
65 KiB
(self["webpackChunk"] = self["webpackChunk"] || []).push([[14064],{
|
|
|
|
/***/ 57732:
|
|
/*!*****************************************!*\
|
|
!*** ./src/components/NoData/index.tsx ***!
|
|
\*****************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 93314);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 3113);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_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_test5_node_modules_babel_runtime_7_23_2_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_test5_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test5_node_modules_babel_runtime_7_23_2_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);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1255:
|
|
/*!*********************************************************************************!*\
|
|
!*** ./src/pages/CoreCurriculum/components/AddOrEditCore/index.tsx + 2 modules ***!
|
|
\*********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ AddOrEditCore; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(26801);
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(10574);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(39343);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(11006);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(27161);
|
|
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: ./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);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
var es_form = __webpack_require__(78241);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
var input = __webpack_require__(1056);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
|
|
var col = __webpack_require__(43604);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
|
|
var table = __webpack_require__(72315);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
|
|
var upload = __webpack_require__(6557);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(67871);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseCircleFilled.js + 1 modules
|
|
var CloseCircleFilled = __webpack_require__(48796);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
|
|
var ui_customization = __webpack_require__(23878);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/components/ImgUploadForm/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["ButtonText", "ButtonOptions"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddOrEdit = function AddOrEdit(_ref) {
|
|
var _file$response2;
|
|
var ButtonText = _ref.ButtonText,
|
|
ButtonOptions = _ref.ButtonOptions,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
file = _useState2[0],
|
|
setFile = _useState2[1];
|
|
var uploadProps = {
|
|
maxCount: 1,
|
|
accept: "image/*",
|
|
withCredentials: true,
|
|
beforeUpload: function beforeUpload(file) {
|
|
var fileSize = file.size / 1024 / 1024;
|
|
if (fileSize == 0) {
|
|
message/* default */.ZP.error("".concat(file.name, " \u56FE\u7247\u65E0\u6CD5\u4E0A\u4F20\u3002").concat(fileSize == 0 ? "文件内容不能为空" : '超过图片大小限制(2MB)'));
|
|
return upload/* default */.Z.LIST_IGNORE;
|
|
}
|
|
return true;
|
|
},
|
|
onChange: function onChange(info) {
|
|
var statusList = ["uploading", "done", "removed"];
|
|
if (statusList.includes(info.file.status)) {
|
|
setFile(info.file);
|
|
}
|
|
if (info.file.status == "done") {
|
|
var _info$file;
|
|
props === null || props === void 0 || props.onChange((_info$file = info.file) === null || _info$file === void 0 || (_info$file = _info$file.response) === null || _info$file === void 0 ? void 0 : _info$file.id);
|
|
}
|
|
},
|
|
onRemove: function () {
|
|
var _onRemove = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(file) {
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
close();
|
|
case 1:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
function onRemove(_x) {
|
|
return _onRemove.apply(this, arguments);
|
|
}
|
|
return onRemove;
|
|
}(),
|
|
action: "".concat(env/* default */.Z.API_SERVER, "/api/attachments.json")
|
|
};
|
|
var renderImg = function renderImg() {
|
|
var _file$response;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
align: "middle",
|
|
justify: "center",
|
|
style: {
|
|
position: "relative",
|
|
width: 400,
|
|
backgroundColor: "#f4f3f4"
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: env/* default */.Z.API_SERVER + "/api/attachments/" + (file === null || file === void 0 || (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.id),
|
|
alt: "avatar",
|
|
style: {
|
|
width: '100%'
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
position: "absolute",
|
|
right: "-6px",
|
|
top: "-6px",
|
|
cursor: "pointer",
|
|
width: 16,
|
|
height: 16,
|
|
borderRadius: "50%",
|
|
backgroundColor: "#fff"
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(CloseCircleFilled/* default */.Z, {
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
close();
|
|
case 1:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
})),
|
|
style: {
|
|
fontSize: '16px',
|
|
color: 'red'
|
|
}
|
|
})
|
|
})]
|
|
});
|
|
};
|
|
var close = function close() {
|
|
setFile(null);
|
|
props === null || props === void 0 || props.onChange();
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
(props === null || props === void 0 ? void 0 : props.value) && setFile({
|
|
response: {
|
|
id: props === null || props === void 0 ? void 0 : props.value
|
|
}
|
|
});
|
|
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
id: (props === null || props === void 0 ? void 0 : props.scrollId) || '',
|
|
children: file !== null && file !== void 0 && (_file$response2 = file.response) !== null && _file$response2 !== void 0 && _file$response2.id ? renderImg() : /*#__PURE__*/(0,jsx_runtime.jsx)(upload/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, uploadProps), {}, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, objectSpread2_default()(objectSpread2_default()({
|
|
style: objectSpread2_default()({
|
|
borderRadius: "2px"
|
|
}, ButtonOptions === null || ButtonOptions === void 0 ? void 0 : ButtonOptions.style)
|
|
}, ButtonOptions), {}, {
|
|
children: ButtonText
|
|
}))
|
|
}))
|
|
});
|
|
};
|
|
/* harmony default export */ var ImgUploadForm = (AddOrEdit);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
|
|
var toConsumableArray = __webpack_require__(93923);
|
|
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
|
|
var es_checkbox = __webpack_require__(24905);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/select/index.js
|
|
var es_select = __webpack_require__(57809);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/auto-complete/index.js
|
|
var auto_complete = __webpack_require__(88522);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller = __webpack_require__(26724);
|
|
var _react_infinite_scroller_1_2_4_react_infinite_scroller_default = /*#__PURE__*/__webpack_require__.n(_react_infinite_scroller_1_2_4_react_infinite_scroller);
|
|
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.10@dayjs/dayjs.min.js
|
|
var dayjs_min = __webpack_require__(9498);
|
|
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
|
|
// EXTERNAL MODULE: ./src/service/classrooms.ts
|
|
var classrooms = __webpack_require__(70622);
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 32 modules
|
|
var ImagesIcon = __webpack_require__(60638);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(15830);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
var _umi_production_exports = __webpack_require__(22211);
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/components/AddOrEditCore/AddTeacher.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddTeacher = function AddTeacher(_ref) {
|
|
var _actionTabs$selectArr, _actionTabs$selectArr2;
|
|
var classroomList = _ref.classroomList,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch;
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
var actionTabs = classroomList.actionTabs;
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
options = _useState2[0],
|
|
setOptions = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
hasMore = _useState4[0],
|
|
setHasmore = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
isLoading = _useState6[0],
|
|
setIsLoading = _useState6[1];
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
form = _Form$useForm2[0];
|
|
var _useState7 = (0,_react_17_0_2_react.useState)([]),
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
tableData = _useState8[0],
|
|
setTableData = _useState8[1];
|
|
var _useState9 = (0,_react_17_0_2_react.useState)(0),
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
page = _useState10[0],
|
|
setPage = _useState10[1];
|
|
var _useState11 = (0,_react_17_0_2_react.useState)([]),
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
selectArrs = _useState12[0],
|
|
setSelectArrs = _useState12[1];
|
|
var _useState13 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState14 = slicedToArray_default()(_useState13, 2),
|
|
notSearch = _useState14[0],
|
|
setNotSearch = _useState14[1];
|
|
var autoCompleteRef = (0,_react_17_0_2_react.useRef)();
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (classroomList.actionTabs.key === '添加成员') {
|
|
setNotSearch(true);
|
|
getData();
|
|
}
|
|
}, [classroomList.actionTabs.key]);
|
|
var getData = /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return dispatch({
|
|
type: 'classroomList/getSchoolList',
|
|
payload: {}
|
|
});
|
|
case 2:
|
|
res = _context.sent;
|
|
setOptions(res.map(function (item) {
|
|
return {
|
|
value: item
|
|
};
|
|
}));
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function getData() {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}();
|
|
var onFinish = function onFinish() {
|
|
var _form$getFieldValue;
|
|
if (((_form$getFieldValue = form.getFieldValue()) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.keyword) === '') {
|
|
setTableData([]);
|
|
message/* default */.ZP.error("请输入搜索内容");
|
|
return;
|
|
}
|
|
;
|
|
setNotSearch(false);
|
|
setHasmore(true);
|
|
setIsLoading(false);
|
|
setSelectArrs([]);
|
|
setTimeout(function () {
|
|
handleInfiniteOnLoad(true);
|
|
}, 200);
|
|
};
|
|
var saveSelect = function saveSelect(id) {
|
|
id = String(id);
|
|
var key = selectArrs.indexOf(id);
|
|
if (key < 0) {
|
|
selectArrs.push(id);
|
|
} else {
|
|
selectArrs.splice(key, 1);
|
|
}
|
|
setSelectArrs(toConsumableArray_default()(selectArrs));
|
|
};
|
|
var handleInfiniteOnLoad = /*#__PURE__*/function () {
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var reload,
|
|
_res$users,
|
|
formValue,
|
|
res,
|
|
_args2 = arguments;
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
reload = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
|
|
if (!((reload || hasMore) && !isLoading)) {
|
|
_context2.next = 11;
|
|
break;
|
|
}
|
|
formValue = form.getFieldValue();
|
|
setIsLoading(true);
|
|
setPage(reload ? 1 : page + 1);
|
|
_context2.next = 7;
|
|
return (0,classrooms/* searchSchoolTeacherList */.nQ)(objectSpread2_default()({
|
|
page: reload ? 1 : page + 1,
|
|
container_id: params.coursesId,
|
|
container_type: 1,
|
|
school_name: formValue === null || formValue === void 0 ? void 0 : formValue.school_name,
|
|
keyword: formValue === null || formValue === void 0 ? void 0 : formValue.keyword
|
|
}, formValue));
|
|
case 7:
|
|
res = _context2.sent;
|
|
reload ? setTableData(toConsumableArray_default()(res.users)) : setTableData([].concat(toConsumableArray_default()(tableData), toConsumableArray_default()(res.users)));
|
|
setIsLoading(false);
|
|
if (((_res$users = res.users) === null || _res$users === void 0 ? void 0 : _res$users.length) < 10) setHasmore(false);
|
|
case 11:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return function handleInfiniteOnLoad() {
|
|
return _ref3.apply(this, arguments);
|
|
};
|
|
}();
|
|
var onOK = /*#__PURE__*/function () {
|
|
var _ref4 = 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:
|
|
if (!(selectArrs == '')) {
|
|
_context3.next = 4;
|
|
break;
|
|
}
|
|
message/* default */.ZP.error('请选择人数');
|
|
_context3.next = 9;
|
|
break;
|
|
case 4:
|
|
console.log(params);
|
|
_context3.next = 7;
|
|
return (0,fetch/* default */.ZP)("/api/core_subjects/".concat(params.coreId, "/add_members.json"), {
|
|
method: 'post',
|
|
body: {
|
|
user_ids: selectArrs.map(function (v) {
|
|
return v;
|
|
})
|
|
}
|
|
});
|
|
case 7:
|
|
res = _context3.sent;
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.success('添加成功');
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
dispatch({
|
|
type: "coreCurriculum/getCoreSubjectDetail",
|
|
payload: {
|
|
id: params.coreId
|
|
}
|
|
});
|
|
}
|
|
case 9:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
return function onOK() {
|
|
return _ref4.apply(this, arguments);
|
|
};
|
|
}();
|
|
var columns = [{
|
|
title: "",
|
|
dataIndex: "added",
|
|
width: 40,
|
|
ellipsis: true,
|
|
render: function render(add, record) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
value: record.numid,
|
|
checked: selectArrs.includes(String(record.numid)),
|
|
disabled: !!add
|
|
});
|
|
}
|
|
}, {
|
|
title: "姓名",
|
|
width: 100,
|
|
ellipsis: true,
|
|
dataIndex: "username",
|
|
render: function render(text, record) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
className: "bold c-black",
|
|
to: "/users/".concat(record.login),
|
|
target: "_blank",
|
|
children: text || '--'
|
|
})
|
|
});
|
|
}
|
|
}, {
|
|
title: "手机",
|
|
width: 100,
|
|
dataIndex: "phone",
|
|
ellipsis: true,
|
|
render: function render(text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: text || '--'
|
|
})
|
|
});
|
|
}
|
|
}, {
|
|
title: "邮箱",
|
|
dataIndex: "email",
|
|
width: 100,
|
|
ellipsis: true,
|
|
render: function render(text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: text || '--'
|
|
})
|
|
});
|
|
}
|
|
}, {
|
|
title: "学号/工号",
|
|
width: 100,
|
|
dataIndex: "student_number",
|
|
ellipsis: true,
|
|
render: function render(text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: text || '--'
|
|
})
|
|
});
|
|
}
|
|
}, {
|
|
title: "学校/单位",
|
|
width: 150,
|
|
dataIndex: "school_name",
|
|
ellipsis: true,
|
|
render: function render(text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: text || '--'
|
|
})
|
|
});
|
|
}
|
|
},
|
|
// {
|
|
// title: "院系/部门",
|
|
// dataIndex: "depart_name",
|
|
// width: 130,
|
|
// ellipsis: true,
|
|
// render: (text: string) => {
|
|
// return <Tooltip placement="bottom" title={text}><span>{text || '--'}</span></Tooltip>
|
|
// }
|
|
// },
|
|
// {
|
|
// title: "实名认证",
|
|
// dataIndex: "school_name",
|
|
// width: 100,
|
|
// render: (text: string) => text ? '是' : "否"
|
|
// },
|
|
{
|
|
title: "最后登录时间",
|
|
dataIndex: "last_login_on",
|
|
width: 140,
|
|
ellipsis: true,
|
|
render: function render(text) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
placement: "bottom",
|
|
title: text,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: dayjs_min_default()(text).format("YYYY-MM-DD HH:mm")
|
|
})
|
|
});
|
|
}
|
|
}, {
|
|
title: "状态",
|
|
dataIndex: "added",
|
|
width: 80,
|
|
render: function render(text) {
|
|
if (text === 1) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "c-green",
|
|
children: "\u5DF2\u6DFB\u52A0"
|
|
});
|
|
}
|
|
}
|
|
}];
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
|
|
centered: true,
|
|
title: "\u6DFB\u52A0\u6210\u5458",
|
|
open: classroomList.actionTabs.key === '添加成员' ? true : false,
|
|
okText: "\u786E\u5B9A",
|
|
cancelText: "\u53D6\u6D88",
|
|
width: 1100,
|
|
zIndex: 1000,
|
|
bodyStyle: {
|
|
minHeight: 200
|
|
},
|
|
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
onOK();
|
|
case 1:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
})),
|
|
onCancel: function onCancel() {
|
|
setSelectArrs([]);
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {}
|
|
});
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
layout: "inline",
|
|
form: form,
|
|
initialValues: {
|
|
school_name: "",
|
|
keyword: "",
|
|
search_type: '1'
|
|
},
|
|
className: "mt10"
|
|
// onFinish={onFinish}
|
|
,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "search_type",
|
|
label: "\u641C\u7D22\u7C7B\u578B",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
|
|
style: {
|
|
width: 90
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
value: "1",
|
|
children: "\u59D3\u540D"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
value: "2",
|
|
children: "\u624B\u673A\u53F7"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
value: "3",
|
|
children: "\u90AE\u7BB1"
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "keyword",
|
|
label: "\u641C\u7D22\u5185\u5BB9\uFF1A",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
allowClear: true,
|
|
style: {
|
|
width: 250
|
|
},
|
|
size: 'middle',
|
|
defaultValue: ((_actionTabs$selectArr = actionTabs.selectArrs) === null || _actionTabs$selectArr === void 0 ? void 0 : _actionTabs$selectArr.category_name) || ((_actionTabs$selectArr2 = actionTabs.selectArrs) === null || _actionTabs$selectArr2 === void 0 ? void 0 : _actionTabs$selectArr2.name)
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "school_name",
|
|
label: "\u5355\u4F4D\uFF1A",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(auto_complete/* default */.Z, {
|
|
options: options,
|
|
style: {
|
|
width: 390
|
|
},
|
|
size: 'middle',
|
|
placeholder: "\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"
|
|
// getPopupContainer={() => autoCompleteRef.current}
|
|
,
|
|
filterOption: function filterOption(inputValue, option) {
|
|
return option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1;
|
|
}
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
htmlType: "submit",
|
|
type: "primary",
|
|
size: 'middle',
|
|
onClick: function onClick() {
|
|
return onFinish();
|
|
},
|
|
children: "\u641C\u7D22"
|
|
})
|
|
})]
|
|
}), notSearch && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "tc font16 c-light-black mt40 pb30",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: ImagesIcon/* searchIcon */.RL,
|
|
width: "100",
|
|
alt: ""
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
className: "mt20",
|
|
children: "\u8BF7\u641C\u7D22\u8981\u6DFB\u52A0\u7684\u4EBA\u5458"
|
|
})]
|
|
}), !notSearch && tableData == '' && !isLoading && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "tc font16 c-light-black mt40 pb30",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: ImagesIcon/* noDataIcon */.z3,
|
|
width: "100",
|
|
alt: ""
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
|
|
className: "mt20",
|
|
children: "\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"
|
|
})]
|
|
}), (!notSearch && tableData != '' || isLoading) && /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "flexd-table-header mt20",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
pagination: false,
|
|
dataSource: [],
|
|
columns: columns
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
style: {
|
|
maxHeight: 260,
|
|
overflow: 'auto'
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)((_react_infinite_scroller_1_2_4_react_infinite_scroller_default()), {
|
|
initialLoad: false,
|
|
pageStart: 1,
|
|
threshold: 20,
|
|
loadMore: function loadMore(page) {
|
|
handleInfiniteOnLoad();
|
|
},
|
|
hasMore: hasMore,
|
|
useWindow: false,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
loading: isLoading,
|
|
showHeader: false,
|
|
pagination: false,
|
|
dataSource: tableData,
|
|
columns: columns,
|
|
onRow: function onRow(record) {
|
|
return {
|
|
onClick: function onClick(event) {
|
|
if (!event.currentTarget.querySelector("input").disabled) saveSelect(event.currentTarget.querySelector("input").value);
|
|
}
|
|
};
|
|
}
|
|
})
|
|
})
|
|
})]
|
|
})]
|
|
});
|
|
};
|
|
/* harmony default export */ var AddOrEditCore_AddTeacher = ((0,_umi_production_exports.connect)(function (_ref6) {
|
|
var classroomList = _ref6.classroomList,
|
|
loading = _ref6.loading;
|
|
return {
|
|
classroomList: classroomList,
|
|
loading: loading
|
|
};
|
|
})(AddTeacher));
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(58696);
|
|
;// CONCATENATED MODULE: ./src/pages/CoreCurriculum/components/AddOrEditCore/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var AddOrEditCore_excluded = ["handleFinish", "form", "dispatch", "user", "coreCurriculum"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddOrEditCore_AddOrEdit = function AddOrEdit(_ref) {
|
|
var _fileList$2, _coreCurriculum$CoreD, _user$userInfo4;
|
|
var handleFinish = _ref.handleFinish,
|
|
form = _ref.form,
|
|
dispatch = _ref.dispatch,
|
|
user = _ref.user,
|
|
coreCurriculum = _ref.coreCurriculum,
|
|
props = objectWithoutProperties_default()(_ref, AddOrEditCore_excluded);
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
fileList = _useState2[0],
|
|
setFileList = _useState2[1];
|
|
var paramsData = (0,_umi_production_exports.useParams)();
|
|
var columns = [{
|
|
title: '姓名',
|
|
dataIndex: 'user_name',
|
|
key: 'user_name'
|
|
}, {
|
|
title: '学校',
|
|
dataIndex: 'school_name',
|
|
key: 'school_name'
|
|
}, {
|
|
title: '身份',
|
|
dataIndex: 'role',
|
|
key: 'role',
|
|
width: 80,
|
|
render: function render(text, record) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: text == '1' ? '管理员' : '成员'
|
|
});
|
|
}
|
|
}, {
|
|
title: '操作',
|
|
render: function render(text, record) {
|
|
var _user$userInfo, _user$userInfo2, _user$userInfo3;
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
children: !(record !== null && record !== void 0 && record.is_current_user) && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
children: [(record === null || record === void 0 ? void 0 : record.role) == '1' && ((user === null || user === void 0 || (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.is_core_subject_admin) || (0,authority/* isSuperAdmins */.Ny)()) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
marginLeft: 10,
|
|
cursor: 'pointer',
|
|
color: 'blue'
|
|
},
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
case 0:
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
title: "\u64A4\u9500\u7BA1\u7406\u5458",
|
|
content: '是否确认将成员撤销管理员?',
|
|
onOk: function () {
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
_context.next = 2;
|
|
return (0,fetch/* default */.ZP)("/api/core_subjects/".concat(paramsData.coreId, "/set_admin.json"), {
|
|
method: 'post',
|
|
body: {
|
|
user_id: record === null || record === void 0 ? void 0 : record.user_id,
|
|
operation: 'revoke'
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
|
|
message/* default */.ZP.success('成功撤销管理员');
|
|
dispatch({
|
|
type: "coreCurriculum/getCoreSubjectDetail",
|
|
payload: {
|
|
id: paramsData.coreId
|
|
}
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
function onOk() {
|
|
return _onOk.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
case 1:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
})),
|
|
children: "\u64A4\u9500\u7BA1\u7406\u5458"
|
|
}), (record === null || record === void 0 ? void 0 : record.role) == '2' && ((user === null || user === void 0 || (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.is_core_subject_admin) || (0,authority/* isSuperAdmins */.Ny)()) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
marginLeft: 10,
|
|
cursor: 'pointer',
|
|
color: 'blue'
|
|
},
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
|
|
while (1) switch (_context4.prev = _context4.next) {
|
|
case 0:
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
title: "\u8BBE\u4E3A\u7BA1\u7406\u5458",
|
|
content: '是否确认将成员设为管理员?',
|
|
onOk: function () {
|
|
var _onOk2 = 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,fetch/* default */.ZP)("/api/core_subjects/".concat(paramsData.coreId, "/set_admin.json"), {
|
|
method: 'post',
|
|
body: {
|
|
user_id: record === null || record === void 0 ? void 0 : record.user_id,
|
|
operation: 'set'
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context3.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
|
|
message/* default */.ZP.success('成功设为管理员');
|
|
dispatch({
|
|
type: "coreCurriculum/getCoreSubjectDetail",
|
|
payload: {
|
|
id: paramsData.coreId
|
|
}
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context3.stop();
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
function onOk() {
|
|
return _onOk2.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
case 1:
|
|
case "end":
|
|
return _context4.stop();
|
|
}
|
|
}, _callee4);
|
|
})),
|
|
children: "\u8BBE\u4E3A\u7BA1\u7406\u5458"
|
|
}), ((user === null || user === void 0 || (_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.is_core_subject_admin) || (0,authority/* isSuperAdmins */.Ny)()) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
marginLeft: 10,
|
|
cursor: 'pointer',
|
|
color: 'blue'
|
|
},
|
|
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
|
|
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
|
|
while (1) switch (_context6.prev = _context6.next) {
|
|
case 0:
|
|
modal/* default */.Z.confirm({
|
|
centered: true,
|
|
okText: '确定',
|
|
cancelText: '取消',
|
|
title: "\u79FB\u9664\u6210\u5458",
|
|
content: '是否确认将成员移除?',
|
|
onOk: function () {
|
|
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
|
|
var res;
|
|
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/core_subjects/".concat(paramsData.coreId, "/remove_members.json"), {
|
|
method: 'post',
|
|
body: {
|
|
user_id: record === null || record === void 0 ? void 0 : record.user_id
|
|
}
|
|
});
|
|
case 2:
|
|
res = _context5.sent;
|
|
if ((res === null || res === void 0 ? void 0 : res.status) == 0) {
|
|
message/* default */.ZP.success('移除成功');
|
|
dispatch({
|
|
type: "coreCurriculum/getCoreSubjectDetail",
|
|
payload: {
|
|
id: paramsData.coreId
|
|
}
|
|
});
|
|
}
|
|
case 4:
|
|
case "end":
|
|
return _context5.stop();
|
|
}
|
|
}, _callee5);
|
|
}));
|
|
function onOk() {
|
|
return _onOk3.apply(this, arguments);
|
|
}
|
|
return onOk;
|
|
}()
|
|
});
|
|
case 1:
|
|
case "end":
|
|
return _context6.stop();
|
|
}
|
|
}, _callee6);
|
|
})),
|
|
children: "\u79FB\u9664\u6210\u5458"
|
|
})]
|
|
})
|
|
});
|
|
}
|
|
}];
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (props.open) {
|
|
var _fileList$;
|
|
!(fileList !== null && fileList !== void 0 && (_fileList$ = fileList[0]) !== null && _fileList$ !== void 0 && (_fileList$ = _fileList$.response) !== null && _fileList$ !== void 0 && _fileList$.id) && setFileList([{
|
|
response: form.getFieldValue("cover") || {
|
|
id: form.getFieldValue("cover_id")
|
|
}
|
|
}]);
|
|
} else {
|
|
setFileList([]);
|
|
}
|
|
}, [props.open, fileList === null || fileList === void 0 || (_fileList$2 = fileList[0]) === null || _fileList$2 === void 0 || (_fileList$2 = _fileList$2.response) === null || _fileList$2 === void 0 ? void 0 : _fileList$2.id]);
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, props), {}, {
|
|
destroyOnClose: true,
|
|
centered: true,
|
|
width: 1200,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
form: form,
|
|
size: "large",
|
|
initialValues: {},
|
|
layout: "vertical",
|
|
onValuesChange: function onValuesChange(changedValues) {},
|
|
onFinish: handleFinish,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "name",
|
|
label: "\u8BFE\u7A0B\u540D\u79F0",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入课程名称'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BFE\u7A0B\u540D\u79F0",
|
|
maxLength: 50,
|
|
showCount: true
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "name_en",
|
|
label: "\u8BFE\u7A0B\u82F1\u6587\u540D\u79F0",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入课程英文名称'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u8BFE\u7A0B\u82F1\u6587\u540D\u79F0",
|
|
maxLength: 50,
|
|
showCount: true
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
gutter: 20,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
flex: 1,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "adminer",
|
|
label: "\u8D1F\u8D23\u4EBA(\u4E2D\u6587)",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入负责人'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA",
|
|
maxLength: 10,
|
|
showCount: true
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
flex: 1,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "adminer_en",
|
|
label: "\u8D1F\u8D23\u4EBA(\u82F1\u6587)",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入负责人'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA",
|
|
maxLength: 100,
|
|
showCount: true
|
|
})
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
gutter: 20,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
flex: 1,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "leading_unit",
|
|
label: "\u7275\u5934\u5355\u4F4D(\u4E2D\u6587)",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入牵头单位'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u7275\u5934\u5355\u4F4D",
|
|
maxLength: 20,
|
|
showCount: true
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
flex: 1,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
htmlFor: null,
|
|
name: "leading_unit_en",
|
|
label: "\u7275\u5934\u5355\u4F4D(\u82F1\u6587)",
|
|
rules: [{
|
|
required: true,
|
|
message: '请输入牵头单位'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
placeholder: "\u8BF7\u8F93\u5165\u7275\u5934\u5355\u4F4D",
|
|
maxLength: 500,
|
|
showCount: true
|
|
})
|
|
})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
gutter: 20,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
|
|
span: 9,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "cover_id",
|
|
label: "\u5217\u8868\u5C01\u9762\u56FE",
|
|
rules: [{
|
|
required: true,
|
|
message: '请上传列表封面图'
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ImgUploadForm, {
|
|
ButtonText: "上传图片"
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
|
|
span: 15,
|
|
style: {
|
|
position: 'relative'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "users_id",
|
|
label: "\u8BFE\u7A0B\u6210\u5458",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
|
|
columns: columns,
|
|
scroll: {
|
|
y: 200
|
|
},
|
|
dataSource: coreCurriculum === null || coreCurriculum === void 0 || (_coreCurriculum$CoreD = coreCurriculum.CoreDetail) === null || _coreCurriculum$CoreD === void 0 ? void 0 : _coreCurriculum$CoreD.members,
|
|
bordered: true,
|
|
pagination: false
|
|
})
|
|
}), ((user === null || user === void 0 || (_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.is_core_subject_member) || (0,authority/* isSuperAdmins */.Ny)()) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
onClick: function onClick() {
|
|
dispatch({
|
|
type: 'classroomList/setActionTabs',
|
|
payload: {
|
|
key: '添加成员'
|
|
}
|
|
});
|
|
},
|
|
style: {
|
|
position: 'absolute',
|
|
right: '10px',
|
|
top: '10px',
|
|
cursor: 'pointer',
|
|
color: 'blue'
|
|
},
|
|
children: "\u6DFB\u52A0\u6210\u5458"
|
|
})]
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(AddOrEditCore_AddTeacher, {})]
|
|
}));
|
|
};
|
|
/* harmony default export */ var AddOrEditCore = ((0,_umi_production_exports.connect)(function (_ref5) {
|
|
var dispatch = _ref5.dispatch,
|
|
coreCurriculum = _ref5.coreCurriculum,
|
|
user = _ref5.user;
|
|
return {
|
|
dispatch: dispatch,
|
|
coreCurriculum: coreCurriculum,
|
|
user: user
|
|
};
|
|
})(AddOrEditCore_AddOrEdit));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 88522:
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/auto-complete/index.js ***!
|
|
\*****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ 12124);
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rc-util/es/Children/toArray */ 45659);
|
|
/* harmony import */ var rc_util_es_omit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util/es/omit */ 99468);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _util_PurePanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../_util/PurePanel */ 53487);
|
|
/* harmony import */ var _util_reactNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_util/reactNode */ 92343);
|
|
/* harmony import */ var _config_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../config-provider */ 36355);
|
|
/* harmony import */ var _select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../select */ 57809);
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
Option
|
|
} = _select__WEBPACK_IMPORTED_MODULE_3__["default"];
|
|
function isSelectOptionOrSelectOptGroup(child) {
|
|
return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
|
|
}
|
|
const AutoComplete = (props, ref) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
className,
|
|
popupClassName,
|
|
dropdownClassName,
|
|
children,
|
|
dataSource
|
|
} = props;
|
|
const childNodes = (0,rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(children);
|
|
// ============================= Input =============================
|
|
let customizeInput;
|
|
if (childNodes.length === 1 && (0,_util_reactNode__WEBPACK_IMPORTED_MODULE_4__/* .isValidElement */ .l$)(childNodes[0]) && !isSelectOptionOrSelectOptGroup(childNodes[0])) {
|
|
[customizeInput] = childNodes;
|
|
}
|
|
const getInputElement = customizeInput ? () => customizeInput : undefined;
|
|
// ============================ Options ============================
|
|
let optionChildren;
|
|
// [Legacy] convert `children` or `dataSource` into option children
|
|
if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {
|
|
optionChildren = children;
|
|
} else {
|
|
optionChildren = dataSource ? dataSource.map(item => {
|
|
if ((0,_util_reactNode__WEBPACK_IMPORTED_MODULE_4__/* .isValidElement */ .l$)(item)) {
|
|
return item;
|
|
}
|
|
switch (typeof item) {
|
|
case 'string':
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(Option, {
|
|
key: item,
|
|
value: item
|
|
}, item);
|
|
case 'object':
|
|
{
|
|
const {
|
|
value: optionValue
|
|
} = item;
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(Option, {
|
|
key: optionValue,
|
|
value: optionValue
|
|
}, item.text);
|
|
}
|
|
default:
|
|
false ? 0 : void 0;
|
|
return undefined;
|
|
}
|
|
}) : [];
|
|
}
|
|
if (false) {}
|
|
const {
|
|
getPrefixCls
|
|
} = react__WEBPACK_IMPORTED_MODULE_2__.useContext(_config_provider__WEBPACK_IMPORTED_MODULE_5__/* .ConfigContext */ .E_);
|
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(_select__WEBPACK_IMPORTED_MODULE_3__["default"], Object.assign({
|
|
ref: ref,
|
|
suffixIcon: null
|
|
}, (0,rc_util_es_omit__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(props, ['dataSource', 'dropdownClassName']), {
|
|
prefixCls: prefixCls,
|
|
popupClassName: popupClassName || dropdownClassName,
|
|
className: classnames__WEBPACK_IMPORTED_MODULE_0___default()(`${prefixCls}-auto-complete`, className),
|
|
mode: _select__WEBPACK_IMPORTED_MODULE_3__["default"].SECRET_COMBOBOX_MODE_DO_NOT_USE
|
|
}, {
|
|
// Internal api
|
|
getInputElement
|
|
}), optionChildren);
|
|
};
|
|
const RefAutoComplete = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.forwardRef(AutoComplete);
|
|
// We don't care debug panel
|
|
/* istanbul ignore next */
|
|
const PurePanel = (0,_util_PurePanel__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)(RefAutoComplete);
|
|
RefAutoComplete.Option = Option;
|
|
RefAutoComplete._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
|
if (false) {}
|
|
/* harmony default export */ __webpack_exports__.Z = (RefAutoComplete);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 51581:
|
|
/*!****************************************************************************************************!*\
|
|
!*** ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/dist/InfiniteScroll.js ***!
|
|
\****************************************************************************************************/
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(/*! react */ 59301);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _propTypes = __webpack_require__(/*! prop-types */ 12708);
|
|
|
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var InfiniteScroll = function (_Component) {
|
|
_inherits(InfiniteScroll, _Component);
|
|
|
|
function InfiniteScroll(props) {
|
|
_classCallCheck(this, InfiniteScroll);
|
|
|
|
var _this = _possibleConstructorReturn(this, (InfiniteScroll.__proto__ || Object.getPrototypeOf(InfiniteScroll)).call(this, props));
|
|
|
|
_this.scrollListener = _this.scrollListener.bind(_this);
|
|
_this.eventListenerOptions = _this.eventListenerOptions.bind(_this);
|
|
_this.mousewheelListener = _this.mousewheelListener.bind(_this);
|
|
return _this;
|
|
}
|
|
|
|
_createClass(InfiniteScroll, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this.pageLoaded = this.props.pageStart;
|
|
this.options = this.eventListenerOptions();
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentDidUpdate',
|
|
value: function componentDidUpdate() {
|
|
if (this.props.isReverse && this.loadMore) {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + this.beforeScrollTop;
|
|
this.loadMore = false;
|
|
}
|
|
this.attachScrollListener();
|
|
}
|
|
}, {
|
|
key: 'componentWillUnmount',
|
|
value: function componentWillUnmount() {
|
|
this.detachScrollListener();
|
|
this.detachMousewheelListener();
|
|
}
|
|
}, {
|
|
key: 'isPassiveSupported',
|
|
value: function isPassiveSupported() {
|
|
var passive = false;
|
|
|
|
var testOptions = {
|
|
get passive() {
|
|
passive = true;
|
|
}
|
|
};
|
|
|
|
try {
|
|
document.addEventListener('test', null, testOptions);
|
|
document.removeEventListener('test', null, testOptions);
|
|
} catch (e) {
|
|
// ignore
|
|
}
|
|
return passive;
|
|
}
|
|
}, {
|
|
key: 'eventListenerOptions',
|
|
value: function eventListenerOptions() {
|
|
var options = this.props.useCapture;
|
|
|
|
if (this.isPassiveSupported()) {
|
|
options = {
|
|
useCapture: this.props.useCapture,
|
|
passive: true
|
|
};
|
|
}
|
|
return options;
|
|
}
|
|
|
|
// Set a defaut loader for all your `InfiniteScroll` components
|
|
|
|
}, {
|
|
key: 'setDefaultLoader',
|
|
value: function setDefaultLoader(loader) {
|
|
this.defaultLoader = loader;
|
|
}
|
|
}, {
|
|
key: 'detachMousewheelListener',
|
|
value: function detachMousewheelListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.scrollComponent.parentNode;
|
|
}
|
|
|
|
scrollEl.removeEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'detachScrollListener',
|
|
value: function detachScrollListener() {
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = this.getParentElement(this.scrollComponent);
|
|
}
|
|
|
|
scrollEl.removeEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.removeEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
}
|
|
}, {
|
|
key: 'getParentElement',
|
|
value: function getParentElement(el) {
|
|
var scrollParent = this.props.getScrollParent && this.props.getScrollParent();
|
|
if (scrollParent != null) {
|
|
return scrollParent;
|
|
}
|
|
return el && el.parentNode;
|
|
}
|
|
}, {
|
|
key: 'filterProps',
|
|
value: function filterProps(props) {
|
|
return props;
|
|
}
|
|
}, {
|
|
key: 'attachScrollListener',
|
|
value: function attachScrollListener() {
|
|
var parentElement = this.getParentElement(this.scrollComponent);
|
|
|
|
if (!this.props.hasMore || !parentElement) {
|
|
return;
|
|
}
|
|
|
|
var scrollEl = window;
|
|
if (this.props.useWindow === false) {
|
|
scrollEl = parentElement;
|
|
}
|
|
|
|
scrollEl.addEventListener('mousewheel', this.mousewheelListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('scroll', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
scrollEl.addEventListener('resize', this.scrollListener, this.options ? this.options : this.props.useCapture);
|
|
|
|
if (this.props.initialLoad) {
|
|
this.scrollListener();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'mousewheelListener',
|
|
value: function mousewheelListener(e) {
|
|
// Prevents Chrome hangups
|
|
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
|
|
if (e.deltaY === 1 && !this.isPassiveSupported()) {
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
}, {
|
|
key: 'scrollListener',
|
|
value: function scrollListener() {
|
|
var el = this.scrollComponent;
|
|
var scrollEl = window;
|
|
var parentNode = this.getParentElement(el);
|
|
|
|
var offset = void 0;
|
|
if (this.props.useWindow) {
|
|
var doc = document.documentElement || document.body.parentNode || document.body;
|
|
var scrollTop = scrollEl.pageYOffset !== undefined ? scrollEl.pageYOffset : doc.scrollTop;
|
|
if (this.props.isReverse) {
|
|
offset = scrollTop;
|
|
} else {
|
|
offset = this.calculateOffset(el, scrollTop);
|
|
}
|
|
} else if (this.props.isReverse) {
|
|
offset = parentNode.scrollTop;
|
|
} else {
|
|
offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight;
|
|
}
|
|
|
|
// Here we make sure the element is visible as well as checking the offset
|
|
if (offset < Number(this.props.threshold) && el && el.offsetParent !== null) {
|
|
this.detachScrollListener();
|
|
this.beforeScrollHeight = parentNode.scrollHeight;
|
|
this.beforeScrollTop = parentNode.scrollTop;
|
|
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
|
|
if (typeof this.props.loadMore === 'function') {
|
|
this.props.loadMore(this.pageLoaded += 1);
|
|
this.loadMore = true;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'calculateOffset',
|
|
value: function calculateOffset(el, scrollTop) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
|
|
return this.calculateTopPosition(el) + (el.offsetHeight - scrollTop - window.innerHeight);
|
|
}
|
|
}, {
|
|
key: 'calculateTopPosition',
|
|
value: function calculateTopPosition(el) {
|
|
if (!el) {
|
|
return 0;
|
|
}
|
|
return el.offsetTop + this.calculateTopPosition(el.offsetParent);
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _this2 = this;
|
|
|
|
var renderProps = this.filterProps(this.props);
|
|
|
|
var children = renderProps.children,
|
|
element = renderProps.element,
|
|
hasMore = renderProps.hasMore,
|
|
initialLoad = renderProps.initialLoad,
|
|
isReverse = renderProps.isReverse,
|
|
loader = renderProps.loader,
|
|
loadMore = renderProps.loadMore,
|
|
pageStart = renderProps.pageStart,
|
|
ref = renderProps.ref,
|
|
threshold = renderProps.threshold,
|
|
useCapture = renderProps.useCapture,
|
|
useWindow = renderProps.useWindow,
|
|
getScrollParent = renderProps.getScrollParent,
|
|
props = _objectWithoutProperties(renderProps, ['children', 'element', 'hasMore', 'initialLoad', 'isReverse', 'loader', 'loadMore', 'pageStart', 'ref', 'threshold', 'useCapture', 'useWindow', 'getScrollParent']);
|
|
|
|
props.ref = function (node) {
|
|
_this2.scrollComponent = node;
|
|
if (ref) {
|
|
ref(node);
|
|
}
|
|
};
|
|
|
|
var childrenArray = [children];
|
|
if (hasMore) {
|
|
if (loader) {
|
|
isReverse ? childrenArray.unshift(loader) : childrenArray.push(loader);
|
|
} else if (this.defaultLoader) {
|
|
isReverse ? childrenArray.unshift(this.defaultLoader) : childrenArray.push(this.defaultLoader);
|
|
}
|
|
}
|
|
return _react2.default.createElement(element, props, childrenArray);
|
|
}
|
|
}]);
|
|
|
|
return InfiniteScroll;
|
|
}(_react.Component);
|
|
|
|
InfiniteScroll.propTypes = {
|
|
children: _propTypes2.default.node.isRequired,
|
|
element: _propTypes2.default.node,
|
|
hasMore: _propTypes2.default.bool,
|
|
initialLoad: _propTypes2.default.bool,
|
|
isReverse: _propTypes2.default.bool,
|
|
loader: _propTypes2.default.node,
|
|
loadMore: _propTypes2.default.func.isRequired,
|
|
pageStart: _propTypes2.default.number,
|
|
ref: _propTypes2.default.func,
|
|
getScrollParent: _propTypes2.default.func,
|
|
threshold: _propTypes2.default.number,
|
|
useCapture: _propTypes2.default.bool,
|
|
useWindow: _propTypes2.default.bool
|
|
};
|
|
InfiniteScroll.defaultProps = {
|
|
element: 'div',
|
|
hasMore: false,
|
|
initialLoad: true,
|
|
pageStart: 0,
|
|
ref: null,
|
|
threshold: 250,
|
|
useWindow: true,
|
|
isReverse: false,
|
|
useCapture: false,
|
|
loader: null,
|
|
getScrollParent: null
|
|
};
|
|
exports["default"] = InfiniteScroll;
|
|
module.exports = exports['default'];
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 26724:
|
|
/*!**************************************************************************************!*\
|
|
!*** ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js ***!
|
|
\**************************************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(/*! ./dist/InfiniteScroll */ 51581)
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |