dev_forum
caishi 6 years ago
parent 240535e751
commit 62c961f487

@ -8,7 +8,7 @@ class Loading extends Component {
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px'}}>
<div className="App" style={{minHeight: '800px',width:"100%"}}>
<style>
{
`

@ -8,7 +8,7 @@ import './pollStyle.css'
import update from 'immutability-helper'
import axios from 'axios'
const map={1:"单选题",2:"多选题",3:"主观题"}
const map={1:"单选题",2:"多选题",3:"主观题",4:"主观题"}
class PollDetailTabSecond extends Component{
constructor(props){
super(props);

@ -54,12 +54,12 @@ class AccountPage extends Component {
let url=`/users/accounts/${login || this.props.current_user.login}.json`;
axios.get(url).then((result)=>{
if(result.data){
this.setState({
basicInfo: Object.assign({}, {...result.data}, { avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`})
})
if(result.data && result.data.base_info_completed == false){
this.props.history.push(`/account/basic/edit`);
}
this.setState({
basicInfo: Object.assign({}, {...result.data}, { avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`})
})
}
}).catch((error)=>{
console.log(error);

@ -21,40 +21,45 @@ class AccountNav extends Component {
const isSecure = path.indexOf('secure') != -1
return (
<div className="accountNav fl">
<div className="accountInfo">
<AccountImg src={basicInfo && basicInfo.avatar_url} {...this.props}></AccountImg>
<span className="name">{basicInfo && basicInfo.name}</span>
<span className="role">{basicInfo && basicInfo.technical_title}</span>
</div>
{
basicInfo &&
<React.Fragment>
<div className="accountInfo">
<AccountImg src={basicInfo.avatar_url} {...this.props}></AccountImg>
<span className="name">{basicInfo.name}</span>
<span className="role">{basicInfo.technical_title}</span>
</div>
<div className="accountManagement">
<div className="title">账号管理</div>
<ul>
<li className={`navItem ${isBasic ? 'active' : ''}`} onClick={this.toBasic}>
<i className="iconfont icon-jibenxinxi color-grey-9 font-16"></i>
基本信息
{
basicInfo && (basicInfo.authentication == 'uncertified' || basicInfo.authentication == 'applying') &&
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
{
basicInfo && basicInfo.authentication == 'certified' &&
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>
}
</li>
<li className={`navItem ${isCertification ? 'active' : ''}`} onClick={this.toCertification}>
<i className="iconfont icon-renzhengxinxi color-grey-9 font-16"></i>
{
basicInfo && basicInfo.professional_certification == 'certified' && basicInfo.authentication == 'certified' ?
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>:
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
</li>
<li className={`navItem ${isSecure ? 'active' : ''}`} onClick={this.toSecure}>
<i className="iconfont icon-anquanshezhi color-grey-9 font-16"></i>
</li>
</ul>
</div>
<div className="accountManagement">
<div className="title">账号管理</div>
<ul>
<li className={`navItem ${isBasic ? 'active' : ''}`} onClick={this.toBasic}>
<i className="iconfont icon-jibenxinxi color-grey-9 font-16"></i>
基本信息
{
(basicInfo.authentication == 'uncertified' || basicInfo.authentication == 'applying') &&
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
{
basicInfo.authentication == 'certified' &&
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>
}
</li>
<li className={`navItem ${isCertification ? 'active' : ''}`} onClick={this.toCertification}>
<i className="iconfont icon-renzhengxinxi color-grey-9 font-16"></i>
{
basicInfo.professional_certification == 'certified' && basicInfo.authentication == 'certified' ?
<i className="status fr iconfont icon-wancheng color-green-light font-16"></i>:
<i className="status fr iconfont icon-tishi color-red font-16"></i>
}
</li>
<li className={`navItem ${isSecure ? 'active' : ''}`} onClick={this.toSecure}>
<i className="iconfont icon-anquanshezhi color-grey-9 font-16"></i>
</li>
</ul>
</div>
</React.Fragment>
}
</div>
);
}

@ -152,7 +152,30 @@ class AccountSecure extends Component {
onPasswordSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
if(values.p_old == values.p_new){
this.props.showNotification("新密码不能与旧密码相同!");
return;
}
if(values.p_again != values.p_new){
this.props.showNotification("两次输入的新密码必须一致!");
return;
}
let {login}=this.props.current_user;
let url=`/users/accounts/${login}/password.json`;
axios.put((url),{
old_password:values.p_old,
password:values.p_new
}).then((result)=>{
if(result){
this.props.showNotification("密码更新成功!");
this.setState({
updating:''
})
this.props.getBasicInfo();
}
}).catch((error)=>{
console.log(error);
})
}
})
}
@ -164,6 +187,25 @@ class AccountSecure extends Component {
})
}
// 修改密码-判断规则
comfirmNewPassword=(rule,value,callback)=>{
const { form } = this.props;
if (value != form.getFieldsValue().p_new) {
callback("两次输入的新密码必须一致!");
}else {
callback();
}
}
InputNewPassword=(rule,value,callback)=>{
const { form } = this.props;
if (value.length<8 || value.length>12) {
callback("请输入8-12个字符的新密码区分大小写");
}else {
callback();
}
}
render() {
let {basicInfo}=this.props;
const { getFieldDecorator } = this.props.form;
@ -189,7 +231,7 @@ class AccountSecure extends Component {
color: #CDCDCD;
}
.description span {
margin-right: 8px;
margin-right: 20px;
color: #05101A;
}
.flexRow .status {
@ -402,10 +444,12 @@ class AccountSecure extends Component {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请设置816位密码区分大小写',
message: '请输入816位的新密码区分大小写',
},{
validator:this.InputNewPassword
}],
})(
<Input type="password" placeholder="请设置816位密码,区分大小写" autoComplete="new-password"></Input>
<Input type="password" placeholder="请输入816位的新密码,区分大小写" autoComplete="new-password"></Input>
)}
</Form.Item>
@ -418,6 +462,8 @@ class AccountSecure extends Component {
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请再次输入新密码',
},{
validator:this.comfirmNewPassword
}],
})(
<Input type="password" placeholder="请再次输入新密码" autoComplete="new-password"></Input>

@ -46,8 +46,42 @@ class RealNameCertificationModal extends Component{
console.log(values);
if(!err){
let{imageUrl2}=this.state;
let{current_user,basicInfo}=this.props;
if(imageUrl2){
let { certification } = this.props;
if(certification == 1){
// 实名认证
let url = `/users/accounts/${current_user && current_user.login}/authentication_apply.json`
axios.post((url),{
name:basicInfo.name,
id_number:values.credentials
}).then((result)=>{
if(result){
this.props.showNotification("申请已提交,请等待审核!");
this.props.getBasicInfo();
this.setVisible(false);
}
}).catch((error)=>{
console.log(error);
})
}else{
// 职业认证
let url = `/users/accounts/${current_user && current_user.login}/professional_auth_apply.json`
axios.post((url),{
school_id:basicInfo && basicInfo.school_id,
department_id:basicInfo && basicInfo.department_id,
identity:basicInfo && basicInfo.identity,
extra:basicInfo && basicInfo.identity == "student" ? basicInfo.student_id:basicInfo.technical_title
}).then((result)=>{
if(result){
this.props.showNotification("申请已提交,请等待审核!");
this.props.getBasicInfo();
this.setVisible(false);
}
}).catch((error)=>{
console.log(error);
})
}
}else{
this.props.showNotification("请先上传照片!");
}
@ -261,7 +295,7 @@ class RealNameCertificationModal extends Component{
</span>
<Dragger {...uploadProps2}>
{imageUrl2 ?
<a href={imageUrl2} target="_blank">
<a href={imageUrl2} target="_blank" title="点击重新上传图片">
<img src={imageUrl2} alt="avatar" style={{ maxHeight: '110px'}}/>
</a> :
<React.Fragment>

Loading…
Cancel
Save