提交 f41263a9 作者: ZhangLingKun

功能:ssr测试

上级 aaa6e234
......@@ -4,6 +4,7 @@ import {
InterItemFunction,
InterListFunction,
} from '@/api/interface';
import { QueryGoodsInfoByCategorySub } from '@/api/interface/mall';
// 获取图片-小程序
export type ListBannerImgType = InterFunction<
......@@ -51,48 +52,6 @@ export type AppCategoryInfoType = InterFunction<
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<
{
......
......@@ -61,5 +61,17 @@ export type QueryGoodsInfoByCategorySub = InterFunction<
tradeName: string;
userAccountId: 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`
.category-select {
position: relative;
width: 100%;
height: 2rem;
min-height: 2rem;
flex-wrap: wrap;
border-bottom: 1px solid #ebebeb;
.select-item {
......
......@@ -2,7 +2,7 @@ import React from 'react';
import { PropertySafetyFilled, ShoppingCartOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import { InterDataType } from '@/api/interface';
import { QueryGoodsInfoByCategorySub } from '@/api/interface/home';
import { QueryGoodsInfoByCategorySub } from '@/api/interface/mall';
const ProductItemWrap = styled.div`
position: relative;
......@@ -110,7 +110,7 @@ const ProductItemView: React.FC<{
</div>
<div className="product-store flex-start">
<PropertySafetyFilled style={{ color: '#FF552D' }} />
<div className="title text-ellipsis">{detail?.tradeName}</div>
<div className="title text-ellipsis">{detail?.companyName}</div>
</div>
<div className="product-cart">
<ShoppingCartOutlined style={{ color: '#ffffff', fontSize: '16px' }} />
......
......@@ -20,15 +20,20 @@ type GoodsInfoListType = InterDataType<QueryGoodsInfoByCategorySub>;
// 每次加载页面都会执行
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 res = await MallAPI.getAppCategoryInfo({
type: 4,
});
if (res && res.code === '200') {
categoryList = res?.result || [];
}
const res = await fetch('https://www.baidu.com');
console.log('fetch测试 res --->', res);
};
// 依次获取接口数据
await (async () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论