Commit 0ad15bc8 by zhanghaozhe

更换滑块验证

parent ca9d3562
import React, { Component } from 'react';
import './index.scss'
import { initCaptchaNC } from "@/utils"
const appkey = 'FFFF0N000000000090FC'
const scene = 'nc_login_h5'
class CaptchaAli extends Component {
nc = null
state = {
isLoaded: false
}
componentDidMount() {
const _this = this
const el = document.querySelector('#nc')
el && initCaptchaNC(() => {
const nc_token = [appkey, (new Date()).getTime(), Math.random()].join(':');
this.nc = NoCaptcha.init({
renderTo: '#nc',
appkey,
scene,
token: nc_token,
elementID: ['tel'],
bannerHidden: false,
callback(data) {
_this.props.onVerify({
app_key: appkey,
scene,
token: nc_token,
session_id: data.csessionid,
sig: data.sig
})
},
error(s) {
console.log(s)
}
})
NoCaptcha.setEnabled(true);
this.nc.reset()
this.props.getInstance(this.nc)
})
}
render() {
const {mb = 30} = this.props
return (
<div id={'captcha'} style={{marginBottom: `${mb}px`}}>
<div id="nc"></div>
</div>
);
}
}
export default CaptchaAli;
\ No newline at end of file
#captcha {
._nc {
.stage {
padding: 0;
}
.stage1 {
height: 48px;
.label {
height: 46px;
}
.button {
width: 48px;
height: 48px;
}
.slider {
height: 48px;
width: 100%;
left: 0;
}
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ export { default as OrderItem } from './OrderList'
export { default as HeaderBar } from './HeaderBar'
export { default as CallApp } from './CallApp'
export { default as Captcha } from './Captcha'
export { default as CaptchaAli } from './Captcha-ali'
export { default as ClearableInput } from "./ClearableInput"
export { default as Loading } from './Loading'
export { default as RenderTabBar } from './renderTabBar'
......
......@@ -323,6 +323,34 @@
border-radius: 10px;
box-sizing: border-box;
background-color: #fff;
#nc{
$height: 36px;
height: $height;
._nc{
.stage1{
height: $height;
.icon{
left: 5px;
}
.button{
width: $height;
height: $height;
}
}
.slider{
height: $height;
.label{
height: 100%;
line-height: $height;
}
.bg-green{
height: $height;
line-height: $height;
}
}
}
}
}
.popup-form__title {
......
......@@ -5,11 +5,7 @@ import { http, getParam } from "@/utils"
import { compose } from "redux"
import { connect } from "react-redux"
import { setCurrentUser } from "@/store/userAction"
import Captcha from '@/common/Captcha'
import { HeaderBar } from '@/common'
// import ClearableInput from '@common/ClearableInput'
import { HeaderBar, CaptchaAli } from '@/common'
import ClearableInput from '../common/clearableInputWithCountryCodes'
import Button from '../common/Button'
import VeriCodeInput from '../common/veriCodeInput'
......@@ -21,7 +17,8 @@ class BindingTel extends Component {
state = {
validate: null,
captchaInstance: null
captchaInstance: null,
validationData: null
}
getCaptchaInstance = instance => {
......@@ -29,14 +26,11 @@ class BindingTel extends Component {
captchaInstance: instance
})
}
onVerify = (err, data) => {
if (err) {
console.log(err)
} else {
this.setState({
validate: data.validate
})
}
onVerify = (data) => {
this.setState({
validate: true,
validationData: data
})
}
render() {
......@@ -79,16 +73,16 @@ class BindingTel extends Component {
placeholder={'验证码'}
account={values.tel}
tel={values.tel}
challenge={this.state.validate}
instance={this.state.captchaInstance}
action={'auth'}
country={country}
validationData={this.state.validationData}
/>
)
}}
/>
<Captcha onVerify={this.onVerify} getInstance={this.getCaptchaInstance}/>
<CaptchaAli onVerify={this.onVerify} getInstance={this.getCaptchaInstance} mb={0}/>
<Button className={'complete-btn'}
active={values.tel && values.veriCode && isEmpty(errors)}>完成</Button>
</Form>
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import './veri-code-input.scss'
import { http, validateEmail } from '@/utils';
import { Toast } from "antd-mobile";
import { has } from 'lodash'
import { has, isEmpty } from 'lodash'
import classnames from 'classnames'
......@@ -10,152 +10,151 @@ import classnames from 'classnames'
import Input from '../Input'
class VeriCodeInput extends Component {
count = 60
state = {
counting: false,
count: this.count,
count = 60
state = {
counting: false,
count: this.count,
isFirst: true
}
timer = null
countDown = () => {
let {count} = this.state
if (!this.state.isFirst) {
Toast.info('请重新进行滑块验证', 2, null, false)
this.props.instance.reset()
this.setState({
isFirst: true
}
timer = null
countDown = () => {
let {count} = this.state
if (!this.state.isFirst) {
Toast.info('请重新进行滑块验证', 2, null, false)
this.props.instance.refresh()
this.setState({
isFirst: true
})
return
}
if (!this.state.counting) {
if (!this.sendCode()) {
return
}
this.setState({count: count--, counting: true})
this.timer = setInterval(() => {
if (count <= 0) {
clearInterval(this.timer)
this.setState({counting: false, count: this.count})
return
}
this.setState({count: count--})
}, 1000)
}
})
return
}
getType = () => {
const {email} = this.props
if (validateEmail(email)) {
return 'email'
if (!this.state.counting) {
if (!this.sendCode()) {
return
}
this.setState({count: count--, counting: true})
this.timer = setInterval(() => {
if (count <= 0) {
clearInterval(this.timer)
this.setState({counting: false, count: this.count})
return
}
this.setState({count: count--})
}, 1000)
}
}
sendCode = () => {
if (!this.validate()) return
this.getType() === 'email' ? this.sendEmail() : this.sendSMS();
return true;
getType = () => {
const {email} = this.props
if (validateEmail(email)) {
return 'email'
}
sendEmail = () => {
const {email, challenge} = this.props
http.post(`${API['passport-api']}/send_email_code`, {
email,
challenge
}).then(res => {
if (res.data.errno === 0) {
Toast.info('验证码发送成功', 2, null, false)
} else {
Toast.info(res.data.msg, 2, null, false)
}
this.setState({
isFirst: false
})
})
}
sendCode = () => {
if (!this.validate()) return
this.getType() === 'email' ? this.sendEmail() : this.sendSMS();
return true;
}
sendEmail = () => {
const {email, validationData} = this.props
http.post(`${API['passport-api']}/send_email_code`, {
email,
...validationData
}).then(res => {
if (res.data.errno === 0) {
Toast.info('验证码发送成功', 2, null, false)
} else {
Toast.info(res.data.msg, 2, null, false)
}
this.setState({
isFirst: false
})
})
}
sendSMS = () => {
const {action, tel, account, validationData, checking, country} = this.props
if (!tel) {
Toast.info('请输入手机号')
return
}
sendSMS = () => {
const {action, tel, account, challenge, checking, country} = this.props
if (!tel) {
Toast.info('请输入手机号')
return
}
http.post(`${API['passport-api']}/quick_sms`, {
phone_num: tel || account,
action: action || 'login',
area_code: '00'+country.num,
challenge,
checking
}).then(res => {
if (res.data.errno === 0) {
Toast.info('验证码发送成功', 2, null, false)
} else {
Toast.info(res.data.msg, 2, null, false)
}
this.setState({
isFirst: false
})
})
http.post(`${API['passport-api']}/quick_sms`, {
phone_num: tel || account,
action: action || 'login',
area_code: '00' + country.num,
checking,
...validationData
}).then(res => {
if (res.data.errno === 0) {
Toast.info('验证码发送成功', 2, null, false)
} else {
Toast.info(res.data.msg, 2, null, false)
}
this.setState({
isFirst: false
})
})
}
validate = () => {
const {tel, validationData, email} = this.props
let hasTel = has(this.props, 'tel')
let content
if (hasTel) {
if (!tel) {
content = '手机号码不能为空'
}
if (!/\d/.test(tel)) {
content = '请输入正确格式的手机号码'
}
} else {
if (!email) {
content = '电子邮件不能为空'
}
if (!validateEmail(email)) {
content = '请输入正确格式的电子邮件'
}
}
validate = () => {
const {tel, challenge, email} = this.props
let hasTel = has(this.props, 'tel')
let content
if (hasTel) {
if (!tel) {
content = '手机号码不能为空'
}
if (!/\d/.test(tel)) {
content = '请输入正确格式的手机号码'
}
} else {
if (!email) {
content = '电子邮件不能为空'
}
if (!validateEmail(email)) {
content = '请输入正确格式的电子邮件'
}
}
if (content) {
Toast.info(content, 2, null, false)
return false
}
if (!challenge) {
Toast.info('请进行滑块验证', 2, null, false)
return false
}
return true
if (content) {
Toast.info(content, 2, null, false)
return false
}
render() {
let {className, ...rest} = this.props
return (
<Input
type={'number'}
wrapperClass={className}
{...rest}
>
<button type='button' className={classnames('verify', {active: !this.state.counting})}
onClick={this.countDown}>
{
this.state.counting ?
(`重新发送${this.state.count}s`)
: '发送验证码'
}
</button>
</Input>
);
if (isEmpty(validationData)) {
Toast.info('请进行滑块验证', 2, null, false)
return false
}
return true
}
render() {
let {className, validationData, ...rest} = this.props
return (
<Input
type={'number'}
wrapperClass={className}
{...rest}
>
<button type='button' className={classnames('verify', {active: !this.state.counting})}
onClick={this.countDown}>
{
this.state.counting ?
(`重新发送${this.state.count}s`)
: '发送验证码'
}
</button>
</Input>
);
}
}
export default VeriCodeInput;
\ No newline at end of file
......@@ -6,7 +6,7 @@ import { withFormik, Form, Field } from 'formik';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Toast } from "antd-mobile";
import { HeaderBar, Captcha } from "@/common";
import { HeaderBar, CaptchaAli } from "@/common";
import ClearableInput from '../common/clearableInputWithCountryCodes'
import { http } from "@/utils";
import { quickLogin } from '@/store/userAction';
......@@ -16,129 +16,128 @@ import { Link } from "react-router-dom";
class ForgotPassword extends Component {
state = {
validate: null,
captchaInstance: null
}
state = {
validate: null,
captchaInstance: null,
validationData: null
}
getCaptchaInstance = instance => {
this.setState({
captchaInstance: instance
})
}
onVerify = (err, data) => {
if (err) {
console.log(err)
} else {
this.setState({
validate: data.validate
})
}
}
onSubmissionError = () => {
const errors = Object.values(this.props.errors);
errors.length && Toast.info(errors[0], 2, null, false)
}
getCaptchaInstance = instance => {
this.setState({
captchaInstance: instance
})
}
onVerify = (data) => {
this.setState({
validationData: data,
validate: true
})
}
onSubmissionError = () => {
const errors = Object.values(this.props.errors);
errors.length && Toast.info(errors[0], 2, null, false)
}
render() {
const {
values,
isValid,
country
} = this.props
return (
<div className={'forgot-password'}>
<HeaderBar title='忘记密码' arrow={true}/>
<div className="content">
<Form className='forgot-password-form'>
<Field
name={'tel'}
render={({field, form}) => {
return (
<ClearableInput
{...field}
type={'tel'}
placeholder={'请输入注册时的手机号'}
wrapperClass={'tel-input'}
setFieldValue={form.setFieldValue}
country={country}
/>)
}}
/>
{
this.state.validate &&
<Field
name='veriCode'
render={({field}) => {
return (
<VeriCodeInput
{...field}
className={'verify-code'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
tel={values.tel}
challenge={this.state.validate}
instance={this.state.captchaInstance}
action={'auth'}
checking={1}
country={country}
/>
)
}}
/>
}
<OnSubmissionError callback={this.onSubmissionError}/>
<Captcha getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
<Button className={'next_step'} active={isValid}>下一步</Button>
<Link className={'to-email'} to={`/passport/forgot-password-email`} replace>邮箱找回</Link>
</Form>
</div>
</div>
);
}
render() {
const {
values,
isValid,
country
} = this.props
return (
<div className={'forgot-password'}>
<HeaderBar title='忘记密码' arrow={true}/>
<div className="content">
<Form className='forgot-password-form'>
<Field
name={'tel'}
render={({field, form}) => {
return (
<ClearableInput
{...field}
type={'tel'}
placeholder={'请输入注册时的手机号'}
wrapperClass={'tel-input'}
setFieldValue={form.setFieldValue}
country={country}
/>)
}}
/>
{
this.state.validate &&
<Field
name='veriCode'
render={({field}) => {
return (
<VeriCodeInput
{...field}
className={'verify-code'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
tel={values.tel}
challenge={this.state.validate}
instance={this.state.captchaInstance}
action={'auth'}
checking={1}
country={country}
validationData={this.state.validationData}
/>
)
}}
/>
}
<OnSubmissionError callback={this.onSubmissionError}/>
<CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
<Button className={'next_step'} active={isValid}>下一步</Button>
<Link className={'to-email'} to={`/passport/forgot-password-email`} replace>邮箱找回</Link>
</Form>
</div>
</div>
);
}
}
const formikConfig = {
mapPropsToValues: () => ({
tel: '',
veriCode: ''
}),
validateOnChange: true,
validateOnBlur: true,
validate: values => {
let errors = {}
if (!/\d/.test(values.tel)) {
errors.tel = '请输入正确的手机号'
}
values.veriCode.toString().length !== 6 && (errors.veriCode = '验证码格式不正确')
return errors
},
handleSubmit(values, {props}) {
sessionStorage.setItem('r_type', 'phone')
sessionStorage.setItem('tel', values.tel)
http.post(`${API['passport-api']}/check_phone_code`, {
phone: values.tel,
code: values.veriCode,
area_code: '00'+props.country.num
}).then(res => {
if (res.data.errno == 0) {
props.history.push('/passport/set-password', {from: props.location})
} else {
Toast.info(res.data.msg, 2, null, false)
}
})
},
mapPropsToValues: () => ({
tel: '',
veriCode: ''
}),
validateOnChange: true,
validateOnBlur: true,
validate: values => {
let errors = {}
if (!/\d/.test(values.tel)) {
errors.tel = '请输入正确的手机号'
}
values.veriCode.toString().length !== 6 && (errors.veriCode = '验证码格式不正确')
return errors
},
handleSubmit(values, {props}) {
sessionStorage.setItem('r_type', 'phone')
sessionStorage.setItem('tel', values.tel)
http.post(`${API['passport-api']}/check_phone_code`, {
phone: values.tel,
code: values.veriCode,
area_code: '00' + props.country.num
}).then(res => {
if (res.data.errno == 0) {
props.history.push('/passport/set-password', {from: props.location})
} else {
Toast.info(res.data.msg, 2, null, false)
}
})
},
}
export default compose(
connect(
state => ({country: state.country}),
{quickLogin}
),
withFormik(formikConfig)
connect(
state => ({country: state.country}),
{quickLogin}
),
withFormik(formikConfig)
)(ForgotPassword)
\ No newline at end of file
......@@ -6,8 +6,8 @@ import { withFormik, Form, Field } from 'formik';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Toast } from "antd-mobile";
import { HeaderBar, Captcha, ClearableInput } from "@/common";
import { validateEmail, http, api } from "@/utils";
import { HeaderBar, ClearableInput, CaptchaAli } from "@/common";
import { validateEmail, http } from "@/utils";
import { quickLogin } from '@/store/userAction';
import OnSubmissionError from '../common/OnSubmissionError'
import { Link } from "react-router-dom";
......@@ -15,125 +15,125 @@ import { Link } from "react-router-dom";
class ForgotPassword extends Component {
state = {
validate: null,
captchaInstance: null
}
state = {
validate: null,
captchaInstance: null,
validationData: null
}
getCaptchaInstance = instance => {
this.setState({
captchaInstance: instance
})
}
onVerify = (err, data) => {
if (err) {
console.log(err)
} else {
this.setState({
validate: data.validate
})
}
}
onSubmissionError = () => {
const errors = Object.values(this.props.errors);
errors.length && Toast.info(errors[0], 2, null, false)
}
getCaptchaInstance = instance => {
this.setState({
captchaInstance: instance
})
}
onVerify = (data) => {
this.setState({
validationData: data,
validate: true
})
}
onSubmissionError = () => {
const errors = Object.values(this.props.errors);
errors.length && Toast.info(errors[0], 2, null, false)
}
render() {
const {
values,
isValid
} = this.props
return (
<div className={'forgot-password-email'}>
<HeaderBar title='忘记密码' arrow={true}/>
<div className="content">
<Form className='forgot-password-form'>
<Field
name={'email'}
render={({field, form}) => {
return (
<ClearableInput
{...field}
type={'email'}
placeholder={'请输入注册时的邮箱账号'}
wrapperClass={'email-input'}
setFieldValue={form.setFieldValue}
/>)
}}
/>
{
this.state.validate &&
<Field
name='veriCode'
render={({field}) => {
return (
<VeriCodeInput
{...field}
className={'verify-code'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
email={values.email}
challenge={this.state.validate}
instance={this.state.captchaInstance}
action={'auth'}
checking={1}
/>
)
}}
/>
}
<OnSubmissionError callback={this.onSubmissionError}/>
<Captcha getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
<Button className={'next_step'} active={isValid}>下一步</Button>
<Link className={'to-phone'} to={'/passport/forgot-password'} replace>手机号找回</Link>
</Form>
</div>
</div>
);
}
render() {
const {
values,
isValid
} = this.props
return (
<div className={'forgot-password-email'}>
<HeaderBar title='忘记密码' arrow={true}/>
<div className="content">
<Form className='forgot-password-form'>
<Field
name={'email'}
render={({field, form}) => {
return (
<ClearableInput
{...field}
type={'email'}
placeholder={'请输入注册时的邮箱账号'}
wrapperClass={'email-input'}
setFieldValue={form.setFieldValue}
/>)
}}
/>
{
this.state.validate &&
<Field
name='veriCode'
render={({field}) => {
return (
<VeriCodeInput
{...field}
className={'verify-code'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
email={values.email}
challenge={this.state.validate}
instance={this.state.captchaInstance}
validationData={this.state.validationData}
action={'auth'}
checking={1}
/>
)
}}
/>
}
<OnSubmissionError callback={this.onSubmissionError}/>
{/*<Captcha getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>*/}
<CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
<Button className={'next_step'} active={isValid}>下一步</Button>
<Link className={'to-phone'} to={'/passport/forgot-password'} replace>手机号找回</Link>
</Form>
</div>
</div>
);
}
}
const formikConfig = {
mapPropsToValues: () => ({
email: '',
veriCode: ''
}),
validateOnChange: true,
validateOnBlur: true,
validate: values => {
let errors = {}
if (!validateEmail(values.email)) {
errors.email = '请输入正确的邮箱地址'
}
values.veriCode.toString().length !== 6 && (errors.veriCode = '验证码格式不正确')
return errors
},
handleSubmit(values, {props}) {
sessionStorage.setItem('r_type', 'email')
sessionStorage.setItem('email', values.email)
http.post(`${API['passport-api']}/check_email_code`, {
email: values.email,
code: values.veriCode
}).then(res => {
if (res.data.errno == 0) {
props.history.push('/passport/set-password', {from: props.location})
} else {
Toast.info(res.data.msg, 2, null, false)
}
})
},
mapPropsToValues: () => ({
email: '',
veriCode: ''
}),
validateOnChange: true,
validateOnBlur: true,
validate: values => {
let errors = {}
if (!validateEmail(values.email)) {
errors.email = '请输入正确的邮箱地址'
}
values.veriCode.toString().length !== 6 && (errors.veriCode = '验证码格式不正确')
return errors
},
handleSubmit(values, {props}) {
sessionStorage.setItem('r_type', 'email')
sessionStorage.setItem('email', values.email)
http.post(`${API['passport-api']}/check_email_code`, {
email: values.email,
code: values.veriCode
}).then(res => {
if (res.data.errno == 0) {
props.history.push('/passport/set-password', {from: props.location})
} else {
Toast.info(res.data.msg, 2, null, false)
}
})
},
}
export default compose(
connect(
null,
{quickLogin}
),
withFormik(formikConfig)
connect(
null,
{quickLogin}
),
withFormik(formikConfig)
)(ForgotPassword)
\ No newline at end of file
......@@ -5,8 +5,7 @@ import { studentLogin } from '@/store/userAction';
import { http } from '@/utils';
import { Formik, Form, Field } from 'formik';
import { Toast } from "antd-mobile";
import { HeaderBar } from "@/common";
import Captcha from '@/common/Captcha'
import { HeaderBar, CaptchaAli } from "@/common";
import Header from '../common/Header';
import Input from '../common/inputWithCountryCodes';
import VeriCodeInput from '../common/veriCodeInput';
......@@ -33,6 +32,7 @@ class StudentRoot extends PureComponent {
list: [],
schoolList: [],
schoolName: '',
validationData: null,
};
}
......@@ -73,7 +73,7 @@ class StudentRoot extends PureComponent {
redirect: from && window.location.origin + from.pathname + from.search + from.hash,
}).then(res => {
if (res.hasError) {
captchaInstance.refresh();
captchaInstance.reset();
Toast.info(res.msg, 2, null, false);
}
});
......@@ -84,13 +84,12 @@ class StudentRoot extends PureComponent {
captchaInstance: instance
});
}
onVerify = (err, data) => {
if (!err) {
this.setState({
validate: data.validate
});
}
onVerify = (data) => {
this.setState({
validationData: data,
validate: true
})
}
selectSwitch = (key, value) => {
......@@ -123,7 +122,7 @@ class StudentRoot extends PureComponent {
<HeaderBar title={'助学计划'} arrow={true}/>
<Header/>
<Formik
initialValues={{
initialValues={{
tel: '',
password: '',
code: '',
......@@ -185,20 +184,16 @@ class StudentRoot extends PureComponent {
)}
/>
<div className="student-form__item">
<Field
className="student-form__input"
type="password"
name="password"
<Field
className="student-form__input"
type="password"
name="password"
minLength="6"
maxLength="16"
placeholder="密码需要包含6-16位字母和数字"
/>
</div>
<Captcha
mrBtm={'15px'}
getInstance={this.getCaptchaInstance}
onVerify={this.onVerify}
/>
<CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify} mb={15}/>
{
validate &&
<Field
......@@ -210,7 +205,7 @@ class StudentRoot extends PureComponent {
className={'student-form__code'}
icon={<i className={'iconfont iconduanxin'} style={{fontSize: '20px', left: '12px'}}/>}
tel={props.values.tel}
challenge={validate}
validationData={this.state.validationData}
errors={props.errors}
placeholder={'请输入验证码'}
instance={captchaInstance}
......@@ -221,7 +216,7 @@ class StudentRoot extends PureComponent {
}
<div className="student-form__item">
<label className="student-form__label">学校</label>
<StudentSelect
<StudentSelect
name="school"
value={props.values.school}
schoolName={schoolName}
......@@ -236,12 +231,12 @@ class StudentRoot extends PureComponent {
props.setFieldValue('college', '')
}}
selectSwitch={this.selectSwitch}
changeToCollege={this.changeToCollege}
changeToCollege={this.changeToCollege}
/>
</div>
<div className="student-form__item">
<label className="student-form__label">学院</label>
<StudentSelect
<StudentSelect
name="college"
value={props.values.college}
data={{
......@@ -252,7 +247,7 @@ class StudentRoot extends PureComponent {
options={collegeList}
placeholder="请先选择学校"
onChange={props.setFieldValue}
selectSwitch={this.selectSwitch}
selectSwitch={this.selectSwitch}
/>
</div>
<div className="student-form__item">
......@@ -280,8 +275,8 @@ class StudentRoot extends PureComponent {
}
const StudentSelect = (props) => {
const {
options = [],
const {
options = [],
data: { key = '' , val = false },
schoolName,
isClick = true,
......@@ -295,23 +290,23 @@ const StudentSelect = (props) => {
} = props;
return (
<div className="student-select">
<input
<input
className={classnames({'active': val})}
value={value}
type="text"
placeholder={placeholder}
type="text"
placeholder={placeholder}
readOnly
onClick={() => {
isClick && selectSwitch(key, true);
}}
}}
/>
{
val &&
<ul className="student-select__list">
{
options.length > 0 && options.map((item, index) => (
<li
className="student-select__option"
<li
className="student-select__option"
key={index}
onClick={() => {
selectSwitch(key, false);
......
......@@ -16,7 +16,6 @@ const accountLogin = user => dispatch => {
const studentLogin = params => dispatch => {
return http.post(`${API['passport-api']}/phone_reg`, {
challenge: params.validate,
phone: params.tel,
password: params.password,
code: params.code,
......
......@@ -67,6 +67,15 @@ function initCaptcha(cb) {
}
function initCaptchaNC(cb) {
if (window.NoCaptcha && typeof window.NoCaptcha.init === 'function') {
cb()
} else {
const url = '//g.alicdn.com/sd/nch5/index.js' + '?t=' + getTimestamp(1 * 60 * 1000)
loadScript(url, cb)
}
}
export const is_weixin = () => {
var ua = window.navigator.userAgent.toLowerCase();
......@@ -126,11 +135,12 @@ export {
export {
html,
initCaptcha,
initCaptchaNC,
validateTel,
validateEmail,
browser,
isLogin,
dateCountDown
dateCountDown,
}
export {
default as SendMessageToApp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment