Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
web-ci-test
Commits
975d3c41
提交
975d3c41
authored
5月 19, 2023
作者:
翁进城
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商城页增加空数据展示优化
上级
86a69d99
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
67 行增加
和
39 行删除
+67
-39
index.ts
pages/mall/api/index.ts
+3
-2
index.module.scss
pages/mall/index.module.scss
+5
-1
index.page.tsx
pages/mall/index.page.tsx
+59
-36
没有找到文件。
pages/mall/api/index.ts
浏览文件 @
975d3c41
...
...
@@ -35,7 +35,7 @@ export interface ListPageGoodsInfoResp {
export
default
{
//web-商品信息-分页
listPageGoodsInfo
:
(
params
:
ListPageGoodsInfoParams
):
Promise
<
Response
<
ListPageGoodsInfoResp
>>
=>
{
return
request
(
'/pms/webProductMall/listPageGoodsInfo'
,
'post'
,
params
)
listPageGoodsInfo
:
(
params
:
ListPageGoodsInfoParams
,
options
=
{}
):
Promise
<
Response
<
ListPageGoodsInfoResp
>>
=>
{
return
request
(
'/pms/webProductMall/listPageGoodsInfo'
,
'post'
,
params
,
options
)
}
}
\ No newline at end of file
pages/mall/index.module.scss
浏览文件 @
975d3c41
...
...
@@ -24,11 +24,15 @@
}
}
.listContent
{
width
:
100%
;
}
.listWrap
{
display
:
flex
;
flex-wrap
:
wrap
;
gap
:
12px
;
height
:
fit-content
;
height
:
856px
;
.item
{
cursor
:
pointer
;
...
...
pages/mall/index.page.tsx
浏览文件 @
975d3c41
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
Pagination
,
Select
,
Space
,
Tag
}
from
"antd"
;
import
{
Button
,
Empty
,
Pagination
,
Select
,
Space
,
Tag
}
from
"antd"
;
import
Layout
from
"~/components/layout"
;
import
styles
from
"./index.module.scss"
;
import
{
useRouter
}
from
"next/router"
;
...
...
@@ -25,23 +25,35 @@ export default function Mall(props: Props) {
pageSize
:
16
,
});
const
[
count
,
setCount
]
=
useState
(
0
);
const
[
abort
,
setAbort
]
=
useState
<
AbortController
|
null
>
(
null
);
useEffect
(()
=>
{
//中断前一次请求
abort
?.
abort
();
setAbort
(
new
AbortController
());
},
[
filterResult
,
pageParams
]);
useEffect
(()
=>
{
api
.
listPageGoodsInfo
({
brandId
:
filterResult
.
brand
?.
id
,
districtId
:
filterResult
.
region
?.
id
,
modelId
:
filterResult
.
model
?.
id
,
partsId
:
filterResult
.
part
?.
id
,
productCategoryId
:
filterResult
.
category
?.
id
,
qualityId
:
filterResult
.
quality
?.
id
,
...
pageParams
,
})
.
listPageGoodsInfo
(
{
brandId
:
filterResult
.
brand
?.
id
,
districtId
:
filterResult
.
region
?.
id
,
modelId
:
filterResult
.
model
?.
id
,
partsId
:
filterResult
.
part
?.
id
,
productCategoryId
:
filterResult
.
category
?.
id
,
qualityId
:
filterResult
.
quality
?.
id
,
...
pageParams
,
},
{
signal
:
abort
?.
signal
,
}
)
.
then
((
res
)
=>
{
setProductList
(
res
.
result
?.
list
||
[]);
setCount
(
res
.
result
?.
totalCount
);
});
},
[
filterResult
,
pageParams
]);
},
[
abort
]);
const
onFilterChange
=
(
filterResult
:
FilterResult
)
=>
{
console
.
log
(
"filterResult"
,
filterResult
);
...
...
@@ -52,8 +64,8 @@ export default function Mall(props: Props) {
setPageParams
({
...
pageParams
,
pageNo
:
page
,
})
}
})
;
}
;
return
(
<
Layout
>
<
div
className=
"page"
style=
{
{
paddingTop
:
"18px"
}
}
>
...
...
@@ -65,36 +77,47 @@ export default function Mall(props: Props) {
<
div
className=
{
styles
.
productList
}
>
<
div
className=
{
styles
.
title
}
>
四旋翼无人机
</
div
>
<
div
className=
{
styles
.
main
}
>
<
ul
className=
{
styles
.
listWrap
}
>
{
productList
.
map
((
item
,
i
)
=>
{
return
(
<
li
key=
{
i
}
className=
{
styles
.
item
}
onClick=
{
()
=>
router
.
push
(
"/mall/detail/1"
)
}
>
<
div
className=
{
styles
.
imgBox
}
>
<
Image
alt=
""
src=
{
item
.
imgUrl
}
className=
{
styles
.
img
}
width=
{
116
}
height=
{
116
}
></
Image
>
</
div
>
<
div
className=
{
styles
.
title
}
>
{
item
.
goodsName
}
</
div
>
<
div
className=
{
styles
.
sellCount
}
>
半年售
{
(
Math
.
floor
(
Math
.
random
()
*
901
)
+
100
).
toFixed
(
0
)
}
</
div
>
</
li
>
);
})
}
<
div
className=
{
styles
.
listContent
}
>
<
ul
className=
{
styles
.
listWrap
}
>
{
productList
.
map
((
item
,
i
)
=>
{
return
(
<
li
key=
{
i
}
className=
{
styles
.
item
}
onClick=
{
()
=>
router
.
push
(
"/mall/detail/1"
)
}
>
<
div
className=
{
styles
.
imgBox
}
>
<
Image
alt=
""
src=
{
item
.
imgUrl
}
className=
{
styles
.
img
}
width=
{
116
}
height=
{
116
}
></
Image
>
</
div
>
<
div
className=
{
styles
.
title
}
>
{
item
.
goodsName
}
</
div
>
<
div
className=
{
styles
.
sellCount
}
>
半年售
{
(
Math
.
floor
(
Math
.
random
()
*
901
)
+
100
).
toFixed
(
0
)
}
</
div
>
</
li
>
);
})
}
{
productList
.
length
===
0
&&
(
<
Empty
style=
{
{
paddingTop
:
20
,
width
:
'100%'
,
textAlign
:
"center"
}
}
></
Empty
>
)
}
</
ul
>
<
Pagination
current=
{
pageParams
.
pageNo
}
showSizeChanger=
{
false
}
showQuickJumper
total=
{
count
}
onChange=
{
onPageChange
}
hideOnSinglePage=
{
true
}
style=
{
{
marginTop
:
20
}
}
/>
</
ul
>
</
div
>
<
div
className=
{
styles
.
adList
}
>
<
div
className=
{
styles
.
ad
}
></
div
>
<
div
className=
{
styles
.
ad
}
></
div
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论