提交 f41263a9 作者: ZhangLingKun

功能:ssr测试

上级 aaa6e234
...@@ -4,6 +4,7 @@ import { ...@@ -4,6 +4,7 @@ import {
InterItemFunction, InterItemFunction,
InterListFunction, InterListFunction,
} from '@/api/interface'; } from '@/api/interface';
import { QueryGoodsInfoByCategorySub } from '@/api/interface/mall';
// 获取图片-小程序 // 获取图片-小程序
export type ListBannerImgType = InterFunction< export type ListBannerImgType = InterFunction<
...@@ -51,48 +52,6 @@ export type AppCategoryInfoType = InterFunction< ...@@ -51,48 +52,6 @@ export type AppCategoryInfoType = InterFunction<
sort?: number; sort?: number;
}[] }[]
>; >;
// 分类下的商品数据
export type QueryGoodsInfoByCategorySub = InterFunction<
number[],
{
categoryPrimaryId: number;
categorySubId: number;
createTime: string;
description: string;
goodsDetails: string;
goodsLabel: string;
goodsSpecList: Array<{
chooseType: number;
goodsSpecValuesList: Array<{
channelPrice: number;
goodsSpecId: number;
id: number;
partNo: string;
salePrice: number;
showPrice: number;
specValueImage: string;
specValueName: string;
stock: number;
}>;
id: number;
mallGoodsId: number;
must: number;
skuUnitId: number;
specName: string;
}>;
id: number;
labelShow: number;
resourcesList: Array<{
id: number;
type: number;
url: string;
}>;
shelfStatus: number;
tradeName: string;
userAccountId: number;
recommend: number;
}[]
>;
// 一级行业列表 // 一级行业列表
export type IndustryListPagesType = InterListFunction< export type IndustryListPagesType = InterListFunction<
{ {
......
...@@ -61,5 +61,17 @@ export type QueryGoodsInfoByCategorySub = InterFunction< ...@@ -61,5 +61,17 @@ export type QueryGoodsInfoByCategorySub = InterFunction<
tradeName: string; tradeName: string;
userAccountId: number; userAccountId: number;
recommend: number; recommend: number;
priceShow: number;
specAttrList: null;
priceStock: Array<{
id: number;
productSpec: string;
salePrice: number;
skuImage: null;
channelPrice: null;
stock: null;
skuNo: null;
}>;
companyName: string;
}[] }[]
>; >;
...@@ -11,7 +11,7 @@ const CategorySelectWrap = styled.div` ...@@ -11,7 +11,7 @@ const CategorySelectWrap = styled.div`
.category-select { .category-select {
position: relative; position: relative;
width: 100%; width: 100%;
height: 2rem; min-height: 2rem;
flex-wrap: wrap; flex-wrap: wrap;
border-bottom: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;
.select-item { .select-item {
......
...@@ -2,7 +2,7 @@ import React from 'react'; ...@@ -2,7 +2,7 @@ import React from 'react';
import { PropertySafetyFilled, ShoppingCartOutlined } from '@ant-design/icons'; import { PropertySafetyFilled, ShoppingCartOutlined } from '@ant-design/icons';
import styled from 'styled-components'; import styled from 'styled-components';
import { InterDataType } from '@/api/interface'; import { InterDataType } from '@/api/interface';
import { QueryGoodsInfoByCategorySub } from '@/api/interface/home'; import { QueryGoodsInfoByCategorySub } from '@/api/interface/mall';
const ProductItemWrap = styled.div` const ProductItemWrap = styled.div`
position: relative; position: relative;
...@@ -110,7 +110,7 @@ const ProductItemView: React.FC<{ ...@@ -110,7 +110,7 @@ const ProductItemView: React.FC<{
</div> </div>
<div className="product-store flex-start"> <div className="product-store flex-start">
<PropertySafetyFilled style={{ color: '#FF552D' }} /> <PropertySafetyFilled style={{ color: '#FF552D' }} />
<div className="title text-ellipsis">{detail?.tradeName}</div> <div className="title text-ellipsis">{detail?.companyName}</div>
</div> </div>
<div className="product-cart"> <div className="product-cart">
<ShoppingCartOutlined style={{ color: '#ffffff', fontSize: '16px' }} /> <ShoppingCartOutlined style={{ color: '#ffffff', fontSize: '16px' }} />
......
...@@ -20,15 +20,20 @@ type GoodsInfoListType = InterDataType<QueryGoodsInfoByCategorySub>; ...@@ -20,15 +20,20 @@ type GoodsInfoListType = InterDataType<QueryGoodsInfoByCategorySub>;
// 每次加载页面都会执行 // 每次加载页面都会执行
export async function getServerSideProps() { export async function getServerSideProps() {
// 分类数据 // 分类数据
let categoryList: CategoryListType = []; const categoryList: CategoryListType = [];
// 获取各个目录及分类信息 // 获取各个目录及分类信息
// const getAppCategoryInfo = async () => {
// const res = await MallAPI.getAppCategoryInfo({
// type: 4,
// });
// if (res && res.code === '200') {
// categoryList = res?.result || [];
// }
// };
// fetch测试
const getAppCategoryInfo = async () => { const getAppCategoryInfo = async () => {
const res = await MallAPI.getAppCategoryInfo({ const res = await fetch('https://www.baidu.com');
type: 4, console.log('fetch测试 res --->', res);
});
if (res && res.code === '200') {
categoryList = res?.result || [];
}
}; };
// 依次获取接口数据 // 依次获取接口数据
await (async () => { await (async () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论