分销商编辑/重置密码
This commit is contained in:
parent
806bb60c5b
commit
4222528c49
|
@ -215,6 +215,10 @@ export const getReseller = (id) => {
|
|||
export const putResellerInfo = (id,data) => {
|
||||
return req('put', baseurl + "/reseller/"+id,data)
|
||||
}
|
||||
//重置分销商密码
|
||||
export const putResellerPwd = (id,data) => {
|
||||
return req('put', baseurl + "/reseller/password/"+id,data)
|
||||
}
|
||||
|
||||
|
||||
// 账号管理
|
||||
|
|
|
@ -10,6 +10,7 @@ import Ipt from "../../../components/input/main"
|
|||
import Grid from "../../../components/gird/main.js"
|
||||
import TabPage from "../../../components/tabPage/main.js"
|
||||
import Filterbar from "../../../components/filterbar/main.js"
|
||||
import Modifydispwd from "./modifydispwd.js"
|
||||
const Column = [
|
||||
{
|
||||
title: '编号',
|
||||
|
@ -98,6 +99,8 @@ export default class acclist extends React.Component{
|
|||
this.state={
|
||||
tabList:[{title:"分销商列表"}],
|
||||
logVisible:false,
|
||||
pwdVisible:false,
|
||||
resellid:null,
|
||||
key_word:'',
|
||||
limit:10,
|
||||
page:1,
|
||||
|
@ -203,12 +206,21 @@ export default class acclist extends React.Component{
|
|||
pageChange(){
|
||||
|
||||
}
|
||||
onMenuItemClick(e,row){
|
||||
onMenuItemClick(e,key,row){
|
||||
if(key==1){
|
||||
//重置密码
|
||||
this.setState({pwdVisible:true,resellid:row.id})
|
||||
}else if(key==2){
|
||||
this.setState({logVisible:true})
|
||||
}
|
||||
}
|
||||
setLogVisible(e){
|
||||
this.setState({logVisible:false})
|
||||
}
|
||||
//重置密码
|
||||
setVisible(e){
|
||||
this.setState({pwdVisible:false});
|
||||
}
|
||||
//page
|
||||
pageChange(e){
|
||||
this.setState({page:e});
|
||||
|
@ -306,9 +318,9 @@ componentDidUpdate(prevProps,prevState){
|
|||
<div className="linkmore"> 更多 <Icon type={"down"} /> </div>
|
||||
</DropdownClickTrigger>
|
||||
<DropdownContent>
|
||||
<Menu onClick={(e)=>{this.onMenuItemClick(e,rowData)}}>
|
||||
<MenuItem >重置密码</MenuItem>
|
||||
<MenuItem>日志</MenuItem>
|
||||
<Menu onClick={(e,key)=>{this.onMenuItemClick(e,key,rowData)}}>
|
||||
<MenuItem key="1">重置密码</MenuItem>
|
||||
<MenuItem key="2"> 日志</MenuItem>
|
||||
</Menu>
|
||||
</DropdownContent>
|
||||
</Dropdown>
|
||||
|
@ -316,6 +328,16 @@ componentDidUpdate(prevProps,prevState){
|
|||
}
|
||||
}}
|
||||
/>
|
||||
<Dialog
|
||||
visible={this.state.pwdVisible}
|
||||
className="questModal"
|
||||
onClose={() => this.setVisible(false)}
|
||||
title="重置密码"
|
||||
>
|
||||
<p>
|
||||
<Modifydispwd visibleShow={(visible)=>this.setVisible(visible) } id={this.state.resellid}/>
|
||||
</p>
|
||||
</Dialog>
|
||||
|
||||
<Dialog
|
||||
visible={this.state.logVisible}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
import ReactDOM from 'react-dom';
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Form,
|
||||
FormStrategy,
|
||||
Notify,
|
||||
Validators,
|
||||
FormInputField,
|
||||
Button,
|
||||
} from 'zent';
|
||||
import {putResellerPwd,handelResponse} from "../../../assets/api.js"
|
||||
import "../../../assets/comm.css"
|
||||
import _ from "lodash"
|
||||
function equalsPassword(value, ctx) {
|
||||
if (value !== ctx.getSectionValue('password').password) {
|
||||
return {
|
||||
name: 'passwordEqual',
|
||||
message: '两次填写的密码不一致',
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const ModifyDispwd=(props)=>{
|
||||
const form = Form.useForm(FormStrategy.View);
|
||||
const onSubmit = React.useCallback(form => {
|
||||
const value = form.getValue();
|
||||
console.log(value);
|
||||
if(value){
|
||||
let data=_.cloneDeep(value);
|
||||
let id=props.id;
|
||||
putResellerPwd(id,data).then(res=>{
|
||||
handelResponse(res,(response,msg)=>{
|
||||
Notify.clear();
|
||||
Notify.success(msg);
|
||||
props.visibleShow(false);
|
||||
},err=>{
|
||||
Notify.clear();
|
||||
Notify.error(res.data.message);
|
||||
return false;
|
||||
});
|
||||
}).catch(err=>{
|
||||
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
const cancelFn=()=>{
|
||||
props.visibleShow(false);
|
||||
}
|
||||
return (
|
||||
<Form
|
||||
form={form}
|
||||
layout="horizontal"
|
||||
scrollToError
|
||||
onSubmit={onSubmit}
|
||||
>
|
||||
<FormInputField
|
||||
name="password"
|
||||
label="新密码"
|
||||
required
|
||||
helpDesc=''
|
||||
validators={[
|
||||
Validators.required('请输入新密码'),
|
||||
Validators.pattern(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/, '6-16位字符,数字+字母组成,(字母区分大小写)'),
|
||||
]}
|
||||
notice="6-16位字符,数字+字母组成,字母(区分大小写)"
|
||||
props={{
|
||||
type: 'password',
|
||||
}}
|
||||
/>
|
||||
<FormInputField
|
||||
name="re_password"
|
||||
label="确认密码"
|
||||
required
|
||||
notice="必须与新密码输入一致"
|
||||
validators={[ Validators.required('请确认密码'),equalsPassword]}
|
||||
props={{
|
||||
type: 'password',
|
||||
}}
|
||||
/>
|
||||
<p className="dflexajce">
|
||||
<Button type="primary" htmlType="submit">确定</Button>,
|
||||
<Button onClick={cancelFn} >取消</Button>
|
||||
</p>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
export default ModifyDispwd;
|
Loading…
Reference in New Issue