提交 ecd85efd 作者: 翁进城

商城页开发

上级 512cd6e7
import request, { Response } from '~/api/request';
export interface ListPageGoodsInfoParams {
"brandId"?: number,
"districtId"?: number,
"modelId"?: number,
"pageNo": number,
"pageSize": number,
"partsId"?: number,
"productCategoryId"?: number,
"qualityId"?: number
}
export interface Goods {
"createTime": string,
"directoryId": number,
"directoryName": string,
"goodsName": string,
"goodsOneLevelTypeName": string,
"goodsTwoLevelTypeName": string,
"id": number,
"imgUrl": string,
"isCoupons": number,
"status": number
}
export interface ListPageGoodsInfoResp {
"pageNo": 1,
"pageSize": 10,
"list": Array<Goods>,
"totalCount": 0,
"totalPage": 0
}
export default {
//web-商品信息-分页
listPageGoodsInfo: (params: ListPageGoodsInfoParams): Promise<Response<ListPageGoodsInfoResp>> => {
return request('/pms/webProductMall/listPageGoodsInfo', 'post', params)
}
}
\ No newline at end of file
@import "~/styles/mixins.scss";
.productList { .productList {
.title { .title {
padding: 20px 10px 18px; padding: 20px 10px 18px;
...@@ -6,37 +8,47 @@ ...@@ -6,37 +8,47 @@
.main { .main {
display: flex; display: flex;
justify-content: space-between;
.ad { .adList {
display: flex;
flex-shrink: 0; flex-shrink: 0;
width: 260px; flex-direction: column;
height: 420px; gap: 12px;
margin-left: 16px;
background-color: gray; .ad {
width: 270px;
height: 422px;
background-color: #d8d8d8;
}
} }
} }
.listWrap { .listWrap {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-left: -14px; gap: 12px;
height: fit-content;
.item { .item {
cursor: pointer; cursor: pointer;
width: 220px; width: 220px;
height: 326px; height: 205px;
background: #ffffff; background: #ffffff;
border-radius: 6px; border-radius: 6px;
margin-bottom: 15px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
padding-bottom: 18px; padding: 19px 0 18px;
margin-left: 14px;
.img { .imgBox {
width: 100%; width: 100%;
height: 220px; text-align: center;
.img {
width: 116px;
height: 116px;
}
} }
.title { .title {
...@@ -45,21 +57,15 @@ ...@@ -45,21 +57,15 @@
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI; font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
line-height: 24px; @include ellipsis(1);
height: 48px;
display: -webkit-box; /* 使用弹性盒子布局 */
-webkit-line-clamp: 2; /* 显示行数 */
-webkit-box-orient: vertical; /* 垂直排列 */
overflow: hidden; /* 隐藏溢出部分 */
text-overflow: ellipsis; /* 使用省略号代替溢出部分 */
} }
.sellCount { .sellCount {
font-size: 14px; font-size: 12px;
font-family: MicrosoftYaHei; font-family: MicrosoftYaHei;
color: #ff552d; color: #ff552d;
padding-left: 20px; padding-left: 20px;
} }
} }
} }
} }
\ No newline at end of file
...@@ -3,27 +3,39 @@ import { Button, Select, Space, Tag } from "antd"; ...@@ -3,27 +3,39 @@ import { Button, Select, Space, Tag } from "antd";
import Layout from "~/components/layout"; import Layout from "~/components/layout";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Image from 'next/image'; import Image from "next/image";
import Filter, { FilterResult } from "~/components/filter"; import Filter, { FilterResult } from "~/components/filter";
import { FilterOptionResp, mallApi } from "~/components/filter/api"; import api, { Goods } from "./api";
// 此函数在构建时被调用 // 此函数在构建时被调用
export async function getServerSideProps() { export async function getServerSideProps() {
return { return {
props: { props: {},
},
}; };
} }
type Props = { type Props = {};
};
export default function Mall(props: Props) { export default function Mall(props: Props) {
const router = useRouter(); const router = useRouter();
const [productList, setProductList] = useState(Array<{}>); const [productList, setProductList] = useState(Array<Goods>);
const [filterResult, setFilterResult] = useState<FilterResult>({});
useEffect(() => {
api
.listPageGoodsInfo({
brandId: 1,
pageNo: 1,
pageSize: 10,
})
.then((res) => {
setProductList(res.result?.list || []);
});
}, []);
const onFilterChange = (filterResult: FilterResult) => { const onFilterChange = (filterResult: FilterResult) => {
console.log('filterResult', filterResult) console.log("filterResult", filterResult);
} };
return ( return (
<Layout> <Layout>
<div className="page" style={{ paddingTop: "18px" }}> <div className="page" style={{ paddingTop: "18px" }}>
...@@ -43,16 +55,25 @@ export default function Mall(props: Props) { ...@@ -43,16 +55,25 @@ export default function Mall(props: Props) {
className={styles.item} className={styles.item}
onClick={() => router.push("/mall/detail/1")} onClick={() => router.push("/mall/detail/1")}
> >
<Image alt="" src="" className={styles.img}></Image> <div className={styles.imgBox}>
<div className={styles.title}> <Image
入云龙ll 1550入云龙ll 1550入云龙ll 1550入云龙ll 1550 alt=""
src={item.imgUrl}
className={styles.img}
width={116}
height={116}
></Image>
</div> </div>
<div className={styles.title}>{item.goodsName}</div>
<div className={styles.sellCount}>半年售12987</div> <div className={styles.sellCount}>半年售12987</div>
</li> </li>
); );
})} })}
</ul> </ul>
<div className={styles.ad}></div> <div className={styles.adList}>
<div className={styles.ad}></div>
<div className={styles.ad}></div>
</div>
</div> </div>
</div> </div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论