Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
web-ci-test
Commits
32e4472f
提交
32e4472f
authored
5月 30, 2023
作者:
翁进城
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品详情规格内容对接
上级
72820481
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
117 行增加
和
50 行删除
+117
-50
[id].page.tsx
pages/mall/detail/[id].page.tsx
+34
-9
index.ts
pages/mall/detail/api/index.ts
+2
-2
index.tsx
pages/mall/detail/components/intentionModal/index.tsx
+81
-39
没有找到文件。
pages/mall/detail/[id].page.tsx
浏览文件 @
32e4472f
import
styles
from
"./index.module.scss"
;
import
Layout
from
"~/components/layout"
;
import
{
Space
,
Image
as
AImage
,
Row
,
Col
,
Button
,
Divider
,
Badge
}
from
"antd"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
use
Context
,
use
Effect
,
useState
}
from
"react"
;
import
{
DownOutlined
,
RightOutlined
}
from
"@ant-design/icons"
;
import
Image
from
"next/image"
;
import
errImg
from
"~/assets/errImg"
;
...
...
@@ -15,16 +15,28 @@ import "swiper/css";
import
"swiper/css/navigation"
;
import
api
,
{
GetAppGoodsInfoDetailResult
}
from
"./api"
;
import
IntentionModal
from
"./components/intentionModal"
;
import
{
UserContext
}
from
"~/lib/userProvider"
;
export
default
function
MallDetail
()
{
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
{
userInfo
,
setNeedLogin
}
=
useContext
(
UserContext
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
//商品图预览
const
router
=
useRouter
();
const
[
id
,
setId
]
=
useState
<
number
|
null
>
(
null
);
const
[
id
,
setId
]
=
useState
<
number
|
null
>
(
null
);
const
[
detail
,
setDetail
]
=
useState
<
GetAppGoodsInfoDetailResult
|
null
>
(
null
);
//详情数据
const
[
intentionModalOpen
,
setIntentionModalOpen
]
=
useState
(
false
);
//意向弹窗
);
//详情数据
const
[
intentionModalOpen
,
setIntentionModalOpen
]
=
useState
(
false
);
//意向弹窗
//打开意向modal
const
openIntentionModal
=
()
=>
{
if
(
userInfo
)
{
setIntentionModalOpen
(
true
);
}
else
{
setNeedLogin
(
true
);
}
};
//提交意向
const
handleIntentionOk
=
()
=>
{
setIntentionModalOpen
(
false
);
};
...
...
@@ -52,7 +64,12 @@ export default function MallDetail() {
return
(
<
Layout
>
{
/* 意向弹窗 */
}
<
IntentionModal
open=
{
intentionModalOpen
}
onOk=
{
handleIntentionOk
}
onCancel=
{
handleIntentionCancel
}
></
IntentionModal
>
<
IntentionModal
open=
{
intentionModalOpen
}
detail=
{
detail
}
onOk=
{
handleIntentionOk
}
onCancel=
{
handleIntentionCancel
}
></
IntentionModal
>
<
div
className=
"page"
style=
{
{
marginTop
:
20
,
backgroundColor
:
"#fff"
}
}
>
<
div
style=
{
{
display
:
"none"
}
}
>
<
AImage
.
PreviewGroup
...
...
@@ -134,7 +151,9 @@ export default function MallDetail() {
</
Col
>
<
Col
>
<
Row
align=
"middle"
style=
{
{
cursor
:
"pointer"
}
}
>
<
Col
className=
{
styles
.
font4
}
onClick=
{
()
=>
setIntentionModalOpen
(
true
)
}
>
共3种可选
</
Col
>
<
Col
className=
{
styles
.
font4
}
onClick=
{
openIntentionModal
}
>
共3种可选
</
Col
>
<
Col
style=
{
{
marginLeft
:
9
}
}
>
<
DownOutlined
style=
{
{
...
...
@@ -169,8 +188,14 @@ export default function MallDetail() {
</
Row
>
</
Space
>
<
Space
size=
{
12
}
style=
{
{
marginTop
:
123
}
}
>
<
Button
className=
{
styles
.
btn1
}
>
加入购物车
</
Button
>
<
Button
className=
{
styles
.
btn2
}
type=
"primary"
onClick=
{
()
=>
setIntentionModalOpen
(
true
)
}
>
<
Button
className=
{
styles
.
btn1
}
onClick=
{
openIntentionModal
}
>
加入购物车
</
Button
>
<
Button
className=
{
styles
.
btn2
}
type=
"primary"
onClick=
{
openIntentionModal
}
>
提交意向
</
Button
>
<
Space
size=
{
20
}
style=
{
{
marginLeft
:
19
}
}
>
...
...
pages/mall/detail/api/index.ts
浏览文件 @
32e4472f
...
...
@@ -46,7 +46,7 @@ export interface GoodsSpec {
skuId
:
number
;
brandInfoId
:
number
;
skuName
:
string
;
productSpecList
:
ProductSpec
List
[];
productSpecList
:
ProductSpec
[];
industrySpecList
?:
any
;
chooseType
:
number
;
skuUnitId
:
number
;
...
...
@@ -55,7 +55,7 @@ export interface GoodsSpec {
flag
?:
any
;
}
export
interface
ProductSpec
List
{
export
interface
ProductSpec
{
id
:
number
;
productSpec
:
number
;
productSkuId
:
number
;
...
...
pages/mall/detail/components/intentionModal/index.tsx
浏览文件 @
32e4472f
import
{
Button
,
Col
,
Image
,
Modal
,
Row
,
Space
}
from
"antd"
;
import
{
useState
}
from
"react"
;
import
errImg
from
"~/assets/errImg"
;
import
{
GetAppGoodsInfoDetailResult
}
from
"../../api"
;
import
styles
from
"./index.module.scss"
;
type
Props
=
{
open
?:
boolean
;
onOk
?:
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
void
;
onCancel
?:
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
void
;
onCancel
:
(
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
void
;
detail
:
GetAppGoodsInfoDetailResult
|
null
;
};
export
default
function
IntentionModal
(
props
:
Props
)
{
const
list
=
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
];
const
[
checkedMap
,
setCheckedMap
]
=
useState
<
{
string
?:
boolean
}
>
({});
//通过索引记录选中的产品规格 例: {'1,1': true|false}
//添加规格到购物车
function
addProductSpec
(
goodsSpecIndex
:
number
,
productSpecIndex
:
number
)
{
let
temp
=
{};
//@ts-ignore
temp
[
`
${
goodsSpecIndex
}
,
${
productSpecIndex
}
`
]
=
//@ts-ignore
!
checkedMap
[
`
${
goodsSpecIndex
}
,
${
productSpecIndex
}
`
];
setCheckedMap
({
...
checkedMap
,
...
temp
,
});
}
return
(
<
Modal
...
...
@@ -21,7 +37,13 @@ export default function IntentionModal(props: Props) {
className=
{
styles
.
model
}
footer=
{
<
div
style=
{
{
padding
:
"13px 36px"
}
}
>
<
Button
type=
"primary"
className=
{
styles
.
font5
}
style=
{
{
width
:
'100%'
,
height
:
44
}
}
>
提交意向
</
Button
>
<
Button
type=
"primary"
className=
{
styles
.
font5
}
style=
{
{
width
:
"100%"
,
height
:
44
}
}
>
提交意向
</
Button
>
</
div
>
}
>
...
...
@@ -32,6 +54,7 @@ export default function IntentionModal(props: Props) {
height=
{
100
}
fallback=
{
errImg
}
style=
{
{
borderRadius
:
8
}
}
src=
{
props
.
detail
?.
images
?.[
0
]?.
imgUrl
}
></
Image
>
</
Col
>
<
Col
flex=
"auto"
style=
{
{
marginLeft
:
13
,
width
:
230
}
}
>
...
...
@@ -39,13 +62,13 @@ export default function IntentionModal(props: Props) {
className=
{
`${styles.font1} ${styles.ellipsis1}`
}
style=
{
{
marginTop
:
28
}
}
>
垂直起降固定翼 插翅虎M9
{
props
.
detail
?.
goodsName
}
</
div
>
<
div
className=
{
`${styles.font2} ${styles.ellipsis2}`
}
style=
{
{
marginTop
:
7
}
}
>
已选:
入云龙【机壳喷绘】+金眼彪Z40【222222222222222222222222233333555555555555555
已选:
</
div
>
</
Col
>
</
Row
>
...
...
@@ -54,40 +77,59 @@ export default function IntentionModal(props: Props) {
<
div
className=
{
styles
.
font3
}
style=
{
{}
}
>
无人机
</
div
>
<
div
>
<
div
className=
{
styles
.
font2
}
style=
{
{
marginBottom
:
5
,
marginTop
:
11
}
}
>
入云龙
</
div
>
<
Space
size=
{
10
}
direction=
"vertical"
style=
{
{
width
:
"100%"
}
}
>
{
list
.
map
((
item
,
i
)
=>
{
return
(
<
Row
key=
{
i
}
align=
"middle"
wrap=
{
false
}
style=
{
{
borderRadius
:
5
,
border
:
"1px solid #d6d6d6"
,
height
:
50
,
}
}
>
<
Col
style=
{
{
marginLeft
:
7
}
}
>
<
Image
width=
{
52
}
height=
{
36
}
src=
""
fallback=
{
errImg
}
preview=
{
false
}
></
Image
>
</
Col
>
<
Col
className=
{
`${styles.ellipsis1} ${styles.font4}`
}
style=
{
{
width
:
238
,
marginLeft
:
18
}
}
>
入云龙1-机壳喷绘
</
Col
>
</
Row
>
);
})
}
</
Space
>
</
div
>
{
props
.
detail
?.
goodsSpec
?.
map
((
item
,
goodsSpecIndex
)
=>
{
return
(
<
div
key=
{
item
.
id
}
>
<
div
className=
{
styles
.
font2
}
style=
{
{
marginBottom
:
5
,
marginTop
:
11
}
}
>
{
item
.
goodsSpecName
}
</
div
>
<
Space
size=
{
10
}
direction=
"vertical"
style=
{
{
width
:
"100%"
}
}
>
{
item
.
productSpecList
?.
map
((
product
,
productSpecIndex
)
=>
{
return
(
<
Row
key=
{
product
.
id
}
align=
"middle"
wrap=
{
false
}
style=
{
{
borderRadius
:
5
,
//@ts-ignore
border
:
checkedMap
[
`${goodsSpecIndex},${productSpecIndex}`
]
?
"1px solid #FF552D"
:
"1px solid #d6d6d6"
,
height
:
50
,
cursor
:
"pointer"
,
}
}
onClick=
{
()
=>
addProductSpec
(
goodsSpecIndex
,
productSpecIndex
)
}
>
<
Col
style=
{
{
marginLeft
:
7
}
}
>
<
Image
width=
{
52
}
height=
{
36
}
src=
{
product
.
specImage
}
fallback=
{
errImg
}
preview=
{
false
}
></
Image
>
</
Col
>
<
Col
className=
{
`${styles.ellipsis1} ${styles.font4}`
}
style=
{
{
width
:
238
,
marginLeft
:
18
}
}
>
{
product
.
specName
}
</
Col
>
</
Row
>
);
})
}
</
Space
>
</
div
>
);
})
}
</
div
>
</
div
>
</
Modal
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论