build/p__Competitions__Update.330...

367 lines
20 KiB
JavaScript

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[13],{
/***/ "CpkQ":
/*!**********************************************************!*\
!*** ./src/pages/Competitions/Update/index.less?modules ***!
\**********************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
module.exports = {"flex_box_center":"flex_box_center___1TLor","flex_space_between":"flex_space_between___2oHSZ","flex_box_vertical_center":"flex_box_vertical_center___1GsMX","flex_box_center_end":"flex_box_center_end___dUr0S","flex_box_column":"flex_box_column___15YZP","Selecttext":"Selecttext___1ucPb","Updatecount":"Updatecount___t5g1H","Spanradius":"Spanradius___F7XLb"};
/***/ }),
/***/ "jmm4":
/*!*************************************************!*\
!*** ./src/pages/Competitions/Update/index.tsx ***!
\*************************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/.umi-production/core/routes.ts (referenced with import()) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/es/button/style */ "+L6B");
/* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/es/button */ "2/Rp");
/* harmony import */ var antd_es_input_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/input/style */ "5NDa");
/* harmony import */ var antd_es_input__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd/es/input */ "5rEg");
/* harmony import */ var antd_es_breadcrumb_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/breadcrumb/style */ "sPJy");
/* harmony import */ var antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/breadcrumb */ "bE4q");
/* harmony import */ var antd_es_message_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd/es/message/style */ "miYZ");
/* harmony import */ var antd_es_message__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd/es/message */ "tsqr");
/* harmony import */ var _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */ "WmNS");
/* harmony import */ var _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */ "9og8");
/* harmony import */ var _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */ "tJVT");
/* harmony import */ var _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties */ "PpiC");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react */ "q1tI");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! umi */ "Ty5D");
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! umi */ "55Ip");
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! umi */ "9kvl");
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./index.less?modules */ "CpkQ");
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_index_less_modules__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var react_cropper__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! react-cropper */ "wyMu");
/* harmony import */ var react_cropper__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(react_cropper__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var cropperjs_dist_cropper_css__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! cropperjs/dist/cropper.css */ "YQfW");
/* harmony import */ var cropperjs_dist_cropper_css__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(cropperjs_dist_cropper_css__WEBPACK_IMPORTED_MODULE_18__);
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @/utils/env */ "m3rI");
var competitionDetails = function competitionDetails(_ref) {
var globalSetting = _ref.globalSetting,
loading = _ref.loading,
dispatch = _ref.dispatch,
props = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"])(_ref, ["globalSetting", "loading", "dispatch"]);
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(),
_useState2 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState, 2),
HeaderDetail = _useState2[0],
setHeaderDetail = _useState2[1]; //头部信息
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(),
_useState4 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState3, 2),
personname = _useState4[0],
setpersonname = _useState4[1]; //战队名
var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(),
_useState6 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState5, 2),
imageurl = _useState6[0],
setimageurl = _useState6[1];
var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(''),
_useState8 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState7, 2),
teamlog = _useState8[0],
setteamlog = _useState8[1];
var Croppers = Object(react__WEBPACK_IMPORTED_MODULE_12__["useRef"])(null);
var _useState9 = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(''),
_useState10 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState9, 2),
updateimg = _useState10[0],
setupdateimg = _useState10[1];
var _useParams = Object(umi__WEBPACK_IMPORTED_MODULE_13__[/* useParams */ "l"])(),
identifier = _useParams.identifier,
Teannameid = _useParams.Teannameid;
var _useState11 = Object(react__WEBPACK_IMPORTED_MODULE_12__["useState"])(''),
_useState12 = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"])(_useState11, 2),
letimg = _useState12[0],
setletimg = _useState12[1];
var history = Object(umi__WEBPACK_IMPORTED_MODULE_13__[/* useHistory */ "j"])();
Object(react__WEBPACK_IMPORTED_MODULE_12__["useEffect"])(function () {
function init() {
return _init.apply(this, arguments);
}
function _init() {
_init = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])( /*#__PURE__*/_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8___default.a.mark(function _callee() {
var data, _data$data, _data$data2, _data$data3;
return _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8___default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.t0 = setHeaderDetail;
_context.next = 3;
return dispatch({
type: 'competitions/getHeader',
payload: {
identifier: identifier
}
});
case 3:
_context.t1 = _context.sent;
(0, _context.t0)(_context.t1);
_context.next = 7;
return dispatch({
type: 'competitions/getTeamDetail',
payload: {
identifier: identifier,
Teannameid: Teannameid
}
});
case 7:
data = _context.sent;
if (data) {
// setpersonname(data.data.name);
// setupdateimg(`${env.IMG_SERVER}/${data.data.team_log}`)
setpersonname(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.name);
setupdateimg("".concat(_utils_env__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"] === null || _utils_env__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"] === void 0 ? void 0 : _utils_env__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"].IMG_SERVER, "/").concat(data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.team_log));
setletimg(data === null || data === void 0 ? void 0 : (_data$data3 = data.data) === null || _data$data3 === void 0 ? void 0 : _data$data3.team_log);
}
case 9:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _init.apply(this, arguments);
}
if (identifier) {
init();
}
}, [identifier]); //裁剪调用了
function _crop() {
setimageurl(Croppers.current.getCroppedCanvas().toDataURL());
}
function submitname() {
return _submitname.apply(this, arguments);
}
function _submitname() {
_submitname = Object(_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])( /*#__PURE__*/_Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8___default.a.mark(function _callee2() {
var data;
return _Users_xxq_node_forgeplus_react_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_8___default.a.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (personname) {
_context2.next = 3;
break;
}
antd_es_message__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"].info("队伍名不能为空");
return _context2.abrupt("return");
case 3:
_context2.next = 5;
return dispatch({
type: 'competitions/UpTeam',
payload: {
identifier: identifier,
Teannameid: Teannameid,
name: personname,
image: letimg ? Croppers.current.getCroppedCanvas().toDataURL("image/jpeg") : undefined
}
});
case 5:
data = _context2.sent;
if ((data === null || data === void 0 ? void 0 : data.status) === 0) {
antd_es_message__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"].info('修改成功');
history.push("/competitions/index/".concat(identifier, "/enroll"));
}
case 7:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _submitname.apply(this, arguments);
}
function handleFileChange(e) {
var file = e.target.files[0];
if (file) {
if (file.size > 2 * 1024 * 1024) {
antd_es_message__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"].info("仅支持文件大小小于2M的文件");
return;
}
} //base64
var reader = new FileReader();
reader.readAsBinaryString(file);
reader.onload = function () {
var base64_content = btoa(reader.result);
setupdateimg("data:".concat(file.type, ";base64,").concat(base64_content));
};
reader.onerror = function () {// console.log('there are some problems');
};
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
className: "edu-container minH500"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
className: "mt10",
separator: ">"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(umi__WEBPACK_IMPORTED_MODULE_14__[/* Link */ "a"], {
to: "/competitions/index"
}, "\u5728\u7EBF\u7ADE\u8D5B")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(umi__WEBPACK_IMPORTED_MODULE_14__[/* Link */ "a"], {
to: "/competitions/index/".concat(identifier)
}, HeaderDetail && HeaderDetail.name, HeaderDetail && HeaderDetail.sub_title ? true && HeaderDetail.sub_title : null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(umi__WEBPACK_IMPORTED_MODULE_14__[/* Link */ "a"], {
to: "/competitions/index/".concat(identifier, "/enroll")
}, "\u62A5\u540D")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_breadcrumb__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, null, "\u7F16\u8F91\u6218\u961F\u4FE1\u606F")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default.a.Selecttext
}, "\u7F16\u8F91\u6218\u961F"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default.a.Updatecount
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("span", {
style: {
fontSize: '14px',
color: '#F73737'
}
}, "*"), "\u961F\u540D\uFF1A", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("p", {
style: {
marginTop: '15px',
marginLeft: '8px',
width: "544px"
}
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_input__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
placeholder: "请输入队名",
value: personname,
maxLength: 60,
addonAfter: String(personname && personname.length) + "/60",
onChange: function onChange(e) {
return setpersonname(e.target.value);
}
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("p", {
style: {
marginTop: '15px',
marginLeft: '8px',
width: "544px"
}
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("span", null, "LOGO\uFF1A"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("label", {
id: "uploadBtn",
style: {
color: '#4DACFF',
cursor: "pointer"
}
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("input", {
type: "file",
className: "sr-only",
id: "inputImage",
name: "file",
accept: "image/*",
onChange: handleFileChange,
style: {
display: "none"
}
}), "\u4E0A\u4F20LOGO"), "\xA0", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("span", null, "(\u652F\u6301jpg\u3001gif\u3001png\u683C\u5F0F\u7684\u56FE\u7247\uFF0C\u5EFA\u8BAE\u6587\u4EF6\u5C0F\u4E8E2M)")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
style: {
marginTop: '15px',
marginLeft: '8px',
display: 'flex'
}
}, imageurl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("img", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default.a.Spanradius,
src: imageurl
}) : teamlog ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("img", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default.a.Spanradius
}) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_16___default.a.Spanradius
}, personname && personname.length > 2 ? personname && personname.substring(0, 2) : personname), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(react_cropper__WEBPACK_IMPORTED_MODULE_17___default.a, {
style: {
width: '320px',
height: '320px',
marginLeft: "30px",
background: '#EEEEEE'
},
src: updateimg // aspectRatio={320/320}
,
guides: false,
ref: Croppers,
crop: _crop
}))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement("div", {
style: {
marginTop: '15px',
marginBottom: '15px'
}
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
type: "primary",
onClick: function onClick() {
return submitname();
}
}, "\u786E\u5B9A"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
style: {
marginLeft: '15px'
}
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_12___default.a.createElement(umi__WEBPACK_IMPORTED_MODULE_14__[/* Link */ "a"], {
to: "/competitions/index/".concat(identifier, "/enroll")
}, "\u53D6\u6D88"))));
};
/* harmony default export */ __webpack_exports__["default"] = (Object(umi__WEBPACK_IMPORTED_MODULE_15__[/* connect */ "a"])(function (_ref2) {
var loading = _ref2.loading,
globalSetting = _ref2.globalSetting;
return {
globalSetting: globalSetting,
loading: loading.models.competitions
};
})(competitionDetails));
/***/ })
}]);