Commit a02edf8b authored by GuanHua's avatar GuanHua

feat:装修页面商品列表分页问题

parent ce3422cb
...@@ -112,6 +112,9 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => { ...@@ -112,6 +112,9 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
if (selectBrandList.length <= 0) { if (selectBrandList.length <= 0) {
message.error("请选择要推荐的品牌") message.error("请选择要推荐的品牌")
return return
} else if (selectBrandList.length > 6) {
message.error("最多推荐6个品牌")
return
} }
setConfirmLoading(true) setConfirmLoading(true)
saveBrand().then(() => { saveBrand().then(() => {
......
...@@ -111,6 +111,10 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p ...@@ -111,6 +111,10 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
reject() reject()
return return
} }
if (selectKeys.length > 3) {
message.error('最多推荐3个二级品类')
return
}
let param = { let param = {
templateId: templateid, templateId: templateid,
categoryId: categoryid, categoryId: categoryid,
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core' import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Select, Form, message, Modal } from 'antd' import { Row, Col, Button, Input, Pagination, Select, Form, message, Modal, Spin } from 'antd'
import SettingList from '../../../../components/SettingList' import SettingList from '../../../../components/SettingList'
import GoodsItem from './GoodsItem' import GoodsItem from './GoodsItem'
import SettingPanel from '../../../../components/SettingPanel' import SettingPanel from '../../../../components/SettingPanel'
...@@ -42,6 +42,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -42,6 +42,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [goodsIds, setGoodsIds] = useState<any>([]) const [goodsIds, setGoodsIds] = useState<any>([])
const [totalCount, setTotalCount] = useState<number>(0) const [totalCount, setTotalCount] = useState<number>(0)
const [filterParam, setFilterParam] = useState() const [filterParam, setFilterParam] = useState()
const [spinLoading, setSpinLoading] = useState<boolean>(false)
const [newProps, setNewProps] = useState(props) const [newProps, setNewProps] = useState(props)
const [categoryResponseList, setCategoryResponseList] = useState<any>([]) const [categoryResponseList, setCategoryResponseList] = useState<any>([])
...@@ -66,10 +67,12 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -66,10 +67,12 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
categoryId: categoryid, categoryId: categoryid,
templateId: templateid templateId: templateid
} }
setSpinLoading(true)
//@ts-ignore //@ts-ignore
PublicApi.getTemplatePlatformFindCategoryList(param).then(res => { PublicApi.getTemplatePlatformFindCategoryList(param).then(res => {
const data = res.data const data = res.data
setCategoryResponseList(data.categoryBOList || []) setCategoryResponseList(data.categoryBOList || [])
setSpinLoading(false)
}) })
} }
...@@ -139,9 +142,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -139,9 +142,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handlePageChange = (page: number, pageSize?: number | undefined) => { const handlePageChange = (page: number, pageSize?: number | undefined) => {
setCurrent(page) setCurrent(page)
setPageSize(pageSize || 10) setPageSize(pageSize || 10)
fetchGoodsList()
} }
useEffect(() => {
fetchGoodsList()
}, [current, pageSize])
const handleSearch = () => { const handleSearch = () => {
setCurrent(1) setCurrent(1)
console.log(form.getFieldsValue()) console.log(form.getFieldsValue())
...@@ -168,6 +175,9 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -168,6 +175,9 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
if (selectGoodsList.length <= 0) { if (selectGoodsList.length <= 0) {
message.error("请选择要推荐的商品") message.error("请选择要推荐的商品")
return return
} else if (selectGoodsList.length > 10) {
message.error("最多推荐10件商品")
return
} }
setConfirmLoading(true) setConfirmLoading(true)
let newList = JSON.parse(JSON.stringify(selectGoodsList)) let newList = JSON.parse(JSON.stringify(selectGoodsList))
...@@ -361,7 +371,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -361,7 +371,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
</SettingList> </SettingList>
</> </>
) : ( ) : (
<> <Spin spinning={spinLoading}>
<SettingList type="select"> <SettingList type="select">
{ {
(noSelectGoods && noSelectGoods.length > 0) && noSelectGoods.map(item => ( (noSelectGoods && noSelectGoods.length > 0) && noSelectGoods.map(item => (
...@@ -381,7 +391,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -381,7 +391,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
showTotal={total => `共 ${totalCount} 条`} showTotal={total => `共 ${totalCount} 条`}
/> />
</div> </div>
</> </Spin>
) )
} }
......
...@@ -113,6 +113,9 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => { ...@@ -113,6 +113,9 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
if (selectShopsList.length <= 0) { if (selectShopsList.length <= 0) {
message.error("请选择要推荐的店铺") message.error("请选择要推荐的店铺")
return return
} else if (selectShopsList.length > 5) {
message.error("最多推荐5个店铺")
return
} }
setConfirmLoading(true) setConfirmLoading(true)
saveShop().then(() => { saveShop().then(() => {
......
...@@ -65,7 +65,7 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => { ...@@ -65,7 +65,7 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
return ( return (
<Drawer <Drawer
// maskClosable={false} maskClosable={false}
title={drawerTitle} title={drawerTitle}
placement="right" placement="right"
onClose={onClose} onClose={onClose}
......
...@@ -98,7 +98,7 @@ class ApiRequest { ...@@ -98,7 +98,7 @@ class ApiRequest {
// } // }
removeAuth() removeAuth()
removeRouters() removeRouters()
history.replace('/login') window.location.replace('/login')
message.destroy() message.destroy()
message.error(res.message) message.error(res.message)
return false return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment