Commit 120b47a0 authored by GuanHua's avatar GuanHua

fix: 平台首页装修分类选择问题

parent 403283b3
...@@ -41,7 +41,7 @@ export interface ShopInfo { ...@@ -41,7 +41,7 @@ export interface ShopInfo {
describe: string; describe: string;
state: number; state: number;
url: string; url: string;
isDefault: number; isDefault?: any;
} }
export interface OrderMode { export interface OrderMode {
...@@ -60,7 +60,7 @@ export interface SiteInfo { ...@@ -60,7 +60,7 @@ export interface SiteInfo {
name: string; name: string;
logo: string; logo: string;
siteUrl: string; siteUrl: string;
symbol: string; symbol?: any;
} }
export interface Site { export interface Site {
......
...@@ -81,10 +81,24 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => { ...@@ -81,10 +81,24 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
const [selectedRows, setSelectedRows] = useState([]); const [selectedRows, setSelectedRows] = useState([]);
const [mallSelectList, setMallSelectList] = useState<NewSelectItemType[]>([]); const [mallSelectList, setMallSelectList] = useState<NewSelectItemType[]>([]);
const [selectMallInfo, setSelectMallInfo] = useState<NewSelectItemType>(); const [selectMallInfo, setSelectMallInfo] = useState<NewSelectItemType>();
const [categoryId, setCategoryId] = useState<number>(); const [categoryId, setCategoryId] = useState<string>();
const [fontColor, setFontColor] = useState<string>(); const [fontColor, setFontColor] = useState<string>();
const ref = useRef<any>({}); const ref = useRef<any>({});
const initCategoryId = () => {
if (dataInfo) {
if (dataInfo.thirdId) {
setCategoryId(dataInfo.thirdId)
} else if (dataInfo.secondId) {
setCategoryId(dataInfo.secondId)
} else if (dataInfo.firstId){
setCategoryId(dataInfo.firstId)
} else {
setCategoryId(undefined)
}
}
}
const initMallList = (mallList: ShopInfo[]) => { const initMallList = (mallList: ShopInfo[]) => {
if (!mallList) { if (!mallList) {
return []; return [];
...@@ -134,6 +148,7 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => { ...@@ -134,6 +148,7 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
const enterpriseMallList = GlobalConfig.web.shopInfo.filter((item) => item.type === 1 && item.environment === 1); const enterpriseMallList = GlobalConfig.web.shopInfo.filter((item) => item.type === 1 && item.environment === 1);
setMallSelectList(initMallList(enterpriseMallList)); setMallSelectList(initMallList(enterpriseMallList));
initColorPicker(); initColorPicker();
initCategoryId()
}, []); }, []);
useEffect(() => { useEffect(() => {
......
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