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

1966 lines
84 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],{
/***/ 55335:
/*!****************************************************************!*\
!*** ./src/components/SelectEnvironment/index.tsx + 1 modules ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": function() { return /* binding */ components_SelectEnvironment; }
});
// EXTERNAL MODULE: ./node_modules/antd/es/empty/style/index.js + 1 modules
var style = __webpack_require__(81151);
// EXTERNAL MODULE: ./node_modules/antd/es/empty/index.js + 2 modules
var empty = __webpack_require__(62986);
// EXTERNAL MODULE: ./node_modules/antd/es/spin/style/index.js + 1 modules
var spin_style = __webpack_require__(22536);
// EXTERNAL MODULE: ./node_modules/antd/es/spin/index.js
var spin = __webpack_require__(11382);
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
var input_style = __webpack_require__(69463);
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
var input = __webpack_require__(75008);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(17061);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(42122);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(17156);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(27424);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(94184);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
;// CONCATENATED MODULE: ./src/components/SelectEnvironment/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var SelectEnvironmentmodules = ({"selectEnvironment":"selectEnvironment___LegvW","search":"search___ZMwsK","searchListWrap":"searchListWrap___iUv9S","searchList":"searchList___T1FBi","name":"name___t0Y2b","tag":"tag___ooWkq","searchListActive":"searchListActive___ahElk","spin":"spin___x2xMT","common":"common___ZhJvk","title":"title___p4_7m","tags":"tags___2fYZM","tagActive":"tagActive___tb54k","wrap":"wrap___I9ZtF","allList":"allList___h31KX","item":"item___PwiKQ","itemActive":"itemActive___JCEc6","line":"line___Qn6mz","apply":"apply___EhZKq","p1":"p1___LxfGu","p2":"p2___jiQhJ","list":"list___n7Ydz","items":"items___OB8qz","darklySelectEnvironment":"darklySelectEnvironment___K__cy"});
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
var noEnvData = __webpack_require__(36723);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(84519);
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
var lodash = __webpack_require__(96486);
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(85893);
;// CONCATENATED MODULE: ./src/components/SelectEnvironment/index.tsx
var SelectEnvironment = function SelectEnvironment(_ref) {
var className = _ref.className,
dispatch = _ref.dispatch,
_ref$skin = _ref.skin,
skin = _ref$skin === void 0 ? 'white' : _ref$skin,
_ref$value = _ref.value,
value = _ref$value === void 0 ? null : _ref$value,
_ref$loading = _ref.loading,
loading = _ref$loading === void 0 ? false : _ref$loading,
_ref$data = _ref.data,
data = _ref$data === void 0 ? [] : _ref$data,
_ref$otherData = _ref.otherData,
otherData = _ref$otherData === void 0 ? [] : _ref$otherData,
_ref$tags = _ref.tags,
tags = _ref$tags === void 0 ? [] : _ref$tags,
_ref$onChange = _ref.onChange,
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
shixun_type = _ref.shixun_type;
var _useState = (0,react.useState)(''),
_useState2 = slicedToArray_default()(_useState, 2),
inputValue = _useState2[0],
setInputValue = _useState2[1];
var _useState3 = (0,react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
visible = _useState4[0],
setVisible = _useState4[1];
var _useState5 = (0,react.useState)([]),
_useState6 = slicedToArray_default()(_useState5, 2),
options = _useState6[0],
setOptions = _useState6[1];
var _useState7 = (0,react.useState)(0),
_useState8 = slicedToArray_default()(_useState7, 2),
listActiveIndex = _useState8[0],
setListActiveIndex = _useState8[1];
var timer = (0,react.useRef)(null);
var quId = (0,react.useRef)(String(Math.floor(Math.random() * 1000000))).current;
var inputRef = (0,react.useRef)();
var timerSearch = (0,react.useRef)(null);
var endCount = (0,react.useRef)(0);
var optionsSave = (0,react.useRef)([]);
(0,react.useEffect)(function () {
window.addEventListener('keydown', handleKeyDown);
return function () {
window.removeEventListener('keydown', handleKeyDown);
};
}, [inputValue, visible, options]);
var handleKeyDown = function handleKeyDown(e) {
if (!visible || e.keyCode !== 40 && e.keyCode !== 38) {
return;
}
var activeIndex = 0;
if (e.keyCode === 40 && visible) {
if (listActiveIndex < options.length - 1) {
activeIndex = listActiveIndex + 1;
} else {
activeIndex = 0;
}
console.log('下');
searchFuc(activeIndex, 'down');
}
if (e.keyCode === 38 && visible) {
if (listActiveIndex === 0) {
activeIndex = options.length - 1;
} else {
activeIndex = listActiveIndex - 1;
}
searchFuc(activeIndex, 'up');
}
setListActiveIndex(activeIndex);
optionsInit(inputValue, activeIndex, true);
};
//高亮字符串 string: 需要处理的字符串keyword键盘输入的内容
var heightLight = function heightLight(string, keyword) {
var regTrim = function regTrim(s) {
var imp = /[\^\.\\\|\(\)\*\+\-\$\[\]\?]/g;
var imp_c = {};
imp_c["^"] = "\\^";
imp_c["."] = "\\.";
imp_c["\\"] = "\\\\";
imp_c["|"] = "\\|";
imp_c["("] = "\\(";
imp_c[")"] = "\\)";
imp_c["*"] = "\\*";
imp_c["+"] = "\\+";
imp_c["-"] = "\\-";
imp_c["$"] = "\$";
imp_c["["] = "\\[";
imp_c["]"] = "\\]";
imp_c["?"] = "\\?";
s = s.replace(imp, function (o) {
return imp_c[o];
});
return s;
};
var reg = new RegExp(regTrim(keyword), "gi");
string = string.replace(reg, function (txt) {
return "<span style='color:#0152d9;'>" + txt + "</span>";
});
return string;
};
var optionsInit = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(searchText, activeList, move) {
var count, listDom, newItems;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
count = endCount.current + 1;
endCount.current = count;
listDom = function listDom(list) {
var newItems = list === null || list === void 0 ? void 0 : list.map(function (er, index) {
var id = er.id,
name = er.name;
var param = objectSpread2_default()(objectSpread2_default()({}, er), {}, {
label: /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
id: "search-".concat(quId, "-").concat(index),
onClick: function onClick() {
return onSelect(id, param);
},
className: index === activeList ? SelectEnvironmentmodules.searchListActive : SelectEnvironmentmodules.searchList,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: SelectEnvironmentmodules.name,
dangerouslySetInnerHTML: {
__html: heightLight(name, searchText)
}
}), er["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: SelectEnvironmentmodules.tag,
children: "\u79C1\u6709"
})]
})
});
return param;
});
return newItems;
};
if (!move) {
_context2.next = 7;
break;
}
newItems = listDom(optionsSave.current);
setOptions(newItems);
return _context2.abrupt("return");
case 7:
clearTimeout(timerSearch.current);
timerSearch.current = setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var params, res, _res$data, _newItems, _res$data2;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
params = {
keywords: encodeURIComponent(searchText || ''),
page: 1,
limit: 100000
};
shixun_type ? params["shixun_type"] = shixun_type : "";
_context.next = 4;
return (0,fetch/* default */.ZP)("/api/shixuns/search_image.json", {
method: 'get',
params: params
});
case 4:
res = _context.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
_newItems = listDom((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.mirrors) || []);
if (count === endCount.current) {
setOptions(_newItems);
optionsSave.current = (0,lodash.cloneDeep)((res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.mirrors) || []);
}
}
case 6:
case "end":
return _context.stop();
}
}, _callee);
})), 300);
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function optionsInit(_x, _x2, _x3) {
return _ref2.apply(this, arguments);
};
}();
var scrollFuc = function scrollFuc(id) {
var itemDom = document.getElementById("scroll-".concat(quId, "-").concat(id));
if (!itemDom) return;
var wrapDom = document.getElementById("scroll-".concat(quId));
wrapDom.scrollTo(0, itemDom.offsetTop);
};
var searchFuc = function searchFuc(index, direction) {
var itemDom = document.getElementById("search-".concat(quId, "-").concat(index));
if (!itemDom) return;
var wrapDom = document.getElementById("search-".concat(quId));
var isClient = itemDom.offsetTop - wrapDom.scrollTop > 0 && itemDom.offsetTop - wrapDom.scrollTop < wrapDom.clientHeight; //判断在盒子内
if (isClient) return; //在盒子内不滚动
if (direction === 'down') {
wrapDom.scrollTo(0, itemDom.offsetTop - wrapDom.clientHeight + itemDom.clientHeight);
} else {
wrapDom.scrollTo(0, itemDom.offsetTop);
}
};
var onSearch = function onSearch(searchText) {
optionsInit(searchText, 0);
setInputValue(searchText);
};
var handlePressEnter = function handlePressEnter(v) {
var _options$listActiveIn, _options$listActiveIn2;
if (!options.length) return;
var realId = options === null || options === void 0 ? void 0 : (_options$listActiveIn = options[listActiveIndex]) === null || _options$listActiveIn === void 0 ? void 0 : _options$listActiveIn.id;
onChange(realId);
setOptions([]);
setListActiveIndex(0);
setInputValue(options === null || options === void 0 ? void 0 : (_options$listActiveIn2 = options[listActiveIndex]) === null || _options$listActiveIn2 === void 0 ? void 0 : _options$listActiveIn2.name);
scrollFuc(realId);
inputRef.current.blur();
};
var onSelect = function onSelect(id, option) {
onChange(id);
setOptions([]);
setListActiveIndex(0);
setInputValue(option === null || option === void 0 ? void 0 : option.name);
scrollFuc(id);
};
var clear = function clear() {
setOptions([]);
setInputValue("");
};
var activeClear = function activeClear(id) {
onChange(id);
setOptions([]);
setInputValue('');
};
var renderIcon = function renderIcon() {
if (inputValue === '') {
return /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
pointerEvents: 'none'
},
className: "iconfont icon-sousuo2 c-grey-c"
});
}
return /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
onClick: function onClick(e) {
e.stopPropagation();
clear();
},
className: "iconfont icon-shanchu4 c-grey-c"
});
};
var handleApply = function handleApply() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {
key: 'NewShixuns-Apply'
}
});
};
var CreateImg = function CreateImg() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {
key: 'Create-Environment'
}
});
};
var onBlur = function onBlur() {
timer.current = setTimeout(function () {
setVisible(false);
setListActiveIndex(0);
}, 200);
//blur阻止了select事件
};
var isEmpty = !(data !== null && data !== void 0 && data.length) && !(otherData !== null && otherData !== void 0 && otherData.length);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: classnames_default()(skin === 'night' ? SelectEnvironmentmodules.darklySelectEnvironment : SelectEnvironmentmodules.selectEnvironment, className),
children: [!isEmpty && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectEnvironmentmodules.search,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
suffix: renderIcon(),
bordered: false,
ref: inputRef,
value: inputValue,
onKeyDown: function onKeyDown(e) {
if (e.keyCode === 40 || e.keyCode === 38) {
e.preventDefault();
}
},
size: "large",
onFocus: function onFocus() {
clearTimeout(timer.current);
onSearch(inputValue);
setVisible(true);
},
onBlur: onBlur,
onChange: function onChange(e) {
return onSearch(e.target.value);
},
placeholder: "\u641C\u7D22\u60A8\u9700\u8981\u7684\u5B9E\u9A8C\u73AF\u5883",
onPressEnter: handlePressEnter
}), visible && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
id: "search-".concat(quId),
className: SelectEnvironmentmodules.searchListWrap,
children: options.map(function (e, i) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
children: [" ", e.label]
}, i);
})
})]
}), loading ? /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
className: SelectEnvironmentmodules.spin
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(react.Fragment, {
children: [isEmpty && /*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, {
style: {
margin: '60px 0'
},
image: noEnvData,
description: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-999",
children: "\u6682\u65E0\u5B9E\u9A8C\u73AF\u5883"
})
}), !!tags.length && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: SelectEnvironmentmodules.common,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.title,
children: "\u63A8\u8350\u73AF\u5883:"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
className: SelectEnvironmentmodules.tags,
children: tags.map(function (e, i) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
onClick: function onClick() {
return activeClear(e.id);
},
className: value === e.id ? "".concat(SelectEnvironmentmodules.tag, " ").concat(SelectEnvironmentmodules.tagActive) : SelectEnvironmentmodules.tag,
children: e.name
}, i);
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: SelectEnvironmentmodules.wrap,
id: "scroll-".concat(quId),
children: [data.map(function (item, i) {
var _item$image;
return !!(item !== null && item !== void 0 && (_item$image = item.image) !== null && _item$image !== void 0 && _item$image.length) ? /*#__PURE__*/(0,jsx_runtime.jsx)(List, {
data: item,
id: value,
handleClick: function handleClick(id) {
return activeClear(id);
}
}, i) : null;
}), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
className: SelectEnvironmentmodules.allList,
children: otherData.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
id: "scroll-".concat(quId, "-").concat(item.id),
className: item.id === value ? "".concat(SelectEnvironmentmodules.item, " ").concat(SelectEnvironmentmodules.itemActive) : SelectEnvironmentmodules.item,
onClick: function onClick() {
return onChange(item.id);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.name,
children: item.name
}), item["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.tag,
children: "\u79C1\u6709"
})]
}, "key-".concat(item.id));
})
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectEnvironmentmodules.apply,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: SelectEnvironmentmodules.p1,
children: "\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: SelectEnvironmentmodules.p2,
onClick: handleApply,
children: " \u7533\u8BF7\u65B0\u5EFA"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: SelectEnvironmentmodules.p2,
onClick: CreateImg,
children: " \u5728\u7EBF\u521B\u5EFA"
})]
})]
});
};
var List = function List(_ref4) {
var data = _ref4.data,
id = _ref4.id,
handleClick = _ref4.handleClick;
var _useState9 = (0,react.useState)(true),
_useState10 = slicedToArray_default()(_useState9, 2),
drop = _useState10[0],
setDrop = _useState10[1];
var name = data.name,
image = data.image;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: SelectEnvironmentmodules.list,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("header", {
onClick: function onClick() {
return setDrop(!drop);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.title,
children: name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
transition: '0.5s',
transform: drop ? 'rotate(0deg)' : 'rotate(180deg)'
},
className: "iconfont icon-shangjiantou c-grey-999"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
className: SelectEnvironmentmodules.items,
style: {
height: drop ? 'auto' : 0
},
children: [image.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
className: item.id === id ? "".concat(SelectEnvironmentmodules.item, " ").concat(SelectEnvironmentmodules.itemActive) : SelectEnvironmentmodules.item,
onClick: function onClick() {
return handleClick(item.id);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.name,
children: item.name
}), item["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: SelectEnvironmentmodules.tag,
children: "\u79C1\u6709"
})]
}, item.id);
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: SelectEnvironmentmodules.line
})]
})]
});
};
/* harmony default export */ var components_SelectEnvironment = (SelectEnvironment);
/***/ }),
/***/ 57944:
/*!***************************************************************************!*\
!*** ./src/pages/Shixuns/New/components/ApplyModal/index.tsx + 1 modules ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": function() { return /* binding */ components_ApplyModal; }
});
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
var style = __webpack_require__(29913);
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
var es_button = __webpack_require__(71577);
// EXTERNAL MODULE: ./node_modules/antd/es/upload/style/index.js + 1 modules
var upload_style = __webpack_require__(13759);
// EXTERNAL MODULE: ./node_modules/antd/es/upload/index.js + 20 modules
var upload = __webpack_require__(7426);
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
var message_style = __webpack_require__(14934);
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
var message = __webpack_require__(12461);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(17061);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(17156);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
var modal_style = __webpack_require__(35611);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
var modal = __webpack_require__(85402);
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js + 1 modules
var form_style = __webpack_require__(75627);
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 17 modules
var es_form = __webpack_require__(51018);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(27424);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(70215);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
var input_style = __webpack_require__(69463);
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
var input = __webpack_require__(75008);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
var _umi_production_exports = __webpack_require__(89214);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(59758);
// EXTERNAL MODULE: ./src/assets/images/qrCode.png
var qrCode = __webpack_require__(55351);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var ApplyModalmodules = ({"flexRow":"flexRow___JBN3B","flexColumn":"flexColumn___zXgFj","formWrap":"formWrap___aNgan","upload":"upload___yGdLQ","color0152d9":"color0152d9___zzEpS","colorCCC":"colorCCC___k4Dxq","footerWrap":"footerWrap___WrUZd","qrCode":"qrCode___GPwSg","a1":"a1___R6etl","code":"code___fCL_L","group":"group___n7tgy","groupNumber":"groupNumber___tw7hA","a2":"a2___GGjDE"});
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(85893);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx
var _excluded = ["newShixuns", "globalSetting", "loading", "dispatch"];
var TextArea = input/* default.TextArea */.Z.TextArea;
var ApplyModal = function ApplyModal(_ref) {
var newShixuns = _ref.newShixuns,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var _Form$useForm = es_form/* default.useForm */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState = (0,react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
fileList = _useState2[0],
setFileList = _useState2[1];
var handleFileChange = function handleFileChange(info) {
var statusList = ["uploading", "done", "removed"];
if (statusList.includes(info.file.status)) {
setFileList(info.fileList);
}
};
var handleFileRemove = function handleFileRemove(file) {
if (!file.percent || file.percent == 100) {
var _file$response;
var id = (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.id;
modal/* default.confirm */.Z.confirm({
centered: true,
title: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
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 dispatch({
type: 'newShixuns/deleteAttachment',
payload: {
id: id
}
});
case 2:
res = _context.sent;
res && setFileList(fileList.filter(function (item) {
var _item$response;
return ((_item$response = item.response) === null || _item$response === void 0 ? void 0 : _item$response.id) !== id;
}));
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
return false;
}
};
var handleFileBeforeUpload = function handleFileBeforeUpload(file) {
if (fileList.length) {
return false;
}
var is150M = file.size / 1024 / 1024 > 50;
if (is150M) {
message/* default.info */.ZP.info('文件大小必须小于50MB');
return false;
}
return true;
};
var handleFinish = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(values) {
var _fileList$, _fileList$$response;
var _ref3, language, runtime, run_method, code, res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_ref3 = values || {}, language = _ref3.language, runtime = _ref3.env, run_method = _ref3.mode, code = _ref3.code;
_context2.next = 3;
return dispatch({
type: 'newShixuns/applyShixunMirror',
payload: {
language: language,
runtime: runtime,
run_method: run_method,
attachment_id: fileList === null || fileList === void 0 ? void 0 : (_fileList$ = fileList[0]) === null || _fileList$ === void 0 ? void 0 : (_fileList$$response = _fileList$.response) === null || _fileList$$response === void 0 ? void 0 : _fileList$$response.id
}
});
case 3:
res = _context2.sent;
dispatch({
type: 'newShixuns/setActionTabs',
payload: {}
});
if (res) {
message/* default.success */.ZP.success("新建申请已提交,请等待管理员审核。");
}
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function handleFinish(_x) {
return _ref2.apply(this, arguments);
};
}();
var handleAfterClose = function handleAfterClose() {
form.resetFields();
setFileList([]);
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
centered: true,
keyboard: false,
closable: false,
destroyOnClose: true,
open: newShixuns.actionTabs.key === 'NewShixuns-Apply',
title: "\u7533\u8BF7\u65B0\u5EFA",
width: "1000px",
footer: null,
afterClose: handleAfterClose,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: ApplyModalmodules.qrCode,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: ApplyModalmodules.a1,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ApplyModalmodules.code,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
width: 120,
height: 120,
src: qrCode,
alt: "\u4E8C\u7EF4\u7801"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ApplyModalmodules.group,
children: "\u5B9E\u9A8C\u73AF\u5883\u7533\u8BF7QQ\u7FA4"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ApplyModalmodules.groupNumber,
children: "\u7FA4\u53F7\uFF1A740157011"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: ApplyModalmodules.a2,
children: ["\u5C0A\u656C\u7684\u8001\u5E08/\u540C\u5B66\u60A8\u597D\uFF0C", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u5982\u679C\u60A8\u60F3\u65B0\u5EFA\u5B9E\u9A8C\u73AF\u5883\uFF0C\u53EF\u4EE5\u626B\u63CF\u5DE6\u4FA7\u4E8C\u7EF4\u7801\u8FDB\u7FA4\uFF0C\u76F4\u63A5\u5411\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u7533\u8BF7\u54E6~ \u4E5F\u53EF\u4EE5\u63D0\u4EA4\u4E0B\u9762\u7684\u8868\u5355\u7533\u8BF7\uFF0C\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u6536\u5230\u7533\u8BF7\u4FE1\u606F\u5C06\u4F1A\u7B2C\u4E00\u65F6\u95F4\u8054\u7CFB\u60A8\uFF01"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
className: ApplyModalmodules.formWrap,
form: form,
labelCol: {
span: 4
},
wrapperCol: {
span: 20
},
onFinish: handleFinish,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
label: "\u8BED\u8A00\uFF1A",
name: "language",
rules: [{
required: true,
message: '请填写该镜像语言'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48\u8BED\u8A00\uFF1A\u793A\u4F8B\uFF1APython",
rows: 4
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
label: "\u7CFB\u7EDF\u73AF\u5883\uFF1A",
name: "env",
rules: [{
required: true,
message: '请填写该镜像语言系统环境'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48linux\u7CFB\u7EDF\u73AF\u5883,\u4EE3\u7801\u8FD0\u884C\u73AF\u5883",
rows: 4
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
label: "\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F\uFF1A",
name: "mode",
rules: [{
required: true,
message: '请填写该镜像测试代码运行方式'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u4E2D\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F",
rows: 4
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default.Item */.Z.Item, {
label: "\u6D4B\u8BD5\u4EE3\u7801\uFF1A",
name: "code",
rules: [{
required: true,
message: '请上传附件'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ApplyModalmodules.upload,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(upload/* default */.Z, {
fileList: fileList,
action: "".concat(env/* default.API_SERVER */.Z.API_SERVER, "/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a"),
onChange: handleFileChange,
onRemove: handleFileRemove,
beforeUpload: handleFileBeforeUpload,
withCredentials: true,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(ApplyModalmodules.color0152d9, " current"),
children: "\u4E0A\u4F20\u9644\u4EF6"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(ApplyModalmodules.colorCCC, " ml10"),
children: "(\u5355\u4E2A\u6587\u4EF650M\u4EE5\u5185)"
})]
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ApplyModalmodules.footerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default.Item */.Z.Item, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
className: "mr5",
size: "large",
onClick: function onClick() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {}
});
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
size: "large",
type: "primary",
htmlType: "submit",
loading: loading['newShixuns/applyShixunMirror'],
children: "\u4FDD\u5B58"
})]
})
})]
})]
});
};
/* harmony default export */ var components_ApplyModal = ((0,_umi_production_exports.connect)(function (_ref4) {
var newShixuns = _ref4.newShixuns,
loading = _ref4.loading,
globalSetting = _ref4.globalSetting;
return {
newShixuns: newShixuns,
globalSetting: globalSetting,
loading: loading.effects
};
})(ApplyModal));
/***/ }),
/***/ 88654:
/*!**********************************************************************!*\
!*** ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx ***!
\**********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var antd_es_modal_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/modal/style */ 35611);
/* harmony import */ var antd_es_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/modal */ 85402);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/slicedToArray.js */ 27424);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 67294);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! umi */ 89214);
/* harmony import */ var _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/assets/images/qrCode.png */ 55351);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ 85893);
var CreateEnvironment = function CreateEnvironment(_ref) {
var _newShixuns$actionTab;
var newShixuns = _ref.newShixuns,
dispatch = _ref.dispatch,
user = _ref.user;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false),
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
isCreateModel = _useState2[0],
setIsCreateModel = _useState2[1];
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (newShixuns.actionTabs.key === 'Create-Environment') {
createImg();
}
}, [newShixuns === null || newShixuns === void 0 ? void 0 : (_newShixuns$actionTab = newShixuns.actionTabs) === null || _newShixuns$actionTab === void 0 ? void 0 : _newShixuns$actionTab.key]);
var cancelImg = function cancelImg() {
dispatch({
type: 'newShixuns/setActionTabs',
payload: {}
});
};
var createImg = function createImg() {
var _user$userInfo, _user$userInfo2, _user$userInfo3;
//判断 #0不能1能2每日上限
cancelImg(); //取消Key值
if (((_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.mirror_marker_status) === 0) {
setIsCreateModel(true);
} else if (((_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.mirror_marker_status) === 1) {
umi__WEBPACK_IMPORTED_MODULE_3__.history.push("/shixuns/new/CreateImg");
} else if (((_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.mirror_marker_status) === 2) {
antd_es_modal__WEBPACK_IMPORTED_MODULE_6__/* ["default"].confirm */ .Z.confirm({
title: '您今日已达到申请上限,是否跳转至云主机列表?',
content: '提示:每天最多允许申请一台云主机',
okText: '跳转',
cancelText: "取消",
onOk: function onOk() {
var _user$userInfo4;
umi__WEBPACK_IMPORTED_MODULE_3__.history.push("/users/".concat((_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.login, "/experiment-img"));
}
});
}
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(antd_es_modal__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
title: "\u52A0\u5165qq\u7FA4\u63D0\u793A",
open: isCreateModel,
footer: null,
onCancel: function onCancel() {
setIsCreateModel(false);
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
style: {
textAlign: 'center'
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("br", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("img", {
width: 120,
height: 120,
style: {
marginTop: '20px'
},
src: _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_4__,
alt: "\u4E8C\u7EF4\u7801"
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("img", {})]
});
};
/* harmony default export */ __webpack_exports__["Z"] = ((0,umi__WEBPACK_IMPORTED_MODULE_3__.connect)(function (_ref2) {
var newShixuns = _ref2.newShixuns,
user = _ref2.user,
globalSetting = _ref2.globalSetting;
return {
newShixuns: newShixuns,
globalSetting: globalSetting,
user: user
};
})(CreateEnvironment));
/***/ }),
/***/ 6220:
/*!*************************************************************************!*\
!*** ./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/antd/es/modal/style/index.js + 1 modules
var style = __webpack_require__(35611);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
var modal = __webpack_require__(85402);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
var RenderHtml = __webpack_require__(12768);
;// 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/jsx-runtime.js
var jsx_runtime = __webpack_require__(85893);
;// 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.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 ? 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.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);
/***/ }),
/***/ 19088:
/*!*****************************************************!*\
!*** ./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/antd/es/radio/style/index.js + 1 modules
var style = __webpack_require__(83822);
// EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules
var es_radio = __webpack_require__(29924);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(27424);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx + 1 modules
var ApplyModal = __webpack_require__(57944);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js + 1 modules
var modal_style = __webpack_require__(35611);
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
var modal = __webpack_require__(85402);
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/style/index.js + 1 modules
var tooltip_style = __webpack_require__(38390);
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(84908);
// EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js + 1 modules
var button_style = __webpack_require__(29913);
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
var es_button = __webpack_require__(71577);
// EXTERNAL MODULE: ./node_modules/antd/es/empty/style/index.js + 1 modules
var empty_style = __webpack_require__(81151);
// EXTERNAL MODULE: ./node_modules/antd/es/empty/index.js + 2 modules
var empty = __webpack_require__(62986);
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js + 1 modules
var message_style = __webpack_require__(14934);
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
var message = __webpack_require__(12461);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(17061);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(17156);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
var _umi_production_exports = __webpack_require__(89214);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(56088);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(29427);
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
var noEnvData = __webpack_require__(36723);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
var RenderHtml = __webpack_require__(12768);
// EXTERNAL MODULE: ./src/components/SelectEnvironment/index.tsx + 1 modules
var SelectEnvironment = __webpack_require__(55335);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(59758);
;// 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__(84519);
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(85893);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/CommonPractice/index.tsx
var CommonPractice = function CommonPractice(_ref) {
var newShixuns = _ref.newShixuns,
user = _ref.user,
dispatch = _ref.dispatch,
shixun_type = _ref.shixun_type;
var _useState = (0,react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
copyInfo = _useState2[0],
setCopyInfo = _useState2[1];
var _useState3 = (0,react.useState)(null),
_useState4 = slicedToArray_default()(_useState3, 2),
activeId = _useState4[0],
setActiveId = _useState4[1];
var _useState5 = (0,react.useState)({}),
_useState6 = slicedToArray_default()(_useState5, 2),
detail = _useState6[0],
setDetail = _useState6[1];
var _useState7 = (0,react.useState)(false),
_useState8 = slicedToArray_default()(_useState7, 2),
isModalVisible = _useState8[0],
setIsModalVisible = _useState8[1];
var _useState9 = (0,react.useState)(false),
_useState10 = slicedToArray_default()(_useState9, 2),
copyLoading = _useState10[0],
setCopyLoading = _useState10[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,
_environmentData$othe = environmentData.other_image,
other_image = _environmentData$othe === void 0 ? [] : _environmentData$othe;
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;
(0,react.useEffect)(function () {
dispatch({
type: 'newShixuns/getEnvironmentData'
});
}, []);
(0,react.useEffect)(function () {
if (activeId === null) return;
getData();
}, [activeId]);
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 (0,shixuns/* getEnvironmentDetail */.Q1)({
mirror_repository_id: activeId
});
case 2:
res = _context.sent;
setDetail(res.data);
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
(0,react.useEffect)(function () {
if ((frequence_image === null || frequence_image === void 0 ? void 0 : 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 ? 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.success */.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: body
});
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);
};
}();
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) {
return setActiveId(id);
},
shixun_type: shixun_type
}), /*#__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", activeId === null ? '— —' : name]
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: CommonPracticemodules.content,
children: [activeId === null && /*#__PURE__*/(0,jsx_runtime.jsxs)(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 */.Z, {
size: "large",
style: {
marginRight: 20
},
onClick: function onClick() {
return handleConfirm(true);
},
children: " \u6682\u4E0D\u9009\u7528\u955C\u50CF"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
size: "large",
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
})
}), /*#__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 */.Z, {
size: "large",
style: {
marginRight: 20
},
onClick: function onClick() {
return handleConfirm(true);
},
children: " \u6682\u4E0D\u9009\u7528\u955C\u50CF"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
size: "large",
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.IMG_SERVER */.Z.IMG_SERVER, "/").concat(pic)
})
}), /*#__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.IMG_SERVER */.Z.IMG_SERVER, "/").concat(pic)
})
}), /*#__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 */.Z, {
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 (_ref5) {
var newShixuns = _ref5.newShixuns,
globalSetting = _ref5.globalSetting,
user = _ref5.user;
return {
newShixuns: newShixuns,
globalSetting: globalSetting,
user: user
};
})(CommonPractice));
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js + 1 modules
var checkbox_style = __webpack_require__(82000);
// EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules
var es_checkbox = __webpack_require__(32808);
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js + 1 modules
var input_style = __webpack_require__(69463);
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 5 modules
var input = __webpack_require__(75008);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(42122);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js + 1 modules
var form_style = __webpack_require__(75627);
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 17 modules
var es_form = __webpack_require__(51018);
// EXTERNAL MODULE: ./node_modules/antd/es/select/style/index.js + 1 modules
var select_style = __webpack_require__(95985);
// EXTERNAL MODULE: ./node_modules/antd/es/select/index.js
var es_select = __webpack_require__(34041);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
var markdown_editor = __webpack_require__(55373);
;// 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__(6220);
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/JupyterPractice/index.tsx
var Option = es_select/* default.Option */.Z.Option;
var JupyterPractice = function JupyterPractice(_ref) {
var _formValue$name, _newShixuns$newData2, _newShixuns$newData2$, _newShixuns$newData3, _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.useForm */.Z.useForm(),
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
form = _Form$useForm2[0];
var _useState = (0,react.useState)({}),
_useState2 = slicedToArray_default()(_useState, 2),
formValue = _useState2[0],
setFormValue = _useState2[1];
var _useState3 = (0,react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
visible = _useState4[0],
setVisible = _useState4[1];
var _useState5 = (0,react.useState)({}),
_useState6 = slicedToArray_default()(_useState5, 2),
installPackage = _useState6[0],
setInstallPackage = _useState6[1];
(0,react.useEffect)(function () {
var type = 'newShixuns/getNewShixunsData';
if (is_jupyter_lab) {
type = 'newShixuns/getShixunsJupyterLab';
}
dispatch({
type: type
});
}, [is_jupyter_lab]);
(0,react.useEffect)(function () {
var _newShixuns$newData, _newShixuns$newData$m, _newShixuns$newData$m2;
var mainTypeId = newShixuns === null || newShixuns === void 0 ? void 0 : (_newShixuns$newData = newShixuns.newData) === null || _newShixuns$newData === void 0 ? void 0 : (_newShixuns$newData$m = _newShixuns$newData.main_type) === null || _newShixuns$newData$m === void 0 ? void 0 : (_newShixuns$newData$m2 = _newShixuns$newData$m[0]) === null || _newShixuns$newData$m2 === void 0 ? void 0 : _newShixuns$newData$m2.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.Item */.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.Item */.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.Item */.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.Item */.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.Item */.Z.Item, {
className: JupyterPracticemodules.width180,
name: "difficulty",
label: "\u96BE\u6613\u5EA6:",
rules: [{
required: true,
message: '请选择难易度'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_select/* default */.Z, {
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.Item */.Z.Item, {
name: "mainType",
label: "\u5B9E\u9A8C\u73AF\u5883:",
rules: [{
required: true,
message: '请选择主类别'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default */.Z, {
bordered: false,
placeholder: "\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B",
style: {
width: 500
},
children: (_newShixuns$newData2 = newShixuns.newData) === null || _newShixuns$newData2 === void 0 ? 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.Item */.Z.Item, {
name: "subType",
className: "".concat(JupyterPracticemodules.width240, " ml20"),
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select/* default */.Z, {
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 ? 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.Item */.Z.Item, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: JupyterPracticemodules.buttonWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.Z, {
size: "large",
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 */.Z, {
size: "large",
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__(88654);
;// 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.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);
/***/ })
}]);