From 4222528c498ea97cfe9a9b50d041090b0cf82408 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Sat, 20 Nov 2021 16:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=94=80=E5=95=86=E7=BC=96=E8=BE=91/?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 4 + src/pages/distributor/list/list.js | 34 +++++++-- src/pages/distributor/list/modifydispwd.js | 88 ++++++++++++++++++++++ 3 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 src/pages/distributor/list/modifydispwd.js 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