diff --git a/src/assets/api.js b/src/assets/api.js index 460f6396..033a8f13 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -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) +} // 账号管理 diff --git a/src/pages/distributor/list/list.js b/src/pages/distributor/list/list.js index eb7bf86f..c9c50338 100644 --- a/src/pages/distributor/list/list.js +++ b/src/pages/distributor/list/list.js @@ -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){ - this.setState({logVisible:true}) + 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){
更多
- {this.onMenuItemClick(e,rowData)}}> - 重置密码 - 日志 + {this.onMenuItemClick(e,key,rowData)}}> + 重置密码 + 日志 @@ -316,7 +328,17 @@ componentDidUpdate(prevProps,prevState){ } }} /> - + this.setVisible(false)} + title="重置密码" + > +

+ this.setVisible(visible) } id={this.state.resellid}/> +

+
+ this.setLogVisible(false)} diff --git a/src/pages/distributor/list/modifydispwd.js b/src/pages/distributor/list/modifydispwd.js new file mode 100644 index 00000000..5041d915 --- /dev/null +++ b/src/pages/distributor/list/modifydispwd.js @@ -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 ( +
+ + +

+ , + +

+ + ); +} +export default ModifyDispwd; \ No newline at end of file