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.
284 lines
14 KiB
284 lines
14 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[43442],{
|
|
|
|
/***/ 56601:
|
|
/*!********************************************************************!*\
|
|
!*** ./src/pages/Classrooms/Lists/Board/Add/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 */ Add; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/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/slicedToArray.js
|
|
var slicedToArray = __webpack_require__(79800);
|
|
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(49105);
|
|
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
|
|
var markdown_editor = __webpack_require__(77036);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(27876);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
var _umi_production_exports = __webpack_require__(80608);
|
|
// 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/breadcrumb/index.js + 6 modules
|
|
var breadcrumb = __webpack_require__(66104);
|
|
// 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/checkbox/index.js + 3 modules
|
|
var es_checkbox = __webpack_require__(24905);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 3 modules
|
|
var input = __webpack_require__(92832);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.4.0@@ant-design/icons/es/icons/ArrowLeftOutlined.js + 1 modules
|
|
var ArrowLeftOutlined = __webpack_require__(40362);
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Board/Add/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Addmodules = ({"flex_box_center":"flex_box_center___Zr62V","flex_space_between":"flex_space_between___MocyP","flex_box_vertical_center":"flex_box_vertical_center___q9TyA","flex_box_center_end":"flex_box_center_end___uv4oS","flex_box_column":"flex_box_column___Tkhbw","title":"title___vcf30","export":"export___WECx3","bg":"bg___cLnNg","tabs":"tabs___fDuTh","btn":"btn___ckSh1","sticky":"sticky___Jdoog"});
|
|
// EXTERNAL MODULE: ./src/components/MultiUpload/index.tsx + 2 modules
|
|
var MultiUpload = __webpack_require__(1058);
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(75916);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Board/Add/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AddBoard = function AddBoard(_ref) {
|
|
var _userInfo$course, _boardsCategoryList$b, _value$subject;
|
|
var shixunHomeworks = _ref.shixunHomeworks,
|
|
classroomList = _ref.classroomList,
|
|
globalSetting = _ref.globalSetting,
|
|
boards = _ref.boards,
|
|
loading = _ref.loading,
|
|
user = _ref.user,
|
|
dispatch = _ref.dispatch;
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
var location = (0,_umi_production_exports.useLocation)();
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
form = _Form$useForm2[0];
|
|
var _useState = (0,_react_17_0_2_react.useState)({
|
|
content: ""
|
|
}),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
value = _useState2[0],
|
|
setValue = _useState2[1];
|
|
var userInfo = user.userInfo;
|
|
var detailLeftMenus = classroomList.detailLeftMenus;
|
|
var boardsCategoryList = boards.boardsCategoryList;
|
|
console.log("boardsCategoryList", boardsCategoryList);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
dispatch({
|
|
type: 'boards/getBoardsCategoryList',
|
|
payload: {
|
|
board_id: params.categoryId
|
|
}
|
|
});
|
|
}, [params.categoryId]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
form.setFieldsValue({
|
|
select_board_id: parseInt(params.categoryId)
|
|
});
|
|
// console.log(JSON.stringify(classroomList.detailLeftMenus))
|
|
}, [classroomList.detailLeftMenus]);
|
|
console.log(detailLeftMenus, 'boardsCateg');
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("section", {
|
|
className: Addmodules.bg,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: "edu-container",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("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, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/classrooms/".concat(params.coursesId, "/board/").concat(params.categoryId || ''),
|
|
children: userInfo === null || userInfo === void 0 || (_userInfo$course = userInfo.course) === null || _userInfo$course === void 0 ? void 0 : _userInfo$course.course_name
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/classrooms/".concat(params.coursesId, "/board/").concat(params.categoryId || ''),
|
|
children: boardsCategoryList === null || boardsCategoryList === void 0 || (_boardsCategoryList$b = boardsCategoryList.boards) === null || _boardsCategoryList$b === void 0 || (_boardsCategoryList$b = _boardsCategoryList$b.filter(function (item) {
|
|
return item.id == params.categoryId;
|
|
})) === null || _boardsCategoryList$b === void 0 || (_boardsCategoryList$b = _boardsCategoryList$b[0]) === null || _boardsCategoryList$b === void 0 ? void 0 : _boardsCategoryList$b.name
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(breadcrumb/* default */.Z.Item, {
|
|
children: "\u5E16\u5B50\u65B0\u5EFA"
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: [Addmodules.title, 'mt20'].join(' '),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/classrooms/".concat(params.coursesId, "/board/").concat(params.categoryId || ''),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ArrowLeftOutlined/* default */.Z, {
|
|
className: "font16 c-black"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("strong", {
|
|
className: "font20 ml5",
|
|
children: "\u65B0\u5EFA\u5E16\u5B50"
|
|
})]
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
layout: 'vertical',
|
|
form: form,
|
|
initialValues: {
|
|
name: "",
|
|
// .defaultValue={[params.categoryId]}
|
|
//select_board_id: parseInt(params.categoryId),
|
|
sticky: false
|
|
},
|
|
scrollToFirstError: true,
|
|
onValuesChange: function onValuesChange(value) {
|
|
setValue(objectSpread2_default()({}, value));
|
|
},
|
|
onFinish: ( /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(v) {
|
|
var _v$attachment_ids, _boardsCategoryList$b2;
|
|
var select_board_id, res, _res$data;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
v.attachment_ids = (_v$attachment_ids = v.attachment_ids) === null || _v$attachment_ids === void 0 ? void 0 : _v$attachment_ids.map(function (v) {
|
|
return v.response.id;
|
|
});
|
|
select_board_id = boardsCategoryList === null || boardsCategoryList === void 0 || (_boardsCategoryList$b2 = boardsCategoryList.boards) === null || _boardsCategoryList$b2 === void 0 || (_boardsCategoryList$b2 = _boardsCategoryList$b2.filter(function (item) {
|
|
return item.name == "未分配目录";
|
|
})) === null || _boardsCategoryList$b2 === void 0 || (_boardsCategoryList$b2 = _boardsCategoryList$b2[0]) === null || _boardsCategoryList$b2 === void 0 ? void 0 : _boardsCategoryList$b2.id;
|
|
v = objectSpread2_default()(objectSpread2_default()({}, v), {}, {
|
|
select_board_id: select_board_id
|
|
});
|
|
_context.next = 5;
|
|
return (0,fetch/* default */.ZP)("/api/boards/".concat(params.categoryId, "/messages.json"), {
|
|
method: "post",
|
|
body: v
|
|
});
|
|
case 5:
|
|
res = _context.sent;
|
|
if (res.status === 0) {
|
|
(0,util/* trackEvent */.L9)(['教学课堂', '讨论', '发帖']);
|
|
message/* default */.ZP.success("发布成功");
|
|
_umi_production_exports.history.push("/classrooms/".concat(params.coursesId, "/board/").concat(params.categoryId, "/Detail/").concat(res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.id));
|
|
}
|
|
case 7:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function (_x) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}()),
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
|
|
className: "mt30 relative bg-white pl30 pr30 pt30 w100 inline-block",
|
|
children: [(0,authority/* isAdmin */.GJ)() && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "sticky",
|
|
className: Addmodules.sticky,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
children: "\u7F6E\u9876"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
label: "\u6807\u9898",
|
|
name: "subject",
|
|
rules: [{
|
|
required: true,
|
|
message: "请输入标题"
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
suffix: "".concat(((_value$subject = value.subject) === null || _value$subject === void 0 ? void 0 : _value$subject.length) || 0, "/60"),
|
|
maxLength: 60
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
label: "\u5185\u5BB9",
|
|
name: "content",
|
|
rules: [{
|
|
required: true,
|
|
message: "请输入内容"
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
|
|
watch: true,
|
|
placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u5E16\u5B50\u8BE6\u60C5\uFF0C\u6700\u5927\u9650\u5236\u4E3A10000\u4E2A\u5B57\u7B26"
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
name: "attachment_ids",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(MultiUpload/* default */.Z, {})
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: [Addmodules.btn, 'mt20'].join(' '),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
htmlType: "submit",
|
|
size: 'middle',
|
|
type: "primary",
|
|
children: "\u63D0\u4EA4"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
size: 'middle',
|
|
ghost: true,
|
|
type: "primary",
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
|
|
to: "/classrooms/".concat(params.coursesId, "/board/").concat(params.categoryId),
|
|
children: "\u53D6\u6D88"
|
|
})
|
|
})]
|
|
})
|
|
})]
|
|
})]
|
|
})
|
|
});
|
|
};
|
|
/* harmony default export */ var Add = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var shixunHomeworks = _ref3.shixunHomeworks,
|
|
classroomList = _ref3.classroomList,
|
|
loading = _ref3.loading,
|
|
user = _ref3.user,
|
|
boards = _ref3.boards,
|
|
globalSetting = _ref3.globalSetting;
|
|
return {
|
|
shixunHomeworks: shixunHomeworks,
|
|
globalSetting: globalSetting,
|
|
classroomList: classroomList,
|
|
user: user,
|
|
boards: boards,
|
|
loading: loading.effects
|
|
};
|
|
})(AddBoard));
|
|
|
|
/***/ })
|
|
|
|
}]); |