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__Shixuns__New__index.29df...

1063 lines
46 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[97008],{
/***/ 34895:
/*!*************************************************************************!*\
!*** ./src/pages/Shixuns/New/components/DesModal/index.tsx + 1 modules ***!
\*************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_DesModal; }
});
// 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: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(85681);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/DesModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var DesModalmodules = ({"wrapInstallPackageStyle":"wrapInstallPackageStyle___AU1GI","installPackageStyle":"installPackageStyle___k2iyn","title":"title___oN9OA","line":"line___PxUeH","bodyHeight":"bodyHeight___QO5he"});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/DesModal/index.tsx
var DesModal = function DesModal(_ref) {
var _installPackage$small, _installPackage$small2;
var installPackage = _ref.installPackage,
visible = _ref.visible,
setVisible = _ref.setVisible;
(0,_react_17_0_2_react.useEffect)(function () {
if (visible) {
document.body.setAttribute('class', DesModalmodules.bodyHeight);
} else {
document.body.removeAttribute('class');
}
return function () {
document.body.removeAttribute('class');
};
}, [visible]);
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
keyboard: false,
destroyOnClose: true,
open: visible,
title: "\u73AF\u5883\u4ECB\u7ECD",
width: "1000px",
wrapClassName: DesModalmodules.wrapInstallPackageStyle,
footer: null,
onCancel: function onCancel() {
return setVisible(false);
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: DesModalmodules.installPackageStyle,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "mb30",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: DesModalmodules.title,
children: installPackage.mainTypeName
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: installPackage.mainTypeDescription
})
})]
}), !!(installPackage !== null && installPackage !== void 0 && (_installPackage$small = installPackage.smallType) !== null && _installPackage$small !== void 0 && _installPackage$small.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: DesModalmodules.line
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: installPackage === null || installPackage === void 0 || (_installPackage$small2 = installPackage.smallType) === null || _installPackage$small2 === void 0 ? void 0 : _installPackage$small2.map(function (e, i) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: DesModalmodules.title,
style: {
marginBottom: 14
},
children: e.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "mb30",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: e.des
})
})]
}, i);
})
})]
})
});
};
/* harmony default export */ var components_DesModal = (DesModal);
/***/ }),
/***/ 95103:
/*!*****************************************************!*\
!*** ./src/pages/Shixuns/New/index.tsx + 5 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 */ New; }
});
// 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: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx + 1 modules
var ApplyModal = __webpack_require__(47630);
// 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/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: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(88271);
// 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/empty/index.js + 3 modules
var empty = __webpack_require__(64165);
// 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/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(47839);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(95972);
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
var noEnvData = __webpack_require__(36723);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(85681);
// EXTERNAL MODULE: ./src/components/SelectEnvironment/index.tsx + 1 modules
var SelectEnvironment = __webpack_require__(55474);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(69423);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/CommonPractice/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var CommonPracticemodules = ({"practice":"practice___gbjN8","right":"right___XrBE2","title":"title___JsAVf","content":"content___rNvQy","des":"des___wAyxo","mainBody":"mainBody___edUsk","sys":"sys___kUTBd","li":"li___V7qds","d1":"d1___r3dOV","img":"img___KXajQ","bot":"bot___lTZjW","btn":"btn___aue5H","b1":"b1___gmKr8","b2":"b2___wT3k7","d2":"d2___mjMbK","btns":"btns___GykuR","practiceModal":"practiceModal___DTgXc"});
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(82710);
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 30 modules
var ui_customization = __webpack_require__(81001);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/CommonPractice/index.tsx
var CommonPractice = function CommonPractice(_ref) {
var _mirrorItems$Number, _ref5;
var newShixuns = _ref.newShixuns,
user = _ref.user,
dispatch = _ref.dispatch,
shixun_type = _ref.shixun_type;
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
var _useState = (0,_react_17_0_2_react.useState)(searchParams.get("mirror") || null),
_useState2 = slicedToArray_default()(_useState, 2),
mirrorId = _useState2[0],
setMirrorId = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(searchParams.get("tab") || null),
_useState4 = slicedToArray_default()(_useState3, 2),
tabId = _useState4[0],
setTabId = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(null),
_useState6 = slicedToArray_default()(_useState5, 2),
copyInfo = _useState6[0],
setCopyInfo = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(Number(mirrorId) || null),
_useState8 = slicedToArray_default()(_useState7, 2),
activeId = _useState8[0],
setActiveId = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)({}),
_useState10 = slicedToArray_default()(_useState9, 2),
detail = _useState10[0],
setDetail = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
isModalVisible = _useState12[0],
setIsModalVisible = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(false),
_useState14 = slicedToArray_default()(_useState13, 2),
copyLoading = _useState14[0],
setCopyLoading = _useState14[1];
var environmentData = newShixuns.environmentData;
var _environmentData$freq = environmentData.frequence_image,
frequence_image = _environmentData$freq === void 0 ? [] : _environmentData$freq,
_environmentData$envi = environmentData.environments,
environments = _environmentData$envi === void 0 ? [] : _environmentData$envi,
other_image = environmentData.other_image;
var name = detail.name,
description = detail.description,
authorization = detail.authorization,
_detail$template_shix = detail.template_shixuns,
template_shixuns = _detail$template_shix === void 0 ? [] : _detail$template_shix,
_detail$recommend_shi = detail.recommend_shixuns,
recommend_shixuns = _detail$recommend_shi === void 0 ? [] : _detail$recommend_shi;
var _useState15 = (0,_react_17_0_2_react.useState)(Number(tabId) || 0),
_useState16 = slicedToArray_default()(_useState15, 2),
tab = _useState16[0],
setTab = _useState16[1];
var mirrorItems = [{
id: 0,
name: '公共镜像',
type: 'public'
}, {
id: 1,
name: '自定义镜像',
type: 'customize'
}, {
id: 2,
name: '共享镜像',
type: 'share'
}];
(0,_react_17_0_2_react.useEffect)(function () {
dispatch({
type: 'newShixuns/getEnvironmentData',
payload: {
tab_type: mirrorItems[Number(tab)].type
}
});
}, [tab]);
(0,_react_17_0_2_react.useEffect)(function () {
if (activeId === null || !other_image) return;
getData();
}, [activeId, other_image]);
var getData = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var fi, ei, oi, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
fi = frequence_image.find(function (item) {
return item.id === activeId;
});
ei = environments.find(function (item) {
return item.id === activeId;
});
oi = other_image === null || other_image === void 0 ? void 0 : other_image.find(function (item) {
return item.id === activeId;
});
console.log("fi,ei,oi", fi, ei, oi);
if (!(fi !== undefined || ei !== undefined || oi !== undefined)) {
_context.next = 11;
break;
}
_context.next = 7;
return (0,shixuns/* getEnvironmentDetail */.Q1)({
mirror_repository_id: activeId
});
case 7:
res = _context.sent;
setDetail(res === null || res === void 0 ? void 0 : res.data);
_context.next = 13;
break;
case 11:
setDetail({});
setActiveId(null);
case 13:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
console.log(activeId);
// useEffect(() => {
// // if(mirrorId){
// // setActiveId(Number(mirrorId))
// // }else{
// if (frequence_image?.length > 0) {
// setActiveId(frequence_image[0].id);
// }
// }, [frequence_image])
var handleCopy = function handleCopy(item) {
setCopyInfo(item);
setIsModalVisible(true);
};
var handleOk = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var res, _res$data;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setCopyLoading(true);
_context2.next = 3;
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(copyInfo === null || copyInfo === void 0 ? void 0 : copyInfo.identifier, "/copy.json"), {
method: 'post',
body: {}
});
case 3:
res = _context2.sent;
if (res.status === 0) {
_umi_production_exports.history === null || _umi_production_exports.history === void 0 || _umi_production_exports.history.push("/shixuns/".concat((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.shixun, "/edit"));
setIsModalVisible(false);
message/* default */.ZP.success('复制成功');
}
setCopyLoading(false);
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function handleOk() {
return _ref3.apply(this, arguments);
};
}();
var handleCancel = function handleCancel() {
setIsModalVisible(false);
};
var handleConfirm = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var skip,
body,
res,
_args3 = arguments;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
skip = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
(0,util/* trackEvent */.L9)(['实践项目', '新建实践项目', '全实践项目', skip ? "暂不选用镜像" : "使用当前镜像"]);
body = activeId && !skip ? {
image_id: activeId
} : {};
_context3.next = 5;
return (0,fetch/* default */.ZP)("/api/shixuns/choose_environment_or_skip.json", {
method: 'post',
body: objectSpread2_default()(objectSpread2_default()({}, body), {}, {
mirror_tab_type: tab
})
});
case 5:
res = _context3.sent;
if (res.status === 0) {
_umi_production_exports.history.push("/shixuns/".concat(res.data.identifier, "/edit"));
}
case 7:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function handleConfirm() {
return _ref4.apply(this, arguments);
};
}();
var _useState17 = (0,_react_17_0_2_react.useState)(""),
_useState18 = slicedToArray_default()(_useState17, 2),
keyword = _useState18[0],
setKeyword = _useState18[1];
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.practice,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SelectEnvironment/* default */.Z, {
dispatch: dispatch,
value: activeId,
data: environments,
otherData: other_image || [],
tags: frequence_image,
onChange: function onChange(id) {
console.log(id, 222);
setActiveId(id);
},
shixun_type: shixun_type,
onSearchWord: function onSearchWord(value) {
return setKeyword(value);
},
tab_type: (_mirrorItems$Number = mirrorItems[Number(tab)]) === null || _mirrorItems$Number === void 0 ? void 0 : _mirrorItems$Number.type,
extraContent: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* SuperiorTabs */.tp, {
dataSource: mirrorItems,
value: tab,
onChange: function onChange(id) {
setTab(id);
setActiveId(null);
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.right,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("header", {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.title,
children: ["\u5B9E\u9A8C\u73AF\u5883:\xA0", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
dangerouslySetInnerHTML: {
__html: activeId === null ? '— —' : (_ref5 = name || "") === null || _ref5 === void 0 ? void 0 : _ref5.replace(new RegExp(keyword === null || keyword === void 0 ? void 0 : keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"), '<span style="color:#0152d9;background-color:#1890ff33">$&</span>')
}
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.content,
children: [activeId === null && /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, {
image: noEnvData,
description: "\u8BF7\u9009\u62E9\u5B9E\u9A8C\u73AF\u5883"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.btns,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
style: {
marginRight: 20
},
onClick: function onClick() {
return handleConfirm(true);
},
children: " \u6682\u4E0D\u9009\u7528\u955C\u50CF"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
type: "primary",
disabled: activeId === null,
onClick: function onClick() {
return handleConfirm();
},
children: "\u4F7F\u7528\u5F53\u524D\u955C\u50CF"
})]
})]
}), activeId !== null && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.des,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.mainBody,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: description,
highlightKeywords: keyword
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.btns,
style: {
borderBottom: template_shixuns.length || recommend_shixuns.length ? '1px solid #F1F1F1' : 0
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
style: {
marginRight: 20
},
onClick: function onClick() {
return handleConfirm(true);
},
children: " \u6682\u4E0D\u9009\u7528\u955C\u50CF"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
type: "primary",
disabled: activeId === null,
onClick: function onClick() {
return handleConfirm();
},
children: "\u4F7F\u7528\u5F53\u524D\u955C\u50CF"
})]
}), !!template_shixuns.length && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.title,
children: "\u57FA\u4E8E\u6A21\u677F\u521B\u5EFA"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
className: CommonPracticemodules.sys,
children: template_shixuns.map(function (item, index) {
var pic = item.pic,
name = item.name,
identifier = item.identifier,
template_description = item.template_description,
id = item.id;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
className: CommonPracticemodules.li,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.d1,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.img,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: "".concat(env/* default */.Z.IMG_SERVER, "/").concat(pic),
style: {
width: '100%',
height: '100%',
objectFit: 'cover'
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.btn,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.b1,
onClick: function onClick() {
return (0,util/* openNewWindow */.xg)("/shixuns/".concat(identifier, "/challenges"));
},
children: "\u67E5\u770B\u8BE6\u60C5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.b2,
onClick: function onClick() {
return handleCopy(item);
},
children: "\u4F7F\u7528\u6A21\u677F"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.bot,
children: name || '--'
})]
}), !!template_description ? /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: template_description,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.d2,
children: template_description
})
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.d2,
children: "--"
})]
}, index);
})
}), !!recommend_shixuns.length && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.title,
children: "\u63A8\u8350\u5B9E\u8DF5\u9879\u76EE\u6837\u4F8B"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
className: CommonPracticemodules.sys,
children: recommend_shixuns.map(function (item, index) {
var pic = item.pic,
name = item.name,
identifier = item.identifier,
id = item.id;
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: CommonPracticemodules.li,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.d1,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.img,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: "".concat(env/* default */.Z.IMG_SERVER, "/").concat(pic),
style: {
width: '100%',
height: '100%',
objectFit: 'cover'
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.btn,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.b1,
onClick: function onClick() {
return (0,util/* openNewWindow */.xg)("/shixuns/".concat(identifier, "/challenges"));
},
children: "\u67E5\u770B\u8BE6\u60C5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.b2,
onClick: function onClick() {
return handleCopy(item);
},
children: "\u4E00\u952E\u590D\u5236"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: CommonPracticemodules.bot,
children: name
})]
})
}, index);
})
})]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: "\u4E00\u952E\u65B0\u5EFA",
open: isModalVisible,
centered: true,
onCancel: handleCancel,
footer: null,
wrapClassName: CommonPracticemodules.practiceModal,
children: [authorization && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u4E00\u952E\u65B0\u5EFA\u540E\uFF0C\u60A8\u53EF\u4EE5\u57FA\u4E8E\u8FD9\u4E2A\u5B9E\u8BAD\u4FEE\u6539\u5F62\u6210\u65B0\u7684\u5B9E\u8BAD"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: CommonPracticemodules.btn,
loading: copyLoading,
onClick: handleOk,
children: "\u786E\u8BA4\u590D\u5236"
})]
}), !authorization && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u8BE5\u5B9E\u8BAD\u6240\u4F7F\u7528\u7684\u5B9E\u9A8C\u73AF\u5883\u4E3A\u79C1\u6709\u73AF\u5883\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#0152d9'
},
children: name
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u60A8\u65E0\u8BE5\u5B9E\u9A8C\u73AF\u5883\u7684\u4F7F\u7528\u6743\u9650\uFF0C\u6240\u4EE5\u65E0\u6CD5\u590D\u5236\u8BE5\u5B9E\u8BAD"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
onClick: function onClick() {
return setIsModalVisible(false);
},
children: "\u6211\u77E5\u9053\u4E86"
})]
})]
})]
});
};
/* harmony default export */ var components_CommonPractice = ((0,_umi_production_exports.connect)(function (_ref6) {
var newShixuns = _ref6.newShixuns,
globalSetting = _ref6.globalSetting,
user = _ref6.user;
return {
newShixuns: newShixuns,
globalSetting: globalSetting,
user: user
};
})(CommonPractice));
// 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/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// 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/checkbox/index.js + 3 modules
var es_checkbox = __webpack_require__(24905);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
var markdown_editor = __webpack_require__(92042);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/JupyterPractice/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var JupyterPracticemodules = ({"flexRow":"flexRow___qhrFS","flexJustifyCenter":"flexJustifyCenter___VrsJS","flexAlignEnd":"flexAlignEnd___j3ukr","flexAlignCenter":"flexAlignCenter___oYrc_","flexColumn":"flexColumn___biwiK","formWrap":"formWrap___y7qnO","JupyterFieldWrapElse":"JupyterFieldWrapElse___mAcbc","button":"button___nO4ST","buttonWrap":"buttonWrap___R159y","width240":"width240___WKtEs","difficultyHint":"difficultyHint___ur1_m","color888":"color888___KIde8","color0152d9":"color0152d9____7CR3","installPackage":"installPackage___uTEn1","apply":"apply___PWFCo","p1":"p1___DywU_","p2":"p2___wgqUA"});
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/DesModal/index.tsx + 1 modules
var DesModal = __webpack_require__(34895);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/JupyterPractice/index.tsx
var Option = es_select["default"].Option;
var JupyterPractice = function JupyterPractice(_ref) {
var _formValue$name, _newShixuns$newData2, _newShixuns$newData3;
var newShixuns = _ref.newShixuns,
loading = _ref.loading,
dispatch = _ref.dispatch,
is_jupyter_lab = _ref.is_jupyter_lab,
user = _ref.user;
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)({}),
_useState2 = slicedToArray_default()(_useState, 2),
formValue = _useState2[0],
setFormValue = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
visible = _useState4[0],
setVisible = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)({}),
_useState6 = slicedToArray_default()(_useState5, 2),
installPackage = _useState6[0],
setInstallPackage = _useState6[1];
(0,_react_17_0_2_react.useEffect)(function () {
var type = 'newShixuns/getNewShixunsData';
if (is_jupyter_lab) {
type = 'newShixuns/getShixunsJupyterLab';
}
dispatch({
type: type
});
}, [is_jupyter_lab]);
(0,_react_17_0_2_react.useEffect)(function () {
var _newShixuns$newData;
var mainTypeId = newShixuns === null || newShixuns === void 0 || (_newShixuns$newData = newShixuns.newData) === null || _newShixuns$newData === void 0 || (_newShixuns$newData = _newShixuns$newData.main_type) === null || _newShixuns$newData === void 0 || (_newShixuns$newData = _newShixuns$newData[0]) === null || _newShixuns$newData === void 0 ? void 0 : _newShixuns$newData.id;
form.setFieldsValue({
mainType: mainTypeId
});
handleChangeInstallPackage(mainTypeId);
}, [newShixuns]);
var handleApply = function handleApply() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {
key: 'NewShixuns-Apply'
}
});
};
var handleValuesChange = function handleValuesChange(changeValues, values) {
setFormValue(objectSpread2_default()({}, values));
console.log(changeValues, 'changeValues');
if ('mainType' in changeValues) {
handleChangeInstallPackage(values.mainType, values.subType);
}
if ('subType' in changeValues) {
handleChangeInstallPackage(values.mainType, values.subType);
}
};
var handleChangeInstallPackage = function handleChangeInstallPackage(mianType) {
var subType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var _ref2 = newShixuns.newData || {},
main_type = _ref2.main_type,
small_type = _ref2.small_type;
var mainInstall = main_type === null || main_type === void 0 ? void 0 : main_type.find(function (item) {
return item.id === mianType;
});
var params = {
mainTypeName: mainInstall === null || mainInstall === void 0 ? void 0 : mainInstall.type_name,
mainTypeDescription: mainInstall === null || mainInstall === void 0 ? void 0 : mainInstall.description,
smallType: []
};
subType.map(function (sub) {
small_type.map(function (item) {
if (sub === item.id && !!item.description) {
params.smallType.push({
name: item.type_name,
des: item.description
});
}
});
});
setInstallPackage(params);
};
var handleFinish = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(values) {
var _ref4, intro, main_type, sub_type, name, number, trainee, _ref4$jupyter_show_de, jupyter_show_description, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_ref4 = values || {}, intro = _ref4.intro, main_type = _ref4.mainType, sub_type = _ref4.subType, name = _ref4.name, number = _ref4.number, trainee = _ref4.difficulty, _ref4$jupyter_show_de = _ref4.jupyter_show_description, jupyter_show_description = _ref4$jupyter_show_de === void 0 ? false : _ref4$jupyter_show_de;
(0,util/* trackEvent */.L9)(['实践项目', '新建实践项目', is_jupyter_lab ? 'Jupyter Notebook实践项目' : 'JupyterLab实践项目', '保存']);
_context.next = 4;
return dispatch({
type: 'newShixuns/submitShixuns',
payload: {
description: intro,
main_type: main_type,
sub_type: sub_type,
shixun: {
jupyter_show_description: jupyter_show_description,
name: name,
number: number,
trainee: trainee,
is_jupyter: is_jupyter_lab ? false : true,
is_jupyter_lab: is_jupyter_lab
}
}
});
case 4:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) !== -1) {
_umi_production_exports.history.push("/shixuns/".concat(res.shixun_identifier, "/challenges"));
}
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return function handleFinish(_x) {
return _ref3.apply(this, arguments);
};
}();
var CreateImg = function CreateImg() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {
key: 'Create-Environment'
}
});
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
form: form,
className: JupyterPracticemodules.JupyterFieldWrapElse,
scrollToFirstError: true,
layout: "vertical",
initialValues: {
difficulty: 1
},
onValuesChange: handleValuesChange,
onFinish: handleFinish,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: JupyterPracticemodules.fieldWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "name",
label: "\u540D\u79F0:",
rules: [{
required: true,
message: '请输入名称'
}, {
max: 60,
message: '请输入名称最大限制60个字符'
}, {
whitespace: true,
message: '请勿输入空格'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
bordered: false,
placeholder: "\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",
suffix: "".concat(((_formValue$name = formValue.name) === null || _formValue$name === void 0 ? void 0 : _formValue$name.length) || 0, "/60")
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "intro",
label: "\u7B80\u4ECB:",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
watch: true
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "jupyter_show_description",
valuePropName: "checked",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
children: "\u663E\u793A\u4EFB\u52A1\u8981\u6C42\uFF08\u52FE\u9009\u540E\uFF0C\u5C06\u7B80\u4ECB\u4F5C\u4E3A\u4EFB\u52A1\u8981\u6C42\u663E\u793A\u5728\u5B9E\u8DF5\u9879\u76EE\u6311\u6218\u9875\u9762\uFF09"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(JupyterPracticemodules.flexRow, " ").concat(JupyterPracticemodules.flexAlignCenter),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: JupyterPracticemodules.width180,
name: "number",
label: "\u5B9E\u9A8C\u7F16\u53F7:"
// rules={[{ required: true, message: '请输入实验编号' }]}
,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
bordered: false,
style: {
width: 500
},
placeholder: "\u8BF7\u8F93\u5165\u5B9E\u9A8C\u7F16\u53F7\uFF0C\u6700\u591A20\u4E2A\u5B57\u7B26",
maxLength: 20
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(JupyterPracticemodules.flexRow, " ").concat(JupyterPracticemodules.flexAlignCenter),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
className: JupyterPracticemodules.width180,
name: "difficulty",
label: "\u96BE\u6613\u5EA6:",
rules: [{
required: true,
message: '请选择难易度'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select["default"], {
bordered: false,
placeholder: "\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6",
style: {
width: 500
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: 1,
children: "\u521D\u7EA7"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: 2,
children: "\u4E2D\u7EA7"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: 3,
children: "\u4E2D\u9AD8\u7EA7"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: 4,
children: "\u9AD8\u7EA7"
})]
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(JupyterPracticemodules.flexRow, " ").concat(JupyterPracticemodules.flexAlignEnd),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "mainType",
label: "\u5B9E\u9A8C\u73AF\u5883:",
rules: [{
required: true,
message: '请选择主类别'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
bordered: false,
placeholder: "\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B",
style: {
width: 500
},
children: (_newShixuns$newData2 = newShixuns.newData) === null || _newShixuns$newData2 === void 0 || (_newShixuns$newData2 = _newShixuns$newData2.main_type) === null || _newShixuns$newData2 === void 0 ? void 0 : _newShixuns$newData2.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: item.id,
name: item.description,
children: item.type_name
}, item.id);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "subType",
className: "".concat(JupyterPracticemodules.width240, " ml20"),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
getPopupContainer: function getPopupContainer(trigger) {
return trigger.parentNode;
},
bordered: false,
placeholder: "\u8BF7\u9009\u62E9\u5C0F\u7C7B\u522B",
mode: "multiple",
children: (_newShixuns$newData3 = newShixuns.newData) === null || _newShixuns$newData3 === void 0 || (_newShixuns$newData3 = _newShixuns$newData3.small_type) === null || _newShixuns$newData3 === void 0 ? void 0 : _newShixuns$newData3.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(Option, {
value: item.id,
name: item.description,
children: item.type_name
}, item.id);
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: JupyterPracticemodules.installPackage,
onClick: function onClick() {
return setVisible(true);
},
children: "\u73AF\u5883\u4ECB\u7ECD"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: JupyterPracticemodules.apply,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: JupyterPracticemodules.p1,
children: "\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: JupyterPracticemodules.p2,
onClick: handleApply,
children: "\u7533\u8BF7\u65B0\u5EFA"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: JupyterPracticemodules.p2,
onClick: CreateImg,
children: "\u5728\u7EBF\u521B\u5EFA"
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: JupyterPracticemodules.buttonWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
className: "".concat(JupyterPracticemodules.button, " mr20"),
onClick: function onClick() {
(0,util/* trackEvent */.L9)(['实践项目', '新建实践项目', is_jupyter_lab ? 'Jupyter Notebook实践项目' : 'JupyterLab实践项目', '取消']);
_umi_production_exports.history.push('/shixuns');
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: 'middle',
type: "primary",
className: "".concat(JupyterPracticemodules.button, " mr20"),
htmlType: "submit",
loading: loading['newShixuns/submitCourses'],
children: "\u4FDD\u5B58"
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(DesModal/* default */.Z, {
installPackage: installPackage,
visible: visible,
setVisible: setVisible
})]
});
};
/* harmony default export */ var components_JupyterPractice = ((0,_umi_production_exports.connect)(function (_ref5) {
var newShixuns = _ref5.newShixuns,
loading = _ref5.loading,
user = _ref5.user;
return {
newShixuns: newShixuns,
loading: loading.effects,
user: user
};
})(JupyterPractice));
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx
var CreateEnvironment = __webpack_require__(1979);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Newmodules = ({"practicalTraining":"practicalTraining___VpEJN","titleWrap":"titleWrap___K8TrM","title":"title___x3Eob","line":"line___z14_S","dec":"dec___z7Nns"});
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/index.tsx
var NewShixunsPage = function NewShixunsPage() {
var _useState = (0,_react_17_0_2_react.useState)('1'),
_useState2 = slicedToArray_default()(_useState, 2),
radioValue = _useState2[0],
setRadioValue = _useState2[1];
var handleRadio = function handleRadio(e) {
setRadioValue(e.target.value);
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: Newmodules.practicalTraining,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Newmodules.titleWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Newmodules.title,
children: "\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Newmodules.line
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
value: radioValue,
onChange: handleRadio,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
style: {
fontSize: 16
},
value: "1",
children: "\u5168\u6808\u5B9E\u8DF5\u9879\u76EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "2",
style: {
marginLeft: 40,
fontSize: 16
},
children: "Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "3",
style: {
marginLeft: 40,
fontSize: 16
},
children: "JupyterLab\u5B9E\u8DF5\u9879\u76EE"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Newmodules.dec,
children: [radioValue === '1' && '多功能新型实战项目模式支持图形化桌面、Web IDE、命令行、虚拟仿真等多种实验场景适用于各类复杂工程项目研发。', radioValue === '2' && '多功能实时交互实验模式支持实时代码、数学方程、可视化和MarkDown等。 适用于数据清理、数值模拟、统计建模、机器学习等系列实验。', radioValue === '3' && 'JupyterLab是新一代Jupyter Notebook配置文件目录和Notebook支持数据科学中的各种工作流程适合中大型项目。']
})]
}), radioValue === '1' && /*#__PURE__*/(0,jsx_runtime.jsx)(components_CommonPractice, {
shixun_type: "normal"
}), (radioValue === '2' || radioValue === '3') && /*#__PURE__*/(0,jsx_runtime.jsx)(components_JupyterPractice, {
is_jupyter_lab: radioValue === '2' ? false : true
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ApplyModal/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(CreateEnvironment/* default */.Z, {})]
});
};
/* harmony default export */ var New = (NewShixunsPage);
/***/ })
}]);