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.
955 lines
43 KiB
955 lines
43 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[12076],{
|
|
|
|
/***/ 56971:
|
|
/*!*****************************************!*\
|
|
!*** ./src/components/NoData/index.tsx ***!
|
|
\*****************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
|
|
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 93314);
|
|
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 3113);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var noData = function noData(_ref) {
|
|
var img = _ref.img,
|
|
_ref$buttonProps = _ref.buttonProps,
|
|
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
_ref$styles = _ref.styles,
|
|
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
customText = _ref.customText,
|
|
ButtonText = _ref.ButtonText,
|
|
ButtonClick = _ref.ButtonClick,
|
|
Buttonclass = _ref.Buttonclass,
|
|
ButtonTwo = _ref.ButtonTwo,
|
|
imgStyles = _ref.imgStyles,
|
|
_ref$loading = _ref.loading,
|
|
loading = _ref$loading === void 0 ? false : _ref$loading;
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("section", {
|
|
className: "tc animated fadeIn",
|
|
style: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, {
|
|
color: '#999',
|
|
margin: '100px auto',
|
|
visibility: loading ? 'hidden' : 'visible'
|
|
}), styles),
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("img", {
|
|
src: img || _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__,
|
|
style: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, imgStyles), {}, {
|
|
pointerEvents: "none",
|
|
userSelect: "none"
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p", {
|
|
className: "mt20 font14",
|
|
children: customText || '暂时还没有相关数据哦!'
|
|
}), ButtonText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
className: Buttonclass,
|
|
onClick: ButtonClick
|
|
}, buttonProps), {}, {
|
|
children: ButtonText
|
|
})), ButtonTwo && ButtonTwo]
|
|
});
|
|
};
|
|
/* harmony default export */ __webpack_exports__.Z = (noData);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 11235:
|
|
/*!******************************************************************!*\
|
|
!*** ./src/pages/User/Detail/Competitions/index.tsx + 1 modules ***!
|
|
\******************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": function() { return /* binding */ Competitions; }
|
|
});
|
|
|
|
// 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/_@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 + 15 modules
|
|
var _umi_production_exports = __webpack_require__(58011);
|
|
// 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/row/index.js
|
|
var row = __webpack_require__(95237);
|
|
// 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/list/index.js + 3 modules
|
|
var list = __webpack_require__(73755);
|
|
// 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/pagination/index.js + 10 modules
|
|
var pagination = __webpack_require__(66786);
|
|
// 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/input/index.js + 5 modules
|
|
var input = __webpack_require__(62680);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Competitions/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Competitionsmodules = ({"flex_box_center":"flex_box_center___ENAOI","flex_space_between":"flex_space_between___Yjoyu","flex_box_vertical_center":"flex_box_vertical_center___aPS45","flex_box_center_end":"flex_box_center_end___kUgIl","flex_box_column":"flex_box_column___mGYey","wrap":"wrap___S3lx0","midWrap":"midWrap___Fwx7_","color999":"color999___fpRZB","orderWrap":"orderWrap___xXwnV","orderIconWrap":"orderIconWrap___btpj3","orderAsc":"orderAsc___Iu6TW","orderDesc":"orderDesc___MVd38","color0152d9":"color0152d9___gS1Es","h10":"h10___OpBG1","cursorPointer":"cursorPointer___BBvno","orderTextWrap":"orderTextWrap___Yee1I","cardWrap":"cardWrap___WWukD","countWrap":"countWrap___tpXul","affixContainer":"affixContainer___Q9aZn","qrcode":"qrcode___sFCxR","img":"img___jdtAg","tips":"tips____Aaub","close":"close___qwPuO","text":"text___tml4V","type":"type___VMu2F","tabsWrap":"tabsWrap___vVFv7","searchWrap":"searchWrap___cLNy_","search":"search___Klnly","searchIcon":"searchIcon___aDsB3","btns":"btns___ofGrI","searchWrap_right":"searchWrap_right___e9C61","description":"description___YHwxX","bg":"bg___WpG67","list":"list___mHF6V","status":"status___nfyAH","desc":"desc___xag2m","flex1":"flex1___PdtmV","item":"item___aNPT4","footer":"footer___p72hy","bottomText":"bottomText___oqcZk","CompetitionsList":"CompetitionsList___mwIel","signup":"signup___c4fp9","CompetitionsListzhezhao":"CompetitionsListzhezhao___OiSIi","shadow":"shadow___iTRBk","divimg":"divimg___vS_gS","commonTextBox":"commonTextBox___THI9L","havetext":"havetext___c1f2m","Finishedtext":"Finishedtext___chFiq","Comingtext":"Comingtext___h6fHO","info":"info___v5RHL","bonus":"bonus___lrFm4","rmb":"rmb___Q8E6y","applyInfo":"applyInfo___ck29q","task_hide":"task_hide___mAsn0","task_hide_2":"task_hide_2___mkLFM","Unpublishedtext":"Unpublishedtext___D9LjX","checkboxtitle":"checkboxtitle___pbwqo","scoremodal":"scoremodal___OiQdF","title":"title___fAx3h","content":"content___MbGbI","bottom":"bottom___cOeks","yes":"yes___lMqJj","no":"no___j6M_d","baseFormItem":"baseFormItem___iTGaw","jsinput":"jsinput___Hg3Qu","scoreByBlankRadio":"scoreByBlankRadio___Ic5Z9"});
|
|
// EXTERNAL MODULE: ./src/utils/fetch.ts
|
|
var fetch = __webpack_require__(56648);
|
|
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 34 modules
|
|
var ui_customization = __webpack_require__(75748);
|
|
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 33 modules
|
|
var ImagesIcon = __webpack_require__(98911);
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
var util = __webpack_require__(73400);
|
|
// EXTERNAL MODULE: ./src/utils/authority.ts
|
|
var authority = __webpack_require__(77971);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
;// CONCATENATED MODULE: ./src/pages/User/Detail/Competitions/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["competitions", "globalSetting", "loading", "dispatch", "user"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tabs = [{
|
|
id: 'mine',
|
|
name: "\u6211\u7BA1\u7406\u7684",
|
|
color: '#DB780F',
|
|
border: '1px solid #FDDBB7'
|
|
}, {
|
|
id: 'join',
|
|
name: "\u6211\u53C2\u4E0E\u7684",
|
|
color: '#4237E7',
|
|
border: '1px solid #B6B1FF'
|
|
}];
|
|
var competitionsPage = function competitionsPage(_ref) {
|
|
var competitions = _ref.competitions,
|
|
globalSetting = _ref.globalSetting,
|
|
loading = _ref.loading,
|
|
dispatch = _ref.dispatch,
|
|
user = _ref.user,
|
|
props = objectWithoutProperties_default()(_ref, _excluded);
|
|
var _useParams = (0,_umi_production_exports.useParams)(),
|
|
identifier = _useParams.identifier;
|
|
var _useState = (0,_react_17_0_2_react.useState)({
|
|
category: 'mine',
|
|
keyword: '',
|
|
page: 1,
|
|
per_page: 20
|
|
}),
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
params = _useState2[0],
|
|
setParams = _useState2[1];
|
|
var _useState3 = (0,_react_17_0_2_react.useState)({}),
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
datas = _useState4[0],
|
|
setdatas = _useState4[1];
|
|
var _useState5 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
iscreate = _useState6[0],
|
|
setiscreate = _useState6[1];
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
form = _Form$useForm2[0];
|
|
var _useState7 = (0,_react_17_0_2_react.useState)(false),
|
|
_useState8 = slicedToArray_default()(_useState7, 2),
|
|
buttonloading = _useState8[0],
|
|
setbuttonloading = _useState8[1];
|
|
|
|
//获取课题
|
|
function getdatas() {
|
|
return _getdatas.apply(this, arguments);
|
|
}
|
|
function _getdatas() {
|
|
_getdatas = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
|
|
var res;
|
|
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/competitions.json", {
|
|
method: 'get',
|
|
params: objectSpread2_default()({}, params)
|
|
});
|
|
case 2:
|
|
res = _context2.sent;
|
|
setdatas(res);
|
|
case 4:
|
|
case "end":
|
|
return _context2.stop();
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
return _getdatas.apply(this, arguments);
|
|
}
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
getdatas();
|
|
}, []);
|
|
|
|
/**
|
|
* 列表数据点击跳转事件
|
|
*/
|
|
var onListClick = function onListClick(item) {
|
|
// 判断有没有配置外链接:
|
|
if (item.external_url) {
|
|
var _user$userInfo;
|
|
// console.log(item.external_url,"-----item.external_url");
|
|
(0,util/* openNewWindow */.xg)("".concat(item.external_url) + "?login=" + (user === null || user === void 0 || (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login) + "&websiteName=educoder");
|
|
} else {
|
|
if (item !== null && item !== void 0 && item.is_new) {
|
|
if (item.permission.editable) {
|
|
(0,util/* openNewWindow */.xg)("/competitions/detail/".concat(item.identifier, "?type=4"));
|
|
} else {
|
|
(0,util/* openNewWindow */.xg)("/competitions/detail/".concat(item.identifier));
|
|
}
|
|
return;
|
|
}
|
|
if (item.competition_status === 'ended' || item.competition_status === 'progressing' || item.competition_status === 'unpublish' || item.competition_status === 'nearly_published' && item.permission.editable == true) {
|
|
(0,util/* openNewWindow */.xg)("/competitions/".concat(item.identifier));
|
|
}
|
|
}
|
|
};
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.wrap,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomTabs */.YG, {
|
|
value: params.category,
|
|
onChange: function onChange(e) {
|
|
params.category = e;
|
|
setParams(objectSpread2_default()({}, params));
|
|
getdatas();
|
|
},
|
|
tabBarExtraContent: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
align: "middle",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
|
|
className: "mr20",
|
|
onClick: function onClick() {
|
|
var _user$userInfo2, _user$userInfo3;
|
|
if ((0,authority/* isAdmins */.eB)() || (_user$userInfo2 = user.userInfo) !== null && _user$userInfo2 !== void 0 && _user$userInfo2.professional_certification && (_user$userInfo3 = user.userInfo) !== null && _user$userInfo3 !== void 0 && _user$userInfo3.is_teacher) {
|
|
setiscreate(true);
|
|
} else {
|
|
message/* default */.ZP.info("当前仅支持已职业认证的教师可创建");
|
|
}
|
|
},
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
|
|
align: "middle",
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
src: ImagesIcon/* cjjs */.FX
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "ml5",
|
|
children: "\u521B\u5EFA\u7ADE\u8D5B"
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomInput */.t7, {
|
|
style: {
|
|
width: 303
|
|
},
|
|
placeholder: "\u8BF7\u8F93\u5165\u7ADE\u8D5B\u540D\u79F0\u8FDB\u884C\u641C\u7D22",
|
|
value: params.keyword,
|
|
onChange: function onChange(e) {
|
|
params.keyword = e;
|
|
setParams(objectSpread2_default()({}, params));
|
|
getdatas();
|
|
}
|
|
})]
|
|
}),
|
|
dataSource: tabs
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(list/* default */.Z, {
|
|
itemLayout: "vertical",
|
|
size: 'middle',
|
|
style: {
|
|
marginTop: 20
|
|
},
|
|
dataSource: datas === null || datas === void 0 ? void 0 : datas.competitions,
|
|
renderItem: function renderItem(item, key) {
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.CompetitionsList,
|
|
children: [item.competition_status === 'nearly_published' ? item.permission.editable == true ? '' : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Competitionsmodules.CompetitionsListzhezhao,
|
|
children: "\u5373\u5C06\u53D1\u5E03 \u656C\u8BF7\u671F\u5F85"
|
|
}) : '', /*#__PURE__*/(0,jsx_runtime.jsxs)(list/* default */.Z.Item, {
|
|
onClick: function onClick() {
|
|
return onListClick(item);
|
|
},
|
|
className: Competitionsmodules.shadow,
|
|
style: {
|
|
display: 'flex',
|
|
padding: 20
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(list/* default */.Z.Item.Meta, {
|
|
style: {
|
|
marginBottom: '0px',
|
|
width: '80%'
|
|
},
|
|
avatar: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
className: Competitionsmodules.divimg,
|
|
src: item && item.image ? item.image : ImagesIcon/* mainbannerBg */.I2
|
|
}),
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
|
|
style: {
|
|
alignItems: 'center',
|
|
display: 'flex',
|
|
marginBottom: 7,
|
|
paddingRight: 20
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
return trigger.parentNode;
|
|
},
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: [item.name, item.sub_title ? "\u2014\u2014".concat(item.sub_title) : '']
|
|
}),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
|
|
className: Competitionsmodules.task_hide,
|
|
children: [item.name, item.sub_title ? "\u2014\u2014".concat(item.sub_title) : '']
|
|
})
|
|
}), item.competition_status && item.competition_status === 'nearly_published' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Comingtext),
|
|
children: "\u5373\u5C06\u53D1\u5E03"
|
|
}) : '', item.competition_status && item.competition_status === 'preparing' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#DB780F',
|
|
border: '1px solid #FDDBB7'
|
|
},
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Finishedtext),
|
|
children: "\u5F85\u5BA1\u6838"
|
|
}) : '', item.competition_status && item.competition_status === 'not_passed' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#E30000',
|
|
border: '1px solid #FFC7C7'
|
|
},
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Finishedtext),
|
|
children: "\u88AB\u9A73\u56DE"
|
|
}) : '', item.competition_status && item.competition_status === 'review' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#4237E7',
|
|
border: '1px solid #B6B1FF'
|
|
},
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Finishedtext),
|
|
children: "\u5BA1\u6838\u4E2D"
|
|
}) : '', item.competition_status && item.competition_status === 'progressing' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
style: {
|
|
color: '#00B187',
|
|
border: '1px solid #B1F0E1'
|
|
},
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.havetext),
|
|
children: "\u8FDB\u884C\u4E2D"
|
|
}) : '', item.competition_status && item.competition_status === 'ended' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Finishedtext),
|
|
children: "\u5DF2\u7ED3\u675F"
|
|
}) : '', item.competition_status && item.competition_status === 'unpublish' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: "".concat(Competitionsmodules.commonTextBox, " ").concat(Competitionsmodules.Finishedtext),
|
|
children: "\u672A\u53D1\u5E03"
|
|
}) : '']
|
|
}),
|
|
description: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.description,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
|
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
return trigger.parentNode;
|
|
},
|
|
title: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
children: item.description ? item.description : '暂无简介~'
|
|
}),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: "multi_ellipsis1 inline-block",
|
|
style: {
|
|
fontSize: '14px',
|
|
color: '#333333'
|
|
},
|
|
children: item.description ? item.description : '暂无简介~'
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.bottomText,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
margin: '14px 0'
|
|
},
|
|
children: ["\u7ADE\u8D5B\u65F6\u95F4: ", item.start_time, "\uFF5E", item.end_time]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
children: ["\u62A5\u540D\u622A\u6B62\u65F6\u95F4\uFF1A", item && item.enroll_end_time ? item.enroll_end_time : '暂无']
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
style: {
|
|
marginLeft: '20px'
|
|
},
|
|
children: ["\u6D4F\u89C8\u6570\uFF1A", item && item.visits_count ? item.visits_count : '暂无']
|
|
})]
|
|
})]
|
|
})]
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
flexShrink: 0,
|
|
width: '20%',
|
|
alignItems: 'flex-end',
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
justifyContent: 'space-around'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.info,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.bonus,
|
|
style: {
|
|
visibility: item && item.bonus ? 'visible' : 'hidden'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Competitionsmodules.rmb,
|
|
children: "\xA5"
|
|
}), parseInt(item.bonus).toLocaleString()]
|
|
}), item.member_count ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.applyInfo,
|
|
children: ["\u5DF2\u62A5\u540D\uFF1A", item.competition_status === 'nearly_published' ? '0' : item.member_count]
|
|
}) : '']
|
|
}), item && item.competition_status === 'ended' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Competitionsmodules.Unpublishedtext
|
|
// onClick={e => noclick(e)}
|
|
,
|
|
children: "\u5DF2\u7ED3\u675F"
|
|
}) : null, item && item.competition_status === 'nearly_published' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Competitionsmodules.Unpublishedtext
|
|
// onClick={e => noclick(e)}
|
|
,
|
|
children: "\u672A\u53D1\u5E03"
|
|
}) : null, item && item.competition_status !== 'nearly_published' && item.enroll_end && item.competition_status !== 'ended' ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
className: Competitionsmodules.Unpublishedtext
|
|
// onClick={e => noclick(e)}
|
|
,
|
|
children: "\u62A5\u540D\u622A\u6B62"
|
|
}) : null]
|
|
})]
|
|
}, key)]
|
|
});
|
|
}
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Competitionsmodules.countWrap,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(pagination/* default */.Z, {
|
|
showQuickJumper: true,
|
|
showSizeChanger: true,
|
|
pageSizeOptions: ['10', '15', '50', '100', '200'],
|
|
total: datas === null || datas === void 0 ? void 0 : datas.count,
|
|
onChange: function onChange(page, pageSize) {
|
|
params.page = page;
|
|
params.per_page = pageSize;
|
|
setParams(objectSpread2_default()({}, params));
|
|
getdatas();
|
|
},
|
|
pageSize: params.per_page,
|
|
hideOnSinglePage: !(datas !== null && datas !== void 0 && datas.count),
|
|
current: params.page
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(modal/* default */.Z, {
|
|
title: false,
|
|
footer: false,
|
|
open: iscreate,
|
|
width: 610,
|
|
className: Competitionsmodules.scoremodal,
|
|
closable: false,
|
|
centered: true,
|
|
onCancel: function onCancel() {
|
|
return setiscreate(false);
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
style: {
|
|
display: 'flex',
|
|
alignItems: 'center'
|
|
},
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Competitionsmodules.title,
|
|
children: "\u521B\u5EFA\u7ADE\u8D5B"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
onClick: function onClick() {
|
|
return setiscreate(false);
|
|
},
|
|
style: {
|
|
cursor: 'pointer'
|
|
},
|
|
className: Competitionsmodules.close,
|
|
children: "X"
|
|
})]
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
className: Competitionsmodules.content,
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z, {
|
|
form: form,
|
|
layout: "vertical",
|
|
onFinish: ( /*#__PURE__*/function () {
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(values) {
|
|
var res;
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
while (1) switch (_context.prev = _context.next) {
|
|
case 0:
|
|
setbuttonloading(true);
|
|
_context.next = 3;
|
|
return (0,fetch/* default */.ZP)("/api/competitions.json", {
|
|
method: 'post',
|
|
body: objectSpread2_default()({}, values)
|
|
});
|
|
case 3:
|
|
res = _context.sent;
|
|
setbuttonloading(false);
|
|
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
|
|
message/* default */.ZP.info('创建成功');
|
|
_umi_production_exports.history.push("/competitions/detail/".concat(res === null || res === void 0 ? void 0 : res.identifier, "?type=4"));
|
|
}
|
|
case 6:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}, _callee);
|
|
}));
|
|
return function (_x) {
|
|
return _ref2.apply(this, arguments);
|
|
};
|
|
}()),
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
label: "\u7ADE\u8D5B\u540D\u79F0",
|
|
name: "name",
|
|
className: Competitionsmodules.jsinput,
|
|
rules: [{
|
|
required: true,
|
|
validator: function validator(_, value) {
|
|
var _value$replaceAll;
|
|
return (value === null || value === void 0 || (_value$replaceAll = value.replaceAll(' ', '')) === null || _value$replaceAll === void 0 ? void 0 : _value$replaceAll.length) > 0 ? Promise.resolve() : Promise.reject('请填写竞赛名称');
|
|
}
|
|
}],
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
maxLength: 60,
|
|
className: Competitionsmodules.baseFormItem,
|
|
showCount: true
|
|
})
|
|
})
|
|
})
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
className: Competitionsmodules.bottom,
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
className: Competitionsmodules.no,
|
|
onClick: function onClick() {
|
|
setiscreate(false);
|
|
},
|
|
children: "\u53D6\u6D88"
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
|
|
loading: buttonloading,
|
|
className: Competitionsmodules.yes,
|
|
onClick: function onClick() {
|
|
form.submit();
|
|
},
|
|
children: "\u521B\u5EFA\u7ADE\u8D5B"
|
|
})]
|
|
})]
|
|
})]
|
|
});
|
|
};
|
|
/* harmony default export */ var Competitions = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
var competitions = _ref3.competitions,
|
|
loading = _ref3.loading,
|
|
globalSetting = _ref3.globalSetting,
|
|
user = _ref3.user;
|
|
return {
|
|
competitions: competitions,
|
|
globalSetting: globalSetting,
|
|
loading: loading.models.competitions,
|
|
user: user
|
|
};
|
|
})(competitionsPage));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 50371:
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/_util/extendsObject.js ***!
|
|
\*****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
function extendsObject() {
|
|
const result = Object.assign({}, arguments.length <= 0 ? undefined : arguments[0]);
|
|
for (let i = 1; i < arguments.length; i++) {
|
|
const obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
|
|
if (obj) {
|
|
Object.keys(obj).forEach(key => {
|
|
const val = obj[key];
|
|
if (val !== undefined) {
|
|
result[key] = val;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
/* harmony default export */ __webpack_exports__.Z = (extendsObject);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 38854:
|
|
/*!************************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js + 1 modules ***!
|
|
\************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ es_dropdown; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/dropdown.js
|
|
var dropdown = __webpack_require__(91857);
|
|
// 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/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.5@@ant-design/icons/es/icons/EllipsisOutlined.js + 1 modules
|
|
var EllipsisOutlined = __webpack_require__(40090);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
|
|
var es_button = __webpack_require__(3113);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// 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/space/Compact.js
|
|
var Compact = __webpack_require__(33234);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/style/index.js + 1 modules
|
|
var style = __webpack_require__(47211);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/dropdown-button.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const DropdownButton = props => {
|
|
const {
|
|
getPopupContainer: getContextPopupContainer,
|
|
getPrefixCls,
|
|
direction
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
type = 'default',
|
|
danger,
|
|
disabled,
|
|
loading,
|
|
onClick,
|
|
htmlType,
|
|
children,
|
|
className,
|
|
menu,
|
|
arrow,
|
|
autoFocus,
|
|
overlay,
|
|
trigger,
|
|
align,
|
|
open,
|
|
onOpenChange,
|
|
placement,
|
|
getPopupContainer,
|
|
href,
|
|
icon = /*#__PURE__*/_react_17_0_2_react.createElement(EllipsisOutlined/* default */.Z, null),
|
|
title,
|
|
buttonsRender = buttons => buttons,
|
|
mouseEnterDelay,
|
|
mouseLeaveDelay,
|
|
overlayClassName,
|
|
overlayStyle,
|
|
destroyPopupOnHide,
|
|
dropdownRender
|
|
} = props,
|
|
restProps = __rest(props, ["prefixCls", "type", "danger", "disabled", "loading", "onClick", "htmlType", "children", "className", "menu", "arrow", "autoFocus", "overlay", "trigger", "align", "open", "onOpenChange", "placement", "getPopupContainer", "href", "icon", "title", "buttonsRender", "mouseEnterDelay", "mouseLeaveDelay", "overlayClassName", "overlayStyle", "destroyPopupOnHide", "dropdownRender"]);
|
|
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
|
const buttonPrefixCls = `${prefixCls}-button`;
|
|
const [wrapSSR, hashId] = (0,style/* default */.Z)(prefixCls);
|
|
const dropdownProps = {
|
|
menu,
|
|
arrow,
|
|
autoFocus,
|
|
align,
|
|
disabled,
|
|
trigger: disabled ? [] : trigger,
|
|
onOpenChange,
|
|
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
mouseEnterDelay,
|
|
mouseLeaveDelay,
|
|
overlayClassName,
|
|
overlayStyle,
|
|
destroyPopupOnHide,
|
|
dropdownRender
|
|
};
|
|
const {
|
|
compactSize,
|
|
compactItemClassnames
|
|
} = (0,Compact/* useCompactItemContext */.ri)(prefixCls, direction);
|
|
const classes = _classnames_2_5_1_classnames_default()(buttonPrefixCls, compactItemClassnames, className, hashId);
|
|
if ('overlay' in props) {
|
|
dropdownProps.overlay = overlay;
|
|
}
|
|
if ('open' in props) {
|
|
dropdownProps.open = open;
|
|
}
|
|
if ('placement' in props) {
|
|
dropdownProps.placement = placement;
|
|
} else {
|
|
dropdownProps.placement = direction === 'rtl' ? 'bottomLeft' : 'bottomRight';
|
|
}
|
|
const leftButton = /*#__PURE__*/_react_17_0_2_react.createElement(es_button/* default */.ZP, {
|
|
type: type,
|
|
danger: danger,
|
|
disabled: disabled,
|
|
loading: loading,
|
|
onClick: onClick,
|
|
htmlType: htmlType,
|
|
href: href,
|
|
title: title
|
|
}, children);
|
|
const rightButton = /*#__PURE__*/_react_17_0_2_react.createElement(es_button/* default */.ZP, {
|
|
type: type,
|
|
danger: danger,
|
|
icon: icon
|
|
});
|
|
const [leftButtonToRender, rightButtonToRender] = buttonsRender([leftButton, rightButton]);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(space/* default */.Z.Compact, Object.assign({
|
|
className: classes,
|
|
size: compactSize,
|
|
block: true
|
|
}, restProps), leftButtonToRender, /*#__PURE__*/_react_17_0_2_react.createElement(dropdown/* default */.Z, Object.assign({}, dropdownProps), rightButtonToRender)));
|
|
};
|
|
DropdownButton.__ANT_BUTTON = true;
|
|
/* harmony default export */ var dropdown_button = (DropdownButton);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/dropdown/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
const Dropdown = dropdown/* default */.Z;
|
|
Dropdown.Button = dropdown_button;
|
|
/* harmony default export */ var es_dropdown = (Dropdown);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 81327:
|
|
/*!*********************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/space/index.js + 3 modules ***!
|
|
\*********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ space; }
|
|
});
|
|
|
|
// UNUSED EXPORTS: SpaceContext
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// 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/_rc-util@5.39.1@rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(47783);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Compact.js
|
|
var Compact = __webpack_require__(33234);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/context.js
|
|
|
|
const SpaceContext = /*#__PURE__*/_react_17_0_2_react.createContext({
|
|
latestIndex: 0
|
|
});
|
|
const SpaceContextProvider = SpaceContext.Provider;
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/Item.js
|
|
"use client";
|
|
|
|
|
|
|
|
const Item = _ref => {
|
|
let {
|
|
className,
|
|
index,
|
|
children,
|
|
split,
|
|
style
|
|
} = _ref;
|
|
const {
|
|
latestIndex
|
|
} = _react_17_0_2_react.useContext(SpaceContext);
|
|
if (children === null || children === undefined) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: className,
|
|
style: style
|
|
}, children), index < latestIndex && split && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${className}-split`
|
|
}, split));
|
|
};
|
|
/* harmony default export */ var space_Item = (Item);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/space/style/index.js + 1 modules
|
|
var space_style = __webpack_require__(2856);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/utils.js
|
|
function isPresetSize(size) {
|
|
return ['small', 'middle', 'large'].includes(size);
|
|
}
|
|
function isValidGapNumber(size) {
|
|
if (!size) {
|
|
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
|
return false;
|
|
}
|
|
return typeof size === 'number' && !Number.isNaN(size);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/space/index.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Space = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
|
|
var _a, _b;
|
|
const {
|
|
getPrefixCls,
|
|
space,
|
|
direction: directionConfig
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const {
|
|
size = (space === null || space === void 0 ? void 0 : space.size) || 'small',
|
|
align,
|
|
className,
|
|
rootClassName,
|
|
children,
|
|
direction = 'horizontal',
|
|
prefixCls: customizePrefixCls,
|
|
split,
|
|
style,
|
|
wrap = false,
|
|
classNames: customClassNames,
|
|
styles
|
|
} = props,
|
|
otherProps = __rest(props, ["size", "align", "className", "rootClassName", "children", "direction", "prefixCls", "split", "style", "wrap", "classNames", "styles"]);
|
|
const [horizontalSize, verticalSize] = Array.isArray(size) ? size : [size, size];
|
|
const isPresetVerticalSize = isPresetSize(verticalSize);
|
|
const isPresetHorizontalSize = isPresetSize(horizontalSize);
|
|
const isValidVerticalSize = isValidGapNumber(verticalSize);
|
|
const isValidHorizontalSize = isValidGapNumber(horizontalSize);
|
|
const childNodes = (0,toArray/* default */.Z)(children, {
|
|
keepEmpty: true
|
|
});
|
|
const mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;
|
|
const prefixCls = getPrefixCls('space', customizePrefixCls);
|
|
const [wrapSSR, hashId] = (0,space_style/* default */.Z)(prefixCls);
|
|
const cls = _classnames_2_5_1_classnames_default()(prefixCls, space === null || space === void 0 ? void 0 : space.className, hashId, `${prefixCls}-${direction}`, {
|
|
[`${prefixCls}-rtl`]: directionConfig === 'rtl',
|
|
[`${prefixCls}-align-${mergedAlign}`]: mergedAlign,
|
|
[`${prefixCls}-gap-row-${verticalSize}`]: isPresetVerticalSize,
|
|
[`${prefixCls}-gap-col-${horizontalSize}`]: isPresetHorizontalSize
|
|
}, className, rootClassName);
|
|
const itemClassName = _classnames_2_5_1_classnames_default()(`${prefixCls}-item`, (_a = customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.item) !== null && _a !== void 0 ? _a : (_b = space === null || space === void 0 ? void 0 : space.classNames) === null || _b === void 0 ? void 0 : _b.item);
|
|
// Calculate latest one
|
|
let latestIndex = 0;
|
|
const nodes = childNodes.map((child, i) => {
|
|
var _a, _b;
|
|
if (child !== null && child !== undefined) {
|
|
latestIndex = i;
|
|
}
|
|
const key = child && child.key || `${itemClassName}-${i}`;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(space_Item, {
|
|
className: itemClassName,
|
|
key: key,
|
|
index: i,
|
|
split: split,
|
|
style: (_a = styles === null || styles === void 0 ? void 0 : styles.item) !== null && _a !== void 0 ? _a : (_b = space === null || space === void 0 ? void 0 : space.styles) === null || _b === void 0 ? void 0 : _b.item
|
|
}, child);
|
|
});
|
|
const spaceContext = _react_17_0_2_react.useMemo(() => ({
|
|
latestIndex
|
|
}), [latestIndex]);
|
|
// =========================== Render ===========================
|
|
if (childNodes.length === 0) {
|
|
return null;
|
|
}
|
|
const gapStyle = {};
|
|
if (wrap) {
|
|
gapStyle.flexWrap = 'wrap';
|
|
}
|
|
if (!isPresetHorizontalSize && isValidHorizontalSize) {
|
|
gapStyle.columnGap = horizontalSize;
|
|
}
|
|
if (!isPresetVerticalSize && isValidVerticalSize) {
|
|
gapStyle.rowGap = verticalSize;
|
|
}
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({
|
|
ref: ref,
|
|
className: cls,
|
|
style: Object.assign(Object.assign(Object.assign({}, gapStyle), space === null || space === void 0 ? void 0 : space.style), style)
|
|
}, otherProps), /*#__PURE__*/_react_17_0_2_react.createElement(SpaceContextProvider, {
|
|
value: spaceContext
|
|
}, nodes)));
|
|
});
|
|
if (false) {}
|
|
const CompoundedSpace = Space;
|
|
CompoundedSpace.Compact = Compact/* default */.ZP;
|
|
/* harmony default export */ var space = (CompoundedSpace);
|
|
|
|
/***/ })
|
|
|
|
}]); |