12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157 |
- import React, { Component } from 'react';
- import { connect } from 'dva';
- import { Form, Input, Modal, Button, message } from 'antd';
- import SlideVerify from "@/components/SlideVerify"
- 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/login/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,
- visibleModalVerify: 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,
- // 登录按钮加载loading
- loginLoading: 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) => {
- Object.keys(values).forEach(key => {
- values[key] = values[key] ? values[key].replace(/\s/g, '') : ''
- })
- const { username, password, verifyCode } = values;
- if (!username) {
- return failTip(`${sldComLanguage('用户名不能为空')}`);
- }
- if (!password) {
- return failTip(`${sldComLanguage('密码不能为空')}`);
- }
- if (!verifyCode) {
- return failTip(`${sldComLanguage('验证码不能为空')}`);
- }
- //用户登录
- values.verifyKey = this.login_captcha;
- const { dispatch } = this.props;
- this.setState({loginLoading: true})
- 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');
- }
- this.setState({loginLoading: false})
- },
- });
- });
- };
- 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: res.data.vendorName, vendorMobile: res.data.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);
- }
- });
- };
- // 获取验证码操作
- getSmsCodeAction = ({ mobile, type, captcha }) => {
- 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,
- is_show_phonecode_err: false,
- phonecode_error_info: '',
- }, () => {
- _this.countDown();
- });
- } else {
- this.setState({
- countDownC: false,
- is_show_phonecode_err: true,
- phonecode_error_info: res.msg,
- });
- }
- },
- });
- }
- //获取短信验证码前的校验
- 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 if (type === 'retrieve'){
- this.setState({visibleModalVerify: true})
- } else {
- this.getSmsCodeAction({ mobile, type, captcha })
- }
- }
- handleCancelVeriyModal = () => {
- this.setState({visibleModalVerify: false})
- }
- verifySuccess = () => {
- message.success(sldComLanguage('验证成功'));
- const mobile = this.props.form.getFieldValue('vendorMobile');
- const captcha = this.props.form.getFieldValue('verifyCode');
- this.setState({visibleModalVerify: false})
- this.getSmsCodeAction({ mobile, type: 'retrieve', captcha })
- }
- render() {
- const { getFieldDecorator } = this.props.form;
- const {
- login_img,
- error_info,
- modal_type,
- is_show_err,
- register_captcha,
- login_captcha,
- title,
- visibleModal,
- visibleModalSuccess,
- visibleModalVerify,
- register_error_info,
- is_show_registe_err,
- countDownM,
- loading,
- loginLoading
- } = 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={default_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}`}>
- <Button
- className={`${styles.sld_login_btn} ${global.flex_row_center_center}`}
- type="primary"
- loading={loginLoading}
- onClick={() => this.props.form.submit(this.handleSubmits)}
- >
- {sldComLanguage('立即登录')}
- </Button>
- {/* <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}
- maskClosable={false}
- 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>
- { /* 人机验证 */ }
- <Modal
- className={styles.verifyModal}
- title={'滑动验证'}
- visible={visibleModalVerify}
- footer={false}
- onCancel={this.handleCancelVeriyModal}
- width={500}
- >
- {visibleModalVerify && <SlideVerify w={450} h={220} onSuccess={this.verifySuccess}/> }
- </Modal>
- </div>
- );
- }
- }
|