1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102 |
- import React, { Component } from 'react';
- import { connect } from 'dva';
- import { Form, Input, Modal, Button } from 'antd';
- import styles from './Login.less';
- import global from '@/global.less';
- import {
- failTip,
- sucTip,
- setLocalStorageTime,
- sldSvgIcon,
- saveSettleData,
- sldCheckMobile,
- getSldImgSet,sldComLanguage,mobile_reg
- } from '@/utils/utils';
- import router from 'umi/router';
- const FormItem = Form.Item;
- let admin_login_logo = require('../../assets/logo.png');
- let main_seller_center_logo_local = admin_login_logo;
- let com_img_login_info = getSldImgSet('com_img_login_info');
- if (com_img_login_info != '') {
- admin_login_logo = com_img_login_info.filter(item => item.name == 'main_seller_center_logo')[0].imageUrl || main_seller_center_logo_local;
- //admin_login_logo = com_img_info
- }
- const default_login_img = {
- admin_login_bg: require('../../assets/supplier_login_bg.jpg'),//登录背景
- admin_login_left_bg: require('../../assets/sld_login_left.png'),//登录左侧图片
- main_seller_center_logo: admin_login_logo,//登录页logo
- vendor_login_head_portrait: require('../../assets/touxiang@2x.png'),//操作成功头像
- };
- @connect(({ login, common }) => ({
- login, common,
- }))
- @Form.create()
- export default class LoginPage extends Component {
- state = {
- countDownC: false, //短信验证码防抖动
- countDownM: 0, //短信验证码倒计时
- type: 'account',
- autoLogin: true,
- login_img: {},
- error_info: '', //登录错误提示信息
- is_show_err: false,
- register_error_info: '', //注册错误提示信息
- is_show_registe_err: false,
- register_captcha: '',//注册——图形验证码
- login_captcha: '',//登录——图形验证码
- visibleModal: false,
- modal_type: 'register', //区分忘记密码和立即注册弹框
- visibleModalSuccess: false,
- //商家账号
- is_show_account_err:false,
- account_error_info:'',
- //手机号
- is_show_phone_err:false,
- phone_error_info:'',
- //验证码
- is_show_code_err:false,
- code_error_info:'',
- //短信验证码
- is_show_phonecode_err:false,
- phonecode_error_info:'',
- //邮箱
- is_show_email_err:false,
- email_error_info:'',
- //密码
- is_show_pwd_err:false,
- pwd_error_info:'',
- //确认密码
- is_show_comfirepwd_err:false,
- comfirepwd_error_info:'',
- // 提交注册按钮加载loading
- loading: false
- };
- register_captcha = '';//注册——图形验证码key
- login_captcha = '';//登录——图形验证码key
- componentDidMount() {
- localStorage.clear();
- this.get_init_img();
- this.get_login_out_img();
- this.getCaptcha('register_captcha');
- this.getCaptcha('login_captcha');
- }
- //获取图形验证码
- getCaptcha = (type) => {
- const { dispatch } = this.props;
- dispatch({
- type: 'common/get_captcha',
- callback: (res) => {
- if (res.state == 200) {
- this[type] = res.data.key;
- this.setState({ [type]: 'data:image/png;base64,' + res.data.captcha });
- }
- },
- });
- };
- //获取登陆页面logo
- get_login_out_img = () => {
- const { dispatch } = this.props;
- let { login_img } = this.state;
- dispatch({
- type: 'login/get_login_out_img',
- callback: (res) => {
- if (res.state == 200) {
- login_img = { ...default_login_img };
- res.data.map(item => {
- if (item.imageUrl) {
- login_img[item.name] = item.imageUrl;
- }
- });
- localStorage.setItem('com_img_login_info', JSON.stringify(res.data));
- this.setState({ login_img });
- }
- },
- });
- }
- //获取登陆后左上角logo
- get_init_img = () => {
- const { dispatch } = this.props;
- dispatch({
- type: 'login/get_login_img',
- callback: (res) => {
- if (res.state == 200) {
- localStorage.setItem('com_img_info', JSON.stringify(res.data));
- }
- },
- });
- };
- //登录操作
- handleSubmits = () => {
- this.props.form.validateFieldsAndScroll(['username', 'password', 'verifyCode'], (err, values) => {
- if (values.username == undefined || values.username == '') {
- failTip(`${sldComLanguage('用户名不能为空')}`);
- } else if (values.password == undefined || values.password == '') {
- failTip(`${sldComLanguage('密码不能为空')}`);
- } else if (values.verifyCode == undefined || values.verifyCode == '') {
- failTip(`${sldComLanguage('验证码不能为空')}`);
- } else {
- //用户登录
- values.verifyKey = this.login_captcha;
- const { dispatch } = this.props;
- dispatch({
- type: 'login/login',
- payload: { ...values },
- callback: (res) => {
- if (res.state == 200 || res.state == 267) {
- localStorage.setItem('sld_token', res.data.access_token);
- localStorage.setItem('sld_refresh_token', res.data.refresh_token);
- {
- setLocalStorageTime();
- }
- localStorage.setItem('user_info', JSON.stringify({ user_name: res.data.vendorName, vendorMobile: res.data.vendorMobile }));
- if (res.state == 267) {
- //登录的时候初始化入驻状态
- if (res.data.applyState == 0) {
- //未入驻
- saveSettleData('state', '');
- saveSettleData('cur_step', 0);
- router.push('/apply/settled_protocol');
- } else {
- saveSettleData('cur_step', 3);
- router.push('/apply/open_up');
- }
- } else {
- // dispatch({ type: 'global/get_site_list_data' });
- }
- } else {
- failTip(res.msg);
- this.getCaptcha('login_captcha');
- }
- },
- });
- }
- });
- };
- showDefault = (type) => {
- let { login_img } = this.state;
- login_img[type] = default_login_img[type];
- this.setState({ login_img });
- };
- handleUserRegisterAgreement = () => {
- window.open("/agreement/detail?type=1", '_blank');
- };
- handleUserPrivacyPolicy = () => {
- window.open("/agreement/detail?type=2", '_blank');
- };
- handleForgetPwd = () => {
- this.setState({
- title: `${sldComLanguage('找回密码')}`,
- visibleModal: true,
- modal_type: 'forgetPwd',
- });
- };
- handleRegister = () => {
- this.getCaptcha('register_captcha');
- this.setState({
- title: `${sldComLanguage('商家账号注册')}`,
- visibleModal: true,
- modal_type: 'register',
- });
- };
- //验证商家账户
- checkVendorName = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_account_err: true,
- account_error_info: `${sldComLanguage('请输入商家账号')}`,
- });
- return;
- }
- if (value.length < 6 || value.length > 20) {
- callback('');
- this.setState({
- is_show_account_err: true,
- account_error_info: `${sldComLanguage('请输入6-20位的字母、数字或符号的商家账号')}`,
- });
- }
- // else if (!(/^[0-9a-zA-Z]+$/.test(value))) {
- // callback('');
- // this.setState({
- // is_show_account_err: true,
- // account_error_info: `${sldComLanguage('商户账号只能输入数字和字母')}`,
- // });
- // } else if (/^[0-9]+$/.test(value)) {
- // callback('');
- // this.setState({
- // is_show_account_err: true,
- // account_error_info: `${sldComLanguage('商户账号不能输入纯数字')}`,
- // });
- // } else if (/^[a-zA-Z]+$/.test(value)) {
- // callback('');
- // this.setState({
- // is_show_account_err: true,
- // account_error_info: `${sldComLanguage('商户账号不能输入纯字母')}`,
- // });
- // }
- else {
- callback();
- this.setState({
- is_show_account_err: false,
- account_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- //验证图像验证码
- checkImgCode = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_code_err: true,
- code_error_info: `${sldComLanguage('请输入图形验证码')}`,
- });
- return;
- }
- if (value.length < 4 || !(/^[0-9a-zA-Z]+$/.test(value))) {
- callback('');
- this.setState({
- is_show_code_err: true,
- code_error_info: `${sldComLanguage('请输入正确的图形验证码')}`,
- });
- }else {
- callback();
- this.setState({
- is_show_code_err: false,
- code_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- //验证短信验证码
- checkSmsCode = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_phonecode_err: true,
- phonecode_error_info: `${sldComLanguage('请输入短信验证码')}`,
- });
- return;
- }
- if (value.length < 6 || !(/^[0-9]+$/.test(value))) {
- callback('');
- this.setState({
- is_show_phonecode_err: true,
- phonecode_error_info: `${sldComLanguage('请输入正确的短信验证码')}`,
- });
- }else {
- callback();
- this.setState({
- is_show_phonecode_err: false,
- phonecode_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- checkPassword = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_pwd_err: true,
- pwd_error_info: `${sldComLanguage('请输入密码')}`,
- });
- return
- }
- if (value.length < 6 || value.length > 20) {
- callback('');
- this.setState({
- is_show_pwd_err: true,
- pwd_error_info: `${sldComLanguage('请输入6~20位密码')}`,
- });
- } else {
- if (/[\u4E00-\u9FA5]/g.test(value)) {
- callback('');
- this.setState({
- is_show_pwd_err: true,
- pwd_error_info: `${sldComLanguage('密码不可以有中文')}`,
- });
- }else if(!(/^\S*$/.test(value))){
- callback('');
- this.setState({
- is_show_pwd_err: true,
- pwd_error_info: `${sldComLanguage('密码中不可以有空格')}`,
- });
- }
- callback();
- this.setState({
- is_show_pwd_err: false,
- pwd_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- //确认密码
- checkConfirmPassword = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_comfirepwd_err: true,
- comfirepwd_error_info: `${sldComLanguage('请输入确认密码')}`,
- });
- return
- }
- if (value.length < 6 || value.length > 20) {
- callback('');
- this.setState({
- is_show_comfirepwd_err: true,
- comfirepwd_error_info: `${sldComLanguage('请输入6~20位密码')}`,
- });
- } else {
- if (/[\u4E00-\u9FA5]/g.test(value)) {
- callback('');
- this.setState({
- is_show_comfirepwd_err: true,
- comfirepwd_error_info: `${sldComLanguage('密码不可以有中文')}`,
- });
- }else if(!(/^\S*$/.test(value))){
- callback('');
- this.setState({
- is_show_comfirepwd_err: true,
- comfirepwd_error_info: `${sldComLanguage('密码中不可以有空格')}`,
- });
- }
- callback();
- this.setState({
- is_show_comfirepwd_err: false,
- comfirepwd_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- //验证手机
- checkMobile = (rule, value, callback) => {
- if(!value){
- callback('');
- this.setState({
- is_show_phone_err: true,
- phone_error_info: `${sldComLanguage('请输入手机号')}`,
- });
- return
- }
- if (!mobile_reg.test(value)) {
- callback('');
- this.setState({
- is_show_phone_err: true,
- phone_error_info: `${sldComLanguage('请输入正确的手机号')}`,
- });
- } else {
- callback();
- this.setState({
- is_show_phone_err: false,
- phone_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- //验证邮箱
- checkEmail = (rule, value, callback) => {
- let emailReg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
- if (value&&value.length != undefined && value.length > 100) {
- callback('');
- this.setState({
- is_show_email_err: true,
- email_error_info: `${sldComLanguage('最多输入100位')}`,
- });
- }
- if (value && !emailReg.test(value)) {
- callback('');
- this.setState({
- is_show_email_err: true,
- email_error_info: `${sldComLanguage('请输入正确的邮箱')}`,
- });
- } else {
- callback();
- this.setState({
- is_show_email_err: false,
- email_error_info: `${sldComLanguage('')}`,
- });
- }
- };
- handleCancelModal = () => {
- this.setState({
- visibleModal: false,
- visibleModalSuccess: false,
- //商家账号
- is_show_account_err:false,
- account_error_info:'',
- //手机号
- is_show_phone_err:false,
- phone_error_info:'',
- //验证码
- is_show_code_err:false,
- code_error_info:'',
- //短信验证码
- is_show_phonecode_err:false,
- phonecode_error_info:'',
- //邮箱
- is_show_email_err:false,
- email_error_info:'',
- //密码
- is_show_pwd_err:false,
- pwd_error_info:'',
- //确认密码
- is_show_comfirepwd_err:false,
- comfirepwd_error_info:'',
- });
- this.props.form.resetFields();
- };
- handleOkModal = (e) => {
- e.preventDefault();
- const { modal_type } = this.state;
- if (modal_type == 'register') {
- this.handleOkModalRegister();
- } else {
- this.handleOkModalForget();
- }
- };
- handleOkModalRegister = () => {
- let _this = this;
- this.props.form.validateFieldsAndScroll(['vendorName', 'vendorPassword', 'vendorEmail', 'confirmPassword', 'vendorMobile', 'verifyCode', 'smsCode'], (err, values) => {
- if(!err){
- if (values.vendorPassword != values.confirmPassword) {
- this.setState({
- pwd_error_info: `${sldComLanguage('密码和确认密码不一致')}`,
- is_show_pwd_err: true,
- });
- return false;
- }
- this.setState({loading: true});
- values.verifyKey = this.register_captcha;
- const { dispatch } = this.props;
- dispatch({
- type: 'login/register',
- payload: values,
- callback: res => {
- if (res.state == 267) {
- {
- setLocalStorageTime();
- }
- localStorage.setItem('sld_token', res.data.access_token);
- localStorage.setItem('sld_refresh_token', res.data.refresh_token);
- localStorage.setItem('user_info', JSON.stringify({ user_name: values.vendorNam, vendorMobile: values.vendorMobile }));
- saveSettleData('state', '');
- saveSettleData('cur_step', 0);
- this.setState({
- visibleModal: false,
- visibleModalSuccess: true,
- }, () => {
- //自动请求更新验证码
- _this.getCaptcha('register_captcha');
- });
- } else {
- //自动请求更新验证码
- this.getCaptcha('register_captcha');
- if(res.msg == '短信验证码不正确'){
- this.setState({
- is_show_phonecode_err: true,
- phonecode_error_info: res.msg,
- });
- }
- else if(res.msg == '图形验证码不正确'){
- this.setState({
- is_show_code_err: true,
- code_error_info: res.msg,
- });
- }
- else if(res.msg == '该手机号已注册'){
- this.setState({
- is_show_phone_err: true,
- phone_error_info: res.msg,
- });
- }
- else{
- this.setState({
- is_show_registe_err: true,
- register_error_info: res.msg,
- });
- }
- }
- this.setState({loading: false});
- },
- });
- }else{
- }
- });
- };
- handleOkModalForget = () => {
- this.props.form.validateFieldsAndScroll(['vendorPassword', 'confirmPassword', 'vendorName', 'vendorMobile', 'smsCode'], (err, values) => {
- if (!err) {
- if (values.vendorPassword != values.confirmPassword) {
- this.setState({
- pwd_error_info: `${sldComLanguage('新密码和确认密码不一致')}`,
- is_show_pwd_err: true,
- });
- return false;
- }
- const { dispatch } = this.props;
- let param = {};
- param.mobile = values.vendorMobile;
- param.smsCode = values.smsCode;
- param.newPwd = values.vendorPassword;
- param.vendorName = values.vendorName;
- param.confirmPwd = values.confirmPassword;
- dispatch({
- type: 'login/lookForPwd',
- payload: param,
- callback: res => {
- if (res.state == 200) {
- sucTip(`${sldComLanguage('恭喜你!成功找回密码')}`);
- this.handleCancelModal();
- // this.setState({
- // visibleModal: false,
- // });
- } else {
- if(res.msg == '对不起,该手机号未注册' || res.msg == '该手机号已被其他账号绑定,请重新填写'){
- this.setState({
- is_show_phone_err: true,
- phone_error_info: res.msg,
- });
- }
- else if(res.msg == '短信验证码不正确'){
- this.setState({
- is_show_phonecode_err: true,
- phonecode_error_info: res.msg,
- });
- }
- else if(res.msg == '新密码与确认密码不一致'){
- this.setState({
- is_show_pwd_err: true,
- pwd_error_info: res.msg,
- });
- }
- else{
- this.setState({
- is_show_registe_err: true,
- register_error_info: res.msg,
- });
- }
- }
- },
- });
- }
- });
- };
- handleSuccessBtn = () => {
- let { modal_type } = this.state;
- if (modal_type == 'register') {
- //去入驻
- router.replace('/apply/settled_protocol');
- } else {
- //去登陆
- router.replace('/user/login');
- }
- };
- handleChangeRegister = () => {
- this.setState({
- is_show_registe_err: false,
- });
- };
- //倒计时
- countDown = () => {
- let { countDownM } = this.state;
- countDownM = countDownM - 1;
- let _this = this;
- this.setState({
- countDownM,
- }, () => {
- if (countDownM == 0) {
- clearTimeout(_this.timeOutId);
- } else {
- _this.timeOutId = setTimeout(() => _this.countDown(), 1000);
- }
- });
- };
- //获取短信验证码
- getSmsCode(type) {
- if (this.state.countDownC) {
- return;
- } else if (this.state.countDownM) {
- return;
- }
- let mobile = this.props.form.getFieldValue('vendorMobile');
- let captcha = this.props.form.getFieldValue('verifyCode');//图形验证码
- if (mobile == undefined || (mobile != undefined && !mobile)) {
- this.setState({
- is_show_phone_err: true,
- phone_error_info: `${sldComLanguage('请输入手机号')}`,
- });
- } else if (!sldCheckMobile(mobile)) {
- this.setState({
- is_show_phone_err: true,
- phone_error_info: `${sldComLanguage('请输入正确的手机号')}`,
- });
- } else if (type == 'register' && (captcha == undefined || (captcha != undefined && !captcha))) {
- this.setState({
- is_show_code_err: true,
- code_error_info: `${sldComLanguage('请输入图形验证码')}`,
- });
- } else {
- const { dispatch } = this.props;
- let _this = this;
- let param = {};
- param.mobile = mobile;
- param.type = type;
- if (type == 'register') {
- param.verifyCode = captcha;
- param.verifyKey = this.register_captcha;
- }
- this.setState({
- countDownC: true,
- })
- dispatch({
- type: 'common/get_sms_code',
- payload: param,
- callback: (res) => {
- if (res.state == 200) {
- this.setState({
- countDownM: 60,
- countDownC: false,
- }, () => {
- _this.countDown();
- });
- } else {
- this.setState({
- countDownC: false,
- is_show_phonecode_err: true,
- phonecode_error_info: res.msg,
- });
- }
- },
- });
- }
- }
- render() {
- const { getFieldDecorator } = this.props.form;
- const {
- login_img,
- error_info,
- modal_type,
- is_show_err,
- register_captcha,
- login_captcha,
- title,
- visibleModal,
- visibleModalSuccess,
- register_error_info,
- is_show_registe_err,
- countDownM,
- loading
- } = this.state;
- return (
- <div className={styles.full_screen}
- style={{
- backgroundImage: window.location.href.indexOf('user') != -1 ? 'url(' + login_img.admin_login_bg + ')' : 'none',
- backgroundSize: '100% 100%',
- }}>
- <div className={styles.left_bg}>
- <img
- src={login_img.admin_login_left_bg}
- onError={() => this.showDefault('admin_login_left_bg')}
- />
- <div className={`${global.flex_row_center_center} ${styles.login_logo_wrap}`}>
- <img className={styles.login_logo} src={login_img.main_seller_center_logo} onError={(e) => {
- e.target.onerror = null;
- e.target.src = main_seller_center_logo_local;
- }}/>
- </div>
- <p className={styles.main_title}>{sldComLanguage('欢迎登录商家中心后台')}</p>
- <div className={styles.right_bg}>
- <div className={styles.formlogin}>
- <Form layout="horizontal" onSubmit={(e) => this.handleSubmits(e)}>
- <FormItem
- >
- {getFieldDecorator('username')(
- <Input
- maxLength={50}
- placeholder={sldComLanguage('请输入用户名')}
- prefix={<img src={require('../../assets/sld_login_username.png')}
- style={{ color: 'rgba(0,0,0,.25)' }}/>}
- onPressEnter={() => this.props.form.submit(this.handleSubmits)}
- />,
- )}
- </FormItem>
- <FormItem
- style={{ marginTop: 20 }}
- >
- {getFieldDecorator('password')(
- <Input
- maxLength={50}
- type="password"
- placeholder={sldComLanguage('请输入密码')}
- prefix={<img src={require('../../assets/sld_login_pwd.png')}/>}
- onPressEnter={() => this.props.form.submit(this.handleSubmits)}
- />,
- )}
- </FormItem>
- <FormItem
- style={{ marginTop: 20 }}
- >
- {getFieldDecorator('verifyCode')(
- <Input
- maxLength={4}
- placeholder={sldComLanguage('请输入验证码')}
- prefix={<img src={require('../../assets/sld_login_img_code.png')}
- style={{ color: 'rgba(0,0,0,.25)' }}/>}
- suffix={<img src={login_captcha} onClick={() => this.getCaptcha('login_captcha')}
- className={styles.verification_code}/>}
- onPressEnter={() => this.props.form.submit(this.handleSubmits)}
- />,
- )}
- </FormItem>
- <div className={`${styles.sld_login_btn_wrap} ${global.flex_column_start_start}`}>
- <div className={`${styles.sld_login_btn} ${global.flex_row_center_center}`}
- onClick={() => this.props.form.submit(this.handleSubmits)}>
- {sldComLanguage('立即登录')}
- </div>
- <div className={`${global.flex_row_between_center} ${styles.operate}`}>
- <a onClick={this.handleForgetPwd}>{sldComLanguage('忘记密码')}</a>
- <a onClick={this.handleRegister}>{sldComLanguage('立即注册')}</a>
- </div>
- <div className={`${global.flex_row_between_center} ${styles.operate}`}>
- <a onClick={this.handleUserRegisterAgreement}>{sldComLanguage('<<用户注册协议>>')}</a>
- <a onClick={this.handleUserPrivacyPolicy}>{sldComLanguage('<<隐私政策>>')}</a>
- </div>
- </div>
- </Form>
- </div>
- </div>
- </div>
- {/* 注册、找回密码弹出框 */}
- <Modal
- title={title}
- visible={visibleModal}
- footer={false}
- onCancel={this.handleCancelModal}
- width={450}
- >
- <div className={styles.form_login_modal}>
- <Form onSubmit={(e) => this.handleOkModal(e)}>
- {modal_type == 'register' &&
- <FormItem
- style={{ textAlign: 'center' }}
- >
- {getFieldDecorator('vendorName', {
- rules: [
- {
- validator: this.checkVendorName,
- },
- ],
- })(
- <Input
- maxLength={20}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入6~20位字母组合')}
- allowClear
- prefix={<p className={styles.user_name}><span className={styles.must}>*</span>{sldComLanguage('商家账号')}</p>}
- />,
- )}
- </FormItem>
- }
- {modal_type == 'register' && this.state.is_show_account_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.account_error_info}~
- </div>
- }
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('vendorMobile', {
- rules: [
- {
- validator: this.checkMobile,
- },
- ],
- })(
- <Input
- maxLength={11}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入手机号')}
- allowClear
- prefix={<p className={styles.user_name}><span className={styles.must}>*</span>{sldComLanguage('手机号')}</p>}
- />,
- )}
- </FormItem>
- {this.state.is_show_phone_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.phone_error_info}~
- </div>
- }
- {modal_type == 'register' &&
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('verifyCode', {
- rules: [
- {
- validator: this.checkImgCode,
- },
- ],
- })(
- <Input
- maxLength={4}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入验证码')}
- prefix={<p className={styles.user_name}><span className={styles.must}>*</span>{sldComLanguage('验证码')}</p>}
- suffix={<img src={register_captcha} onClick={() => this.getCaptcha('register_captcha')}
- className={styles.verification_code}/>}
- />,
- )}
- </FormItem>
- }
- {this.state.is_show_code_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.code_error_info}~
- </div>
- }
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('smsCode', {
- rules: [
- {
- validator: this.checkSmsCode,
- },
- ],
- })(
- <Input
- maxLength={6}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入短信验证码')}
- prefix={<p className={styles.user_name}><span className={styles.must}>*</span>{sldComLanguage('短信验证码')}</p>}
- suffix={<div className={`${global.flex_row_between_center} ${styles.get_sms_code_wrap}`}><span
- className={`${styles.v_split}`}>|</span><span className={styles.sms_code}
- style={{ opacity: countDownM > 0 ? 0.3 : 1 }}
- onClick={() => this.getSmsCode(modal_type == 'register' ? 'register' : 'retrieve')}>{countDownM ? `${countDownM}${sldComLanguage('s后重新获取')}` : `${sldComLanguage('获取验证码')}`}</span>
- </div>}
- />,
- )}
- </FormItem>
- {this.state.is_show_phonecode_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.phonecode_error_info}~
- </div>
- }
- {modal_type == 'register' &&
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('vendorEmail', {
- rules: [
- {
- validator: this.checkEmail,
- },
- ],
- })(
- <Input
- maxLength={100}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入邮箱')}
- allowClear
- prefix={<p className={styles.user_name}>{sldComLanguage('邮箱')}</p>}
- />,
- )}
- </FormItem>
- }
- {this.state.is_show_email_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.email_error_info}~
- </div>
- }
- {modal_type == 'forgetPwd' &&
- <FormItem
- style={{marginTop: 20, textAlign: 'center'}}
- >
- {getFieldDecorator('vendorName', {
- rules: [
- {
- validator: this.checkVendorName,
- },
- ],
- })(
- <Input
- maxLength={20}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请输入商家账号')}
- prefix={<p className={styles.user_name}><span
- className={styles.must}>*</span>{sldComLanguage('商家账号')}
- </p>}
- />,
- )}
- </FormItem>}
- {modal_type == 'forgetPwd' && this.state.is_show_account_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.account_error_info}~
- </div>
- }
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('vendorPassword', {
- rules: [
- {
- validator: this.checkPassword,
- },
- ],
- })(
- <Input.Password
- maxLength={20}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请设置6~20位字母、数字或符号组成的密码')}
- prefix={<p className={styles.user_name}><span
- className={styles.must}>*</span>{modal_type == 'register' ? `${sldComLanguage('设置密码')}` : `${sldComLanguage('新密码')}`}</p>}
- />,
- )}
- </FormItem>
- {this.state.is_show_pwd_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.pwd_error_info}~
- </div>
- }
- <FormItem
- style={{ marginTop: 20, textAlign: 'center' }}
- >
- {getFieldDecorator('confirmPassword', {
- rules: [
- {
- required: true,
- whitespace: true,
- message: ' ',
- },
- {
- validator: this.checkConfirmPassword,
- },
- ],
- })(
- <Input.Password
- maxLength={20}
- onChange={this.handleChangeRegister}
- placeholder={sldComLanguage('请再次输入密码')}
- prefix={<p className={styles.user_name}><span className={styles.must}>*</span>{sldComLanguage('确认密码')}</p>}
- />,
- )}
- </FormItem>
- {this.state.is_show_comfirepwd_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {this.state.comfirepwd_error_info}~
- </div>
- }
- {is_show_registe_err &&
- <div className={styles.register_error}>
- {sldSvgIcon('#ef1216', 16, 16, 'cuowutishi')}
- {register_error_info}~
- </div>
- }
- <FormItem
- style={{ textAlign: 'center' }}
- >
- <Button loading={loading} htmlType="submit" size={'small'} style={{ height: 40 }}
- className={styles.registerBtn}>{modal_type == 'register' ? `${sldComLanguage('提交注册')}` : `${sldComLanguage('找回密码')}`}</Button>
- </FormItem>
- </Form>
- </div>
- </Modal>
- {/* 操作成功提示框 */}
- <Modal
- title={title}
- visible={visibleModalSuccess}
- footer={false}
- onCancel={this.handleCancelModal}
- width={450}
- >
- <div className={styles.success_wrap}>
- <div className={`${styles.head_wrap} ${global.flex_column_center_center}`}>
- {sldSvgIcon('rgba(255, 74, 33, .2)', 65, 65, 'ziyuan113')}
- <p style={{ fontSize: 16, marginTop: 10 }}>{sldComLanguage('注册成功')}</p>
- </div>
- <Button className={styles.success_btn}
- onClick={this.handleSuccessBtn}>{sldComLanguage('点击入驻')}</Button>
- </div>
- </Modal>
- </div>
- );
- }
- }
|