Commit a02edf8b authored by GuanHua's avatar GuanHua

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

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