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.
673 lines
36 KiB
673 lines
36 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[7008],{
|
|
|
|
/***/ 4422:
|
|
/*!*************************************************************************!*\
|
|
!*** ./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
|
|
var RenderHtml = __webpack_require__(16921);
|
|
;// 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"});
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/DesModal/index.tsx
|
|
|
|
|
|
|
|
|
|
const DesModal = ({
|
|
installPackage,
|
|
visible,
|
|
setVisible
|
|
}) => {
|
|
var _a, _b;
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (visible) {
|
|
document.body.setAttribute("class", DesModalmodules.bodyHeight);
|
|
} else {
|
|
document.body.removeAttribute("class");
|
|
}
|
|
return () => {
|
|
document.body.removeAttribute("class");
|
|
};
|
|
}, [visible]);
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
keyboard: false,
|
|
destroyOnClose: true,
|
|
open: visible,
|
|
title: "\u73AF\u5883\u4ECB\u7ECD",
|
|
width: "1000px",
|
|
wrapClassName: DesModalmodules.wrapInstallPackageStyle,
|
|
footer: null,
|
|
onCancel: () => setVisible(false)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: DesModalmodules.installPackageStyle }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mb30" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: DesModalmodules.title }, installPackage.mainTypeName), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: installPackage.mainTypeDescription }))), !!((_a = installPackage == null ? void 0 : installPackage.smallType) == null ? void 0 : _a.length) && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: DesModalmodules.line }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, (_b = installPackage == null ? void 0 : installPackage.smallType) == null ? void 0 : _b.map((e, i) => {
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, { key: i }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: DesModalmodules.title, style: { marginBottom: 14 } }, e.name), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: "mb30" }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: e.des })));
|
|
})))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_DesModal = (DesModal);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 92729:
|
|
/*!*****************************************************!*\
|
|
!*** ./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/_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__(53277);
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
|
|
var _umi_production_exports = __webpack_require__(67866);
|
|
// 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__(30278);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(13462);
|
|
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
|
|
var noEnvData = __webpack_require__(36723);
|
|
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
|
|
var RenderHtml = __webpack_require__(16921);
|
|
// EXTERNAL MODULE: ./src/components/SelectEnvironment/index.tsx + 1 modules
|
|
var SelectEnvironment = __webpack_require__(46064);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(21873);
|
|
;// 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__(51165);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
var ui_customization = __webpack_require__(26324);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/CommonPractice/index.tsx
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CommonPractice = ({
|
|
newShixuns,
|
|
user,
|
|
dispatch,
|
|
shixun_type
|
|
}) => {
|
|
var _a, _b;
|
|
const [searchParams] = (0,_umi_production_exports.useSearchParams)();
|
|
const [mirrorId, setMirrorId] = (0,_react_17_0_2_react.useState)(searchParams.get("mirror") || null);
|
|
const [tabId, setTabId] = (0,_react_17_0_2_react.useState)(searchParams.get("tab") || null);
|
|
const [copyInfo, setCopyInfo] = (0,_react_17_0_2_react.useState)(null);
|
|
const [activeId, setActiveId] = (0,_react_17_0_2_react.useState)(Number(mirrorId) || null);
|
|
const [detail, setDetail] = (0,_react_17_0_2_react.useState)({});
|
|
const [isModalVisible, setIsModalVisible] = (0,_react_17_0_2_react.useState)(false);
|
|
const [copyLoading, setCopyLoading] = (0,_react_17_0_2_react.useState)(false);
|
|
const { environmentData } = newShixuns;
|
|
const { frequence_image = [], environments = [], other_image } = environmentData;
|
|
const { name, description, authorization, template_shixuns = [], recommend_shixuns = [] } = detail;
|
|
const [tab, setTab] = (0,_react_17_0_2_react.useState)(Number(tabId) || 0);
|
|
const mirrorItems = [{
|
|
id: 0,
|
|
name: "\u516C\u5171\u955C\u50CF",
|
|
type: "public"
|
|
}, {
|
|
id: 1,
|
|
name: "\u81EA\u5B9A\u4E49\u955C\u50CF",
|
|
type: "customize"
|
|
}, {
|
|
id: 2,
|
|
name: "\u5171\u4EAB\u955C\u50CF",
|
|
type: "share"
|
|
}];
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
dispatch({
|
|
type: "newShixuns/getEnvironmentData",
|
|
payload: {
|
|
tab_type: mirrorItems[Number(tab)].type
|
|
}
|
|
});
|
|
}, [tab]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
if (activeId === null || !other_image)
|
|
return;
|
|
getData();
|
|
}, [activeId, other_image]);
|
|
const getData = () => __async(void 0, null, function* () {
|
|
const fi = frequence_image.find((item) => item.id === activeId);
|
|
const ei = environments.find((item) => item.id === activeId);
|
|
const oi = other_image == null ? void 0 : other_image.find((item) => item.id === activeId);
|
|
console.log("fi,ei,oi", fi, ei, oi);
|
|
if (fi !== void 0 || ei !== void 0 || oi !== void 0) {
|
|
const res = yield (0,shixuns/* getEnvironmentDetail */.Q1)({ mirror_repository_id: activeId });
|
|
setDetail(res == null ? void 0 : res.data);
|
|
} else {
|
|
setDetail({});
|
|
setActiveId(null);
|
|
}
|
|
});
|
|
console.log(activeId);
|
|
const handleCopy = (item) => {
|
|
setCopyInfo(item);
|
|
setIsModalVisible(true);
|
|
};
|
|
const handleOk = () => __async(void 0, null, function* () {
|
|
var _a2, _b2;
|
|
setCopyLoading(true);
|
|
const res = yield (0,fetch/* default */.ZP)(
|
|
`/api/shixuns/${copyInfo == null ? void 0 : copyInfo.identifier}/copy.json`,
|
|
{
|
|
method: "post",
|
|
body: {}
|
|
}
|
|
);
|
|
if (res.status === 0) {
|
|
(_b2 = _umi_production_exports.history) == null ? void 0 : _b2.push(`/shixuns/${(_a2 = res.data) == null ? void 0 : _a2.shixun}/edit`);
|
|
setIsModalVisible(false);
|
|
message/* default */.ZP.success("\u590D\u5236\u6210\u529F");
|
|
}
|
|
setCopyLoading(false);
|
|
});
|
|
const handleCancel = () => {
|
|
setIsModalVisible(false);
|
|
};
|
|
const handleConfirm = (skip = false) => __async(void 0, null, function* () {
|
|
(0,util/* trackEvent */.L9)(["\u5B9E\u8DF5\u9879\u76EE", "\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE", "\u5168\u5B9E\u8DF5\u9879\u76EE", skip ? "\u6682\u4E0D\u9009\u7528\u955C\u50CF" : "\u4F7F\u7528\u5F53\u524D\u955C\u50CF"]);
|
|
const body = activeId && !skip ? { image_id: activeId } : {};
|
|
const res = yield (0,fetch/* default */.ZP)(
|
|
`/api/shixuns/choose_environment_or_skip.json`,
|
|
{
|
|
method: "post",
|
|
body: __spreadProps(__spreadValues({}, body), { mirror_tab_type: tab })
|
|
}
|
|
);
|
|
if (res.status === 0) {
|
|
_umi_production_exports.history.push(`/shixuns/${res.data.identifier}/edit`);
|
|
}
|
|
});
|
|
const [keyword, setKeyword] = (0,_react_17_0_2_react.useState)("");
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.practice }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
SelectEnvironment/* default */.Z,
|
|
{
|
|
dispatch,
|
|
value: activeId,
|
|
data: environments,
|
|
otherData: other_image || [],
|
|
tags: frequence_image,
|
|
onChange: (id) => {
|
|
console.log(id, 222);
|
|
setActiveId(id);
|
|
},
|
|
shixun_type,
|
|
onSearchWord: (value) => setKeyword(value),
|
|
tab_type: (_a = mirrorItems[Number(tab)]) == null ? void 0 : _a.type,
|
|
extraContent: /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
ui_customization/* SuperiorTabs */.tp,
|
|
{
|
|
dataSource: mirrorItems,
|
|
value: tab,
|
|
onChange: (id) => {
|
|
setTab(id);
|
|
setActiveId(null);
|
|
}
|
|
}
|
|
)
|
|
}
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.right }, /* @__PURE__ */ _react_17_0_2_react.createElement("header", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.title }, "\u5B9E\u9A8C\u73AF\u5883:\xA0", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { dangerouslySetInnerHTML: { __html: activeId === null ? "\u2014 \u2014" : (_b = name || "") == null ? void 0 : _b.replace(new RegExp(keyword == null ? void 0 : keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"), '<span style="color:#0152d9;background-color:#1890ff33">$&</span>') } }))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.content }, activeId === null && /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /* @__PURE__ */ _react_17_0_2_react.createElement(empty/* default */.Z, { image: noEnvData, description: "\u8BF7\u9009\u62E9\u5B9E\u9A8C\u73AF\u5883" }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.btns }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { size: "middle", style: { marginRight: 20 }, onClick: () => handleConfirm(true) }, " \u6682\u4E0D\u9009\u7528\u955C\u50CF"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { size: "middle", type: "primary", disabled: activeId === null, onClick: () => handleConfirm() }, "\u4F7F\u7528\u5F53\u524D\u955C\u50CF"))), activeId !== null && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.des }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.mainBody }, /* @__PURE__ */ _react_17_0_2_react.createElement(RenderHtml/* default */.Z, { value: description, highlightKeywords: keyword })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.btns, style: { borderBottom: template_shixuns.length || recommend_shixuns.length ? "1px solid #F1F1F1" : 0 } }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { size: "middle", style: { marginRight: 20 }, onClick: () => handleConfirm(true) }, " \u6682\u4E0D\u9009\u7528\u955C\u50CF"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { size: "middle", type: "primary", disabled: activeId === null, onClick: () => handleConfirm() }, "\u4F7F\u7528\u5F53\u524D\u955C\u50CF")), !!template_shixuns.length && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.title }, "\u57FA\u4E8E\u6A21\u677F\u521B\u5EFA"), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: CommonPracticemodules.sys }, template_shixuns.map((item, index) => {
|
|
const { pic, name: name2, identifier, template_description, id } = item;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: CommonPracticemodules.li, key: index }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.d1 }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.img }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: `${env/* default */.Z.IMG_SERVER}/${pic}`, style: { width: "100%", height: "100%", objectFit: "cover" } })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.btn }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"div",
|
|
{
|
|
className: CommonPracticemodules.b1,
|
|
onClick: () => (0,util/* openNewWindow */.xg)(`/shixuns/${identifier}/challenges`)
|
|
},
|
|
"\u67E5\u770B\u8BE6\u60C5"
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.b2, onClick: () => handleCopy(item) }, "\u4F7F\u7528\u6A21\u677F")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.bot }, name2 || "--")), !!template_description ? /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: template_description }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.d2 }, template_description)) : /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.d2 }, "--"));
|
|
})), !!recommend_shixuns.length && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.title }, "\u63A8\u8350\u5B9E\u8DF5\u9879\u76EE\u6837\u4F8B"), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: CommonPracticemodules.sys }, recommend_shixuns.map((item, index) => {
|
|
const { pic, name: name2, identifier, id } = item;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: CommonPracticemodules.li, key: index }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.d1 }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.img }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { src: `${pic}`, style: { width: "100%", height: "100%", objectFit: "cover" } })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.btn }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.b1, onClick: () => (0,util/* openNewWindow */.xg)(`/shixuns/${identifier}/challenges`) }, "\u67E5\u770B\u8BE6\u60C5"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.b2, onClick: () => handleCopy(item) }, "\u4E00\u952E\u590D\u5236")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.bot }, name2)));
|
|
}))))), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
title: "\u4E00\u952E\u65B0\u5EFA",
|
|
open: isModalVisible,
|
|
centered: true,
|
|
onCancel: handleCancel,
|
|
footer: null,
|
|
wrapClassName: CommonPracticemodules.practiceModal
|
|
},
|
|
authorization && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement("p", null, "\u4E00\u952E\u65B0\u5EFA\u540E\uFF0C\u60A8\u53EF\u4EE5\u57FA\u4E8E\u8FD9\u4E2A\u5B9E\u8BAD\u4FEE\u6539\u5F62\u6210\u65B0\u7684\u5B9E\u8BAD"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { className: CommonPracticemodules.btn, loading: copyLoading, onClick: handleOk }, "\u786E\u8BA4\u590D\u5236")),
|
|
!authorization && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: CommonPracticemodules.content }, /* @__PURE__ */ _react_17_0_2_react.createElement("aside", null, /* @__PURE__ */ _react_17_0_2_react.createElement("p", null, "\u8BE5\u5B9E\u8BAD\u6240\u4F7F\u7528\u7684\u5B9E\u9A8C\u73AF\u5883\u4E3A\u79C1\u6709\u73AF\u5883\uFF1A", /* @__PURE__ */ _react_17_0_2_react.createElement("span", { style: { color: "#0152d9" } }, name)), /* @__PURE__ */ _react_17_0_2_react.createElement("p", null, "\u60A8\u65E0\u8BE5\u5B9E\u9A8C\u73AF\u5883\u7684\u4F7F\u7528\u6743\u9650\uFF0C\u6240\u4EE5\u65E0\u6CD5\u590D\u5236\u8BE5\u5B9E\u8BAD")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { onClick: () => setIsModalVisible(false) }, "\u6211\u77E5\u9053\u4E86"))
|
|
));
|
|
};
|
|
/* harmony default export */ var components_CommonPractice = ((0,_umi_production_exports.connect)(
|
|
({
|
|
newShixuns,
|
|
globalSetting,
|
|
user
|
|
}) => ({
|
|
newShixuns,
|
|
globalSetting,
|
|
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 + 5 modules
|
|
var input = __webpack_require__(98135);
|
|
// 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 + 15 modules
|
|
var markdown_editor = __webpack_require__(96180);
|
|
;// 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__(4422);
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/JupyterPractice/index.tsx
|
|
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
|
|
var JupyterPractice_defProp = Object.defineProperty;
|
|
var JupyterPractice_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var JupyterPractice_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var JupyterPractice_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var JupyterPractice_defNormalProp = (obj, key, value) => key in obj ? JupyterPractice_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var JupyterPractice_spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (JupyterPractice_hasOwnProp.call(b, prop))
|
|
JupyterPractice_defNormalProp(a, prop, b[prop]);
|
|
if (JupyterPractice_getOwnPropSymbols)
|
|
for (var prop of JupyterPractice_getOwnPropSymbols(b)) {
|
|
if (JupyterPractice_propIsEnum.call(b, prop))
|
|
JupyterPractice_defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var JupyterPractice_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Option = es_select["default"].Option;
|
|
const JupyterPractice = ({
|
|
newShixuns,
|
|
loading,
|
|
dispatch,
|
|
is_jupyter_lab,
|
|
user
|
|
}) => {
|
|
var _a, _b, _c, _d, _e;
|
|
const [form] = es_form["default"].useForm();
|
|
const [formValue, setFormValue] = (0,_react_17_0_2_react.useState)({});
|
|
const [visible, setVisible] = (0,_react_17_0_2_react.useState)(false);
|
|
const [installPackage, setInstallPackage] = (0,_react_17_0_2_react.useState)({});
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
let type = "newShixuns/getNewShixunsData";
|
|
if (is_jupyter_lab) {
|
|
type = "newShixuns/getShixunsJupyterLab";
|
|
}
|
|
dispatch({
|
|
type
|
|
});
|
|
}, [is_jupyter_lab]);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a2, _b2, _c2;
|
|
const mainTypeId = (_c2 = (_b2 = (_a2 = newShixuns == null ? void 0 : newShixuns.newData) == null ? void 0 : _a2.main_type) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.id;
|
|
form.setFieldsValue({
|
|
mainType: mainTypeId
|
|
});
|
|
handleChangeInstallPackage(mainTypeId);
|
|
}, [newShixuns]);
|
|
const handleApply = () => {
|
|
dispatch({
|
|
type: "newShixuns/setActionTabs",
|
|
payload: { key: "NewShixuns-Apply" }
|
|
});
|
|
};
|
|
const handleValuesChange = (changeValues, values) => {
|
|
setFormValue(JupyterPractice_spreadValues({}, values));
|
|
console.log(changeValues, "changeValues");
|
|
if ("mainType" in changeValues) {
|
|
handleChangeInstallPackage(values.mainType, values.subType);
|
|
}
|
|
if ("subType" in changeValues) {
|
|
handleChangeInstallPackage(values.mainType, values.subType);
|
|
}
|
|
};
|
|
const handleChangeInstallPackage = (mianType, subType = []) => {
|
|
const { main_type, small_type } = newShixuns.newData || {};
|
|
const mainInstall = main_type == null ? void 0 : main_type.find((item) => item.id === mianType);
|
|
const params = {
|
|
mainTypeName: mainInstall == null ? void 0 : mainInstall.type_name,
|
|
mainTypeDescription: mainInstall == null ? void 0 : mainInstall.description,
|
|
smallType: []
|
|
};
|
|
subType.map((sub) => {
|
|
small_type.map((item) => {
|
|
if (sub === item.id && !!item.description) {
|
|
params.smallType.push({
|
|
name: item.type_name,
|
|
des: item.description
|
|
});
|
|
}
|
|
});
|
|
});
|
|
setInstallPackage(params);
|
|
};
|
|
const handleFinish = (values) => JupyterPractice_async(void 0, null, function* () {
|
|
const {
|
|
intro,
|
|
mainType: main_type,
|
|
subType: sub_type,
|
|
name,
|
|
number,
|
|
difficulty: trainee,
|
|
jupyter_show_description = false
|
|
} = values || {};
|
|
(0,util/* trackEvent */.L9)([
|
|
"\u5B9E\u8DF5\u9879\u76EE",
|
|
"\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",
|
|
is_jupyter_lab ? "Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE" : "JupyterLab\u5B9E\u8DF5\u9879\u76EE",
|
|
"\u4FDD\u5B58"
|
|
]);
|
|
let res = yield dispatch({
|
|
type: "newShixuns/submitShixuns",
|
|
payload: {
|
|
description: intro,
|
|
main_type,
|
|
sub_type,
|
|
shixun: {
|
|
jupyter_show_description,
|
|
name,
|
|
number,
|
|
trainee,
|
|
is_jupyter: is_jupyter_lab ? false : true,
|
|
is_jupyter_lab
|
|
}
|
|
}
|
|
});
|
|
if ((res == null ? void 0 : res.status) !== -1) {
|
|
window.location.href = `/shixuns/${res.shixun_identifier}/challenges`;
|
|
}
|
|
});
|
|
const CreateImg = () => {
|
|
dispatch({
|
|
type: "newShixuns/setActionTabs",
|
|
payload: { key: "Create-Environment" }
|
|
});
|
|
};
|
|
return /* @__PURE__ */ React.createElement(
|
|
es_form["default"],
|
|
{
|
|
form,
|
|
className: JupyterPracticemodules.JupyterFieldWrapElse,
|
|
scrollToFirstError: true,
|
|
layout: "vertical",
|
|
initialValues: { difficulty: 1 },
|
|
onValuesChange: handleValuesChange,
|
|
onFinish: handleFinish
|
|
},
|
|
/* @__PURE__ */ React.createElement("div", { className: JupyterPracticemodules.fieldWrap }, /* @__PURE__ */ React.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "name",
|
|
label: "\u540D\u79F0:",
|
|
rules: [
|
|
{ required: true, message: "\u8BF7\u8F93\u5165\u540D\u79F0" },
|
|
{ max: 60, message: "\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26" },
|
|
{ whitespace: true, message: "\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C" }
|
|
]
|
|
},
|
|
/* @__PURE__ */ React.createElement(
|
|
input["default"],
|
|
{
|
|
bordered: false,
|
|
placeholder: "\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",
|
|
suffix: `${((_a = formValue.name) == null ? void 0 : _a.length) || 0}/60`
|
|
}
|
|
)
|
|
), /* @__PURE__ */ React.createElement(es_form["default"].Item, { name: "intro", label: "\u7B80\u4ECB:" }, /* @__PURE__ */ React.createElement(markdown_editor/* default */.Z, { watch: true })), /* @__PURE__ */ React.createElement(es_form["default"].Item, { name: "jupyter_show_description", valuePropName: "checked" }, /* @__PURE__ */ React.createElement(es_checkbox["default"], null, "\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__ */ React.createElement("div", { className: `${JupyterPracticemodules.flexRow} ${JupyterPracticemodules.flexAlignCenter}` }, /* @__PURE__ */ React.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
className: JupyterPracticemodules.width180,
|
|
name: "number",
|
|
label: "\u5B9E\u9A8C\u7F16\u53F7:"
|
|
},
|
|
/* @__PURE__ */ React.createElement(
|
|
input["default"],
|
|
{
|
|
bordered: false,
|
|
style: { width: 500 },
|
|
placeholder: "\u8BF7\u8F93\u5165\u5B9E\u9A8C\u7F16\u53F7\uFF0C\u6700\u591A20\u4E2A\u5B57\u7B26",
|
|
maxLength: 20
|
|
}
|
|
)
|
|
)), /* @__PURE__ */ React.createElement("div", { className: `${JupyterPracticemodules.flexRow} ${JupyterPracticemodules.flexAlignCenter}` }, /* @__PURE__ */ React.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
className: JupyterPracticemodules.width180,
|
|
name: "difficulty",
|
|
label: "\u96BE\u6613\u5EA6:",
|
|
rules: [{ required: true, message: "\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6" }]
|
|
},
|
|
/* @__PURE__ */ React.createElement(
|
|
es_select["default"],
|
|
{
|
|
bordered: false,
|
|
placeholder: "\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6",
|
|
style: { width: 500 }
|
|
},
|
|
/* @__PURE__ */ React.createElement(Option, { value: 1 }, "\u521D\u7EA7"),
|
|
/* @__PURE__ */ React.createElement(Option, { value: 2 }, "\u4E2D\u7EA7"),
|
|
/* @__PURE__ */ React.createElement(Option, { value: 3 }, "\u4E2D\u9AD8\u7EA7"),
|
|
/* @__PURE__ */ React.createElement(Option, { value: 4 }, "\u9AD8\u7EA7")
|
|
)
|
|
)), /* @__PURE__ */ React.createElement("div", { className: `${JupyterPracticemodules.flexRow} ${JupyterPracticemodules.flexAlignEnd}` }, /* @__PURE__ */ React.createElement(
|
|
es_form["default"].Item,
|
|
{
|
|
name: "mainType",
|
|
label: "\u5B9E\u9A8C\u73AF\u5883:",
|
|
rules: [{ required: true, message: "\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B" }]
|
|
},
|
|
/* @__PURE__ */ React.createElement(es_select["default"], { bordered: false, placeholder: "\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B", style: { width: 500 } }, (_c = (_b = newShixuns.newData) == null ? void 0 : _b.main_type) == null ? void 0 : _c.map((item) => {
|
|
return /* @__PURE__ */ React.createElement(Option, { value: item.id, key: item.id, name: item.description }, item.type_name);
|
|
}))
|
|
), /* @__PURE__ */ React.createElement(es_form["default"].Item, { name: "subType", className: `${JupyterPracticemodules.width240} ml20` }, /* @__PURE__ */ React.createElement(
|
|
es_select["default"],
|
|
{
|
|
getPopupContainer: (trigger) => trigger.parentNode,
|
|
bordered: false,
|
|
placeholder: "\u8BF7\u9009\u62E9\u5C0F\u7C7B\u522B",
|
|
mode: "multiple"
|
|
},
|
|
(_e = (_d = newShixuns.newData) == null ? void 0 : _d.small_type) == null ? void 0 : _e.map((item) => {
|
|
return /* @__PURE__ */ React.createElement(Option, { value: item.id, key: item.id, name: item.description }, item.type_name);
|
|
})
|
|
)), /* @__PURE__ */ React.createElement(
|
|
"div",
|
|
{
|
|
className: JupyterPracticemodules.installPackage,
|
|
onClick: () => setVisible(true)
|
|
},
|
|
"\u73AF\u5883\u4ECB\u7ECD"
|
|
)), /* @__PURE__ */ React.createElement("div", { className: JupyterPracticemodules.apply }, /* @__PURE__ */ React.createElement("span", { className: JupyterPracticemodules.p1 }, "\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"), /* @__PURE__ */ React.createElement("span", { className: JupyterPracticemodules.p2, onClick: handleApply }, "\u7533\u8BF7\u65B0\u5EFA"), /* @__PURE__ */ React.createElement("span", { className: JupyterPracticemodules.p2, onClick: CreateImg }, "\u5728\u7EBF\u521B\u5EFA"))),
|
|
/* @__PURE__ */ React.createElement(es_form["default"].Item, null, /* @__PURE__ */ React.createElement("div", { className: JupyterPracticemodules.buttonWrap }, /* @__PURE__ */ React.createElement(
|
|
es_button/* default */.ZP,
|
|
{
|
|
size: "middle",
|
|
className: `${JupyterPracticemodules.button} mr20`,
|
|
onClick: () => {
|
|
(0,util/* trackEvent */.L9)([
|
|
"\u5B9E\u8DF5\u9879\u76EE",
|
|
"\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE",
|
|
is_jupyter_lab ? "Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE" : "JupyterLab\u5B9E\u8DF5\u9879\u76EE",
|
|
"\u53D6\u6D88"
|
|
]);
|
|
_umi_production_exports.history.push("/shixuns");
|
|
}
|
|
},
|
|
"\u53D6\u6D88"
|
|
), /* @__PURE__ */ React.createElement(
|
|
es_button/* default */.ZP,
|
|
{
|
|
size: "middle",
|
|
type: "primary",
|
|
className: `${JupyterPracticemodules.button} mr20`,
|
|
htmlType: "submit",
|
|
loading: loading["newShixuns/submitCourses"]
|
|
},
|
|
"\u4FDD\u5B58"
|
|
))),
|
|
/* @__PURE__ */ React.createElement(
|
|
DesModal/* default */.Z,
|
|
{
|
|
installPackage,
|
|
visible,
|
|
setVisible
|
|
}
|
|
)
|
|
);
|
|
};
|
|
/* harmony default export */ var components_JupyterPractice = ((0,_umi_production_exports.connect)(
|
|
({
|
|
newShixuns,
|
|
loading,
|
|
user
|
|
}) => ({
|
|
newShixuns,
|
|
loading: loading.effects,
|
|
user
|
|
})
|
|
)(JupyterPractice));
|
|
|
|
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx
|
|
var CreateEnvironment = __webpack_require__(60304);
|
|
;// 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const NewShixunsPage = () => {
|
|
const [radioValue, setRadioValue] = (0,_react_17_0_2_react.useState)("1");
|
|
const handleRadio = (e) => {
|
|
setRadioValue(e.target.value);
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Newmodules.practicalTraining }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Newmodules.titleWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Newmodules.title }, "\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Newmodules.line }), /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default.Group */.ZP.Group, { value: radioValue, onChange: handleRadio }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default */.ZP, { style: { fontSize: 16 }, value: "1" }, "\u5168\u6808\u5B9E\u8DF5\u9879\u76EE"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default */.ZP, { value: "2", style: { marginLeft: 40, fontSize: 16 } }, "Jupyter Notebook\u5B9E\u8DF5\u9879\u76EE"), /* @__PURE__ */ _react_17_0_2_react.createElement(es_radio/* default */.ZP, { value: "3", style: { marginLeft: 40, fontSize: 16 } }, "JupyterLab\u5B9E\u8DF5\u9879\u76EE")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Newmodules.dec }, radioValue === "1" && "\u591A\u529F\u80FD\u65B0\u578B\u5B9E\u6218\u9879\u76EE\u6A21\u5F0F\uFF0C\u652F\u6301\u56FE\u5F62\u5316\u684C\u9762\u3001Web IDE\u3001\u547D\u4EE4\u884C\u3001\u865A\u62DF\u4EFF\u771F\u7B49\u591A\u79CD\u5B9E\u9A8C\u573A\u666F\uFF0C\u9002\u7528\u4E8E\u5404\u7C7B\u590D\u6742\u5DE5\u7A0B\u9879\u76EE\u7814\u53D1\u3002", radioValue === "2" && "\u591A\u529F\u80FD\u5B9E\u65F6\u4EA4\u4E92\u5B9E\u9A8C\u6A21\u5F0F\uFF0C\u652F\u6301\u5B9E\u65F6\u4EE3\u7801\u3001\u6570\u5B66\u65B9\u7A0B\u3001\u53EF\u89C6\u5316\u548CMarkDown\u7B49\u3002 \u9002\u7528\u4E8E\u6570\u636E\u6E05\u7406\u3001\u6570\u503C\u6A21\u62DF\u3001\u7EDF\u8BA1\u5EFA\u6A21\u3001\u673A\u5668\u5B66\u4E60\u7B49\u7CFB\u5217\u5B9E\u9A8C\u3002", radioValue === "3" && "JupyterLab\u662F\u65B0\u4E00\u4EE3Jupyter Notebook\uFF0C\u914D\u7F6E\u6587\u4EF6\u76EE\u5F55\u548CNotebook\uFF0C\u652F\u6301\u6570\u636E\u79D1\u5B66\u4E2D\u7684\u5404\u79CD\u5DE5\u4F5C\u6D41\u7A0B\uFF0C\u9002\u5408\u4E2D\u5927\u578B\u9879\u76EE\u3002")), radioValue === "1" && /* @__PURE__ */ _react_17_0_2_react.createElement(components_CommonPractice, { shixun_type: "normal" }), (radioValue === "2" || radioValue === "3") && /* @__PURE__ */ _react_17_0_2_react.createElement(components_JupyterPractice, { is_jupyter_lab: radioValue === "2" ? false : true }), /* @__PURE__ */ _react_17_0_2_react.createElement(ApplyModal/* default */.Z, null), /* @__PURE__ */ _react_17_0_2_react.createElement(CreateEnvironment/* default */.Z, null));
|
|
};
|
|
/* harmony default export */ var New = (NewShixunsPage);
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |