|
|
@ -5,9 +5,24 @@ import { Form, Button, Input } from 'antd'
|
|
|
|
|
|
|
|
|
|
|
|
import '../../courses/css/Courses.css'
|
|
|
|
import '../../courses/css/Courses.css'
|
|
|
|
import './common.css'
|
|
|
|
import './common.css'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
|
|
const PHONE = 'PHONE'
|
|
|
|
const PHONE = 'PHONE'
|
|
|
|
const EMAIL = 'EMAIL'
|
|
|
|
const EMAIL = 'EMAIL'
|
|
|
|
const PASSWORD = 'PASSWORD'
|
|
|
|
const PASSWORD = 'PASSWORD'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function regPhoneAndEmail(value){
|
|
|
|
|
|
|
|
if(value.indexOf("@")>-1){
|
|
|
|
|
|
|
|
// 加密邮箱
|
|
|
|
|
|
|
|
let beforeStr=value.split("@")[0];
|
|
|
|
|
|
|
|
let afterStr=value.split("@")[1];
|
|
|
|
|
|
|
|
return beforeStr.substr(0,3)+"**"+beforeStr.substr(beforeStr.length-1,1)+"@"+afterStr;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
// 加密手机号码
|
|
|
|
|
|
|
|
return value.substr(0,3)+"****"+value.substr(7,4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
class AccountSecure extends Component {
|
|
|
|
class AccountSecure extends Component {
|
|
|
|
constructor (props) {
|
|
|
|
constructor (props) {
|
|
|
|
super(props)
|
|
|
|
super(props)
|
|
|
@ -15,10 +30,41 @@ class AccountSecure extends Component {
|
|
|
|
updating: ''
|
|
|
|
updating: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取验证码
|
|
|
|
|
|
|
|
getCode=(index)=>{
|
|
|
|
|
|
|
|
let url=`/account/get_verification_code.json`
|
|
|
|
|
|
|
|
if(index == 3){
|
|
|
|
|
|
|
|
//绑定手机号码
|
|
|
|
|
|
|
|
let values=this.props.form.getFieldsValue();
|
|
|
|
|
|
|
|
console.log(values);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onPhoneSubmit = () => {
|
|
|
|
onPhoneSubmit = () => {
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
if (!err) {
|
|
|
|
if (!err) {
|
|
|
|
|
|
|
|
let {login}=this.props.current_user;
|
|
|
|
|
|
|
|
let reg=/^1\d{10}$/;
|
|
|
|
|
|
|
|
if(reg.test(values.phone)){
|
|
|
|
|
|
|
|
let url=`/users/accounts/${login}/phone_bind.json`
|
|
|
|
|
|
|
|
axios.post((url),{
|
|
|
|
|
|
|
|
phone:values.phone,
|
|
|
|
|
|
|
|
code:values.phoneValidateCode
|
|
|
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
this.props.showNotification("手机号码绑定成功!");
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
updating:''
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.props.getBasicInfo();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.props.showNotification("请输入有效的11位手机号码");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -36,7 +82,16 @@ class AccountSecure extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//取消编辑
|
|
|
|
|
|
|
|
hideUpdating=()=>{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
updating:""
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
const { updating } = this.state
|
|
|
|
const { updating } = this.state
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -93,6 +148,12 @@ class AccountSecure extends Component {
|
|
|
|
.settingForm .ant-form-item-label {
|
|
|
|
.settingForm .ant-form-item-label {
|
|
|
|
width: 204px;
|
|
|
|
width: 204px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.formItemInline .ant-form-explain{
|
|
|
|
|
|
|
|
position:absolute;
|
|
|
|
|
|
|
|
bottom:-17px;
|
|
|
|
|
|
|
|
left:0px;
|
|
|
|
|
|
|
|
width:100%;
|
|
|
|
|
|
|
|
}
|
|
|
|
`}</style>
|
|
|
|
`}</style>
|
|
|
|
<div className="title">安全设置</div>
|
|
|
|
<div className="title">安全设置</div>
|
|
|
|
<Form>
|
|
|
|
<Form>
|
|
|
@ -100,25 +161,30 @@ class AccountSecure extends Component {
|
|
|
|
<div className="flexTable">
|
|
|
|
<div className="flexTable">
|
|
|
|
<div className="flexRow">
|
|
|
|
<div className="flexRow">
|
|
|
|
<div className="name">手机</div>
|
|
|
|
<div className="name">手机</div>
|
|
|
|
{/* #EA320E
|
|
|
|
|
|
|
|
仅自己可见,可用于手机号码登录EduCoder
|
|
|
|
|
|
|
|
*/}
|
|
|
|
|
|
|
|
<div className="description">
|
|
|
|
<div className="description">
|
|
|
|
<span style={{color: '#EA320E'}}>未绑定</span>
|
|
|
|
{
|
|
|
|
|
|
|
|
basicInfo && basicInfo.phone ?
|
|
|
|
|
|
|
|
<span>{ regPhoneAndEmail(basicInfo.phone) }</span>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<span style={{color: '#EA320E'}}>未绑定</span>
|
|
|
|
|
|
|
|
}
|
|
|
|
绑定手机号码,将获得500金币的奖励哟~,手机号码仅自己可见~
|
|
|
|
绑定手机号码,将获得500金币的奖励哟~,手机号码仅自己可见~
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="status">
|
|
|
|
{
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
updating != PHONE &&
|
|
|
|
onClick={() => this.setState({updating: PHONE})}
|
|
|
|
<div className="status">
|
|
|
|
>立即绑定</WordsBtn>
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
</div>
|
|
|
|
onClick={() => this.setState({updating: PHONE})}
|
|
|
|
|
|
|
|
>{basicInfo && basicInfo.phone ? "更换" : "立即绑定" }</WordsBtn>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{ updating == PHONE &&
|
|
|
|
{ updating == PHONE &&
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="你的手机号"
|
|
|
|
label="你的手机号"
|
|
|
|
className="formItemInline hideRequireTag mb15"
|
|
|
|
className="formItemInline hideRequireTag mb20"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('phone', {
|
|
|
|
{getFieldDecorator('phone', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -133,7 +199,7 @@ class AccountSecure extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="手机验证码"
|
|
|
|
label="手机验证码"
|
|
|
|
className="mb15 formItemInline hideRequireTag"
|
|
|
|
className="mb20 formItemInline hideRequireTag"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('phoneValidateCode', {
|
|
|
|
{getFieldDecorator('phoneValidateCode', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -144,12 +210,12 @@ class AccountSecure extends Component {
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<Input placeholder="请输入手机获取的验证码" className="validateInput"></Input>
|
|
|
|
<Input placeholder="请输入手机获取的验证码" className="validateInput"></Input>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
<Button type="primary">获取验证码</Button>
|
|
|
|
<Button type="primary" onClick={()=>this.getCode(3)}>获取验证码</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<Button type="primary" onClick={this.onPhoneSubmit}>确定</Button>
|
|
|
|
<Button type="primary" onClick={this.onPhoneSubmit}>确定</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</React.Fragment> }
|
|
|
|
</React.Fragment> }
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -158,21 +224,29 @@ class AccountSecure extends Component {
|
|
|
|
<div className="flexRow">
|
|
|
|
<div className="flexRow">
|
|
|
|
<div className="name">邮箱</div>
|
|
|
|
<div className="name">邮箱</div>
|
|
|
|
<div className="description">
|
|
|
|
<div className="description">
|
|
|
|
<span>kuc***w@126.com</span>
|
|
|
|
{
|
|
|
|
|
|
|
|
basicInfo && basicInfo.mail ?
|
|
|
|
|
|
|
|
<span>{ regPhoneAndEmail(basicInfo.mail) }</span>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<span style={{color: '#EA320E'}}>未绑定</span>
|
|
|
|
|
|
|
|
}
|
|
|
|
邮箱账号仅自己可见,可用于邮箱账号登录EduCoder
|
|
|
|
邮箱账号仅自己可见,可用于邮箱账号登录EduCoder
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="status">
|
|
|
|
{
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
updating != EMAIL &&
|
|
|
|
onClick={() => this.setState({updating: EMAIL})}
|
|
|
|
<div className="status">
|
|
|
|
>更换</WordsBtn>
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
</div>
|
|
|
|
onClick={() => this.setState({updating: EMAIL})}
|
|
|
|
|
|
|
|
>{basicInfo && basicInfo.mail ?"更换":"立即绑定"}</WordsBtn>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{ updating == EMAIL &&
|
|
|
|
{ updating == EMAIL &&
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="邮箱地址"
|
|
|
|
label="邮箱地址"
|
|
|
|
className="formItemInline hideRequireTag mb15"
|
|
|
|
className="formItemInline hideRequireTag mb20"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('phone', {
|
|
|
|
{getFieldDecorator('phone', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -187,7 +261,7 @@ class AccountSecure extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="邮箱验证码"
|
|
|
|
label="邮箱验证码"
|
|
|
|
className="mb15 formItemInline hideRequireTag"
|
|
|
|
className="mb20 formItemInline hideRequireTag"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('phoneValidateCode', {
|
|
|
|
{getFieldDecorator('phoneValidateCode', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -202,8 +276,8 @@ class AccountSecure extends Component {
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<Button type="primary">确定</Button>
|
|
|
|
<Button type="primary" onClick={this.onEmailSubmit}>确定</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</React.Fragment> }
|
|
|
|
</React.Fragment> }
|
|
|
|
|
|
|
|
|
|
|
@ -217,18 +291,21 @@ class AccountSecure extends Component {
|
|
|
|
<span>**********</span>
|
|
|
|
<span>**********</span>
|
|
|
|
用于保护账户信息和登录安全
|
|
|
|
用于保护账户信息和登录安全
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="status">
|
|
|
|
{
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
updating != PASSWORD &&
|
|
|
|
onClick={() => this.setState({updating: PASSWORD})}
|
|
|
|
<div className="status">
|
|
|
|
>修改</WordsBtn>
|
|
|
|
<WordsBtn style="blue" className="borderBottom"
|
|
|
|
</div>
|
|
|
|
onClick={() => this.setState({updating: PASSWORD})}
|
|
|
|
|
|
|
|
>修改</WordsBtn>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{ updating == PASSWORD &&
|
|
|
|
{ updating == PASSWORD &&
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="旧密码"
|
|
|
|
label="旧密码"
|
|
|
|
className="mb15 formItemInline hideRequireTag"
|
|
|
|
className="mb20 formItemInline hideRequireTag"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('p_old', {
|
|
|
|
{getFieldDecorator('p_old', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -243,7 +320,7 @@ class AccountSecure extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="新密码"
|
|
|
|
label="新密码"
|
|
|
|
className="mb15 formItemInline hideRequireTag"
|
|
|
|
className="mb20 formItemInline hideRequireTag"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('p_new', {
|
|
|
|
{getFieldDecorator('p_new', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -258,7 +335,7 @@ class AccountSecure extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="再次输入"
|
|
|
|
label="再次输入"
|
|
|
|
className="mb15 formItemInline hideRequireTag"
|
|
|
|
className="mb20 formItemInline hideRequireTag"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{getFieldDecorator('p_again', {
|
|
|
|
{getFieldDecorator('p_again', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
@ -273,7 +350,7 @@ class AccountSecure extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<div className="mb20" style={{ marginLeft: '118px' }}>
|
|
|
|
<Button type="primary" onClick={this.onPasswordSubmit}>确定</Button>
|
|
|
|
<Button type="primary" onClick={this.onPasswordSubmit}>确定</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}}>取消</Button>
|
|
|
|
<Button type="primary grayBtn" style={{ marginLeft: '20px'}} onClick={this.hideUpdating}>取消</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</React.Fragment> }
|
|
|
|
</React.Fragment> }
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|