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/9488.async.js

698 lines
33 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[9488],{
/***/ 88618:
/*!****************************************************************!*\
!*** ./src/components/SelectEnvironment/index.tsx + 1 modules ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_SelectEnvironment; }
});
// EXTERNAL MODULE: ./node_modules/_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/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(20008);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/empty/index.js + 3 modules
var empty = __webpack_require__(64165);
// 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);
;// CONCATENATED MODULE: ./src/components/SelectEnvironment/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var SelectEnvironmentmodules = ({"selectEnvironment":"selectEnvironment___LegvW","search":"search___ZMwsK","searchListWrap":"searchListWrap___iUv9S","searchList":"searchList___T1FBi","name":"name___t0Y2b","tag":"tag___ooWkq","searchListActive":"searchListActive___ahElk","spin":"spin___x2xMT","common":"common___ZhJvk","title":"title___p4_7m","tags":"tags___2fYZM","tagActive":"tagActive___tb54k","wrap":"wrap___I9ZtF","allList":"allList___h31KX","item":"item___PwiKQ","itemActive":"itemActive___JCEc6","line":"line___Qn6mz","apply":"apply___EhZKq","p1":"p1___LxfGu","p2":"p2___jiQhJ","list":"list___n7Ydz","items":"items___OB8qz","darklySelectEnvironment":"darklySelectEnvironment___K__cy"});
// EXTERNAL MODULE: ./src/assets/images/noEnvData.png
var noEnvData = __webpack_require__(36723);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(64841);
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
var lodash = __webpack_require__(89392);
;// CONCATENATED MODULE: ./src/components/SelectEnvironment/index.tsx
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const SelectEnvironment = ({
className,
dispatch,
skin = "white",
value = null,
loading = false,
data = [],
otherData = [],
tags = [],
onChange = () => {
},
onSearchWord = () => {
},
shixun_type,
extraContent,
tab_type,
is_create_mirror,
hiddenCreateOnline
}) => {
const [inputValue, setInputValue] = (0,_react_17_0_2_react.useState)("");
const [visible, setVisible] = (0,_react_17_0_2_react.useState)(false);
const [options, setOptions] = (0,_react_17_0_2_react.useState)([]);
const [listActiveIndex, setListActiveIndex] = (0,_react_17_0_2_react.useState)(0);
const timer = (0,_react_17_0_2_react.useRef)(null);
const quId = (0,_react_17_0_2_react.useRef)(String(Math.floor(Math.random() * 1e6))).current;
const inputRef = (0,_react_17_0_2_react.useRef)();
const timerSearch = (0,_react_17_0_2_react.useRef)(null);
const endCount = (0,_react_17_0_2_react.useRef)(0);
const optionsSave = (0,_react_17_0_2_react.useRef)([]);
(0,_react_17_0_2_react.useEffect)(() => {
window.addEventListener("keydown", handleKeyDown);
return () => {
window.removeEventListener("keydown", handleKeyDown);
};
}, [inputValue, visible, options]);
(0,_react_17_0_2_react.useEffect)(() => {
setOptions([]);
}, [tab_type]);
const handleKeyDown = (e) => {
if (!visible || e.keyCode !== 40 && e.keyCode !== 38) {
return;
}
let activeIndex = 0;
if (e.keyCode === 40 && visible) {
if (listActiveIndex < options.length - 1) {
activeIndex = listActiveIndex + 1;
} else {
activeIndex = 0;
}
console.log("\u4E0B");
searchFuc(activeIndex, "down");
}
if (e.keyCode === 38 && visible) {
if (listActiveIndex === 0) {
activeIndex = options.length - 1;
} else {
activeIndex = listActiveIndex - 1;
}
searchFuc(activeIndex, "up");
}
setListActiveIndex(activeIndex);
optionsInit(inputValue, activeIndex, true);
};
const heightLight = (string, keyword) => {
const regTrim = (s) => {
var imp = /[\^\.\\\|\(\)\*\+\-\$\[\]\?]/g;
var imp_c = {};
imp_c["^"] = "\\^";
imp_c["."] = "\\.";
imp_c["\\"] = "\\\\";
imp_c["|"] = "\\|";
imp_c["("] = "\\(";
imp_c[")"] = "\\)";
imp_c["*"] = "\\*";
imp_c["+"] = "\\+";
imp_c["-"] = "\\-";
imp_c["$"] = "$";
imp_c["["] = "\\[";
imp_c["]"] = "\\]";
imp_c["?"] = "\\?";
s = s.replace(imp, function(o) {
return imp_c[o];
});
return s;
};
var reg = new RegExp(regTrim(keyword), "gi");
string = string.replace(reg, function(txt) {
return "<span style='color:#0152d9;'>" + txt + "</span>";
});
return string;
};
const optionsInit = (searchText, activeList, move) => __async(void 0, null, function* () {
let count = endCount.current + 1;
endCount.current = count;
const listDom = (list) => {
const newItems = list == null ? void 0 : list.map((er, index) => {
const { id, name } = er;
const param = __spreadProps(__spreadValues({}, er), {
label: /* @__PURE__ */ _react_17_0_2_react.createElement(
"ul",
{
id: `search-${quId}-${index}`,
onClick: () => onSelect(id, param),
className: index === activeList ? SelectEnvironmentmodules.searchListActive : SelectEnvironmentmodules.searchList
},
/* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: SelectEnvironmentmodules.name, dangerouslySetInnerHTML: { __html: heightLight(name, searchText) } }),
er.private && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E" }, /* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: SelectEnvironmentmodules.tag, style: { color: "#FF9D18", border: "1px solid #FFCF8D", fontSize: 10 } }, "\u9650\u5B9A")),
er.is_base && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883" }, /* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: SelectEnvironmentmodules.tag, style: { color: "#165DFF", border: "1px solid #BACFFE", fontSize: 10 } }, "\u57FA\u7840"))
)
});
return param;
});
return newItems;
};
if (move) {
const newItems = listDom(optionsSave.current);
setOptions(newItems);
return;
}
clearTimeout(timerSearch.current);
timerSearch.current = setTimeout(() => __async(void 0, null, function* () {
var _a, _b;
const params = {
keywords: encodeURIComponent(searchText || ""),
page: 1,
limit: 1e5,
tab_type
};
shixun_type ? params["shixun_type"] = shixun_type : "";
const res = yield (0,fetch/* default */.ZP)(`/api/shixuns/search_image.json`, {
method: "get",
params: __spreadProps(__spreadValues({}, params), { is_create_mirror })
});
if ((res == null ? void 0 : res.status) === 0) {
const newItems = listDom(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.mirrors) || []);
if (count === endCount.current) {
setOptions(newItems);
optionsSave.current = (0,lodash.cloneDeep)(((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.mirrors) || []);
}
}
}), 300);
});
const scrollFuc = (id) => {
const itemDom = document.getElementById(`scroll-${quId}-${id}`);
if (!itemDom)
return;
const wrapDom = document.getElementById(`scroll-${quId}`);
wrapDom.scrollTo(0, itemDom.offsetTop);
};
const searchFuc = (index, direction) => {
const itemDom = document.getElementById(`search-${quId}-${index}`);
if (!itemDom)
return;
const wrapDom = document.getElementById(`search-${quId}`);
const isClient = itemDom.offsetTop - wrapDom.scrollTop > 0 && itemDom.offsetTop - wrapDom.scrollTop < wrapDom.clientHeight;
if (isClient)
return;
if (direction === "down") {
wrapDom.scrollTo(0, itemDom.offsetTop - wrapDom.clientHeight + itemDom.clientHeight);
} else {
wrapDom.scrollTo(0, itemDom.offsetTop);
}
};
const onSearch = (searchText) => {
optionsInit(searchText, 0);
};
const handlePressEnter = (v) => {
var _a;
if (!options.length)
return;
const realId = (_a = options == null ? void 0 : options[listActiveIndex]) == null ? void 0 : _a.id;
onChange(realId);
setOptions([]);
setListActiveIndex(0);
scrollFuc(realId);
inputRef.current.blur();
};
const onSelect = (id, option) => {
onChange(id);
setOptions([]);
setListActiveIndex(0);
scrollFuc(id);
};
const clear = () => {
setOptions([]);
setInputValue("");
onSearchWord("");
};
const activeClear = (id) => {
onChange(id);
setOptions([]);
};
const renderIcon = () => {
if (inputValue === "") {
return /* @__PURE__ */ _react_17_0_2_react.createElement("i", { style: { pointerEvents: "none" }, className: "iconfont icon-sousuo2 c-grey-c" });
}
return /* @__PURE__ */ _react_17_0_2_react.createElement("i", { onClick: (e) => {
e.stopPropagation();
clear();
}, className: "iconfont icon-shanchu4 c-grey-c" });
};
const handleApply = () => {
dispatch({
type: "newShixuns/setActionTabs",
payload: { key: "NewShixuns-Apply" }
});
};
const CreateImg = () => {
dispatch({
type: "newShixuns/setActionTabs",
payload: { key: "Create-Environment" }
});
};
const onBlur = () => {
timer.current = setTimeout(() => {
setVisible(false);
setListActiveIndex(0);
}, 200);
};
const isEmpty = !(data == null ? void 0 : data.length) && !(otherData == null ? void 0 : otherData.length);
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: _classnames_2_5_1_classnames_default()(skin === "night" ? SelectEnvironmentmodules.darklySelectEnvironment : SelectEnvironmentmodules.selectEnvironment, className) }, extraContent && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { style: { marginTop: 20, marginLeft: 20 } }, extraContent), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.search }, /* @__PURE__ */ _react_17_0_2_react.createElement(
input["default"],
{
suffix: renderIcon(),
bordered: false,
ref: inputRef,
value: inputValue,
onKeyDown: (e) => {
if (e.keyCode === 40 || e.keyCode === 38 || e.keyCode === 13) {
e.preventDefault();
}
},
size: "middle",
onFocus: () => {
clearTimeout(timer.current);
if (inputValue) {
onSearch(inputValue);
}
setVisible(true);
},
onBlur,
onChange: (e) => {
setInputValue(e.target.value);
if (e.target.value) {
onSearch(e.target.value);
}
onSearchWord(e.target.value);
},
placeholder: "\u641C\u7D22\u60A8\u9700\u8981\u7684\u5B9E\u9A8C\u73AF\u5883",
onPressEnter: handlePressEnter
}
), visible && /* @__PURE__ */ _react_17_0_2_react.createElement("div", { id: `search-${quId}`, className: SelectEnvironmentmodules.searchListWrap }, options.map((e, i) => /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, { key: i }, " ", e.label)))), loading ? /* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { className: SelectEnvironmentmodules.spin }) : /* @__PURE__ */ _react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, !!tags.length && /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: SelectEnvironmentmodules.common }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.title }, "\u63A8\u8350\u73AF\u5883:"), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: SelectEnvironmentmodules.tags }, tags.map((e, i) => /* @__PURE__ */ _react_17_0_2_react.createElement(
"li",
{
key: i,
onClick: () => activeClear(e.id),
className: value === e.id ? `${SelectEnvironmentmodules.tag} ${SelectEnvironmentmodules.tagActive}` : SelectEnvironmentmodules.tag
},
e.name
)))), isEmpty && /* @__PURE__ */ _react_17_0_2_react.createElement(empty/* default */.Z, { style: { margin: "60px 0" }, image: noEnvData, description: /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: "c-grey-999" }, "\u6682\u65E0\u5B9E\u9A8C\u73AF\u5883") }), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: SelectEnvironmentmodules.wrap, id: `scroll-${quId}` }, data.map((item, i) => {
var _a;
return !!((_a = item == null ? void 0 : item.image) == null ? void 0 : _a.length) ? /* @__PURE__ */ _react_17_0_2_react.createElement(List, { key: i, data: item, id: value, handleClick: (id) => activeClear(id) }) : null;
}), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: SelectEnvironmentmodules.allList }, otherData.map((item) => /* @__PURE__ */ _react_17_0_2_react.createElement(
"li",
{
key: `key-${item.id}`,
id: `scroll-${quId}-${item.id}`,
className: item.id === value ? `${SelectEnvironmentmodules.item} ${SelectEnvironmentmodules.itemActive}` : SelectEnvironmentmodules.item,
onClick: () => onChange(item.id)
},
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.name }, item.name),
item.private && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.tag, style: { color: "#FF9D18", border: "1px solid #FFCF8D", fontSize: 10 } }, "\u9650\u5B9A")),
item.is_base && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.tag, style: { color: "#165DFF", border: "1px solid #BACFFE", fontSize: 10 } }, "\u57FA\u7840"))
))))), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.apply }, /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: SelectEnvironmentmodules.p1 }, "\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F"), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: SelectEnvironmentmodules.p2, onClick: handleApply }, " \u7533\u8BF7\u65B0\u5EFA"), !hiddenCreateOnline && /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: SelectEnvironmentmodules.p2, onClick: CreateImg }, " \u5728\u7EBF\u521B\u5EFA")));
};
const List = ({
data,
id,
handleClick
}) => {
const [drop, setDrop] = (0,_react_17_0_2_react.useState)(true);
const { name, image } = data;
return /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.list }, /* @__PURE__ */ _react_17_0_2_react.createElement("header", { onClick: () => setDrop(!drop) }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.title }, name), /* @__PURE__ */ _react_17_0_2_react.createElement(
"i",
{
style: { transition: "0.5s", transform: drop ? "rotate(0deg)" : "rotate(180deg)" },
className: "iconfont icon-shangjiantou c-grey-999"
}
)), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: SelectEnvironmentmodules.items, style: { height: drop ? "auto" : 0 } }, image.map((item) => /* @__PURE__ */ _react_17_0_2_react.createElement(
"li",
{
key: item.id,
className: item.id === id ? `${SelectEnvironmentmodules.item} ${SelectEnvironmentmodules.itemActive}` : SelectEnvironmentmodules.item,
onClick: () => handleClick(item.id)
},
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.name }, item.name),
item.private && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.tag, style: { color: "#FF9D18", border: "1px solid #FFCF8D", fontSize: 10 } }, "\u9650\u5B9A")),
item.is_base && /* @__PURE__ */ _react_17_0_2_react.createElement(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883" }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: SelectEnvironmentmodules.tag, style: { color: "#165DFF", border: "1px solid #BACFFE", fontSize: 10 } }, "\u57FA\u7840"))
)), /* @__PURE__ */ _react_17_0_2_react.createElement("li", { className: SelectEnvironmentmodules.line })));
};
/* harmony default export */ var components_SelectEnvironment = (SelectEnvironment);
/***/ }),
/***/ 37103:
/*!***************************************************************************!*\
!*** ./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/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
var _umi_production_exports = __webpack_require__(23852);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(20008);
// 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__(73598);
// 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__(19351);
// 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"});
;// CONCATENATED MODULE: ./src/pages/Shixuns/New/components/ApplyModal/index.tsx
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const TextArea = input["default"].TextArea;
const ApplyModal = (_a) => {
var _b = _a, {
newShixuns,
globalSetting,
loading,
dispatch
} = _b, props = __objRest(_b, [
"newShixuns",
"globalSetting",
"loading",
"dispatch"
]);
const [form] = es_form["default"].useForm();
const [fileList, setFileList] = (0,_react_17_0_2_react.useState)([]);
const handleFileChange = (info) => {
const statusList = ["uploading", "done", "removed"];
if (statusList.includes(info.file.status)) {
setFileList(info.fileList);
}
};
const handleFileRemove = (file) => {
var _a2;
if (!file.percent || file.percent == 100) {
const id = (_a2 = file.response) == null ? void 0 : _a2.id;
modal["default"].confirm({
centered: true,
title: "\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A\u9644\u4EF6\u5417?",
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
onOk: () => __async(void 0, null, function* () {
const res = yield dispatch({
type: "newShixuns/deleteAttachment",
payload: { id }
});
res && setFileList(fileList.filter((item) => {
var _a3;
return ((_a3 = item.response) == null ? void 0 : _a3.id) !== id;
}));
})
});
return false;
}
};
const handleFileBeforeUpload = (file) => {
if (fileList.length) {
return false;
}
const is150M = file.size / 1024 / 1024 > 50;
if (is150M) {
message/* default */.ZP.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E50MB");
return false;
}
return true;
};
const handleFinish = (values) => __async(void 0, null, function* () {
var _a2, _b2;
const { language, env: runtime, mode: run_method, code } = values || {};
const res = yield dispatch({
type: "newShixuns/applyShixunMirror",
payload: {
language,
runtime,
run_method,
attachment_id: (_b2 = (_a2 = fileList == null ? void 0 : fileList[0]) == null ? void 0 : _a2.response) == null ? void 0 : _b2.id
}
});
dispatch({
type: "newShixuns/setActionTabs",
payload: {}
});
if (res) {
message/* default */.ZP.success("\u65B0\u5EFA\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u5BA1\u6838\u3002");
}
});
const handleAfterClose = () => {
form.resetFields();
setFileList([]);
};
return /* @__PURE__ */ _react_17_0_2_react.createElement(
modal["default"],
{
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
},
/* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: ApplyModalmodules.qrCode }, /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: ApplyModalmodules.a1 }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: ApplyModalmodules.code }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { width: 120, height: 120, src: qrCode, alt: "\u4E8C\u7EF4\u7801" })), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: ApplyModalmodules.group }, "\u5B9E\u9A8C\u73AF\u5883\u7533\u8BF7QQ\u7FA4"), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: ApplyModalmodules.groupNumber }, "\u7FA4\u53F7\uFF1A740157011")), /* @__PURE__ */ _react_17_0_2_react.createElement("aside", { className: ApplyModalmodules.a2 }, "\u5C0A\u656C\u7684\u8001\u5E08/\u540C\u5B66\u60A8\u597D\uFF0C", /* @__PURE__ */ _react_17_0_2_react.createElement("br", null), "\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__ */ _react_17_0_2_react.createElement(
es_form["default"],
{
className: ApplyModalmodules.formWrap,
form,
labelCol: { span: 4 },
wrapperCol: { span: 20 },
onFinish: handleFinish
},
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u8BED\u8A00\uFF1A", name: "language", rules: [{ required: true, message: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(TextArea, { placeholder: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48\u8BED\u8A00\uFF1A\u793A\u4F8B\uFF1APython", rows: 4 })),
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u7CFB\u7EDF\u73AF\u5883\uFF1A", name: "env", rules: [{ required: true, message: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00\u7CFB\u7EDF\u73AF\u5883" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(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__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F\uFF1A", name: "mode", rules: [{ required: true, message: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement(TextArea, { placeholder: "\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u4E2D\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F", rows: 4 })),
/* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, { label: "\u6D4B\u8BD5\u4EE3\u7801\uFF1A", name: "code", rules: [{ required: true, message: "\u8BF7\u4E0A\u4F20\u9644\u4EF6" }] }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: ApplyModalmodules.upload }, /* @__PURE__ */ _react_17_0_2_react.createElement(
upload["default"],
{
fileList,
action: `${env/* default */.Z.API_SERVER}/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a`,
onChange: handleFileChange,
onRemove: handleFileRemove,
beforeUpload: handleFileBeforeUpload,
withCredentials: true
},
/* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${ApplyModalmodules.color0152d9} current` }, "\u4E0A\u4F20\u9644\u4EF6"),
/* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: `${ApplyModalmodules.colorCCC} ml10` }, "(\u5355\u4E2A\u6587\u4EF650M\u4EE5\u5185)")
))),
/* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: ApplyModalmodules.footerWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(es_form["default"].Item, null, /* @__PURE__ */ _react_17_0_2_react.createElement(
es_button/* default */.ZP,
{
className: "mr5",
size: "middle",
onClick: () => {
dispatch({
type: "newShixuns/setActionTabs",
payload: {}
});
}
},
"\u53D6\u6D88"
), /* @__PURE__ */ _react_17_0_2_react.createElement(es_button/* default */.ZP, { size: "middle", type: "primary", htmlType: "submit", loading: loading["newShixuns/applyShixunMirror"] }, "\u4FDD\u5B58")))
)
);
};
/* harmony default export */ var components_ApplyModal = ((0,_umi_production_exports.connect)(
({
newShixuns,
loading,
globalSetting
}) => ({
newShixuns,
globalSetting,
loading: loading.effects
})
)(ApplyModal));
/***/ }),
/***/ 24257:
/*!**********************************************************************!*\
!*** ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx ***!
\**********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! umi */ 23852);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd */ 43418);
/* harmony import */ var _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/assets/images/qrCode.png */ 55351);
const CreateEnvironment = ({
newShixuns,
dispatch,
user
}) => {
var _a;
const [isCreateModel, setIsCreateModel] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (newShixuns.actionTabs.key === "Create-Environment") {
createImg();
}
}, [(_a = newShixuns == null ? void 0 : newShixuns.actionTabs) == null ? void 0 : _a.key]);
const cancelImg = () => {
dispatch({
type: "newShixuns/setActionTabs",
payload: {}
});
};
const createImg = () => {
var _a2, _b, _c, _d;
cancelImg();
if (((_a2 = user.userInfo) == null ? void 0 : _a2.mirror_marker_status) === 0) {
setIsCreateModel(true);
} else if (((_b = user.userInfo) == null ? void 0 : _b.mirror_marker_status) === 1) {
umi__WEBPACK_IMPORTED_MODULE_1__.history.push(`/users/${(_c = user.userInfo) == null ? void 0 : _c.login}/experiment-img/add`);
} else if (((_d = user.userInfo) == null ? void 0 : _d.mirror_marker_status) === 2) {
antd__WEBPACK_IMPORTED_MODULE_3__["default"].confirm({
title: "\u60A8\u4ECA\u65E5\u5DF2\u8FBE\u5230\u7533\u8BF7\u4E0A\u9650\uFF0C\u662F\u5426\u8DF3\u8F6C\u81F3\u4E91\u4E3B\u673A\u5217\u8868\uFF1F",
content: "\u63D0\u793A\uFF1A\u6BCF\u5929\u6700\u591A\u5141\u8BB8\u7533\u8BF7\u4E00\u53F0\u4E91\u4E3B\u673A",
okText: "\u8DF3\u8F6C",
cancelText: "\u53D6\u6D88",
onOk() {
var _a3;
umi__WEBPACK_IMPORTED_MODULE_1__.history.push(`/users/${(_a3 = user.userInfo) == null ? void 0 : _a3.login}/experiment-img`);
}
});
}
};
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(
antd__WEBPACK_IMPORTED_MODULE_3__["default"],
{
title: "\u52A0\u5165qq\u7FA4\u63D0\u793A",
open: isCreateModel,
footer: null,
onCancel: () => {
setIsCreateModel(false);
}
},
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("br", null), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", { width: 120, height: 120, style: { marginTop: "20px" }, src: _assets_images_qrCode_png__WEBPACK_IMPORTED_MODULE_2__, alt: "\u4E8C\u7EF4\u7801" })),
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", null)
);
};
/* harmony default export */ __webpack_exports__.Z = ((0,umi__WEBPACK_IMPORTED_MODULE_1__.connect)(
({
newShixuns,
user,
globalSetting
}) => ({
newShixuns,
globalSetting,
user
})
)(CreateEnvironment));
/***/ })
}]);