|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[91470],{
|
|
|
|
|
|
/***/ 91937:
|
|
|
/*!******************************************************************!*\
|
|
|
!*** ./src/components/User/RegisterPanel/unlock.tsx + 1 modules ***!
|
|
|
\******************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ unlock; }
|
|
|
});
|
|
|
|
|
|
// 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/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
;// CONCATENATED MODULE: ./src/components/User/RegisterPanel/unlock.less
|
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.5.2@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
|
|
|
var CloseOutlined = __webpack_require__(72119);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.5.2@@ant-design/icons/es/icons/CheckOutlined.js + 1 modules
|
|
|
var CheckOutlined = __webpack_require__(10402);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.5.2@@ant-design/icons/es/icons/DoubleRightOutlined.js + 1 modules
|
|
|
var DoubleRightOutlined = __webpack_require__(93343);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(34458);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/User/RegisterPanel/unlock.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialState = {
|
|
|
moveX: 0,
|
|
|
verify: 0
|
|
|
};
|
|
|
var Types = /*#__PURE__*/function (Types) {
|
|
|
Types[Types["SET_MOVEX"] = 0] = "SET_MOVEX";
|
|
|
Types[Types["VERIFY"] = 1] = "VERIFY";
|
|
|
return Types;
|
|
|
}(Types || {});
|
|
|
function reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.SET_MOVEX:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
moveX: action.payload
|
|
|
});
|
|
|
case Types.VERIFY:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), action.payload);
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//antd 自定义表单项
|
|
|
/* harmony default export */ var unlock = (function (_ref) {
|
|
|
var value = _ref.value,
|
|
|
onChange = _ref.onChange,
|
|
|
onValidate = _ref.onValidate;
|
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var moveX = state.moveX,
|
|
|
verify = state.verify;
|
|
|
var handlerEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var wrapperEL = (0,_react_17_0_2_react.useRef)();
|
|
|
var bgEl = (0,_react_17_0_2_react.useRef)();
|
|
|
var startDrag = (0,_react_17_0_2_react.useRef)();
|
|
|
var wrapperRect = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
if (wrapperEL.current) {
|
|
|
return wrapperEL.current.getBoundingClientRect();
|
|
|
}
|
|
|
}, [wrapperEL.current]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (wrapperRect) {
|
|
|
var onMove = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e) {
|
|
|
var pageX;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
if (!startDrag.current) {
|
|
|
_context.next = 15;
|
|
|
break;
|
|
|
}
|
|
|
pageX = e.pageX - left;
|
|
|
if (isMobile) {
|
|
|
pageX = e.changedTouches[0].pageX - left;
|
|
|
}
|
|
|
if (pageX < 0) {
|
|
|
pageX = 0;
|
|
|
}
|
|
|
if (!(pageX >= distance)) {
|
|
|
_context.next = 14;
|
|
|
break;
|
|
|
}
|
|
|
startDrag.current = false;
|
|
|
pageX = distance;
|
|
|
_context.next = 9;
|
|
|
return onValidate();
|
|
|
case 9:
|
|
|
flag = _context.sent;
|
|
|
dispatch({
|
|
|
type: Types.VERIFY,
|
|
|
payload: {
|
|
|
moveX: pageX,
|
|
|
verify: flag
|
|
|
}
|
|
|
});
|
|
|
onChange(flag);
|
|
|
_context.next = 15;
|
|
|
break;
|
|
|
case 14:
|
|
|
dispatch({
|
|
|
type: Types.SET_MOVEX,
|
|
|
payload: pageX
|
|
|
});
|
|
|
case 15:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onMove(_x) {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
var onMouseUp = function onMouseUp() {
|
|
|
startDrag.current = false;
|
|
|
if (flag === 0) {
|
|
|
handlerEl.current.style.transition = 'left .5s ease';
|
|
|
bgEl.current.style.transition = 'width .5s ease';
|
|
|
dispatch({
|
|
|
type: Types.VERIFY,
|
|
|
payload: {
|
|
|
moveX: 0
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
var flag = 0;
|
|
|
var width = wrapperRect.width,
|
|
|
left = wrapperRect.left;
|
|
|
var distance = width - 48;
|
|
|
var isMobile = !(0,util/* isPc */.b9)();
|
|
|
if (!isMobile) {
|
|
|
window.addEventListener('mousemove', onMove);
|
|
|
window.addEventListener('mouseup', onMouseUp);
|
|
|
} else {
|
|
|
window.addEventListener('touchmove', onMove);
|
|
|
window.addEventListener('touchend', onMouseUp);
|
|
|
}
|
|
|
return function () {
|
|
|
if (!isMobile) {
|
|
|
window.removeEventListener('mousemove', onMove);
|
|
|
window.removeEventListener('mouseup', onMouseUp);
|
|
|
} else {
|
|
|
window.removeEventListener('touchmove', onMove);
|
|
|
window.removeEventListener('touchend', onMouseUp);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}, [wrapperRect, util/* isPc */.b9]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
dispatch({
|
|
|
type: Types.VERIFY,
|
|
|
payload: {
|
|
|
verify: value,
|
|
|
moveX: value ? (wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.width) - 48 : 0
|
|
|
}
|
|
|
});
|
|
|
}, [value]);
|
|
|
function onStartDrag() {
|
|
|
if (!verify) {
|
|
|
startDrag.current = true;
|
|
|
handlerEl.current.style.transition = '';
|
|
|
bgEl.current.style.transition = '';
|
|
|
}
|
|
|
}
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
ref: wrapperEL,
|
|
|
className: "unlock-wrapper",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: bgEl,
|
|
|
className: verify === 1 ? 'unlock-error-bg' : 'unlock-bg',
|
|
|
style: {
|
|
|
width: moveX
|
|
|
}
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
className: "unlock-text",
|
|
|
children: verify ? verify === 1 ? '验证失败' : '验证通过' : '拖动滑块至右侧验证'
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
|
ref: handlerEl,
|
|
|
onTouchStart: onStartDrag,
|
|
|
onMouseDown: onStartDrag,
|
|
|
style: {
|
|
|
left: moveX
|
|
|
},
|
|
|
className: "unlock-handler",
|
|
|
children: verify ? verify === 1 ? /*#__PURE__*/(0,jsx_runtime.jsx)(CloseOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(CheckOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(DoubleRightOutlined/* default */.Z, {})
|
|
|
})]
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 56961:
|
|
|
/*!*******************************************************!*\
|
|
|
!*** ./src/pages/User/Register/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 */ Register; }
|
|
|
});
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(82242);
|
|
|
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(7557);
|
|
|
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(41498);
|
|
|
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
|
// 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/_antd@5.9.0@antd/es/form/index.js + 19 modules
|
|
|
var es_form = __webpack_require__(78241);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
|
var es_message = __webpack_require__(8591);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
|
|
|
var input = __webpack_require__(36920);
|
|
|
// 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/checkbox/index.js + 3 modules
|
|
|
var es_checkbox = __webpack_require__(24905);
|
|
|
// EXTERNAL MODULE: ./src/components/User/RegisterPanel/unlock.tsx + 1 modules
|
|
|
var unlock = __webpack_require__(91937);
|
|
|
// EXTERNAL MODULE: ./src/utils/util.tsx
|
|
|
var util = __webpack_require__(34458);
|
|
|
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
|
|
|
var _umi_production_exports = __webpack_require__(2133);
|
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
|
var env = __webpack_require__(4023);
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
|
|
|
var jsx_runtime = __webpack_require__(37712);
|
|
|
;// CONCATENATED MODULE: ./src/components/User/RegisterPanel/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var inputStyle = {
|
|
|
height: 48
|
|
|
};
|
|
|
var loginRegex = /(\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b)|(^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$)/i;
|
|
|
var initialState = {
|
|
|
timer: 0
|
|
|
};
|
|
|
var Types = /*#__PURE__*/function (Types) {
|
|
|
Types[Types["setTimer"] = 0] = "setTimer";
|
|
|
return Types;
|
|
|
}(Types || {});
|
|
|
function reducer(state, action) {
|
|
|
switch (action.type) {
|
|
|
case Types.setTimer:
|
|
|
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
|
|
|
timer: action.payload
|
|
|
});
|
|
|
default:
|
|
|
throw new Error();
|
|
|
}
|
|
|
}
|
|
|
var RegisterComponent = function RegisterComponent(_ref) {
|
|
|
var _globalSetting$settin2, _globalSetting$settin3, _globalSetting$settin4, _globalSetting$settin5, _globalSetting$settin6;
|
|
|
var validateName = _ref.validateName,
|
|
|
getCode = _ref.getCode,
|
|
|
register = _ref.register,
|
|
|
_ref$style = _ref.style,
|
|
|
style = _ref$style === void 0 ? {} : _ref$style,
|
|
|
_ref$buttonText = _ref.buttonText,
|
|
|
buttonText = _ref$buttonText === void 0 ? '注册' : _ref$buttonText,
|
|
|
globalSetting = _ref.globalSetting;
|
|
|
var _Form$useForm = es_form/* default */.Z.useForm(),
|
|
|
_Form$useForm2 = slicedToArray_default()(_Form$useForm, 1),
|
|
|
form = _Form$useForm2[0];
|
|
|
var _useReducer = (0,_react_17_0_2_react.useReducer)(reducer, initialState),
|
|
|
_useReducer2 = slicedToArray_default()(_useReducer, 2),
|
|
|
state = _useReducer2[0],
|
|
|
dispatch = _useReducer2[1];
|
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
|
codeLoading = _useState2[0],
|
|
|
setCodeLoading = _useState2[1];
|
|
|
var timer = state.timer;
|
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(0),
|
|
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
|
changeImgNum = _useState4[0],
|
|
|
setChangeImgNum = _useState4[1];
|
|
|
var imgSrc = (0,_react_17_0_2_react.useMemo)(function () {
|
|
|
return '/rucaptcha?t=' + new Date().getTime();
|
|
|
}, [changeImgNum]);
|
|
|
function onFinish(_x) {
|
|
|
return _onFinish.apply(this, arguments);
|
|
|
}
|
|
|
function _onFinish() {
|
|
|
_onFinish = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(values) {
|
|
|
var login, password, code, _yield$register, message, status, addinfo, href;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
|
|
|
while (1) switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
login = values.login, password = values.password, code = values.code;
|
|
|
_context2.next = 3;
|
|
|
return register({
|
|
|
login: login,
|
|
|
password: password,
|
|
|
code: code
|
|
|
});
|
|
|
case 3:
|
|
|
_yield$register = _context2.sent;
|
|
|
message = _yield$register.message;
|
|
|
status = _yield$register.status;
|
|
|
if (!(status < 0)) {
|
|
|
_context2.next = 9;
|
|
|
break;
|
|
|
}
|
|
|
form.setFields([{
|
|
|
name: 'code',
|
|
|
errors: [message]
|
|
|
}]);
|
|
|
return _context2.abrupt("return");
|
|
|
case 9:
|
|
|
localStorage.removeItem('extension-modal');
|
|
|
es_message/* default */.ZP.info('注册成功');
|
|
|
addinfo = localStorage.getItem('addinfo');
|
|
|
if (addinfo === '2') {
|
|
|
localStorage.setItem('addinfo', '2');
|
|
|
href = localStorage.getItem('classromeurl');
|
|
|
_umi_production_exports.history.replace(href);
|
|
|
} else {
|
|
|
// history.replace('/');
|
|
|
_umi_production_exports.history.replace("/account/profile");
|
|
|
}
|
|
|
case 13:
|
|
|
case "end":
|
|
|
return _context2.stop();
|
|
|
}
|
|
|
}, _callee2);
|
|
|
}));
|
|
|
return _onFinish.apply(this, arguments);
|
|
|
}
|
|
|
function onValidateName() {
|
|
|
return _onValidateName.apply(this, arguments);
|
|
|
}
|
|
|
function _onValidateName() {
|
|
|
_onValidateName = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
|
|
|
var login, flag, _yield$validateName, status, message, isOk;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
|
|
|
while (1) switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
login = form.getFieldValue('login');
|
|
|
flag = 0;
|
|
|
if (!(!loginRegex.test(login) || login.indexOf(' ') > -1)) {
|
|
|
_context3.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
form.setFields([{
|
|
|
name: 'login',
|
|
|
errors: ['请输入正确的手机号或邮箱']
|
|
|
}]);
|
|
|
flag = 1;
|
|
|
return _context3.abrupt("return", flag);
|
|
|
case 6:
|
|
|
_context3.next = 8;
|
|
|
return validateName({
|
|
|
login: login,
|
|
|
type: 1
|
|
|
});
|
|
|
case 8:
|
|
|
_yield$validateName = _context3.sent;
|
|
|
status = _yield$validateName.status;
|
|
|
message = _yield$validateName.message;
|
|
|
isOk = status > 0;
|
|
|
if (isOk) {
|
|
|
flag = 2;
|
|
|
} else {
|
|
|
form.setFields([{
|
|
|
name: 'login',
|
|
|
errors: [message]
|
|
|
}]);
|
|
|
flag = 1;
|
|
|
}
|
|
|
return _context3.abrupt("return", flag);
|
|
|
case 14:
|
|
|
case "end":
|
|
|
return _context3.stop();
|
|
|
}
|
|
|
}, _callee3);
|
|
|
}));
|
|
|
return _onValidateName.apply(this, arguments);
|
|
|
}
|
|
|
var onGetCode = /*#__PURE__*/function () {
|
|
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
|
|
|
var verify, login, _yield$getCode, status, message;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
verify = form.getFieldValue('verify');
|
|
|
login = form.getFieldValue('login');
|
|
|
if (verify) {
|
|
|
_context.next = 6;
|
|
|
break;
|
|
|
}
|
|
|
form.validateFields(['verify']);
|
|
|
_context.next = 15;
|
|
|
break;
|
|
|
case 6:
|
|
|
setCodeLoading(true);
|
|
|
_context.next = 9;
|
|
|
return getCode({
|
|
|
login: login,
|
|
|
type: 1,
|
|
|
smscode: (0,util/* setmiyah */.M)(login)
|
|
|
});
|
|
|
case 9:
|
|
|
_yield$getCode = _context.sent;
|
|
|
status = _yield$getCode.status;
|
|
|
message = _yield$getCode.message;
|
|
|
if (status < 0) {
|
|
|
form.setFields([{
|
|
|
name: 'code',
|
|
|
errors: [message]
|
|
|
}]);
|
|
|
}
|
|
|
dispatch({
|
|
|
type: Types.setTimer,
|
|
|
payload: 60
|
|
|
});
|
|
|
setCodeLoading(false);
|
|
|
case 15:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
return function onGetCode() {
|
|
|
return _ref2.apply(this, arguments);
|
|
|
};
|
|
|
}();
|
|
|
function validatePassword(_, value) {
|
|
|
if (!value) {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
if (value.indexOf(' ') > -1) {
|
|
|
return Promise.reject('请输入8~16位字符,字母、数字和特殊符号至少包含2种');
|
|
|
}
|
|
|
var len = value.length;
|
|
|
if (len >= 8 && len <= 16) {
|
|
|
return Promise.resolve();
|
|
|
} else {
|
|
|
return Promise.reject('请输入8~16位字符,字母、数字和特殊符号至少包含2种');
|
|
|
}
|
|
|
}
|
|
|
var verifyValidate = function verifyValidate(_, value) {
|
|
|
return value ? Promise.resolve() : Promise.reject('请拖动滑块验证');
|
|
|
};
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
if (timer > 0) {
|
|
|
setTimeout(function () {
|
|
|
dispatch({
|
|
|
type: Types.setTimer,
|
|
|
payload: timer - 1
|
|
|
});
|
|
|
}, 1000);
|
|
|
}
|
|
|
}, [timer]);
|
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
|
var _globalSetting$settin;
|
|
|
if ((globalSetting === null || globalSetting === void 0 || (_globalSetting$settin = globalSetting.setting) === null || _globalSetting$settin === void 0 ? void 0 : _globalSetting$settin.close_register) === true) {
|
|
|
_umi_production_exports.history.replace('/404');
|
|
|
}
|
|
|
}, [globalSetting === null || globalSetting === void 0 || (_globalSetting$settin2 = globalSetting.setting) === null || _globalSetting$settin2 === void 0 ? void 0 : _globalSetting$settin2.close_register]);
|
|
|
var LoginValidate = function LoginValidate(_, value) {
|
|
|
if (!value) {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
if (value.indexOf(' ') > -1) {
|
|
|
return Promise.reject('请输入正确的手机号或邮箱');
|
|
|
}
|
|
|
if (loginRegex.test(value)) {
|
|
|
return Promise.resolve();
|
|
|
} else {
|
|
|
return Promise.reject('请输入正确的手机号或邮箱');
|
|
|
}
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
|
|
|
layout: "vertical",
|
|
|
form: form,
|
|
|
style: style,
|
|
|
initialValues: {
|
|
|
autologin: true,
|
|
|
protool: false
|
|
|
},
|
|
|
onFinish: onFinish,
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "login",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入正确的手机号或邮箱'
|
|
|
}, {
|
|
|
validator: LoginValidate
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: inputStyle,
|
|
|
autoComplete: "new-login",
|
|
|
size: "large",
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u624B\u673A\u53F7/\u90AE\u7BB1\u53F7",
|
|
|
onChange: function onChange() {
|
|
|
return form.setFieldsValue({
|
|
|
verify: 0
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "verify",
|
|
|
rules: [{
|
|
|
validator: verifyValidate
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(unlock/* default */.Z, {
|
|
|
onValidate: onValidateName
|
|
|
})
|
|
|
}), (!(globalSetting !== null && globalSetting !== void 0 && (_globalSetting$settin3 = globalSetting.setting) !== null && _globalSetting$settin3 !== void 0 && _globalSetting$settin3.is_local) || (globalSetting === null || globalSetting === void 0 || (_globalSetting$settin4 = globalSetting.setting) === null || _globalSetting$settin4 === void 0 ? void 0 : _globalSetting$settin4.is_need_code) == 'true') && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "code",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入验证码'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
suffix: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
loading: codeLoading,
|
|
|
type: "link",
|
|
|
onClick: onGetCode,
|
|
|
disabled: timer > 0,
|
|
|
children: [' ', timer === 0 ? '获取验证码' : "".concat(timer, "\u79D2\u53EF\u91CD\u65B0\u83B7\u53D6")]
|
|
|
}),
|
|
|
style: {
|
|
|
paddingRight: 2,
|
|
|
height: 48
|
|
|
},
|
|
|
placeholder: "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",
|
|
|
size: "large"
|
|
|
})
|
|
|
}), !(globalSetting !== null && globalSetting !== void 0 && (_globalSetting$settin5 = globalSetting.setting) !== null && _globalSetting$settin5 !== void 0 && _globalSetting$settin5.is_need_code) == 'true' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "code",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入验证码'
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
|
style: {
|
|
|
display: 'flex'
|
|
|
},
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
|
|
|
style: inputStyle
|
|
|
// visibilityToggle={false}
|
|
|
,
|
|
|
size: "large",
|
|
|
placeholder: "\u9A8C\u8BC1\u7801"
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
|
src: (env/* default */.Z === null || env/* default */.Z === void 0 ? void 0 : env/* default */.Z.API_SERVER) + imgSrc,
|
|
|
style: {
|
|
|
height: '32px',
|
|
|
marginLeft: '10px'
|
|
|
},
|
|
|
onClick: function onClick() {
|
|
|
// setImgsrc(ImgSrc + '/?t=' + Date.now())
|
|
|
setChangeImgNum(changeImgNum + 1);
|
|
|
// "this.src = '/rucaptcha/?t=' + Date.now();"
|
|
|
}
|
|
|
})]
|
|
|
})
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
name: "password",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请输入8~16位字符,字母、数字和特殊符号至少包含2种'
|
|
|
}, {
|
|
|
validator: validatePassword
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z.Password, {
|
|
|
autoComplete: "new-password",
|
|
|
style: inputStyle,
|
|
|
size: "large",
|
|
|
placeholder: "\u8F93\u51658\uFF5E16\u4F4D\u5BC6\u7801\uFF0C\u533A\u5206\u5927\u5C0F\u5199",
|
|
|
visibilityToggle: false
|
|
|
})
|
|
|
}), !(globalSetting !== null && globalSetting !== void 0 && (_globalSetting$settin6 = globalSetting.setting) !== null && _globalSetting$settin6 !== void 0 && _globalSetting$settin6.is_local) && /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
|
|
|
className: "service-terms",
|
|
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
noStyle: true,
|
|
|
name: "protool",
|
|
|
valuePropName: "checked",
|
|
|
rules: [{
|
|
|
validator: function validator(_, value) {
|
|
|
return value ? Promise.resolve() : Promise.reject('请同意《服务协议条款》');
|
|
|
}
|
|
|
}],
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
|
|
|
style: {
|
|
|
marginRight: 10
|
|
|
}
|
|
|
})
|
|
|
}), "\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F", ' ', /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
|
|
|
href: "https://engineer.educoder.net/help?index=4",
|
|
|
target: "_blank",
|
|
|
children: "\u300A\u670D\u52A1\u534F\u8BAE\u6761\u6B3E\u300B"
|
|
|
})]
|
|
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
|
|
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_button/* default */.ZP, {
|
|
|
size: "large",
|
|
|
type: "primary",
|
|
|
htmlType: "submit",
|
|
|
block: true,
|
|
|
style: inputStyle,
|
|
|
className: "font16",
|
|
|
children: [' ', buttonText, ' ']
|
|
|
})
|
|
|
})]
|
|
|
});
|
|
|
};
|
|
|
/* harmony default export */ var RegisterPanel = ((0,_umi_production_exports.connect)(function (_ref3) {
|
|
|
var globalSetting = _ref3.globalSetting;
|
|
|
return {
|
|
|
globalSetting: globalSetting
|
|
|
};
|
|
|
})(RegisterComponent));
|
|
|
// EXTERNAL MODULE: ./src/pages/User/Register/service.ts
|
|
|
var service = __webpack_require__(52167);
|
|
|
;// CONCATENATED MODULE: ./src/pages/User/Register/index.tsx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ var Register = (function () {
|
|
|
var registerPanelProps = {
|
|
|
getCode: service/* getValidateCode */.o1,
|
|
|
register: function () {
|
|
|
var _register2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(values) {
|
|
|
var response;
|
|
|
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
|
|
|
while (1) switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
_context.next = 2;
|
|
|
return (0,service/* register */.z2)(values);
|
|
|
case 2:
|
|
|
response = _context.sent;
|
|
|
return _context.abrupt("return", response);
|
|
|
case 4:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}, _callee);
|
|
|
}));
|
|
|
function register(_x) {
|
|
|
return _register2.apply(this, arguments);
|
|
|
}
|
|
|
return register;
|
|
|
}(),
|
|
|
validateName: service/* validateName */.Ol
|
|
|
};
|
|
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(RegisterPanel, objectSpread2_default()({}, registerPanelProps));
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 52167:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/pages/User/Register/service.ts ***!
|
|
|
\********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ Ol: function() { return /* binding */ validateName; },
|
|
|
/* harmony export */ c0: function() { return /* binding */ resetPassword; },
|
|
|
/* harmony export */ o1: function() { return /* binding */ getValidateCode; },
|
|
|
/* harmony export */ z2: function() { return /* binding */ register; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export wechatRegister */
|
|
|
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/fetch */ 93969);
|
|
|
|
|
|
//type 1 表示用户注册 2 忘记密码 3 绑定手机/邮箱
|
|
|
function validateName(params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)('accounts/valid_email_and_phone.json', params);
|
|
|
}
|
|
|
//type 1:用户注册注册 2:忘记密码 3:绑定手机 4: 绑定邮箱,5: 验收手机号有效
|
|
|
function getValidateCode(params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .get */ .U2)('accounts/get_verification_code.json', params);
|
|
|
}
|
|
|
function register(params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)('accounts/register.json', params);
|
|
|
}
|
|
|
function wechatRegister(params) {
|
|
|
return post('weapps/register.json', params);
|
|
|
}
|
|
|
function resetPassword(params) {
|
|
|
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_0__/* .post */ .v_)('accounts/reset_password.json', params);
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 24905:
|
|
|
/*!************************************************************************!*\
|
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules ***!
|
|
|
\************************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
Z: function() { return /* binding */ es_checkbox; }
|
|
|
});
|
|
|
|
|
|
// 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-checkbox@3.1.0@rc-checkbox/es/index.js
|
|
|
var es = __webpack_require__(5630);
|
|
|
// 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/config-provider/context.js
|
|
|
var config_provider_context = __webpack_require__(36355);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/DisabledContext.js
|
|
|
var DisabledContext = __webpack_require__(1684);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/context.js
|
|
|
var context = __webpack_require__(32441);
|
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/GroupContext.js
|
|
|
|
|
|
const GroupContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
|
/* harmony default export */ var checkbox_GroupContext = (GroupContext);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/style/index.js
|
|
|
var checkbox_style = __webpack_require__(98447);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/wave/index.js + 4 modules
|
|
|
var wave = __webpack_require__(14088);
|
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/wave/interface.js
|
|
|
var wave_interface = __webpack_require__(4572);
|
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/Checkbox.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 InternalCheckbox = (props, ref) => {
|
|
|
var _a;
|
|
|
const {
|
|
|
prefixCls: customizePrefixCls,
|
|
|
className,
|
|
|
rootClassName,
|
|
|
children,
|
|
|
indeterminate = false,
|
|
|
style,
|
|
|
onMouseEnter,
|
|
|
onMouseLeave,
|
|
|
skipGroup = false,
|
|
|
disabled
|
|
|
} = props,
|
|
|
restProps = __rest(props, ["prefixCls", "className", "rootClassName", "children", "indeterminate", "style", "onMouseEnter", "onMouseLeave", "skipGroup", "disabled"]);
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction,
|
|
|
checkbox
|
|
|
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
|
|
|
const checkboxGroup = _react_17_0_2_react.useContext(checkbox_GroupContext);
|
|
|
const {
|
|
|
isFormItemInput
|
|
|
} = _react_17_0_2_react.useContext(context/* FormItemInputContext */.aM);
|
|
|
const contextDisabled = _react_17_0_2_react.useContext(DisabledContext/* default */.Z);
|
|
|
const mergedDisabled = (_a = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled) || disabled) !== null && _a !== void 0 ? _a : contextDisabled;
|
|
|
const prevValue = _react_17_0_2_react.useRef(restProps.value);
|
|
|
_react_17_0_2_react.useEffect(() => {
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
|
|
false ? 0 : void 0;
|
|
|
}, []);
|
|
|
_react_17_0_2_react.useEffect(() => {
|
|
|
if (skipGroup) {
|
|
|
return;
|
|
|
}
|
|
|
if (restProps.value !== prevValue.current) {
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(prevValue.current);
|
|
|
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
|
|
prevValue.current = restProps.value;
|
|
|
}
|
|
|
return () => checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(restProps.value);
|
|
|
}, [restProps.value]);
|
|
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
|
|
const [wrapSSR, hashId] = (0,checkbox_style/* default */.ZP)(prefixCls);
|
|
|
const checkboxProps = Object.assign({}, restProps);
|
|
|
if (checkboxGroup && !skipGroup) {
|
|
|
checkboxProps.onChange = function () {
|
|
|
if (restProps.onChange) {
|
|
|
restProps.onChange.apply(restProps, arguments);
|
|
|
}
|
|
|
if (checkboxGroup.toggleOption) {
|
|
|
checkboxGroup.toggleOption({
|
|
|
label: children,
|
|
|
value: restProps.value
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
checkboxProps.name = checkboxGroup.name;
|
|
|
checkboxProps.checked = checkboxGroup.value.includes(restProps.value);
|
|
|
}
|
|
|
const classString = _classnames_2_5_1_classnames_default()(`${prefixCls}-wrapper`, {
|
|
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
|
[`${prefixCls}-wrapper-checked`]: checkboxProps.checked,
|
|
|
[`${prefixCls}-wrapper-disabled`]: mergedDisabled,
|
|
|
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput
|
|
|
}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.className, className, rootClassName, hashId);
|
|
|
const checkboxClass = _classnames_2_5_1_classnames_default()({
|
|
|
[`${prefixCls}-indeterminate`]: indeterminate
|
|
|
}, wave_interface/* TARGET_CLS */.A, hashId);
|
|
|
const ariaChecked = indeterminate ? 'mixed' : undefined;
|
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(wave/* default */.Z, {
|
|
|
component: "Checkbox",
|
|
|
disabled: mergedDisabled
|
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("label", {
|
|
|
className: classString,
|
|
|
style: Object.assign(Object.assign({}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.style), style),
|
|
|
onMouseEnter: onMouseEnter,
|
|
|
onMouseLeave: onMouseLeave
|
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, Object.assign({
|
|
|
"aria-checked": ariaChecked
|
|
|
}, checkboxProps, {
|
|
|
prefixCls: prefixCls,
|
|
|
className: checkboxClass,
|
|
|
disabled: mergedDisabled,
|
|
|
ref: ref
|
|
|
})), children !== undefined && /*#__PURE__*/_react_17_0_2_react.createElement("span", null, children))));
|
|
|
};
|
|
|
const Checkbox = /*#__PURE__*/_react_17_0_2_react.forwardRef(InternalCheckbox);
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var checkbox_Checkbox = (Checkbox);
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.26.0@@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
|
var toConsumableArray = __webpack_require__(26390);
|
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.1@rc-util/es/omit.js
|
|
|
var omit = __webpack_require__(7305);
|
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/Group.js
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
var Group_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 InternalGroup = (props, ref) => {
|
|
|
const {
|
|
|
defaultValue,
|
|
|
children,
|
|
|
options = [],
|
|
|
prefixCls: customizePrefixCls,
|
|
|
className,
|
|
|
rootClassName,
|
|
|
style,
|
|
|
onChange
|
|
|
} = props,
|
|
|
restProps = Group_rest(props, ["defaultValue", "children", "options", "prefixCls", "className", "rootClassName", "style", "onChange"]);
|
|
|
const {
|
|
|
getPrefixCls,
|
|
|
direction
|
|
|
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
|
|
|
const [value, setValue] = _react_17_0_2_react.useState(restProps.value || defaultValue || []);
|
|
|
const [registeredValues, setRegisteredValues] = _react_17_0_2_react.useState([]);
|
|
|
_react_17_0_2_react.useEffect(() => {
|
|
|
if ('value' in restProps) {
|
|
|
setValue(restProps.value || []);
|
|
|
}
|
|
|
}, [restProps.value]);
|
|
|
const memoOptions = _react_17_0_2_react.useMemo(() => options.map(option => {
|
|
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
|
return {
|
|
|
label: option,
|
|
|
value: option
|
|
|
};
|
|
|
}
|
|
|
return option;
|
|
|
}), [options]);
|
|
|
const cancelValue = val => {
|
|
|
setRegisteredValues(prevValues => prevValues.filter(v => v !== val));
|
|
|
};
|
|
|
const registerValue = val => {
|
|
|
setRegisteredValues(prevValues => [].concat((0,toConsumableArray/* default */.Z)(prevValues), [val]));
|
|
|
};
|
|
|
const toggleOption = option => {
|
|
|
const optionIndex = value.indexOf(option.value);
|
|
|
const newValue = (0,toConsumableArray/* default */.Z)(value);
|
|
|
if (optionIndex === -1) {
|
|
|
newValue.push(option.value);
|
|
|
} else {
|
|
|
newValue.splice(optionIndex, 1);
|
|
|
}
|
|
|
if (!('value' in restProps)) {
|
|
|
setValue(newValue);
|
|
|
}
|
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue.filter(val => registeredValues.includes(val)).sort((a, b) => {
|
|
|
const indexA = memoOptions.findIndex(opt => opt.value === a);
|
|
|
const indexB = memoOptions.findIndex(opt => opt.value === b);
|
|
|
return indexA - indexB;
|
|
|
}));
|
|
|
};
|
|
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
|
|
const groupPrefixCls = `${prefixCls}-group`;
|
|
|
const [wrapSSR, hashId] = (0,checkbox_style/* default */.ZP)(prefixCls);
|
|
|
const domProps = (0,omit/* default */.Z)(restProps, ['value', 'disabled']);
|
|
|
const childrenNode = options.length ? memoOptions.map(option => /*#__PURE__*/_react_17_0_2_react.createElement(checkbox_Checkbox, {
|
|
|
prefixCls: prefixCls,
|
|
|
key: option.value.toString(),
|
|
|
disabled: 'disabled' in option ? option.disabled : restProps.disabled,
|
|
|
value: option.value,
|
|
|
checked: value.includes(option.value),
|
|
|
onChange: option.onChange,
|
|
|
className: `${groupPrefixCls}-item`,
|
|
|
style: option.style,
|
|
|
title: option.title
|
|
|
}, option.label)) : children;
|
|
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
|
const context = {
|
|
|
toggleOption,
|
|
|
value,
|
|
|
disabled: restProps.disabled,
|
|
|
name: restProps.name,
|
|
|
// https://github.com/ant-design/ant-design/issues/16376
|
|
|
registerValue,
|
|
|
cancelValue
|
|
|
};
|
|
|
const classString = _classnames_2_5_1_classnames_default()(groupPrefixCls, {
|
|
|
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
|
|
|
}, className, rootClassName, hashId);
|
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({
|
|
|
className: classString,
|
|
|
style: style
|
|
|
}, domProps, {
|
|
|
ref: ref
|
|
|
}), /*#__PURE__*/_react_17_0_2_react.createElement(checkbox_GroupContext.Provider, {
|
|
|
value: context
|
|
|
}, childrenNode)));
|
|
|
};
|
|
|
|
|
|
const CheckboxGroup = /*#__PURE__*/_react_17_0_2_react.forwardRef(InternalGroup);
|
|
|
/* harmony default export */ var Group = (/*#__PURE__*/_react_17_0_2_react.memo(CheckboxGroup));
|
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
const es_checkbox_Checkbox = checkbox_Checkbox;
|
|
|
es_checkbox_Checkbox.Group = Group;
|
|
|
es_checkbox_Checkbox.__ANT_CHECKBOX = true;
|
|
|
if (false) {}
|
|
|
/* harmony default export */ var es_checkbox = (es_checkbox_Checkbox);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 98447:
|
|
|
/*!******************************************************************!*\
|
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/checkbox/style/index.js ***!
|
|
|
\******************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ C2: function() { return /* binding */ getStyle; }
|
|
|
/* harmony export */ });
|
|
|
/* unused harmony export genCheckboxStyle */
|
|
|
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style */ 17313);
|
|
|
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ 37613);
|
|
|
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ 83116);
|
|
|
|
|
|
|
|
|
// ============================== Styles ==============================
|
|
|
const genCheckboxStyle = token => {
|
|
|
const {
|
|
|
checkboxCls
|
|
|
} = token;
|
|
|
const wrapperCls = `${checkboxCls}-wrapper`;
|
|
|
return [
|
|
|
// ===================== Basic =====================
|
|
|
{
|
|
|
// Group
|
|
|
[`${checkboxCls}-group`]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .resetComponent */ .Wf)(token)), {
|
|
|
display: 'inline-flex',
|
|
|
flexWrap: 'wrap',
|
|
|
columnGap: token.marginXS,
|
|
|
// Group > Grid
|
|
|
[`> ${token.antCls}-row`]: {
|
|
|
flex: 1
|
|
|
}
|
|
|
}),
|
|
|
// Wrapper
|
|
|
[wrapperCls]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .resetComponent */ .Wf)(token)), {
|
|
|
display: 'inline-flex',
|
|
|
alignItems: 'baseline',
|
|
|
cursor: 'pointer',
|
|
|
// Fix checkbox & radio in flex align #30260
|
|
|
'&:after': {
|
|
|
display: 'inline-block',
|
|
|
width: 0,
|
|
|
overflow: 'hidden',
|
|
|
content: "'\\a0'"
|
|
|
},
|
|
|
// Checkbox near checkbox
|
|
|
[`& + ${wrapperCls}`]: {
|
|
|
marginInlineStart: 0
|
|
|
},
|
|
|
[`&${wrapperCls}-in-form-item`]: {
|
|
|
'input[type="checkbox"]': {
|
|
|
width: 14,
|
|
|
height: 14 // FIXME: magic
|
|
|
}
|
|
|
}
|
|
|
}),
|
|
|
|
|
|
// Wrapper > Checkbox
|
|
|
[checkboxCls]: Object.assign(Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .resetComponent */ .Wf)(token)), {
|
|
|
position: 'relative',
|
|
|
whiteSpace: 'nowrap',
|
|
|
lineHeight: 1,
|
|
|
cursor: 'pointer',
|
|
|
borderRadius: token.borderRadiusSM,
|
|
|
// To make alignment right when `controlHeight` is changed
|
|
|
// Ref: https://github.com/ant-design/ant-design/issues/41564
|
|
|
alignSelf: 'center',
|
|
|
// Wrapper > Checkbox > input
|
|
|
[`${checkboxCls}-input`]: {
|
|
|
position: 'absolute',
|
|
|
// Since baseline align will get additional space offset,
|
|
|
// we need to move input to top to make it align with text.
|
|
|
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
|
|
|
inset: 0,
|
|
|
zIndex: 1,
|
|
|
cursor: 'pointer',
|
|
|
opacity: 0,
|
|
|
margin: 0,
|
|
|
[`&:focus-visible + ${checkboxCls}-inner`]: Object.assign({}, (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .genFocusOutline */ .oN)(token))
|
|
|
},
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
boxSizing: 'border-box',
|
|
|
position: 'relative',
|
|
|
top: 0,
|
|
|
insetInlineStart: 0,
|
|
|
display: 'block',
|
|
|
width: token.checkboxSize,
|
|
|
height: token.checkboxSize,
|
|
|
direction: 'ltr',
|
|
|
backgroundColor: token.colorBgContainer,
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
|
|
borderRadius: token.borderRadiusSM,
|
|
|
borderCollapse: 'separate',
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
'&:after': {
|
|
|
boxSizing: 'border-box',
|
|
|
position: 'absolute',
|
|
|
top: '50%',
|
|
|
insetInlineStart: '21.5%',
|
|
|
display: 'table',
|
|
|
width: token.checkboxSize / 14 * 5,
|
|
|
height: token.checkboxSize / 14 * 8,
|
|
|
border: `${token.lineWidthBold}px solid ${token.colorWhite}`,
|
|
|
borderTop: 0,
|
|
|
borderInlineStart: 0,
|
|
|
transform: 'rotate(45deg) scale(0) translate(-50%,-50%)',
|
|
|
opacity: 0,
|
|
|
content: '""',
|
|
|
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`
|
|
|
}
|
|
|
},
|
|
|
// Wrapper > Checkbox + Text
|
|
|
'& + span': {
|
|
|
paddingInlineStart: token.paddingXS,
|
|
|
paddingInlineEnd: token.paddingXS
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// ===================== Hover =====================
|
|
|
{
|
|
|
// Wrapper & Wrapper > Checkbox
|
|
|
[`
|
|
|
${wrapperCls}:not(${wrapperCls}-disabled),
|
|
|
${checkboxCls}:not(${checkboxCls}-disabled)
|
|
|
`]: {
|
|
|
[`&:hover ${checkboxCls}-inner`]: {
|
|
|
borderColor: token.colorPrimary
|
|
|
}
|
|
|
},
|
|
|
[`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
|
|
|
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimaryHover,
|
|
|
borderColor: 'transparent'
|
|
|
},
|
|
|
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
|
|
|
borderColor: token.colorPrimaryHover
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ==================== Checked ====================
|
|
|
{
|
|
|
// Wrapper > Checkbox
|
|
|
[`${checkboxCls}-checked`]: {
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimary,
|
|
|
borderColor: token.colorPrimary,
|
|
|
'&:after': {
|
|
|
opacity: 1,
|
|
|
transform: 'rotate(45deg) scale(1) translate(-50%,-50%)',
|
|
|
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
[`
|
|
|
${wrapperCls}-checked:not(${wrapperCls}-disabled),
|
|
|
${checkboxCls}-checked:not(${checkboxCls}-disabled)
|
|
|
`]: {
|
|
|
[`&:hover ${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorPrimaryHover,
|
|
|
borderColor: 'transparent'
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ================= Indeterminate =================
|
|
|
{
|
|
|
[checkboxCls]: {
|
|
|
'&-indeterminate': {
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
backgroundColor: token.colorBgContainer,
|
|
|
borderColor: token.colorBorder,
|
|
|
'&:after': {
|
|
|
top: '50%',
|
|
|
insetInlineStart: '50%',
|
|
|
width: token.fontSizeLG / 2,
|
|
|
height: token.fontSizeLG / 2,
|
|
|
backgroundColor: token.colorPrimary,
|
|
|
border: 0,
|
|
|
transform: 'translate(-50%, -50%) scale(1)',
|
|
|
opacity: 1,
|
|
|
content: '""'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// ==================== Disable ====================
|
|
|
{
|
|
|
// Wrapper
|
|
|
[`${wrapperCls}-disabled`]: {
|
|
|
cursor: 'not-allowed'
|
|
|
},
|
|
|
// Wrapper > Checkbox
|
|
|
[`${checkboxCls}-disabled`]: {
|
|
|
// Wrapper > Checkbox > input
|
|
|
[`&, ${checkboxCls}-input`]: {
|
|
|
cursor: 'not-allowed',
|
|
|
// Disabled for native input to enable Tooltip event handler
|
|
|
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
|
|
|
pointerEvents: 'none'
|
|
|
},
|
|
|
// Wrapper > Checkbox > inner
|
|
|
[`${checkboxCls}-inner`]: {
|
|
|
background: token.colorBgContainerDisabled,
|
|
|
borderColor: token.colorBorder,
|
|
|
'&:after': {
|
|
|
borderColor: token.colorTextDisabled
|
|
|
}
|
|
|
},
|
|
|
'&:after': {
|
|
|
display: 'none'
|
|
|
},
|
|
|
'& + span': {
|
|
|
color: token.colorTextDisabled
|
|
|
},
|
|
|
[`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
|
|
|
background: token.colorTextDisabled
|
|
|
}
|
|
|
}
|
|
|
}];
|
|
|
};
|
|
|
// ============================== Export ==============================
|
|
|
function getStyle(prefixCls, token) {
|
|
|
const checkboxToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__/* .merge */ .TS)(token, {
|
|
|
checkboxCls: `.${prefixCls}`,
|
|
|
checkboxSize: token.controlInteractiveSize
|
|
|
});
|
|
|
return [genCheckboxStyle(checkboxToken)];
|
|
|
}
|
|
|
/* harmony default export */ __webpack_exports__.ZP = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)('Checkbox', (token, _ref) => {
|
|
|
let {
|
|
|
prefixCls
|
|
|
} = _ref;
|
|
|
return [getStyle(prefixCls, token)];
|
|
|
}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 5630:
|
|
|
/*!*****************************************************************!*\
|
|
|
!*** ./node_modules/_rc-checkbox@3.1.0@rc-checkbox/es/index.js ***!
|
|
|
\*****************************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* unused harmony export Checkbox */
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ 5891);
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ 57259);
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ 80962);
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ 29043);
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ 19149);
|
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ 92310);
|
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
/* harmony import */ var rc_util_es_hooks_useMergedState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rc-util/es/hooks/useMergedState */ 14283);
|
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["prefixCls", "className", "style", "checked", "disabled", "defaultChecked", "type", "title", "onChange"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Checkbox = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)(function (props, ref) {
|
|
|
var _classNames;
|
|
|
var _props$prefixCls = props.prefixCls,
|
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-checkbox' : _props$prefixCls,
|
|
|
className = props.className,
|
|
|
style = props.style,
|
|
|
checked = props.checked,
|
|
|
disabled = props.disabled,
|
|
|
_props$defaultChecked = props.defaultChecked,
|
|
|
defaultChecked = _props$defaultChecked === void 0 ? false : _props$defaultChecked,
|
|
|
_props$type = props.type,
|
|
|
type = _props$type === void 0 ? 'checkbox' : _props$type,
|
|
|
title = props.title,
|
|
|
onChange = props.onChange,
|
|
|
inputProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(props, _excluded);
|
|
|
var inputRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);
|
|
|
var _useMergedState = (0,rc_util_es_hooks_useMergedState__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(defaultChecked, {
|
|
|
value: checked
|
|
|
}),
|
|
|
_useMergedState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(_useMergedState, 2),
|
|
|
rawValue = _useMergedState2[0],
|
|
|
setRawValue = _useMergedState2[1];
|
|
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref, function () {
|
|
|
return {
|
|
|
focus: function focus() {
|
|
|
var _inputRef$current;
|
|
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
|
},
|
|
|
blur: function blur() {
|
|
|
var _inputRef$current2;
|
|
|
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
|
|
|
},
|
|
|
input: inputRef.current
|
|
|
};
|
|
|
});
|
|
|
var classString = classnames__WEBPACK_IMPORTED_MODULE_0___default()(prefixCls, className, (_classNames = {}, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-checked"), rawValue), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
|
|
|
var handleChange = function handleChange(e) {
|
|
|
if (disabled) {
|
|
|
return;
|
|
|
}
|
|
|
if (!('checked' in props)) {
|
|
|
setRawValue(e.target.checked);
|
|
|
}
|
|
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
|
target: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)({}, props), {}, {
|
|
|
type: type,
|
|
|
checked: e.target.checked
|
|
|
}),
|
|
|
stopPropagation: function stopPropagation() {
|
|
|
e.stopPropagation();
|
|
|
},
|
|
|
preventDefault: function preventDefault() {
|
|
|
e.preventDefault();
|
|
|
},
|
|
|
nativeEvent: e.nativeEvent
|
|
|
});
|
|
|
};
|
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement("span", {
|
|
|
className: classString,
|
|
|
title: title,
|
|
|
style: style
|
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement("input", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)({}, inputProps, {
|
|
|
className: "".concat(prefixCls, "-input"),
|
|
|
ref: inputRef,
|
|
|
onChange: handleChange,
|
|
|
disabled: disabled,
|
|
|
checked: !!rawValue,
|
|
|
type: type
|
|
|
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement("span", {
|
|
|
className: "".concat(prefixCls, "-inner")
|
|
|
}));
|
|
|
});
|
|
|
/* harmony default export */ __webpack_exports__.Z = (Checkbox);
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |