From f608c8459891a25223fe199ba330f0bba5a9d55a Mon Sep 17 00:00:00 2001 From: zhangds Date: Fri, 15 Apr 2022 18:10:10 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E5=A2=9E=E5=8A=A0=20=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E5=88=86=E9=94=80=E5=95=86=20=E6=A8=A1=E7=B3=8A=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseLazyLoadingSelect/index.js | 4 +++ .../adddistributorinfo/adddistributorinfo.js | 29 ++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/components/UseLazyLoadingSelect/index.js b/src/components/UseLazyLoadingSelect/index.js index 6063c127..c5b39f3f 100644 --- a/src/components/UseLazyLoadingSelect/index.js +++ b/src/components/UseLazyLoadingSelect/index.js @@ -10,6 +10,8 @@ const UseLazyLoadingSelect = ({ width, onChangePage, disabled = false, + onKeywordChange, + keyword = "", }) => { let firstOpen = true; const [loading, setLoading] = useState(true); @@ -74,6 +76,8 @@ const UseLazyLoadingSelect = ({ disabled={disabled} onOpenChange={handleOpenChange} renderOptionList={renderOptionList} + onKeywordChange={onKeywordChange} + keyword={keyword} /> ); diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js index e9bc4c20..c12ae080 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js @@ -168,6 +168,7 @@ export default class adduserinfo extends React.Component { ], //身份类型 limit: 15, page: 1, + keyword: "", }; } @@ -190,16 +191,7 @@ export default class adduserinfo extends React.Component { this.directList(params); } - componentDidUpdate(prevProps, prevState) { - // 典型用法(不要忘记比较 props): - if (this.state.page !== prevState.page) { - let params = { - limit: this.state.limit, - page: this.state.page, - }; - this.directList(params); - } - } + componentDidUpdate(prevProps, prevState) {} // 获取分销商数据 directList(param) { @@ -298,6 +290,11 @@ export default class adduserinfo extends React.Component { this.setState({ page: that.state.page + 1, }); + let params = { + limit: this.state.limit, + page: that.state.page + 1, + }; + this.directList(params); closeLoading && closeLoading(); } //校验分销商名称 @@ -536,6 +533,16 @@ export default class adduserinfo extends React.Component { changeKind() { this.setState({ pwdtype: "password" }); } + onKeywordChange(e) { + console.log("keyword ==>", e); + let params = { + limit: this.state.limit, + page: this.state.page, + key_word: e, + }; + this.directList(params); + this.setState({ keyword: e }); + } render() { const companyOptions = this.state.companyList; //校验规则 @@ -1147,6 +1154,8 @@ export default class adduserinfo extends React.Component { value={this.state.model.direct_reseller_id} onChangePage={this.onChangePageSelect.bind(this)} disabled={this.state.isSelectDirect} + keyword={this.state.keyword} + onKeywordChange={this.onKeywordChange.bind(this)} onChange={(e) => { this.onDirectChange(e); Bus.emit("change", "direct_reseller_id", e);