From 240876581765e7a0bb7cf0d65260f20eb429160c Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Fri, 28 Oct 2022 18:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=E5=AE=A2=E6=88=B7=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.ts | 4 +- .../components/ChoseCity/index.tsx | 29 +++++++++++++- .../components/tabs/index.module.scss | 15 ++++++- .../components/tabs/index.tsx | 39 +++++++++++-------- src/pages/customerManagement/index.tsx | 6 +-- 5 files changed, 68 insertions(+), 25 deletions(-) diff --git a/src/common/constant.ts b/src/common/constant.ts index 988f7c3..d19a317 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,4 +1,4 @@ -// export const BASE_URL = CURRENT_BASE_URL +export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` @@ -15,7 +15,7 @@ // export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰 // export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华 -export const BASE_URL = 'http://192.168.1.22:50002/lymarket' // 婷 +// export const BASE_URL = 'http://192.168.1.22:50002/lymarket' // 婷 // CDN // 生成密钥 diff --git a/src/pages/customerManagement/components/ChoseCity/index.tsx b/src/pages/customerManagement/components/ChoseCity/index.tsx index e506ab4..be28da0 100644 --- a/src/pages/customerManagement/components/ChoseCity/index.tsx +++ b/src/pages/customerManagement/components/ChoseCity/index.tsx @@ -152,11 +152,36 @@ export default memo(forwardRef((props: Props, ref) => { return list } - + //重置 + const handReset = () => { + TarBarList.map((item, index) => { + if (index == 0) { + item.name = '选择省' + item.showBorder = true + } else { + item.showBorder = false + } + return item + }) + setTarBarList([...TarBarList]) + setCurrentValue(1) + choseCityArr.current.list = [] + list.map(item => { + item.check = false + return item + }) + setlist([...list]) + cityList.map(item => { + item.check = false + return item + }) + setcityList([...cityList]) + props.handCity?.('', '') + } return ( - handChose?.(item)}> + handChose?.(item)} handReset={() => handReset()}> { currentValue == 1 && { diff --git a/src/pages/customerManagement/components/tabs/index.module.scss b/src/pages/customerManagement/components/tabs/index.module.scss index 939516b..5fdb765 100644 --- a/src/pages/customerManagement/components/tabs/index.module.scss +++ b/src/pages/customerManagement/components/tabs/index.module.scss @@ -1,5 +1,18 @@ +.main { + display: flex; + justify-content: space-between; + align-items: center; + + .resetBox { + font-size: 28px; + font-weight: 500; + color: #337FFF; + margin-right: 48px; + } +} + .flexBox { - width: 100%; + // width: 100%; height: 102px; background: #ffffff; display: flex; diff --git a/src/pages/customerManagement/components/tabs/index.tsx b/src/pages/customerManagement/components/tabs/index.tsx index 6ed5f40..e603f8e 100644 --- a/src/pages/customerManagement/components/tabs/index.tsx +++ b/src/pages/customerManagement/components/tabs/index.tsx @@ -5,28 +5,33 @@ import classnames from "classnames"; interface Props { list: any[], - handChose?: (any) => void + handChose?: (any) => void, + handReset?: () => void } export default memo((props: Props) => { const { list = [], handChose } = props return ( - - { - list.map((item, index) => { - return ( - handChose?.(item)}> - + + { + list.map((item, index) => { + return ( + handChose?.(item)}> + {item?.name} - { - item.showBorder && - } - - ) - }) - } - + >{item?.name} + { + item.showBorder && + } + + ) + }) + } + + + props?.handReset?.()}>重置 + ) }) \ No newline at end of file diff --git a/src/pages/customerManagement/index.tsx b/src/pages/customerManagement/index.tsx index 794d8cf..99d3674 100644 --- a/src/pages/customerManagement/index.tsx +++ b/src/pages/customerManagement/index.tsx @@ -97,15 +97,15 @@ export default () => { const handCity = useCallback((provinceVal, cityVal) => { const provinceArr: number[] = [] const cityArr: number[] = [] - provinceVal.forEach(item => { + provinceVal.length && provinceVal.forEach(item => { provinceArr.push(item.id) }) - cityVal.forEach(item => { + cityVal.length && cityVal.forEach(item => { cityArr.push(item.id) }) console.log(provinceArr, cityArr) pageNum.current.page = 1 - setSearchField((val) => ({ ...val, province_id: provinceArr, city_id: cityArr, size: 10 })) + setSearchField((val) => ({ ...val, province_id: provinceArr.length > 0 ? provinceArr : '', city_id: cityArr.length > 0 ? cityArr : '', size: 10 })) // ChoseCityRef.current.close() }, [])