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

1865 lines
82 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([[63157],{
/***/ 77459:
/*!*****************************************************************************!*\
!*** ./src/pages/Shixuns/Edit/body/Environment/Label/index.tsx + 1 modules ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ Environment_Label; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Environment/Label/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Labelmodules = ({"label":"label___CZ1_z","left":"left___ZKFRV","right":"right___zVTRn","error":"error___oNJNo"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Environment/Label/index.tsx
var Label = function Label(_ref) {
var name = _ref.name,
tooltipTitle = _ref.tooltipTitle,
children = _ref.children,
required = _ref.required,
errorKey = _ref.errorKey,
errorValue = _ref.errorValue,
errorName = _ref.errorName,
_ref$errorStyle = _ref.errorStyle,
errorStyle = _ref$errorStyle === void 0 ? {} : _ref$errorStyle,
_ref$nameWidth = _ref.nameWidth,
nameWidth = _ref$nameWidth === void 0 ? 112 : _ref$nameWidth,
_ref$align = _ref.align,
align = _ref$align === void 0 ? 'center' : _ref$align,
_ref$contentStyle = _ref.contentStyle,
contentStyle = _ref$contentStyle === void 0 ? {} : _ref$contentStyle;
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Labelmodules.label,
style: {
alignItems: align
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Labelmodules.left,
style: {
width: nameWidth
},
children: [required && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "*"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: name
}), !!tooltipTitle && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: tooltipTitle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xiaowenhao2"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Labelmodules.right,
style: contentStyle,
children: [children, errorName && errorValue === errorKey && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Labelmodules.error,
style: errorStyle,
children: errorName
})]
})]
})
});
};
/* harmony default export */ var Environment_Label = (Label);
/***/ }),
/***/ 23329:
/*!*************************************************************************************!*\
!*** ./src/pages/Shixuns/Edit/body/Environment/MarkdownModal/index.tsx + 1 modules ***!
\*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ Environment_MarkdownModal; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Environment/MarkdownModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var MarkdownModalmodules = ({"mirrorModal":"mirrorModal___Pi3tF","right":"right___Hot5f","title":"title___jjMKh","content":"content___BmOkD","des":"des___oGTUM","modal":"modal___yy3VB"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(26404);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Shixuns/Edit/body/Environment/MarkdownModal/index.tsx
var MarkdownModal = function MarkdownModal(_ref) {
var title = _ref.title,
children = _ref.children,
value = _ref.value;
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
visible = _useState2[0],
setVisible = _useState2[1];
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
onClick: function onClick() {
return setVisible(true);
},
children: children
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
title: title,
open: visible,
width: 1000,
destroyOnClose: true,
centered: true,
onCancel: function onCancel() {
return setVisible(false);
},
className: MarkdownModalmodules.modal,
footer: null,
children: [typeof value === 'string' && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: value || ''
}), Object.prototype.toString.call(value) === '[object Array]' && /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: value === null || value === void 0 ? void 0 : value.map(function (e, i) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
children: e.name || e.type_name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: e.description || ''
})]
}, i);
})
})]
})]
});
};
/* harmony default export */ var Environment_MarkdownModal = (MarkdownModal);
/***/ }),
/***/ 62564:
/*!***********************************************************************!*\
!*** ./src/pages/User/Detail/ExperImentImg/Add/index.tsx + 6 modules ***!
\***********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ Add; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(39647);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(80184);
// 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/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// 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/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(10249);
// EXTERNAL MODULE: ./src/pages/tasks/vnc-view/index.less
var vnc_view = __webpack_require__(84470);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 10 modules
var markdown_editor = __webpack_require__(49731);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(35325);
;// CONCATENATED MODULE: ./src/pages/User/Detail/ExperImentImg/Add/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Addmodules = ({"wrap":"wrap___ONdsC","content":"content___N0LEk","crumbs":"crumbs___ZMtFD","title":"title___zwDOY","upload":"upload___MSuSG","btn":"btn___VpNOC","activeBtn":"activeBtn___WARNi","head":"head___G0LuH","add":"add___ThO12","addDisable":"addDisable___ykVne","setting":"setting___ACQW6","tabs":"tabs___kF5MC","name":"name___APZDD","active":"active___hzqus","line":"line___DAGKO","resource":"resource___Gveup","mirror":"mirror___IBeiQ","interface":"interface___pzUyA","disabled":"disabled___d4p_T","port":"port___vS58L","grade":"grade___4_rtU","tabsBox":"tabsBox___DfBD9","tabTitle":"tabTitle___yxNTA","more":"more___hoice","system":"system___utj75","explain":"explain___ecqpL","btns":"btns___MTI71","template":"template___xdQbN","liWrap":"liWrap___z55nC","li":"li___GcxuL","tag":"tag___xVpLK","cpuWrap":"cpuWrap___Wi43O","activebtn":"activebtn___UamsA","activeTab":"activeTab___fzQvD","tab":"tab___UNT6N","disabledBtn":"disabledBtn___maLgB","doc":"doc___gT07l"});
// EXTERNAL MODULE: ./src/pages/Shixuns/Edit/body/Environment/Label/index.tsx + 1 modules
var Label = __webpack_require__(77459);
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 36 modules
var ui_customization = __webpack_require__(96114);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/empty/index.js + 3 modules
var empty = __webpack_require__(64165);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(18240);
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
var noEnvData = __webpack_require__(36723);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 2 modules
var RenderHtml = __webpack_require__(26404);
// EXTERNAL MODULE: ./src/components/SelectEnvironment/index.tsx + 1 modules
var SelectEnvironment = __webpack_require__(44170);
;// CONCATENATED MODULE: ./src/pages/User/Detail/ExperImentImg/components/MirrorModal/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var MirrorModalmodules = ({"mirrorModal":"mirrorModal___Or3Fz","right":"right___dmM3o","title":"title___qvx5b","content":"content___bgacR","des":"des___tTuzA","btns":"btns___AAZk3","confirm":"confirm___NIDd7","cancel":"cancel___oCK9D","modal":"modal___zo5el"});
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx + 1 modules
var ApplyModal = __webpack_require__(52007);
// EXTERNAL MODULE: ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx
var CreateEnvironment = __webpack_require__(38352);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/User/Detail/ExperImentImg/components/MirrorModal/index.tsx
var MirrorModal = function MirrorModal(_ref) {
var _newShixuns$actionTab, _ref3;
var newShixuns = _ref.newShixuns,
user = _ref.user,
dispatch = _ref.dispatch,
tab_type = _ref.tab_type,
visible = _ref.visible,
onOk = _ref.onOk,
onCancel = _ref.onCancel,
_ref$useId = _ref.useId,
useId = _ref$useId === void 0 ? null : _ref$useId,
identifier = _ref.identifier,
shixun_environment_id = _ref.shixun_environment_id;
var _useState = (0,_react_17_0_2_react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
activeId = _useState2[0],
setActiveId = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)({}),
_useState4 = slicedToArray_default()(_useState3, 2),
detail = _useState4[0],
setDetail = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(""),
_useState6 = slicedToArray_default()(_useState5, 2),
keyword = _useState6[0],
setKeyword = _useState6[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;
(0,_react_17_0_2_react.useEffect)(function () {
if (visible) {
dispatch({
type: 'newShixuns/getEnvironmentData',
payload: {
is_create_mirror: 1,
tab_type: tab_type
}
});
setKeyword("");
setActiveId(useId);
}
}, [visible, useId]);
(0,_react_17_0_2_react.useEffect)(function () {
if (newShixuns.actionTabs.key === 'NewShixuns-Apply') {
onCancel();
}
}, [newShixuns === null || newShixuns === void 0 || (_newShixuns$actionTab = newShixuns.actionTabs) === null || _newShixuns$actionTab === void 0 ? void 0 : _newShixuns$actionTab.key]);
(0,_react_17_0_2_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,
identifier: identifier,
shixun_environment_id: shixun_environment_id
});
case 2:
res = _context.sent;
setDetail(res.data);
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
title: "\u9009\u62E9\u5B9E\u9A8C\u955C\u50CF",
open: visible,
width: 1000,
destroyOnClose: true,
centered: true,
onCancel: onCancel,
className: MirrorModalmodules.modal,
footer: null,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: MirrorModalmodules.mirrorModal,
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);
},
onSearchWord: function onSearchWord(value) {
return setKeyword(value);
},
hiddenCreateOnline: true,
tab_type: tab_type,
is_create_mirror: 1
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: MirrorModalmodules.right,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("header", {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: MirrorModalmodules.title,
children: ["\u5B9E\u9A8C\u73AF\u5883:\xA0", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
dangerouslySetInnerHTML: {
__html: activeId === null ? '— —' : (_ref3 = name || "") === null || _ref3 === void 0 ? void 0 : _ref3.replace(new RegExp(keyword === null || keyword === void 0 ? void 0 : keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"), '<span style="color:#0152d9;background-color:#1890ff33">$&</span>')
}
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: MirrorModalmodules.content,
children: [activeId === null && /*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, {
image: noEnvData,
description: "\u8BF7\u9009\u62E9\u5B9E\u9A8C\u73AF\u5883"
}), activeId !== null && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: MirrorModalmodules.des,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: description,
highlightKeywords: keyword
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: MirrorModalmodules.btns,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
setActiveId(null);
setDetail({});
onCancel();
},
className: MirrorModalmodules.cancel,
children: "\u53D6\u6D88 "
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
onOk(detail);
},
className: MirrorModalmodules.confirm,
type: "primary",
children: "\u4FDD\u5B58 "
})]
})]
})]
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ApplyModal/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(CreateEnvironment/* default */.Z, {})]
});
};
/* harmony default export */ var components_MirrorModal = ((0,_umi_production_exports.connect)(function (_ref4) {
var newShixuns = _ref4.newShixuns,
globalSetting = _ref4.globalSetting,
user = _ref4.user;
return {
newShixuns: newShixuns,
globalSetting: globalSetting,
user: user
};
})(MirrorModal));
// EXTERNAL MODULE: ./src/pages/Shixuns/Edit/body/Environment/MarkdownModal/index.tsx + 1 modules
var MarkdownModal = __webpack_require__(23329);
;// CONCATENATED MODULE: ./src/assets/images/user/nodata.png
var nodata_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAABACAYAAABGHBTIAAAAAXNSR0IArs4c6QAABlFJREFUaEPtm2lsVFUUx3/nzUxHNsFqqXFvpcOqKEhLTIghkUSN0UT5YPADicagQRA1iiIKJu5RkbD4waAkJsbli7hEo8YYF2IpCCEE2oHGFlnaAQst7TDtzLxjXqHY0lnuG2dLnPtx3v+ce37n3HfenftmhCyP1apWx/r2JSryIFAl6D4R6621i8d/kuWpMnInGVmlMFq6of1dtfXh8yWWxRNrF1+6JtvzufWXVeBlG45PjtuxvYmCEOgtL6ssX71Iwm6DzKbeNfCyDaEb1NZrEwWhlsxR234sWYBiyXKxaU503S5j17pFlQmvFRR4yfq2dpTx2QzijC/5Yd2SynnZ9zvUY3+Fu8J6MzYTEdJWfOX7oTWKXpjtwLwe2friwvGb0vpVbAt2jR4tu9JqEwikK6yv2jbPmBqv2hw6ZauOMdWb6kb4rT9WLKiYYaoX4dGxo2SDqX5AJye7tQswBigaYNg3drRMyQRY3RjlCvgCv/XHcy4qjHBo3Ci50k3s/Z3iZLe6An5hc+iEql7kdqJ0+pF+a8ezCypmptOdu54v4D0tvbsOtvd1GgdmKJxWfcElV1X4phrKyVuFjQPKtTBfFc41h7H/ErBZqlw3LTO3eVCVKmyW5FKFzfJUBKrSkjYrQmlJm+WpCFS5WNI9vbQ2t2mL2vkH9HrgmkqpGeXnsoSz5wL4i212Yzyuk/KPe2ZGv1923DHDSvyFIhfAW363D9uqlxcK2OeVxjtnWYkTXgI2K0vKLv2/q/CX2+29sai6PkYxy3V61Qg/DbfN8MzKW9OK9NHWelwPYOPqVCQ9ioFCkKpKmVTm5ZK8ARuEVThJLppW4WgMZi4BGyQpk1NLM7d5UJUqbJbklM/hnggtB45qq5DVLi0TLpfqkWW4PkQfgpSLCn/ZYO+LxXSyWe7MVf4y2XHHzCR7ZFM3uQDO1U7L45HgXbVWwJQtb8/hEvB/Ksm/xplU+HQfhPsgHodovN9XuDvCJoQWLH6urWaniJy5kmKkbFpfNdh7ojGdls6J2+sjymTnbTOtG9PZRWPw9ynoioCd7hBCOCHKZp+PtTOqpTWZ75TAkRjtre26P5sbaa+FXF0hk31eypMFZSuEOqGzJ4PHgxBHeKfSy8qqKomcP0fRHeL1ReFQB/TF0tU/zdKFJsvH3bOqpWmwsqiAI1E4eAycCmdlCCGfl3kzq2X3gL+iAXYaUWsIYunuVbeZEEKWj+m1VdLmmBYNcOsxcDpxLobAj7UB5omIXRTAXWE4csIMVYQ9lvJyXJiPcq+ZFYhwf11APioK4Oa2c8/WIfFbQqPC1sEfqhLxBlgWDzIFYen5wKrcBFw/rDtDU22AKQUHdpaxs5wTDYG36ybKk6ZVdHT1QX1NleWJbDwWcwsO7DxvO7pTA9cH9S9VrhChVyGMMvArol+B6f2/MxP2zw5IIBWwJbxZcOCDxyHcmxR4i1hsUpsPVDiA8IDAWJTfgEPlQk3HCEZLmGcU7hFhma0sTHpvC/UFB25uB2cLmWJ84xHWzArI9/VNOl3hQ+C6s/pGy2JVbY18uv1PnRSLshmlLpkvEQ4VHDh4JPVGw7JY7BG+i8X778uFCr4EDelzKeMRjbJOlfkpgHsLDpysQw8KuhFhkyV4Uy0DG06J8pIq45LqhPaCAxtsOHb7vUOrFq+m5eIWPCftocdEvTF+giSvV51dlrBTOns0porHTevPpvZoB3SedudRvEz0wPhYjF9cWQofOxV2snKLK8Msik9F4PDf7hxmCmx5uE+6VSvjYZ5XxXkPm/YX8e5CM1JL8AhzbB1+j4rg/GGk4XwvI70sDytjibNi2AzKbIWJwz4XImPGUVEIwGGx1Af1dVWeTtB9M9lpbVTlkWG+hDfqArK8KIB/368XogRRKgcHem5nZbRQzogERqriH2IihBBqZtdIV1EAO8E1BPXWOHxLlhuoCM437LvrAvLV2YS4SF+Opdua9CEbNkLqZ66bMERYWheQdQM2RVPhgYAagjrPhs/UaUr/YQhE1eLx2TVD//lSdMAOo7MvjvexRSHTtxMtlof7ayfIkO/SRbekBxd0u6ovHmQRwlOqXGVY7CNYvDJmAu9NFUl4YFSUFR4Mp6qyrZm5YnO7Qp1CNVCO9p8/twkcxTkVUb6uDbA13duHfwA4Vw8Pu1GN2AAAAABJRU5ErkJggg==";
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/upload/index.js + 24 modules
var upload = __webpack_require__(54580);
;// CONCATENATED MODULE: ./src/components/NewSliceUpload/request.ts
var getMd5List = /*#__PURE__*/function () {
var _ref = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/getMd5List"), {
method: 'get',
params: params
}, false, true));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getMd5List(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
var checkFileExists = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/fileExists"), {
method: 'get',
params: params
}, false, true));
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function checkFileExists(_x3, _x4) {
return _ref2.apply(this, arguments);
};
}();
var prepareUpload = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/newFile"), {
method: 'post',
body: params
}, false, true));
case 1:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function prepareUpload(_x5, _x6) {
return _ref3.apply(this, arguments);
};
}();
var filePatchUpload = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
return _context4.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/filePatchUpload"), {
method: 'post',
body: params
}, true, true));
case 1:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function filePatchUpload(_x7, _x8) {
return _ref4.apply(this, arguments);
};
}();
var filePatchMerge = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
return _context5.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/filePatchMerge"), {
method: 'post',
body: params
}, true, true));
case 1:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return function filePatchMerge(_x9, _x10) {
return _ref5.apply(this, arguments);
};
}();
var downloadCheck = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6(urlPrefix, params) {
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
return _context6.abrupt("return", (0,fetch/* default */.ZP)("".concat(urlPrefix, "/file/v3/downloadCheck"), {
method: 'get',
params: params
}, false, true));
case 1:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return function downloadCheck(_x11, _x12) {
return _ref6.apply(this, arguments);
};
}();
;// CONCATENATED MODULE: ./src/components/NewSliceUpload/index.tsx
var Dragger = upload/* default */.Z.Dragger;
var shardSize = 15 * 1024 * 1024;
//测试环境
// let api='https://testfu.educoder.net';
//线上地址
// let api='https://fu.educoder.net';
var UploadFile = function UploadFile(_ref) {
var user = _ref.user,
setloading = _ref.setloading,
uploading = _ref.uploading,
successCallback = _ref.successCallback,
url = _ref.url;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
fileList = _useState2[0],
setFileList = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(false),
_useState4 = slicedToArray_default()(_useState3, 2),
startFlag = _useState4[0],
setStartFlag = _useState4[1];
var uploadIndex = (0,_react_17_0_2_react.useRef)(0);
(0,_react_17_0_2_react.useEffect)(function () {
if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0 && startFlag) {
startUpload(fileList === null || fileList === void 0 ? void 0 : fileList[0]);
}
}, [fileList, startFlag]);
(0,_react_17_0_2_react.useEffect)(function () {
return function () {
uploadIndex.current++; //取消上传
};
}, []);
var clearStatus = function clearStatus() {
setFileList([]);
uploadIndex.current++;
currentIndex.current = 0;
finishedCount.current = 0;
currentRate.current = 0;
sharedCount.current = 0;
};
var updatePercent = function updatePercent(id) {
var intervalId = setInterval(function () {
downloadCheck(url, {
id: id
}).then(function (res) {
var _res$data;
if (res.status === '000000' && ((_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data[0]) === null || _res$data === void 0 ? void 0 : _res$data.isDownload) === 1) {
var _res$data2;
fileList[0]['percent'] = 100;
fileList[0]['status'] = 'success';
setFileList(toConsumableArray_default()(fileList));
// setloading(100)
message/* default */.ZP.info('上传成功');
successCallback(res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2[0]);
clearInterval(intervalId);
}
if (res.status !== '000000') {
clearStatus();
}
});
}, 2000);
};
var startUpload = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(file) {
var _user$userInfo;
var patchNum, uploadCurrentIndex, md5Res, _md5Res$data, _md5Res$data2, _user$userInfo2, fileExistRes, _fileExistRes$data, _md5Res$data3, _md5Res$data4, _fileExistRes$data2, _fileExistRes$data3, _fileExistRes$data5, _fileExistRes$data6, _user$userInfo3, _md5Res$data6, _newFileRes$data, parentId, _fileExistRes$data4, _fileExistRes$data7, _md5Res$data5, newFileRes, _newFileRes$data2, _md5Res$data7;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
patchNum = Math.ceil(file.size / shardSize);
uploadCurrentIndex = uploadIndex.current + 1;
uploadIndex.current = uploadCurrentIndex;
setStartFlag(false);
fileList[0]['status'] = 'uploading';
//获取md5列表
_context.next = 7;
return getMd5List(url, {
filename: file.name,
userId: (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login,
size: file.size,
patchNum: patchNum,
lastModified: "".concat(file.lastModified)
});
case 7:
md5Res = _context.sent;
if (!(md5Res.status === '000000')) {
_context.next = 41;
break;
}
_context.next = 11;
return checkFileExists(url, {
md5: ((_md5Res$data = md5Res.data) === null || _md5Res$data === void 0 || (_md5Res$data = _md5Res$data[0]) === null || _md5Res$data === void 0 ? void 0 : _md5Res$data.fmd5) || ((_md5Res$data2 = md5Res.data) === null || _md5Res$data2 === void 0 || (_md5Res$data2 = _md5Res$data2[0]) === null || _md5Res$data2 === void 0 ? void 0 : _md5Res$data2.md5),
size: file.size,
dirName: (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login,
lastModified: "".concat(file.lastModified)
});
case 11:
fileExistRes = _context.sent;
if (!(fileExistRes.status === '000000')) {
_context.next = 38;
break;
}
if (!(uploadIndex.current !== uploadCurrentIndex)) {
_context.next = 15;
break;
}
return _context.abrupt("return");
case 15:
parentId = (_fileExistRes$data = fileExistRes.data) === null || _fileExistRes$data === void 0 || (_fileExistRes$data = _fileExistRes$data[0]) === null || _fileExistRes$data === void 0 ? void 0 : _fileExistRes$data.id;
if (!(Array.isArray((_md5Res$data3 = md5Res.data) === null || _md5Res$data3 === void 0 || (_md5Res$data3 = _md5Res$data3[0]) === null || _md5Res$data3 === void 0 ? void 0 : _md5Res$data3.md5List) && !((_md5Res$data4 = md5Res.data) !== null && _md5Res$data4 !== void 0 && (_md5Res$data4 = _md5Res$data4[0]) !== null && _md5Res$data4 !== void 0 && (_md5Res$data4 = _md5Res$data4.md5List) !== null && _md5Res$data4 !== void 0 && _md5Res$data4.length))) {
_context.next = 19;
break;
}
mergePatch(parentId, file, patchNum);
return _context.abrupt("return");
case 19:
if (!(((_fileExistRes$data2 = fileExistRes.data) === null || _fileExistRes$data2 === void 0 ? void 0 : _fileExistRes$data2.length) > 0 && ((_fileExistRes$data3 = fileExistRes.data) === null || _fileExistRes$data3 === void 0 || (_fileExistRes$data3 = _fileExistRes$data3[0]) === null || _fileExistRes$data3 === void 0 ? void 0 : _fileExistRes$data3.type) === 1)) {
_context.next = 26;
break;
}
fileList[0]['percent'] = 100;
fileList[0]['status'] = 'success';
setFileList(toConsumableArray_default()(fileList));
message/* default */.ZP.info('秒传成功');
successCallback(fileExistRes === null || fileExistRes === void 0 || (_fileExistRes$data4 = fileExistRes.data) === null || _fileExistRes$data4 === void 0 || (_fileExistRes$data4 = _fileExistRes$data4[0]) === null || _fileExistRes$data4 === void 0 ? void 0 : _fileExistRes$data4.item);
return _context.abrupt("return");
case 26:
if (!(((_fileExistRes$data5 = fileExistRes.data) === null || _fileExistRes$data5 === void 0 ? void 0 : _fileExistRes$data5.length) > 0 && ((_fileExistRes$data6 = fileExistRes.data) === null || _fileExistRes$data6 === void 0 || (_fileExistRes$data6 = _fileExistRes$data6[0]) === null || _fileExistRes$data6 === void 0 ? void 0 : _fileExistRes$data6.type) === 0)) {
_context.next = 32;
break;
}
fileList[0]['percent'] = parseInt("".concat(((_fileExistRes$data7 = fileExistRes.data) === null || _fileExistRes$data7 === void 0 || (_fileExistRes$data7 = _fileExistRes$data7[0]) === null || _fileExistRes$data7 === void 0 ? void 0 : _fileExistRes$data7.rate) * 100));
fileList[0]['status'] = 'uploading';
setFileList(toConsumableArray_default()(fileList));
startUploadQueue(parentId, file, (_md5Res$data5 = md5Res.data) === null || _md5Res$data5 === void 0 || (_md5Res$data5 = _md5Res$data5[0]) === null || _md5Res$data5 === void 0 ? void 0 : _md5Res$data5.md5List, uploadCurrentIndex, patchNum);
return _context.abrupt("return");
case 32:
_context.next = 34;
return prepareUpload(url, {
dirName: (_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.login,
md5: (_md5Res$data6 = md5Res.data) === null || _md5Res$data6 === void 0 || (_md5Res$data6 = _md5Res$data6[0]) === null || _md5Res$data6 === void 0 ? void 0 : _md5Res$data6.fmd5,
name: file.name,
size: file.size
});
case 34:
newFileRes = _context.sent;
if (((_newFileRes$data = newFileRes.data) === null || _newFileRes$data === void 0 ? void 0 : _newFileRes$data.length) > 0) {
startUploadQueue((_newFileRes$data2 = newFileRes.data) === null || _newFileRes$data2 === void 0 || (_newFileRes$data2 = _newFileRes$data2[0]) === null || _newFileRes$data2 === void 0 ? void 0 : _newFileRes$data2.id, file, (_md5Res$data7 = md5Res.data) === null || _md5Res$data7 === void 0 || (_md5Res$data7 = _md5Res$data7[0]) === null || _md5Res$data7 === void 0 ? void 0 : _md5Res$data7.md5List, uploadCurrentIndex, patchNum);
}
_context.next = 39;
break;
case 38:
clearStatus();
case 39:
_context.next = 42;
break;
case 41:
clearStatus();
case 42:
case "end":
return _context.stop();
}
}, _callee);
}));
return function startUpload(_x) {
return _ref2.apply(this, arguments);
};
}();
var sharedCount = (0,_react_17_0_2_react.useRef)(0);
var finishedCount = (0,_react_17_0_2_react.useRef)(0);
var currentIndex = (0,_react_17_0_2_react.useRef)(0);
var currentRate = (0,_react_17_0_2_react.useRef)(0);
var startUploadQueue = function startUploadQueue(parentId, file, md5List, uploadCurrentIndex, patchNum) {
if (!parentId) {
return;
}
sharedCount.current = md5List.length;
var concurrentLimit = Math.min(4, md5List.length);
for (var i = 0; i < concurrentLimit; i++) {
uploadPatch("".concat(parentId), file, md5List, uploadCurrentIndex, patchNum);
}
};
function uploadPatch(parentId, file, md5List, uploadCurrentIndex, patchNum) {
var _md5List$currentIndex, _md5List$currentIndex2;
if (currentIndex.current >= sharedCount.current) {
return;
}
var md5 = (_md5List$currentIndex = md5List[currentIndex.current]) === null || _md5List$currentIndex === void 0 ? void 0 : _md5List$currentIndex.md5;
var md5Index = (_md5List$currentIndex2 = md5List[currentIndex.current]) === null || _md5List$currentIndex2 === void 0 ? void 0 : _md5List$currentIndex2.index;
var start = md5Index * shardSize;
var end = Math.min(file.size, start + shardSize);
var patch = file.slice(start, end);
var reader = new FileReader();
currentIndex.current++;
reader.readAsArrayBuffer(patch);
reader.onload = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(e) {
var _user$userInfo4;
var form, res, _res$data$;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
form = new FormData();
form.append("index", "".concat(md5Index));
form.append("parent", parentId);
form.append("size", patch.size);
form.append("patch", patch);
form.append("md5", md5);
form.append("userId", (_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.login);
form.append("name", file.name + "-patch-" + md5Index);
// for (let [name, value] of form) {
// console.log(`${name} = ${value}`); // key1 = value1然后是 key2 = value2
// }
_context2.next = 10;
return filePatchUpload(url, form);
case 10:
res = _context2.sent;
if (!(uploadIndex.current !== uploadCurrentIndex)) {
_context2.next = 13;
break;
}
return _context2.abrupt("return");
case 13:
fileList[0]['percent'] = 0;
fileList[0]['status'] = 'uploading';
if (!(res.errorCode === "000000")) {
_context2.next = 26;
break;
}
finishedCount.current++;
mergePatch("".concat(parentId), file, patchNum);
currentRate.current = Math.max((_res$data$ = res.data[0]) === null || _res$data$ === void 0 ? void 0 : _res$data$.rate, currentRate.current);
fileList[0]['percent'] = parseInt("".concat(currentRate.current * 100));
fileList[0]['status'] = 'uploading';
setFileList(toConsumableArray_default()(fileList));
uploadPatch("".concat(parentId), file, md5List, uploadCurrentIndex, patchNum);
return _context2.abrupt("return");
case 26:
// message.info('上传分片失败')
clearStatus();
case 27:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x2) {
return _ref3.apply(this, arguments);
};
}();
}
function mergePatch(_x3, _x4, _x5) {
return _mergePatch.apply(this, arguments);
}
function _mergePatch() {
_mergePatch = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(parentId, file, patchNum) {
var _user$userInfo5;
var form, res, _res$data3;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
if (!(finishedCount.current < sharedCount.current)) {
_context4.next = 2;
break;
}
return _context4.abrupt("return");
case 2:
form = new FormData();
form.append("parent", parentId);
form.append("size", "".concat(file.size));
form.append("userId", (_user$userInfo5 = user.userInfo) === null || _user$userInfo5 === void 0 ? void 0 : _user$userInfo5.login);
form.append('patchNum', "".concat(patchNum));
_context4.next = 9;
return filePatchMerge(url, form);
case 9:
res = _context4.sent;
if (res.errorCode === "000000") {
// fileList[0]['percent'] = 99;
// fileList[0]['status'] = 'success';
updatePercent((_res$data3 = res.data) === null || _res$data3 === void 0 || (_res$data3 = _res$data3[0]) === null || _res$data3 === void 0 ? void 0 : _res$data3.id);
} else {
clearStatus();
}
case 11:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _mergePatch.apply(this, arguments);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(Dragger, {
height: 200,
accept: ".gz,.bz2,.tar",
onRemove: function onRemove(file) {
clearStatus();
successCallback(null);
},
multiple: false,
fileList: fileList,
beforeUpload: ( /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(file) {
var fileSize, name, allowedExtensions, fileExtension;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
fileSize = 5 * 1024 * 1024 * 1024;
name = file.name.toLowerCase();
allowedExtensions = ['.gz', '.bz2', '.tar'];
fileExtension = name.substring(name.lastIndexOf('.'));
if (allowedExtensions.includes(fileExtension)) {
_context3.next = 7;
break;
}
message/* default */.ZP.info("\u4EC5\u652F\u6301\u4E0A\u4F20gz\u3001bz2\u3001tar\u3001tar.gz\u3001tar.bz2\u683C\u5F0F\u7684\u955C\u50CF\u6587\u4EF6");
return _context3.abrupt("return", false);
case 7:
if (!((file === null || file === void 0 ? void 0 : file.size) > fileSize)) {
_context3.next = 10;
break;
}
message/* default */.ZP.info("\u6587\u4EF6\u8D85\u8FC7".concat(fileSize / 1024 / 1024 / 1024, "GB\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42"));
return _context3.abrupt("return", false);
case 10:
clearStatus();
successCallback(null);
setStartFlag(true);
setFileList([file]);
return _context3.abrupt("return", false);
case 15:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function (_x6) {
return _ref4.apply(this, arguments);
};
}()),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-shangchuanwenjian1 font50",
style: {
color: '#A9C9FB '
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "font14 mt30 mb20",
style: {
color: '#9096A3'
},
children: ["\u62D6\u62FD\u6587\u4EF6\u6216", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#3061D0',
marginLeft: 5
},
children: "\u70B9\u51FB\u6B64\u5904\u4E0A\u4F20"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
fontSize: 12,
color: "#9096A3"
},
children: ["\u4EC5\u652F\u6301\u4E0A\u4F20gz\u3001bz2\u3001tar\u3001tar.gz\u3001tar.bz2\u683C\u5F0F\u7684\u955C\u50CF\u6587\u4EF6\uFF0C\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC75GB", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u5982\u679C\u6709\u4E0A\u4F20\u4E2D\u7684\u6587\u4EF6\uFF0C\u8BF7\u52FF\u5237\u65B0\u6216\u5173\u95ED\u6D4F\u89C8\u5668"]
})]
});
};
/* harmony default export */ var NewSliceUpload = ((0,_umi_production_exports.connect)(function (_ref5) {
var user = _ref5.user;
return {
user: user
};
})(UploadFile));
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(1079);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(67390);
;// CONCATENATED MODULE: ./src/pages/User/Detail/ExperImentImg/Add/index.tsx
var _excluded = ["classroomList", "globalSetting", "loading", "user", "dispatch"];
var EditPage = function EditPage(_ref) {
var _location, _globalSetting$settin, _configData$cpu_memor, _configData$time_limi2;
var classroomList = _ref.classroomList,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
user = _ref.user,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var _useState = (0,_react_17_0_2_react.useState)(1),
_useState2 = slicedToArray_default()(_useState, 2),
methods = _useState2[0],
setMethods = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(1),
_useState4 = slicedToArray_default()(_useState3, 2),
tabs = _useState4[0],
setTabs = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(false),
_useState6 = slicedToArray_default()(_useState5, 2),
mirrorModal = _useState6[0],
setMirrorModal = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(true),
_useState8 = slicedToArray_default()(_useState7, 2),
isEmpty = _useState8[0],
setIsEmpty = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)({}),
_useState10 = slicedToArray_default()(_useState9, 2),
mirrorInfo = _useState10[0],
setMirrorInfo = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(''),
_useState12 = slicedToArray_default()(_useState11, 2),
description = _useState12[0],
setDescription = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(false),
_useState14 = slicedToArray_default()(_useState13, 2),
configModal = _useState14[0],
setConfigModal = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)({}),
_useState16 = slicedToArray_default()(_useState15, 2),
configData = _useState16[0],
setConfigData = _useState16[1];
var _useState17 = (0,_react_17_0_2_react.useState)(),
_useState18 = slicedToArray_default()(_useState17, 2),
defaultDesc = _useState18[0],
setDefaultDesc = _useState18[1];
var _useState19 = (0,_react_17_0_2_react.useState)(0),
_useState20 = slicedToArray_default()(_useState19, 2),
cpuId = _useState20[0],
setCpuId = _useState20[1];
var _useState21 = (0,_react_17_0_2_react.useState)(0),
_useState22 = slicedToArray_default()(_useState21, 2),
timeId = _useState22[0],
setTimeId = _useState22[1];
var _useState23 = (0,_react_17_0_2_react.useState)(''),
_useState24 = slicedToArray_default()(_useState23, 2),
mirrorError = _useState24[0],
setMirrorError = _useState24[1];
var _useState25 = (0,_react_17_0_2_react.useState)(true),
_useState26 = slicedToArray_default()(_useState25, 2),
command = _useState26[0],
setCommand = _useState26[1]; //命令行
var _useState27 = (0,_react_17_0_2_react.useState)(false),
_useState28 = slicedToArray_default()(_useState27, 2),
graphical = _useState28[0],
setGraphical = _useState28[1]; // 图像化
var _useState29 = (0,_react_17_0_2_react.useState)(''),
_useState30 = slicedToArray_default()(_useState29, 2),
mirrorTypeError = _useState30[0],
setMirrorTypeError = _useState30[1];
var _useState31 = (0,_react_17_0_2_react.useState)(''),
_useState32 = slicedToArray_default()(_useState31, 2),
fileError = _useState32[0],
setFileError = _useState32[1];
var _useState33 = (0,_react_17_0_2_react.useState)({}),
_useState34 = slicedToArray_default()(_useState33, 2),
fileInfo = _useState34[0],
setFileInfo = _useState34[1];
var _useState35 = (0,_react_17_0_2_react.useState)({}),
_useState36 = slicedToArray_default()(_useState35, 2),
publicMirrorInfo = _useState36[0],
setPublicMirrorInfo = _useState36[1]; //公共镜像数据
var _useState37 = (0,_react_17_0_2_react.useState)({}),
_useState38 = slicedToArray_default()(_useState37, 2),
customizeMirrorInfo = _useState38[0],
setCustomizeMirrorInfo = _useState38[1]; //自定义镜像数据
var _useState39 = (0,_react_17_0_2_react.useState)({}),
_useState40 = slicedToArray_default()(_useState39, 2),
shareMirrorInfo = _useState40[0],
setShareMirrorInfo = _useState40[1]; //共享镜像数据
var _useState41 = (0,_react_17_0_2_react.useState)(),
_useState42 = slicedToArray_default()(_useState41, 2),
basicTypeName = _useState42[0],
setBasicTypeName = _useState42[1]; //基于基础镜像创建的镜像名称
var _useState43 = (0,_react_17_0_2_react.useState)(),
_useState44 = slicedToArray_default()(_useState43, 2),
localTypeName = _useState44[0],
setLocalTypeName = _useState44[1]; //导入本地镜像创建的镜像名称
var _useState45 = (0,_react_17_0_2_react.useState)(''),
_useState46 = slicedToArray_default()(_useState45, 2),
basicNameError = _useState46[0],
setBasicNameError = _useState46[1];
var _useState47 = (0,_react_17_0_2_react.useState)(''),
_useState48 = slicedToArray_default()(_useState47, 2),
basicNameErrorText = _useState48[0],
setBasicNameErrorText = _useState48[1];
var _useState49 = (0,_react_17_0_2_react.useState)(''),
_useState50 = slicedToArray_default()(_useState49, 2),
localNameError = _useState50[0],
setLocalNameError = _useState50[1];
var _useState51 = (0,_react_17_0_2_react.useState)(''),
_useState52 = slicedToArray_default()(_useState51, 2),
localNameErrorText = _useState52[0],
setLocalNameErrorText = _useState52[1];
var _useState53 = (0,_react_17_0_2_react.useState)(false),
_useState54 = slicedToArray_default()(_useState53, 2),
createBtnLoading = _useState54[0],
setCreateBtnLoading = _useState54[1];
var _useState55 = (0,_react_17_0_2_react.useState)(false),
_useState56 = slicedToArray_default()(_useState55, 2),
btnLoading = _useState56[0],
setBtnLoading = _useState56[1];
var _useState57 = (0,_react_17_0_2_react.useState)(false),
_useState58 = slicedToArray_default()(_useState57, 2),
modalBtnLoading = _useState58[0],
setModalBtnLoading = _useState58[1];
var methodsItems = [{
id: 1,
name: '基于基础镜像创建'
}, {
id: 2,
name: '导入本地镜像创建'
}];
var mirrorItems = [{
id: 1,
name: '公共镜像',
type: 'public'
}, {
id: 2,
name: '自定义镜像',
type: 'customize'
}, {
id: 3,
name: '共享镜像',
type: 'share'
}];
(0,_react_17_0_2_react.useEffect)(function () {
getConfig();
dispatch({
type: 'globalSetting/footerToggle',
payload: false
});
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
document.title = '创建镜像';
}, [(_location = location) === null || _location === void 0 ? void 0 : _location.pathname]);
var getConfig = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, _res$data;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,fetch/* default */.ZP)('/api/user_mirrors/other_info.json', {
method: 'get'
});
case 2:
res = _context.sent;
if (res.status === 0) {
setConfigData(res === null || res === void 0 ? void 0 : res.data);
setDefaultDesc(res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.default_mirror_desc);
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getConfig() {
return _ref2.apply(this, arguments);
};
}();
var getNameError = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(typeName, isStart) {
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (methods === 1) setCreateBtnLoading(true);else setBtnLoading(true);
_context2.next = 3;
return (0,fetch/* default */.ZP)("/api/user_mirrors/check_mirror_name.json", {
method: 'post',
body: {
type_name: typeName
}
});
case 3:
res = _context2.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
if (methods === 1) {
setBasicNameError('');
setBasicNameErrorText('');
if (isStart) {
setConfigModal(true);
}
}
if (methods === 2) {
setLocalNameError('');
setLocalNameErrorText('');
if (isStart) {
creatMirrorByFile();
}
}
} else {
if (methods === 1) {
setBasicNameError('type_name');
setBasicNameErrorText(res === null || res === void 0 ? void 0 : res.message);
}
if (methods === 2) {
setLocalNameError('type_name');
setLocalNameErrorText(res === null || res === void 0 ? void 0 : res.message);
}
document.body.scrollIntoView();
}
setBtnLoading(false);
setCreateBtnLoading(false);
case 7:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function getNameError(_x, _x2) {
return _ref3.apply(this, arguments);
};
}();
var creatMirrorByFile = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
setBtnLoading(true);
_context3.next = 3;
return (0,fetch/* default */.ZP)("/api/user_mirrors.json", {
method: 'post',
body: {
create_method: 2,
type_name: localTypeName,
description: description,
is_support_vnc: graphical,
is_support_webssh: command,
file_path: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.path,
file_id: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.id,
file_old_name: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.oldName,
file_new_name: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
filesize: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.size
}
});
case 3:
res = _context3.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
message/* default */.ZP.success("创建成功");
_umi_production_exports.history.back();
setBtnLoading(false);
}
case 5:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function creatMirrorByFile() {
return _ref4.apply(this, arguments);
};
}();
var getMirror = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
var res, _res$data2, _res$data3;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,fetch/* default */.ZP)('/api/shixuns/new.json', {
method: 'get',
params: {
is_create_mirror: 1,
tab_type: mirrorItems[Number(tabs) - 1].type
}
});
case 2:
res = _context4.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
if ((res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 || (_res$data2 = _res$data2.environments) === null || _res$data2 === void 0 ? void 0 : _res$data2.length) === 0 && (res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.other_image.length) === 0) {
setIsEmpty(true);
} else {
setIsEmpty(false);
}
}
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function getMirror() {
return _ref5.apply(this, arguments);
};
}();
var toExit = function toExit() {
var toNext = function toNext() {
_umi_production_exports.history.back();
};
var flag = false;
if (publicMirrorInfo !== null && publicMirrorInfo !== void 0 && publicMirrorInfo.id || customizeMirrorInfo !== null && customizeMirrorInfo !== void 0 && customizeMirrorInfo.id || shareMirrorInfo !== null && shareMirrorInfo !== void 0 && shareMirrorInfo.id || basicTypeName) flag = true;
if (fileInfo !== null && fileInfo !== void 0 && fileInfo.id || localTypeName || command === false || graphical === true) {
flag = true;
}
if (flag) {
modal/* default */.Z.confirm({
title: '离开此页提示',
content: '系统可能不会保存您所做的更改。',
okText: '离开',
cancelText: '取消',
onOk: function onOk() {
toNext();
}
});
} else {
toNext();
}
};
(0,_react_17_0_2_react.useEffect)(function () {
getMirror();
}, [tabs]);
var handleConfirm = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
if (!(methods === 1)) {
_context5.next = 17;
break;
}
if (mirrorInfo !== null && mirrorInfo !== void 0 && mirrorInfo.id) {
_context5.next = 7;
break;
}
setMirrorError('mirror');
document.body.scrollIntoView();
return _context5.abrupt("return");
case 7:
setMirrorError('');
case 8:
if (basicTypeName) {
_context5.next = 15;
break;
}
setBasicNameError('type_name');
setBasicNameErrorText('镜像名称不能为空');
document.body.scrollIntoView();
return _context5.abrupt("return");
case 15:
_context5.next = 17;
return getNameError(basicTypeName, true);
case 17:
if (!(methods === 2)) {
_context5.next = 40;
break;
}
if (!(!command && !graphical)) {
_context5.next = 24;
break;
}
setMirrorTypeError('interface');
document.body.scrollIntoView();
return _context5.abrupt("return");
case 24:
setMirrorTypeError('');
case 25:
if (!((fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.id) != undefined)) {
_context5.next = 29;
break;
}
setFileError('');
_context5.next = 32;
break;
case 29:
setFileError('file');
document.body.scrollIntoView();
return _context5.abrupt("return");
case 32:
if (localTypeName) {
_context5.next = 39;
break;
}
setLocalNameError('type_name');
setLocalNameErrorText('镜像名称不能为空');
document.body.scrollIntoView();
return _context5.abrupt("return");
case 39:
getNameError(localTypeName, true);
case 40:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return function handleConfirm() {
return _ref6.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules.wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules.crumbs,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-fanhuijingxiang",
style: {
color: '#3061D0',
fontSize: 14,
cursor: "pointer"
},
onClick: toExit
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
paddingLeft: 8
},
children: "\u521B\u5EFA\u955C\u50CF"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "",
className: Addmodules.doc,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
onClick: function onClick() {
(0,util/* openNewWindow */.xg)("".concat(env/* default */.Z.API_SERVER, "/pdf/\u81EA\u5B9A\u4E49\u955C\u50CF\u64CD\u4F5C\u5E2E\u52A9\u6587\u6863.pdf"));
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-a-wenhaobeifen2"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
paddingLeft: 4
},
children: "\u5E2E\u52A9\u6587\u6863"
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Addmodules.title,
children: "\u521B\u5EFA\u65B9\u5F0F\u4E0E\u6765\u6E90"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginBottom: 60
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
nameWidth: 100,
name: "\u521B\u5EFA\u65B9\u5F0F",
children: methodsItems.map(function (item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: methods === item.id ? "primary" : "default",
style: {
marginRight: 20,
borderRadius: 2
},
className: methods === item.id ? Addmodules.activeBtn : Addmodules.btn,
onClick: function onClick() {
setMethods(item.id);
if (tabs === 1) {
setMirrorInfo(publicMirrorInfo);
if (publicMirrorInfo !== null && publicMirrorInfo !== void 0 && publicMirrorInfo.id) setMirrorError('');
}
if (tabs === 2) {
setMirrorInfo(customizeMirrorInfo);
if (customizeMirrorInfo !== null && customizeMirrorInfo !== void 0 && customizeMirrorInfo.id) setMirrorError('');
}
if (tabs === 3) {
setMirrorInfo(shareMirrorInfo);
if (shareMirrorInfo !== null && shareMirrorInfo !== void 0 && shareMirrorInfo.id) setMirrorError('');
}
},
children: item.name
});
})
}), methods === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
nameWidth: 100,
name: "\u57FA\u7840\u955C\u50CF",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* SuperiorTabs */.tp, {
dataSource: mirrorItems,
value: tabs,
onChange: function onChange(id) {
setTabs(id);
if (id === 1) {
setMirrorInfo(objectSpread2_default()({}, publicMirrorInfo));
if (publicMirrorInfo !== null && publicMirrorInfo !== void 0 && publicMirrorInfo.id) setMirrorError('');
}
if (id === 2) {
setMirrorInfo(objectSpread2_default()({}, customizeMirrorInfo));
if (customizeMirrorInfo !== null && customizeMirrorInfo !== void 0 && customizeMirrorInfo.id) setMirrorError('');
}
if (id === 3) {
setMirrorInfo(objectSpread2_default()({}, shareMirrorInfo));
if (shareMirrorInfo !== null && shareMirrorInfo !== void 0 && shareMirrorInfo.id) setMirrorError('');
}
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
nameWidth: 100,
errorKey: "mirror",
errorValue: mirrorError,
errorName: "\u8BF7\u9009\u62E9\u57FA\u7840\u955C\u50CF",
errorStyle: {
fontSize: 12,
paddingBottom: 8
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
align: "middle",
children: isEmpty === false ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [!!(mirrorInfo !== null && mirrorInfo !== void 0 && mirrorInfo.id) && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
setMirrorModal(true);
},
className: Addmodules.mirror,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: mirrorInfo === null || mirrorInfo === void 0 ? void 0 : mirrorInfo.name
}), /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-genghuan"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(MarkdownModal/* default */.Z, {
value: [{
description: mirrorInfo === null || mirrorInfo === void 0 ? void 0 : mirrorInfo.description,
name: mirrorInfo === null || mirrorInfo === void 0 ? void 0 : mirrorInfo.name
}],
title: "\u5B9E\u9A8C\u955C\u50CF\u8BF4\u660E",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: Addmodules.explain,
children: "\u5B9E\u9A8C\u955C\u50CF\u8BF4\u660E"
})
})]
}), !(mirrorInfo !== null && mirrorInfo !== void 0 && mirrorInfo.id) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
setMirrorModal(true);
},
className: Addmodules.mirror,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-tianjia3 font14 mr10"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: "\u9009\u62E9\u5B9E\u9A8C\u955C\u50CF"
})]
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: nodata_namespaceObject,
style: {
width: '30px',
height: '32px'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
paddingLeft: '10px'
},
children: "\u6682\u65E0\u6570\u636E~"
})]
})
})
})]
}), methods === 2 && /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
nameWidth: 100,
align: "start",
required: true,
name: "\u955C\u50CF\u6587\u4EF6",
errorKey: "file",
errorValue: fileError,
errorName: "\u8BF7\u4E0A\u4F20\u955C\u50CF\u6587\u4EF6",
errorStyle: {
fontSize: 12,
paddingBottom: 8
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(NewSliceUpload, {
successCallback: function successCallback(e) {
if (!!e) {
setFileError('');
setFileInfo(objectSpread2_default()({}, e));
} else {
setFileInfo({});
}
},
url: globalSetting === null || globalSetting === void 0 || (_globalSetting$settin = globalSetting.setting) === null || _globalSetting$settin === void 0 ? void 0 : _globalSetting$settin.bigfiles_upload
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
name: "\u955C\u50CF\u7C7B\u578B",
nameWidth: 100,
align: "start",
errorKey: "interface",
errorValue: mirrorTypeError,
errorName: "\u8BF7\u9009\u62E9\u955C\u50CF\u7C7B\u578B",
errorStyle: {
fontSize: 12,
paddingBottom: 8
},
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules["interface"],
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
setCommand(!command);
if (!command || graphical === true) {
setMirrorTypeError('');
}
},
className: command ? Addmodules.active : '',
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "iconfont icon-xuanzhong9"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-minglinghang"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u547D\u4EE4\u884C\u7EC8\u7AEF"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
children: "\u901A\u8FC7\u547D\u4EE4\u884C\u7EC8\u7AEF\u7684\u65B9\u5F0F\u8FDE\u63A5"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
setGraphical(!graphical);
if (!graphical || command === true) {
setMirrorTypeError('');
}
},
className: graphical ? Addmodules.active : '',
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "iconfont icon-xuanzhong9"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-tuxinghuazhuomian"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u56FE\u5F62\u5316\u684C\u9762"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
children: "\u901A\u8FC7\u56FE\u5F62\u5316\u684C\u9762\u7684\u65B9\u5F0F\u8FDE\u63A5"
})]
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Addmodules.title,
style: {
marginTop: 0
},
children: "\u955C\u50CF\u4FE1\u606F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
nameWidth: 100,
name: "\u955C\u50CF\u540D\u79F0",
errorKey: "type_name",
errorValue: methods === 1 ? basicNameError : localNameError,
errorName: methods === 1 ? basicNameErrorText : localNameErrorText,
errorStyle: {
fontSize: 12,
paddingBottom: 8
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
value: methods === 1 ? basicTypeName : localTypeName
// maxLength={60}
,
onChange: function onChange(e) {
var value = e.target.value;
if (methods === 1) {
setBasicTypeName(value);
}
if (methods === 2) {
setLocalTypeName(value);
}
},
onBlur: function onBlur(e) {
var value = e.target.value;
//await getNameError(value,false)
if (value.length <= 60) {
var regex = /^[a-zA-Z][a-zA-Z0-9#+.\-/_:]*$/;
if (value.match(regex) || value === '') {
if (methods === 1) {
setBasicTypeName(value);
setBasicNameError('');
setBasicNameErrorText('');
} else if (methods === 2) {
setLocalTypeName(value);
setLocalNameError('');
setLocalNameErrorText('');
}
} else {
if (methods === 1) {
setBasicNameError('type_name');
setBasicNameErrorText('镜像名称只能以字母开头,仅支持字母、数字和特殊字符#+.-/_:');
} else if (methods === 2) {
setLocalNameError('type_name');
setLocalNameErrorText('镜像名称只能以字母开头,仅支持字母、数字和特殊字符#+.-/_:');
}
}
} else {
if (methods === 1) {
setBasicNameError('type_name');
setBasicNameErrorText('镜像名称不能超过60个字符');
} else if (methods === 2) {
setLocalNameError('type_name');
setLocalNameErrorText('镜像名称不能超过60个字符');
}
}
}
// bordered={false}
,
placeholder: "\u4F8B\u5982\uFF1APython3.6",
size: "large"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
name: "\u955C\u50CF\u63CF\u8FF0",
nameWidth: 100,
align: "start",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
fullScreen: false,
watch: true,
height: 500,
placeholder: '',
defaultValue: methods === 1 ? mirrorInfo === null || mirrorInfo === void 0 ? void 0 : mirrorInfo.description : defaultDesc,
onChange: function onChange(value) {
setDescription(value);
},
onBlur: function onBlur(value) {
setDescription(value);
}
})
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Addmodules.btns,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
style: {
marginRight: 40
},
onClick: toExit,
children: "\u53D6\u6D88"
}), methods === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
onClick: handleConfirm,
loading: createBtnLoading,
children: "\u5F00\u59CB\u5236\u4F5C\u955C\u50CF"
}), methods === 2 && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
disabled: !(fileInfo !== null && fileInfo !== void 0 && fileInfo.id),
type: !(fileInfo !== null && fileInfo !== void 0 && fileInfo.id) ? "default" : "primary",
className: !(fileInfo !== null && fileInfo !== void 0 && fileInfo.id) ? Addmodules.disabledBtn : '',
onClick: function onClick() {
return handleConfirm();
},
loading: btnLoading,
children: "\u5F00\u59CB\u5BFC\u5165"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(components_MirrorModal, {
useId: mirrorInfo === null || mirrorInfo === void 0 ? void 0 : mirrorInfo.id,
tab_type: mirrorItems[Number(tabs) - 1].type,
visible: mirrorModal,
onCancel: function onCancel() {
setMirrorModal(false);
},
onOk: function onOk(value) {
if (tabs === 1) setPublicMirrorInfo(value);
if (tabs === 2) setCustomizeMirrorInfo(value);
if (tabs === 3) setShareMirrorInfo(value);
setMirrorInfo(value);
setMirrorModal(false);
setMirrorError('');
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
maskClosable: false,
keyboard: false,
destroyOnClose: true,
open: configModal,
title: "\u9009\u62E9\u8FD0\u884C\u73AF\u5883",
width: "558px",
okText: "\u786E\u5B9A",
wrapClassName: Addmodules.auditModal,
confirmLoading: modalBtnLoading,
onCancel: function onCancel() {
setConfigModal(false);
},
onOk: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
var _configData$time_limi;
var res, _res$data4;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
setModalBtnLoading(true);
_context6.next = 3;
return (0,fetch/* default */.ZP)('/api/user_mirrors.json', {
method: 'post',
body: {
create_method: 1,
base_mirror_repository_id: mirrorInfo.id,
cpu_memory_limit: configData === null || configData === void 0 ? void 0 : configData.cpu_memory_limit_config[Number(cpuId)],
time_limit: configData === null || configData === void 0 || (_configData$time_limi = configData.time_limit_config[Number(timeId)]) === null || _configData$time_limi === void 0 ? void 0 : _configData$time_limi.value,
type_name: basicTypeName,
description: description
}
});
case 3:
res = _context6.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
message/* default */.ZP.success("创建成功");
_umi_production_exports.history.push("/shixuns/new/".concat(res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.user_mirror_id, "/imagepreview?operation=create_image"));
}
setModalBtnLoading(false);
setConfigModal(false);
case 7:
case "end":
return _context6.stop();
}
}, _callee6);
})),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
paddingTop: 20
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
name: "\u914D\u7F6E",
align: "center",
nameWidth: 60
// errorName='请选择配置'
,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Addmodules.cpuWrap,
children: configData === null || configData === void 0 || (_configData$cpu_memor = configData.cpu_memory_limit_config) === null || _configData$cpu_memor === void 0 ? void 0 : _configData$cpu_memor.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: cpuId === index ? Addmodules.activebtn : Addmodules.btn,
onClick: function onClick() {
return setCpuId(index);
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: item
}), cpuId === index ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-xuanzhong9",
style: {
paddingRight: 12
}
})
}) : '']
});
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Label/* default */.Z, {
required: true,
name: "\u65F6\u957F",
align: "center",
nameWidth: 60
// errorName='请选择时长'
,
children: configData === null || configData === void 0 || (_configData$time_limi2 = configData.time_limit_config) === null || _configData$time_limi2 === void 0 ? void 0 : _configData$time_limi2.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: timeId === index ? Addmodules.activeTab : Addmodules.tab,
onClick: function onClick() {
return setTimeId(index);
},
children: item.name
});
})
})]
})
})]
});
};
/* harmony default export */ var Add = ((0,_umi_production_exports.connect)(function (_ref8) {
var classroomList = _ref8.classroomList,
loading = _ref8.loading,
globalSetting = _ref8.globalSetting,
user = _ref8.user;
return {
classroomList: classroomList,
globalSetting: globalSetting,
loading: loading.models.classroomList,
user: user
};
})(EditPage));
/***/ }),
/***/ 84470:
/*!*********************************************!*\
!*** ./src/pages/tasks/vnc-view/index.less ***!
\*********************************************/
/***/ (function() {
// extracted by mini-css-extract-plugin
/***/ })
}]);