"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([[33959],{ /***/ 71850: /*!****************************************************************!*\ !*** ./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/_@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/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/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: ./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__(10249); // 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__(74973); // 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__(87281); // EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js var lodash = __webpack_require__(89392); // EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js var jsx_runtime = __webpack_require__(37712); ;// CONCATENATED MODULE: ./src/components/SelectEnvironment/index.tsx var SelectEnvironment = function SelectEnvironment(_ref) { var className = _ref.className, dispatch = _ref.dispatch, _ref$skin = _ref.skin, skin = _ref$skin === void 0 ? 'white' : _ref$skin, _ref$value = _ref.value, value = _ref$value === void 0 ? null : _ref$value, _ref$loading = _ref.loading, loading = _ref$loading === void 0 ? false : _ref$loading, _ref$data = _ref.data, data = _ref$data === void 0 ? [] : _ref$data, _ref$otherData = _ref.otherData, otherData = _ref$otherData === void 0 ? [] : _ref$otherData, _ref$tags = _ref.tags, tags = _ref$tags === void 0 ? [] : _ref$tags, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange, _ref$onSearchWord = _ref.onSearchWord, onSearchWord = _ref$onSearchWord === void 0 ? function () {} : _ref$onSearchWord, shixun_type = _ref.shixun_type, extraContent = _ref.extraContent, tab_type = _ref.tab_type, is_create_mirror = _ref.is_create_mirror, hiddenCreateOnline = _ref.hiddenCreateOnline; var _useState = (0,_react_17_0_2_react.useState)(''), _useState2 = slicedToArray_default()(_useState, 2), inputValue = _useState2[0], setInputValue = _useState2[1]; var _useState3 = (0,_react_17_0_2_react.useState)(false), _useState4 = slicedToArray_default()(_useState3, 2), visible = _useState4[0], setVisible = _useState4[1]; var _useState5 = (0,_react_17_0_2_react.useState)([]), _useState6 = slicedToArray_default()(_useState5, 2), options = _useState6[0], setOptions = _useState6[1]; var _useState7 = (0,_react_17_0_2_react.useState)(0), _useState8 = slicedToArray_default()(_useState7, 2), listActiveIndex = _useState8[0], setListActiveIndex = _useState8[1]; var timer = (0,_react_17_0_2_react.useRef)(null); var quId = (0,_react_17_0_2_react.useRef)(String(Math.floor(Math.random() * 1000000))).current; var inputRef = (0,_react_17_0_2_react.useRef)(); var timerSearch = (0,_react_17_0_2_react.useRef)(null); var endCount = (0,_react_17_0_2_react.useRef)(0); var optionsSave = (0,_react_17_0_2_react.useRef)([]); (0,_react_17_0_2_react.useEffect)(function () { window.addEventListener('keydown', handleKeyDown); return function () { window.removeEventListener('keydown', handleKeyDown); }; }, [inputValue, visible, options]); (0,_react_17_0_2_react.useEffect)(function () { setOptions([]); }, [tab_type]); var handleKeyDown = function handleKeyDown(e) { if (!visible || e.keyCode !== 40 && e.keyCode !== 38) { return; } var activeIndex = 0; if (e.keyCode === 40 && visible) { if (listActiveIndex < options.length - 1) { activeIndex = listActiveIndex + 1; } else { activeIndex = 0; } console.log('下'); searchFuc(activeIndex, 'down'); } if (e.keyCode === 38 && visible) { if (listActiveIndex === 0) { activeIndex = options.length - 1; } else { activeIndex = listActiveIndex - 1; } searchFuc(activeIndex, 'up'); } setListActiveIndex(activeIndex); optionsInit(inputValue, activeIndex, true); }; //高亮字符串 string: 需要处理的字符串,keyword:键盘输入的内容 var heightLight = function heightLight(string, keyword) { var regTrim = function regTrim(s) { var imp = /[\^\.\\\|\(\)\*\+\-\$\[\]\?]/g; var imp_c = {}; imp_c["^"] = "\\^"; imp_c["."] = "\\."; imp_c["\\"] = "\\\\"; imp_c["|"] = "\\|"; imp_c["("] = "\\("; imp_c[")"] = "\\)"; imp_c["*"] = "\\*"; imp_c["+"] = "\\+"; imp_c["-"] = "\\-"; imp_c["$"] = "\$"; imp_c["["] = "\\["; imp_c["]"] = "\\]"; imp_c["?"] = "\\?"; s = s.replace(imp, function (o) { return imp_c[o]; }); return s; }; var reg = new RegExp(regTrim(keyword), "gi"); string = string.replace(reg, function (txt) { return "" + txt + ""; }); return string; }; var optionsInit = /*#__PURE__*/function () { var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(searchText, activeList, move) { var count, listDom, newItems; return regeneratorRuntime_default()().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: count = endCount.current + 1; endCount.current = count; listDom = function listDom(list) { var newItems = list === null || list === void 0 ? void 0 : list.map(function (er, index) { var id = er.id, name = er.name; var param = objectSpread2_default()(objectSpread2_default()({}, er), {}, { label: /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", { id: "search-".concat(quId, "-").concat(index), onClick: function onClick() { return onSelect(id, param); }, className: index === activeList ? SelectEnvironmentmodules.searchListActive : SelectEnvironmentmodules.searchList, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", { className: SelectEnvironmentmodules.name, dangerouslySetInnerHTML: { __html: heightLight(name, searchText) } }), er["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E", children: /*#__PURE__*/(0,jsx_runtime.jsx)("li", { className: SelectEnvironmentmodules.tag, style: { color: '#FF9D18', border: '1px solid #FFCF8D', fontSize: 10 }, children: "\u9650\u5B9A" }) }), er.is_base && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883", children: /*#__PURE__*/(0,jsx_runtime.jsx)("li", { className: SelectEnvironmentmodules.tag, style: { color: '#165DFF', border: '1px solid #BACFFE', fontSize: 10 }, children: "\u57FA\u7840" }) })] }) }); return param; }); return newItems; }; if (!move) { _context2.next = 7; break; } newItems = listDom(optionsSave.current); setOptions(newItems); return _context2.abrupt("return"); case 7: clearTimeout(timerSearch.current); timerSearch.current = setTimeout( /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() { var params, res, _res$data, _newItems, _res$data2; return regeneratorRuntime_default()().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: params = { keywords: encodeURIComponent(searchText || ''), page: 1, limit: 100000, tab_type: tab_type }; shixun_type ? params["shixun_type"] = shixun_type : ""; _context.next = 4; return (0,fetch/* default */.ZP)("/api/shixuns/search_image.json", { method: 'get', params: objectSpread2_default()(objectSpread2_default()({}, params), {}, { is_create_mirror: is_create_mirror }) }); case 4: res = _context.sent; if ((res === null || res === void 0 ? void 0 : res.status) === 0) { _newItems = listDom((res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.mirrors) || []); if (count === endCount.current) { setOptions(_newItems); optionsSave.current = (0,lodash.cloneDeep)((res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.mirrors) || []); } } case 6: case "end": return _context.stop(); } }, _callee); })), 300); case 9: case "end": return _context2.stop(); } }, _callee2); })); return function optionsInit(_x, _x2, _x3) { return _ref2.apply(this, arguments); }; }(); var scrollFuc = function scrollFuc(id) { var itemDom = document.getElementById("scroll-".concat(quId, "-").concat(id)); if (!itemDom) return; var wrapDom = document.getElementById("scroll-".concat(quId)); wrapDom.scrollTo(0, itemDom.offsetTop); }; var searchFuc = function searchFuc(index, direction) { var itemDom = document.getElementById("search-".concat(quId, "-").concat(index)); if (!itemDom) return; var wrapDom = document.getElementById("search-".concat(quId)); var isClient = itemDom.offsetTop - wrapDom.scrollTop > 0 && itemDom.offsetTop - wrapDom.scrollTop < wrapDom.clientHeight; //判断在盒子内 if (isClient) return; //在盒子内不滚动 if (direction === 'down') { wrapDom.scrollTo(0, itemDom.offsetTop - wrapDom.clientHeight + itemDom.clientHeight); } else { wrapDom.scrollTo(0, itemDom.offsetTop); } }; var onSearch = function onSearch(searchText) { optionsInit(searchText, 0); }; var handlePressEnter = function handlePressEnter(v) { var _options$listActiveIn; if (!options.length) return; var realId = options === null || options === void 0 || (_options$listActiveIn = options[listActiveIndex]) === null || _options$listActiveIn === void 0 ? void 0 : _options$listActiveIn.id; onChange(realId); setOptions([]); setListActiveIndex(0); // setInputValue(options?.[listActiveIndex]?.name) scrollFuc(realId); inputRef.current.blur(); }; var onSelect = function onSelect(id, option) { onChange(id); setOptions([]); setListActiveIndex(0); // setInputValue(option?.name) scrollFuc(id); }; var clear = function clear() { setOptions([]); setInputValue(""); onSearchWord(''); }; var activeClear = function activeClear(id) { onChange(id); setOptions([]); // setInputValue('') }; var renderIcon = function renderIcon() { if (inputValue === '') { return /*#__PURE__*/(0,jsx_runtime.jsx)("i", { style: { pointerEvents: 'none' }, className: "iconfont icon-sousuo2 c-grey-c" }); } return /*#__PURE__*/(0,jsx_runtime.jsx)("i", { onClick: function onClick(e) { e.stopPropagation(); clear(); }, className: "iconfont icon-shanchu4 c-grey-c" }); }; var handleApply = function handleApply() { dispatch({ type: 'newShixuns/setActionTabs', payload: { key: 'NewShixuns-Apply' } }); }; var CreateImg = function CreateImg() { dispatch({ type: 'newShixuns/setActionTabs', payload: { key: 'Create-Environment' } }); }; var onBlur = function onBlur() { timer.current = setTimeout(function () { setVisible(false); setListActiveIndex(0); }, 200); //blur阻止了select事件 }; var isEmpty = !(data !== null && data !== void 0 && data.length) && !(otherData !== null && otherData !== void 0 && otherData.length); return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", { className: _classnames_2_5_1_classnames_default()(skin === 'night' ? SelectEnvironmentmodules.darklySelectEnvironment : SelectEnvironmentmodules.selectEnvironment, className), children: [extraContent && /*#__PURE__*/(0,jsx_runtime.jsx)("div", { style: { marginTop: 20, marginLeft: 20 }, children: extraContent }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", { className: SelectEnvironmentmodules.search, children: [/*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, { suffix: renderIcon(), bordered: false, ref: inputRef, value: inputValue, onKeyDown: function onKeyDown(e) { if (e.keyCode === 40 || e.keyCode === 38 || e.keyCode === 13) { e.preventDefault(); } }, size: 'middle', onFocus: function onFocus() { clearTimeout(timer.current); if (inputValue) { onSearch(inputValue); } setVisible(true); }, onBlur: onBlur, onChange: function 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__*/(0,jsx_runtime.jsx)("div", { id: "search-".concat(quId), className: SelectEnvironmentmodules.searchListWrap, children: options.map(function (e, i) { return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, { children: [" ", e.label] }, i); }) })] }), loading ? /*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, { className: SelectEnvironmentmodules.spin }) : /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, { children: [!!tags.length && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { className: SelectEnvironmentmodules.common, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.title, children: "\u63A8\u8350\u73AF\u5883:" }), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", { className: SelectEnvironmentmodules.tags, children: tags.map(function (e, i) { return /*#__PURE__*/(0,jsx_runtime.jsx)("li", { onClick: function onClick() { return activeClear(e.id); }, className: value === e.id ? "".concat(SelectEnvironmentmodules.tag, " ").concat(SelectEnvironmentmodules.tagActive) : SelectEnvironmentmodules.tag, children: e.name }, i); }) })] }), isEmpty && /*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, { style: { margin: '60px 0' }, image: noEnvData, description: /*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: "c-grey-999", children: "\u6682\u65E0\u5B9E\u9A8C\u73AF\u5883" }) }), /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", { className: SelectEnvironmentmodules.wrap, id: "scroll-".concat(quId), children: [data.map(function (item, i) { var _item$image; return !!(item !== null && item !== void 0 && (_item$image = item.image) !== null && _item$image !== void 0 && _item$image.length) ? /*#__PURE__*/(0,jsx_runtime.jsx)(List, { data: item, id: value, handleClick: function handleClick(id) { return activeClear(id); } }, i) : null; }), /*#__PURE__*/(0,jsx_runtime.jsx)("ul", { className: SelectEnvironmentmodules.allList, children: otherData.map(function (item) { return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", { id: "scroll-".concat(quId, "-").concat(item.id), className: item.id === value ? "".concat(SelectEnvironmentmodules.item, " ").concat(SelectEnvironmentmodules.itemActive) : SelectEnvironmentmodules.item, onClick: function onClick() { return onChange(item.id); }, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.name, children: item.name }), item["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E", children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.tag, style: { color: '#FF9D18', border: '1px solid #FFCF8D', fontSize: 10 }, children: "\u9650\u5B9A" }) }), item.is_base && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883", children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.tag, style: { color: '#165DFF', border: '1px solid #BACFFE', fontSize: 10 }, children: "\u57FA\u7840" }) })] }, "key-".concat(item.id)); }) })] })] }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", { className: SelectEnvironmentmodules.apply, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: SelectEnvironmentmodules.p1, children: "\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F" }), /*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: SelectEnvironmentmodules.p2, onClick: handleApply, children: " \u7533\u8BF7\u65B0\u5EFA" }), !hiddenCreateOnline && /*#__PURE__*/(0,jsx_runtime.jsx)("span", { className: SelectEnvironmentmodules.p2, onClick: CreateImg, children: " \u5728\u7EBF\u521B\u5EFA" })] })] }); }; var List = function List(_ref4) { var data = _ref4.data, id = _ref4.id, handleClick = _ref4.handleClick; var _useState9 = (0,_react_17_0_2_react.useState)(true), _useState10 = slicedToArray_default()(_useState9, 2), drop = _useState10[0], setDrop = _useState10[1]; var name = data.name, image = data.image; return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", { className: SelectEnvironmentmodules.list, children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("header", { onClick: function onClick() { return setDrop(!drop); }, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.title, children: name }), /*#__PURE__*/(0,jsx_runtime.jsx)("i", { style: { transition: '0.5s', transform: drop ? 'rotate(0deg)' : 'rotate(180deg)' }, className: "iconfont icon-shangjiantou c-grey-999" })] }), /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", { className: SelectEnvironmentmodules.items, style: { height: drop ? 'auto' : 0 }, children: [image.map(function (item) { return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", { className: item.id === id ? "".concat(SelectEnvironmentmodules.item, " ").concat(SelectEnvironmentmodules.itemActive) : SelectEnvironmentmodules.item, onClick: function onClick() { return handleClick(item.id); }, children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.name, children: item.name }), item["private"] && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u8BE5\u955C\u50CF\u9762\u5411\u6307\u5B9A\u7528\u6237\u5F00\u653E", children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.tag, style: { color: '#FF9D18', border: '1px solid #FFCF8D', fontSize: 10 }, children: "\u9650\u5B9A" }) }), item.is_base && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, { title: "\u4EC5\u63D0\u4F9B\u4E00\u4E2A\u57FA\u672C\u7684\u64CD\u4F5C\u7CFB\u7EDF\u73AF\u5883", children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", { className: SelectEnvironmentmodules.tag, style: { color: '#165DFF', border: '1px solid #BACFFE', fontSize: 10 }, children: "\u57FA\u7840" }) })] }, item.id); }), /*#__PURE__*/(0,jsx_runtime.jsx)("li", { className: SelectEnvironmentmodules.line })] })] }); }; /* harmony default export */ var components_SelectEnvironment = (SelectEnvironment); /***/ }), /***/ 88394: /*!***************************************************************************!*\ !*** ./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__(64515); // EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules var input = __webpack_require__(10249); // 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__(54580); // 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__(51200); // 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)); /***/ }), /***/ 84884: /*!**********************************************************************!*\ !*** ./src/pages/Shixuns/New/components/CreateEnvironment/index.tsx ***! \**********************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { /* harmony import */ var _root_workspace_ppte5yg23_local_v9_test5_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_test5_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_test5_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 */ 64515); /* 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_test5_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)); /***/ }) }]);