|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[88397],{
|
|
|
|
|
|
/***/ 20090:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./src/components/FixedButton/index.tsx + 1 modules ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
t: function() { return /* binding */ FixedButton; }
|
|
|
});
|
|
|
|
|
|
// 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/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var FixedButtonmodules = ({"buttonFixed":"buttonFixed___vyq30","button":"button___hxmYv","buttonWrap":"buttonWrap___uK8dl"});
|
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
|
|
|
var _classnames_2_5_1_classnames = __webpack_require__(92310);
|
|
|
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/FixedButton/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var FixedButton = function FixedButton(_ref) {
|
|
|
var _ref$cancelText = _ref.cancelText,
|
|
|
cancelText = _ref$cancelText === void 0 ? '取消' : _ref$cancelText,
|
|
|
_ref$okText = _ref.okText,
|
|
|
okText = _ref$okText === void 0 ? '确定' : _ref$okText,
|
|
|
_ref$loading = _ref.loading,
|
|
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
|
_ref$hasOkBtn = _ref.hasOkBtn,
|
|
|
hasOkBtn = _ref$hasOkBtn === void 0 ? true : _ref$hasOkBtn,
|
|
|
_ref$hasCancelBtn = _ref.hasCancelBtn,
|
|
|
hasCancelBtn = _ref$hasCancelBtn === void 0 ? true : _ref$hasCancelBtn,
|
|
|
_ref$okButtonProps = _ref.okButtonProps,
|
|
|
okButtonProps = _ref$okButtonProps === void 0 ? {} : _ref$okButtonProps,
|
|
|
_ref$onCancel = _ref.onCancel,
|
|
|
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
|
|
|
_ref$onOk = _ref.onOk,
|
|
|
onOk = _ref$onOk === void 0 ? function () {} : _ref$onOk,
|
|
|
_ref$className = _ref.className,
|
|
|
className = _ref$className === void 0 ? '' : _ref$className;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: _classnames_2_5_1_classnames_default()(FixedButtonmodules.buttonFixed, className),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: FixedButtonmodules.buttonWrap,
|
|
|
children: [hasCancelBtn && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
size: "middle",
|
|
|
className: "".concat(FixedButtonmodules.button, " mr20")
|
|
|
// 点击取消的返回
|
|
|
,
|
|
|
onClick: onCancel,
|
|
|
children: cancelText
|
|
|
}), hasOkBtn && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, objectSpread2_default()(objectSpread2_default()({
|
|
|
size: 'middle',
|
|
|
type: "primary",
|
|
|
className: "".concat(FixedButtonmodules.button, " mr20"),
|
|
|
loading: loading,
|
|
|
onClick: onOk
|
|
|
}, okButtonProps), {}, {
|
|
|
children: okText
|
|
|
}))]
|
|
|
})
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 99185:
|
|
|
/*!*************************************************************************************!*\
|
|
|
!*** ./src/pages/Shixuns/Detail/Settings/components/TestCase/index.tsx + 1 modules ***!
|
|
|
\*************************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ components_TestCase; }
|
|
|
});
|
|
|
|
|
|
// 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/_@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/_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__(26789);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/collapse/index.js + 8 modules
|
|
|
var collapse = __webpack_require__(36381);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(73782);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/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/checkbox/index.js + 3 modules
|
|
|
var es_checkbox = __webpack_require__(24905);
|
|
|
// 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/input-number/index.js + 14 modules
|
|
|
var input_number = __webpack_require__(94001);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
|
|
|
var es_radio = __webpack_require__(5112);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/index.js + 3 modules
|
|
|
var space = __webpack_require__(81327);
|
|
|
// 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/select/index.js
|
|
|
var es_select = __webpack_require__(57809);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
|
|
|
var es_switch = __webpack_require__(78673);
|
|
|
// EXTERNAL MODULE: ./src/components/FixedButton/index.tsx + 1 modules
|
|
|
var FixedButton = __webpack_require__(20090);
|
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
|
|
|
var ui_customization = __webpack_require__(6897);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Settings/components/TestCase/index.less?modules
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
/* harmony default export */ var TestCasemodules = ({"wrap":"wrap___BgpUe","row":"row___UWxAG","textarea":"textarea___gaLin","btn":"btn___ZpuhS","sub":"sub___Jd_ZS"});
|
|
|
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 3 modules
|
|
|
var monaco_editor = __webpack_require__(65680);
|
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
|
var fetch = __webpack_require__(18838);
|
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
|
var authority = __webpack_require__(14533);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/Detail/Settings/components/TestCase/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Panel = collapse/* default */.Z.Panel;
|
|
|
var TextArea = input/* default */.Z.TextArea;
|
|
|
var TestCase = function TestCase(_ref) {
|
|
|
var _userInfo;
|
|
|
var active = _ref.active,
|
|
|
_ref$type = _ref.type,
|
|
|
type = _ref$type === void 0 ? 'jupyter' : _ref$type;
|
|
|
var params = (0,_umi_production_exports.useParams)();
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,_react_17_0_2_react.useState)({}),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
formValue = _useState2[0],
|
|
|
setFormValue = _useState2[1];
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
btnLoading = _useState4[0],
|
|
|
setBtnLoading = _useState4[1];
|
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
|
activeKey = _useState6[0],
|
|
|
setActiveKey = _useState6[1];
|
|
|
var _useState7 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
|
testSetList = _useState8[0],
|
|
|
setTestSetList = _useState8[1];
|
|
|
var _useState9 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState10 = slicedToArray_default()(_useState9, 2),
|
|
|
tagsList = _useState10[0],
|
|
|
setTagsList = _useState10[1];
|
|
|
var _useState11 = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState12 = slicedToArray_default()(_useState11, 2),
|
|
|
list = _useState12[0],
|
|
|
setList = _useState12[1]; //评测脚本下拉
|
|
|
var editable = (_userInfo = (0,authority/* userInfo */.eY)()) === null || _userInfo === void 0 || (_userInfo = _userInfo.shixun) === null || _userInfo === void 0 ? void 0 : _userInfo.editable;
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (active === 'testCase') {
|
|
|
getData();
|
|
|
}
|
|
|
}, [active]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
getTags();
|
|
|
}, []);
|
|
|
var getData = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var testSetData, res, _res$data, _res$data2, _res$data3, _res$data4, _res$data5, _res$data6, _res$data7, _res$data8, _res$data9, _res$data10, _res$data11, _res$data12, _res$data13, initData;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
testSetData = [{
|
|
|
hidden: 0,
|
|
|
input: "",
|
|
|
output: "",
|
|
|
score: 100
|
|
|
}];
|
|
|
_context.next = 3;
|
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(params === null || params === void 0 ? void 0 : params.id, "/jupyter_evalute_setting.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
setList(res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.standard_scripts);
|
|
|
initData = {
|
|
|
open_evaluate: res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.open_evaluate,
|
|
|
exec_time: (res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.exec_time) || 3,
|
|
|
test_set_score: (res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.test_set_score) === null ? false : res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.test_set_score,
|
|
|
test_set_average: (res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.test_set_average) === null ? true : res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.test_set_average,
|
|
|
choice_standard_scripts: (res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.choice_standard_scripts) || null,
|
|
|
evaluate_script: (res === null || res === void 0 || (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.evaluate_script) || '',
|
|
|
evaluate_method: res === null || res === void 0 || (_res$data10 = res.data) === null || _res$data10 === void 0 ? void 0 : _res$data10.evaluate_method,
|
|
|
use_jupyter_result: res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.use_jupyter_result
|
|
|
};
|
|
|
form.setFieldsValue(initData);
|
|
|
setFormValue(initData);
|
|
|
setTestSetList(res !== null && res !== void 0 && (_res$data12 = res.data) !== null && _res$data12 !== void 0 && (_res$data12 = _res$data12.test_sets) !== null && _res$data12 !== void 0 && _res$data12.length ? res === null || res === void 0 || (_res$data13 = res.data) === null || _res$data13 === void 0 ? void 0 : _res$data13.test_sets : testSetData);
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function getData() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var getTags = /*#__PURE__*/function () {
|
|
|
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
|
var res, _res$data14;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
_context2.next = 2;
|
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(params === null || params === void 0 ? void 0 : params.id, "/get_jupyter_tags.json"), {
|
|
|
method: 'get'
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context2.sent;
|
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
|
setTagsList((res === null || res === void 0 || (_res$data14 = res.data) === null || _res$data14 === void 0 ? void 0 : _res$data14.list) || []);
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return function getTags() {
|
|
|
return _ref3.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleOk = /*#__PURE__*/function () {
|
|
|
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3(values) {
|
|
|
var scoreList, sumScore, res;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
scoreList = testSetList.map(function (item) {
|
|
|
return item.score;
|
|
|
});
|
|
|
sumScore = scoreList.reduce(function (current, next) {
|
|
|
return current + next;
|
|
|
}, 0);
|
|
|
if (!(values.test_set_score && sumScore !== 100)) {
|
|
|
_context3.next = 5;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('测试用例的评分占比之和必须等于100');
|
|
|
return _context3.abrupt("return");
|
|
|
case 5:
|
|
|
if (!(values.evaluate_method === 3 && testSetList !== null && testSetList !== void 0 && testSetList.some(function (e) {
|
|
|
return !e.tags;
|
|
|
}))) {
|
|
|
_context3.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
message/* default */.ZP.warning('请选择指定代码块');
|
|
|
return _context3.abrupt("return");
|
|
|
case 8:
|
|
|
setBtnLoading(true);
|
|
|
_context3.next = 11;
|
|
|
return (0,fetch/* default */.ZP)("/api/shixuns/".concat(params === null || params === void 0 ? void 0 : params.id, "/update_jupyter_evaluate_setting.json"), {
|
|
|
method: 'post',
|
|
|
body: objectSpread2_default()(objectSpread2_default()({}, values), {}, {
|
|
|
mirror_script_id: values === null || values === void 0 ? void 0 : values.choice_standard_scripts,
|
|
|
open_evaluate: values !== null && values !== void 0 && values.open_evaluate ? 1 : 0,
|
|
|
test_set: testSetList.map(function (e) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, e), {}, {
|
|
|
is_file: false
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
case 11:
|
|
|
res = _context3.sent;
|
|
|
if (res.status === 0) {
|
|
|
message/* default */.ZP.success('保存成功');
|
|
|
}
|
|
|
setBtnLoading(false);
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return function handleOk(_x) {
|
|
|
return _ref4.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var handleValuesChange = function handleValuesChange(changedValues) {
|
|
|
setFormValue(objectSpread2_default()({}, form.getFieldsValue()));
|
|
|
if ('test_set_average' in changedValues && changedValues !== null && changedValues !== void 0 && changedValues.test_set_average) {
|
|
|
handleShareRatio(testSetList);
|
|
|
}
|
|
|
if ('test_set_score' in changedValues && changedValues !== null && changedValues !== void 0 && changedValues.test_set_score) {
|
|
|
form.setFieldsValue({
|
|
|
test_set_average: true
|
|
|
});
|
|
|
setFormValue(objectSpread2_default()(objectSpread2_default()({}, form.getFieldsValue()), {}, {
|
|
|
test_set_average: true
|
|
|
}));
|
|
|
handleShareRatio(testSetList);
|
|
|
}
|
|
|
if ('choice_standard_scripts' in changedValues) {
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
title: '提示',
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "tc font16",
|
|
|
children: ["\u539F\u6709\u811A\u672C\u5C06\u88AB\u65B0\u7684\u811A\u672C\u8986\u76D6\uFF0C\u65E0\u6CD5\u64A4\u9500", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u662F\u5426\u786E\u8BA4\u6267\u884C\u8986\u76D6\u64CD\u4F5C"]
|
|
|
}),
|
|
|
onOk: function () {
|
|
|
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4() {
|
|
|
var res;
|
|
|
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/".concat(params === null || params === void 0 ? void 0 : params.id, "/get_script_contents.json"), {
|
|
|
method: 'get',
|
|
|
params: {
|
|
|
id: params === null || params === void 0 ? void 0 : params.id,
|
|
|
script_id: changedValues === null || changedValues === void 0 ? void 0 : changedValues.choice_standard_scripts
|
|
|
}
|
|
|
});
|
|
|
case 2:
|
|
|
res = _context4.sent;
|
|
|
if (res !== null && res !== void 0 && res.content) {
|
|
|
modal/* default */.Z.info({
|
|
|
centered: true,
|
|
|
title: '提示',
|
|
|
okText: '知道啦',
|
|
|
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "tc font16",
|
|
|
children: "\u8BC4\u6D4B\u811A\u672C\u751F\u6210\u6210\u529F\uFF01"
|
|
|
})
|
|
|
});
|
|
|
form.setFieldsValue({
|
|
|
evaluate_script: res === null || res === void 0 ? void 0 : res.content
|
|
|
});
|
|
|
setFormValue(objectSpread2_default()(objectSpread2_default()({}, form.getFieldsValue()), {}, {
|
|
|
evaluate_script: res === null || res === void 0 ? void 0 : res.content
|
|
|
}));
|
|
|
}
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context4.stop();
|
|
|
}
|
|
|
}, _callee4);
|
|
|
}));
|
|
|
function onOk() {
|
|
|
return _onOk.apply(this, arguments);
|
|
|
}
|
|
|
return onOk;
|
|
|
}()
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var handleShareRatio = function handleShareRatio(testSetData) {
|
|
|
var code_compile_score = 0;
|
|
|
var score = Math.floor((100 - code_compile_score) / testSetData.length);
|
|
|
var lastScore = score + (100 - code_compile_score) % testSetData.length;
|
|
|
testSetData = testSetData.map(function (item, index) {
|
|
|
if (index === testSetData.length - 1) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
score: lastScore
|
|
|
});
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, item), {}, {
|
|
|
score: score
|
|
|
});
|
|
|
});
|
|
|
setTestSetList(testSetData);
|
|
|
};
|
|
|
var handleAddTestSet = function handleAddTestSet() {
|
|
|
var testSetData = [].concat(toConsumableArray_default()(testSetList), [{
|
|
|
hidden: 0,
|
|
|
input: "",
|
|
|
output: "",
|
|
|
score: 0
|
|
|
}]);
|
|
|
if (form.getFieldValue('test_set_average')) {
|
|
|
handleShareRatio(testSetData);
|
|
|
} else {
|
|
|
setTestSetList(testSetData);
|
|
|
}
|
|
|
};
|
|
|
var test_set_score = formValue.test_set_score,
|
|
|
test_set_average = formValue.test_set_average,
|
|
|
choice_standard_scripts = formValue.choice_standard_scripts,
|
|
|
open_evaluate = formValue.open_evaluate;
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
|
|
|
className: TestCasemodules.wrap,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
form: form,
|
|
|
disabled: !open_evaluate,
|
|
|
layout: "vertical",
|
|
|
onValuesChange: handleValuesChange,
|
|
|
onFinish: handleOk,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "open_evaluate",
|
|
|
style: {
|
|
|
marginTop: 10
|
|
|
},
|
|
|
valuePropName: "checked",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
disabled: false,
|
|
|
children: "\u542F\u7528Jupyter\u8BC4\u6D4B\u529F\u80FD"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("h4", {
|
|
|
className: "font14",
|
|
|
children: "\u8BC4\u6D4B\u65F6\u957F\u9650\u5236"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: '评测时长(秒):',
|
|
|
name: "exec_time",
|
|
|
className: TestCasemodules.row,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入评测时长限制'
|
|
|
}, {
|
|
|
type: 'number',
|
|
|
min: 3,
|
|
|
message: '最小限制时间是3秒'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {
|
|
|
size: "large",
|
|
|
style: {
|
|
|
width: 400
|
|
|
},
|
|
|
min: 3
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("h4", {
|
|
|
className: "font14 mb10",
|
|
|
children: "\u7CFB\u7EDF\u8BC4\u5206\u89C4\u5219"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "test_set_score",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(space/* default */.Z, {
|
|
|
direction: "vertical",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
value: false,
|
|
|
children: ["\u901A\u8FC7\u5168\u90E8\u6D4B\u8BD5\u96C6", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: " \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u4EC5\u5F53\u6240\u6709\u6D4B\u8BD5\u96C6\u90FD\u6B63\u786E\u65F6\uFF0C\u624D\u83B7\u5F97\u4E00\u6B21\u6027\u5956\u52B1\uFF09"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
value: true,
|
|
|
children: ["\u901A\u8FC7\u90E8\u5206\u6D4B\u8BD5\u96C6", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: " \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u901A\u8FC7\u6D4B\u8BD5\u96C6\u5373\u53EF\u83B7\u5F97\u5BF9\u5E94\u5956\u52B1\uFF09"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
label: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
fontWeight: 500
|
|
|
},
|
|
|
className: "c-black",
|
|
|
children: "\u8BC4\u6D4B\u8BBE\u7F6E"
|
|
|
}),
|
|
|
name: "evaluate_method",
|
|
|
style: {
|
|
|
flexDirection: 'row',
|
|
|
marginTop: 15
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择评测设置'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(space/* default */.Z, {
|
|
|
direction: "vertical",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
value: 1,
|
|
|
children: ["\u901A\u8FC7\u6240\u6709\u4EE3\u7801\u5757\u8BC4\u6D4B", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: " \uFF08\u5BF9\u5B66\u5458\u4EFB\u52A1\u6587\u4EF6\u7684\u6240\u6709\u975E\u7A7A\u4EE3\u7801\u5757\u8FDB\u884C\u8BC4\u6D4B\uFF09"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
|
|
|
value: 3,
|
|
|
children: ["\u901A\u8FC7\u6307\u5B9A\u4EE3\u7801\u5757\u8BC4\u6D4B", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "c-grey-999",
|
|
|
children: " \uFF08\u5BF9\u5B66\u5458\u4EFB\u52A1\u6587\u4EF6\u7684\u6307\u5B9A\u975E\u7A7A\u4EE3\u7801\u5757\u8FDB\u884C\u8BC4\u6D4B\uFF09"
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
justify: "space-between",
|
|
|
className: "font14",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
fontWeight: 500
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: TestCasemodules.sub,
|
|
|
children: "*"
|
|
|
}), "\u6D4B\u8BD5\u7528\u4F8B"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
|
style: {
|
|
|
borderRadius: 2
|
|
|
},
|
|
|
onClick: handleAddTestSet,
|
|
|
children: "\u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B"
|
|
|
})
|
|
|
})]
|
|
|
}), test_set_score && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "test_set_average",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default.Group */.ZP.Group, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: true,
|
|
|
children: "\u5747\u5206\u6BD4\u4F8B"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
|
|
|
value: false,
|
|
|
style: {
|
|
|
marginLeft: 50
|
|
|
},
|
|
|
children: "\u81EA\u5B9A\u4E49\u6BD4\u4F8B"
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: testSetList.map(function (item, key) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(collapse/* default */.Z
|
|
|
// collapsible='icon'
|
|
|
, {
|
|
|
activeKey: activeKey,
|
|
|
onChange: function onChange() {
|
|
|
setActiveKey(function (p) {
|
|
|
return p === key ? null : key;
|
|
|
});
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Panel, {
|
|
|
header: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "font16",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "mr10",
|
|
|
children: ["\u6D4B\u8BD5\u7528\u4F8B", key + 1]
|
|
|
}), formValue.test_set_score && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
style: {
|
|
|
marginLeft: 40
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: {
|
|
|
width: 120
|
|
|
},
|
|
|
value: item.score,
|
|
|
onClick: function onClick(e) {
|
|
|
return e.stopPropagation();
|
|
|
},
|
|
|
type: "number",
|
|
|
disabled: test_set_average,
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
score: e.target.value ? Number(e.target.value) : 0
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
var data = {
|
|
|
test_set_average: false
|
|
|
};
|
|
|
setFormValue(objectSpread2_default()(objectSpread2_default()({}, formValue), data));
|
|
|
form.setFieldsValue(data);
|
|
|
setTestSetList(testData);
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "ml10 mr10",
|
|
|
children: "%"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "tr flex1",
|
|
|
style: {
|
|
|
"float": 'right'
|
|
|
},
|
|
|
children: key !== 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
placement: "bottom",
|
|
|
title: "删除",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
style: {
|
|
|
color: '#c5c5c5'
|
|
|
},
|
|
|
className: "current iconfont icon-shanchu4",
|
|
|
onClick: function onClick(e) {
|
|
|
e.stopPropagation();
|
|
|
modal/* default */.Z.confirm({
|
|
|
centered: true,
|
|
|
icon: null,
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
title: '提示',
|
|
|
content: '确认要删除这个测试用例吗?',
|
|
|
onOk: function onOk() {
|
|
|
var testData = testSetList.filter(function (_, testIndex) {
|
|
|
return testIndex !== key;
|
|
|
});
|
|
|
handleShareRatio(testData);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
})]
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [formValue.evaluate_method === 3 && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
className: "mb20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: TestCasemodules.sub,
|
|
|
children: "*"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u6307\u5B9A\u4EE3\u7801\u5757"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: "\u8BF7\u5148\u5728Jupyter\u4E2D\u5BF9\u60A8\u9700\u8981\u8BC4\u6D4B\u7684\u6307\u5B9A\u4EE3\u7801\u5757\u5B8C\u6210\u6807\u7B7E\u8BBE\u7F6E\u3002",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
marginLeft: 6,
|
|
|
marginRight: 20,
|
|
|
color: '#145DFF'
|
|
|
},
|
|
|
className: "iconfont icon-xiaowenhao2 font14"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
|
|
|
value: item.tags,
|
|
|
size: "large",
|
|
|
style: {
|
|
|
width: 450
|
|
|
},
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
tags: e
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
},
|
|
|
children: tagsList === null || tagsList === void 0 ? void 0 : tagsList.map(function (e) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: e === null || e === void 0 ? void 0 : e.tags,
|
|
|
children: e === null || e === void 0 ? void 0 : e.tags
|
|
|
}, e === null || e === void 0 ? void 0 : e.tags);
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [" ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u9884\u671F\u8F93\u51FA"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
|
|
|
bordered: false,
|
|
|
className: TestCasemodules.textarea,
|
|
|
rows: 5,
|
|
|
placeholder: "\u9884\u671F\u8F93\u51FA",
|
|
|
value: item.output,
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
output: e.target.value
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
}
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mt20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
children: "\u53EF\u89C1\u6027"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u5168\u90E8\u9690\u85CF\uFF1A\u9690\u85CF\u6D4B\u8BD5\u96C6\u53EF\u4EE5\u9632\u6B62\u5B66\u751F\u901A\u8FC7\"print\"\u7B49\u624B\u6BB5\u76F4\u63A5\u901A\u5173"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u9690\u85CF\u9884\u671F\u8F93\u51FA\uFF1A\u52FE\u9009\u540E\u9884\u671F\u8F93\u51FA\u5BF9\u5B66\u5458\u59CB\u7EC8\u4E0D\u53EF\u89C1"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: "\u9690\u85CF\u5B9E\u9645\u8F93\u51FA\uFF1A\u52FE\u9009\u540E\u5B9E\u9645\u8F93\u51FA\u5BF9\u5B66\u5458\u59CB\u7EC8\u4E0D\u53EF\u89C1"
|
|
|
})]
|
|
|
}),
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
|
|
|
style: {
|
|
|
marginLeft: 6,
|
|
|
marginRight: 13,
|
|
|
color: '#145DFF'
|
|
|
},
|
|
|
className: "iconfont icon-xiaowenhao2 font14"
|
|
|
})
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
className: "font14 ml5",
|
|
|
checked: item.hidden === 1,
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
var param = {
|
|
|
is_invisible: false,
|
|
|
actual_output_visible: false
|
|
|
};
|
|
|
if (e.target.checked) {
|
|
|
param = {
|
|
|
is_invisible: true,
|
|
|
actual_output_visible: true
|
|
|
};
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, test), param), {}, {
|
|
|
hidden: e.target.checked ? 1 : 0
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
},
|
|
|
children: "\u5168\u90E8\u9690\u85CF"
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: item.is_invisible,
|
|
|
style: {
|
|
|
margin: '0 60px'
|
|
|
},
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
var hidden = 0;
|
|
|
if (e.target.checked && test.actual_output_visible) {
|
|
|
hidden = 1;
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
hidden: hidden,
|
|
|
is_invisible: e.target.checked
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
},
|
|
|
children: "\u9690\u85CF\u9884\u671F\u8F93\u51FA"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: item.actual_output_visible,
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
var hidden = 0;
|
|
|
if (e.target.checked && test.is_invisible) {
|
|
|
hidden = 1;
|
|
|
}
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
hidden: hidden,
|
|
|
actual_output_visible: e.target.checked
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
},
|
|
|
children: "\u9690\u85CF\u5B9E\u9645\u8F93\u51FA"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
className: "mt20",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font14 mr20",
|
|
|
children: "\u7279\u6B8A\u5224\u5B9A:"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
checked: item.last_match_rule,
|
|
|
onChange: function onChange(e) {
|
|
|
var testData = testSetList.map(function (test, testIndex) {
|
|
|
if (testIndex === key) {
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, test), {}, {
|
|
|
last_match_rule: e.target.checked
|
|
|
});
|
|
|
}
|
|
|
return test;
|
|
|
});
|
|
|
setTestSetList(testData);
|
|
|
},
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
|
className: "font14",
|
|
|
children: ["\u672B\u5C3E\u5339\u914D", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: "font12 c-light-black",
|
|
|
children: "\uFF08\u5B9E\u9645\u8F93\u51FA\u4E0E\u9884\u671F\u8F93\u51FA\u6700\u540E\u4E00\u884C\u76F8\u540C\u5373\u53EF\u901A\u5173\uFF09"
|
|
|
})]
|
|
|
})
|
|
|
})]
|
|
|
})]
|
|
|
})
|
|
|
}, key)
|
|
|
}, key);
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("h4", {
|
|
|
className: "font14 mt20 mb10",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
|
className: TestCasemodules.sub,
|
|
|
children: "*"
|
|
|
}), "\u8BC4\u6D4B\u811A\u672C"]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "choice_standard_scripts",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择评测脚本'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"], {
|
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
|
return trigger.parentNode;
|
|
|
},
|
|
|
size: "large",
|
|
|
style: {
|
|
|
width: 400
|
|
|
},
|
|
|
placeholder: "\u8BF7\u9009\u62E9\u8BC4\u6D4B\u811A\u672C",
|
|
|
children: list.map(function (item, index) {
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(es_select["default"].Option, {
|
|
|
value: item.id,
|
|
|
children: item.scptname
|
|
|
}, index);
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
|
title: !open_evaluate && "请启用Jupyter评测功能后,进行编辑",
|
|
|
placement: "topLeft",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "evaluate_script",
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
|
|
|
height: 450,
|
|
|
style: {
|
|
|
border: '1px solid #ccc'
|
|
|
},
|
|
|
language: "shell",
|
|
|
theme: "vs-light",
|
|
|
options: {
|
|
|
readOnly: !open_evaluate
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
}), (0,authority/* isSuperAdmins */.Ny)() && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
|
className: "mb20",
|
|
|
align: "middle",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "use_jupyter_result",
|
|
|
className: "mt10",
|
|
|
valuePropName: "checked",
|
|
|
noStyle: true,
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_switch/* default */.Z, {})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "ml10",
|
|
|
children: "\u662F\u5426\u6CBF\u7528Jupyter\u8FD0\u884C\u7ED3\u679C"
|
|
|
})]
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(FixedButton/* FixedButton */.t, {
|
|
|
okText: "\u4FDD\u5B58",
|
|
|
hasOkBtn: editable,
|
|
|
loading: btnLoading,
|
|
|
onCancel: function onCancel() {
|
|
|
return _umi_production_exports.history.push("/shixuns/".concat(params === null || params === void 0 ? void 0 : params.id, "/challenges"));
|
|
|
},
|
|
|
onOk: function onOk() {
|
|
|
return form.submit();
|
|
|
},
|
|
|
className: type === 'jupyterLab' ? TestCasemodules.btn : ''
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var components_TestCase = (TestCase);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 78038:
|
|
|
/*!***************************************************************************!*\
|
|
|
!*** ./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/_@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__(26789);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(73782);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
|
|
|
var modal = __webpack_require__(43418);
|
|
|
// 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/upload/index.js + 24 modules
|
|
|
var upload = __webpack_require__(59028);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
|
var es_button = __webpack_require__(3113);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(41681);
|
|
|
// 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@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["newShixuns", "globalSetting", "loading", "dispatch"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TextArea = input/* default */.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 */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useState = (0,_react_17_0_2_react.useState)([]),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
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 */.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 */.ZP.info('文件大小必须小于50MB');
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
var handleFinish = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(values) {
|
|
|
var _fileList$;
|
|
|
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 || (_fileList$ = fileList[0]) === null || _fileList$ === void 0 || (_fileList$ = _fileList$.response) === null || _fileList$ === void 0 ? void 0 : _fileList$.id
|
|
|
}
|
|
|
});
|
|
|
case 3:
|
|
|
res = _context2.sent;
|
|
|
dispatch({
|
|
|
type: 'newShixuns/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
if (res) {
|
|
|
message/* default */.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 */.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 */.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 */.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 */.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 */.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 */.Z.Item, {
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
className: "mr5",
|
|
|
size: 'middle',
|
|
|
onClick: function onClick() {
|
|
|
dispatch({
|
|
|
type: 'newShixuns/setActionTabs',
|
|
|
payload: {}
|
|
|
});
|
|
|
},
|
|
|
children: "\u53D6\u6D88"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
|
size: 'middle',
|
|
|
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));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 67813:
|
|
|
/*!**********************************************************************!*\
|
|
|
!*** ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx ***!
|
|
|
\**********************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
|
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! umi */ 26789);
|
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 43418);
|
|
|
/* harmony import */ var _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/assets/images/qrCode.png */ 55351);
|
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_1__.useState)(false),
|
|
|
_useState2 = _root_workspace_ppte5yg23_local_v9_test4_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default()(_useState, 2),
|
|
|
isCreateModel = _useState2[0],
|
|
|
setIsCreateModel = _useState2[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
|
|
if (newShixuns.actionTabs.key === 'Create-Environment') {
|
|
|
createImg();
|
|
|
}
|
|
|
}, [newShixuns === null || newShixuns === 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$userInfo4;
|
|
|
//判断 #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) {
|
|
|
var _user$userInfo3;
|
|
|
umi__WEBPACK_IMPORTED_MODULE_2__.history.push("/users/".concat((_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.login, "/experiment-img/add"));
|
|
|
} else if (((_user$userInfo4 = user.userInfo) === null || _user$userInfo4 === void 0 ? void 0 : _user$userInfo4.mirror_marker_status) === 2) {
|
|
|
antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.confirm({
|
|
|
title: '您今日已达到申请上限,是否跳转至云主机列表?',
|
|
|
content: '提示:每天最多允许申请一台云主机',
|
|
|
okText: '跳转',
|
|
|
cancelText: "取消",
|
|
|
onOk: function onOk() {
|
|
|
var _user$userInfo5;
|
|
|
umi__WEBPACK_IMPORTED_MODULE_2__.history.push("/users/".concat((_user$userInfo5 = user.userInfo) === null || _user$userInfo5 === void 0 ? void 0 : _user$userInfo5.login, "/experiment-img"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_5__/* ["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_4__.jsxs)("div", {
|
|
|
style: {
|
|
|
textAlign: 'center'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("br", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {
|
|
|
width: 120,
|
|
|
height: 120,
|
|
|
style: {
|
|
|
marginTop: '20px'
|
|
|
},
|
|
|
src: _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_3__,
|
|
|
alt: "\u4E8C\u7EF4\u7801"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("img", {})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_2__.connect)(function (_ref2) {
|
|
|
var newShixuns = _ref2.newShixuns,
|
|
|
user = _ref2.user,
|
|
|
globalSetting = _ref2.globalSetting;
|
|
|
return {
|
|
|
newShixuns: newShixuns,
|
|
|
globalSetting: globalSetting,
|
|
|
user: user
|
|
|
};
|
|
|
})(CreateEnvironment));
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |