Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
1685253b
提交
1685253b
authored
4月 17, 2024
作者:
刘明祎-运维用途
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:后台管理页面添加商品绑定话题id功能
上级
e4dc018d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
123 行增加
和
14 行删除
+123
-14
goodsType.ts
src/api/interface/goodsType.ts
+1
-0
index.tsx
.../forumManage/topicList/components/addTopicModal/index.tsx
+18
-8
index.scss
...ods/goodsAddOrEditOrDetail/components/baseInfo/index.scss
+15
-0
index.tsx
...oods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
+80
-5
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+9
-1
没有找到文件。
src/api/interface/goodsType.ts
浏览文件 @
1685253b
...
@@ -109,6 +109,7 @@ export type exchangeGoodsInfoType = InterFunction<{ firstId: number; secondId: n
...
@@ -109,6 +109,7 @@ export type exchangeGoodsInfoType = InterFunction<{ firstId: number; secondId: n
//商品-新增(新)
//商品-新增(新)
//商品item类型
//商品item类型
type
goodsItemType
=
{
type
goodsItemType
=
{
gambitId
:
number
;
categoryPrimaryId
:
number
;
categoryPrimaryId
:
number
;
categorySubId
:
number
;
categorySubId
:
number
;
description
:
string
;
description
:
string
;
...
...
src/pages/forumManage/topicList/components/addTopicModal/index.tsx
浏览文件 @
1685253b
...
@@ -15,9 +15,17 @@ interface selfProps {
...
@@ -15,9 +15,17 @@ interface selfProps {
onOk
:
()
=>
void
;
onOk
:
()
=>
void
;
onCancel
:
()
=>
void
;
onCancel
:
()
=>
void
;
currentTopicItem
:
topicListType
[
0
]
|
undefined
;
currentTopicItem
:
topicListType
[
0
]
|
undefined
;
showProperty
?:
boolean
;
}
}
const
AddTopicModal
:
FC
<
ModalProps
&
selfProps
>
=
({
open
,
onCancel
,
onOk
,
currentTopicItem
})
=>
{
const
AddTopicModal
:
FC
<
ModalProps
&
selfProps
>
=
({
open
,
onCancel
,
onOk
,
currentTopicItem
,
showProperty
=
true
,
})
=>
{
const
[
form
]
=
Form
.
useForm
<
addTopicParams
>
();
const
[
form
]
=
Form
.
useForm
<
addTopicParams
>
();
const
[
gambitIconFileList
,
setGambitIconFileList
]
=
useState
<
any
>
([]);
const
[
gambitIconFileList
,
setGambitIconFileList
]
=
useState
<
any
>
([]);
const
[
gambitCoverFileList
,
setGambitCoverFileList
]
=
useState
<
any
>
([]);
const
[
gambitCoverFileList
,
setGambitCoverFileList
]
=
useState
<
any
>
([]);
...
@@ -130,13 +138,15 @@ const AddTopicModal: FC<ModalProps & selfProps> = ({ open, onCancel, onOk, curre
...
@@ -130,13 +138,15 @@ const AddTopicModal: FC<ModalProps & selfProps> = ({ open, onCancel, onOk, curre
<
UploadOutlined
/>
<
UploadOutlined
/>
</
Uploader
>
</
Uploader
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
{
showProperty
&&
(
label=
'属性'
<
Form
.
Item
name=
'gambitProperty'
label=
'属性'
rules=
{
[{
required
:
true
,
message
:
'请选择属性'
}]
}
name=
'gambitProperty'
>
rules=
{
[{
required
:
true
,
message
:
'请选择属性'
}]
}
<
Select
placeholder=
'请选择属性'
options=
{
gambitPropertyList
}
></
Select
>
>
</
Form
.
Item
>
<
Select
placeholder=
'请选择属性'
options=
{
gambitPropertyList
}
></
Select
>
</
Form
.
Item
>
)
}
</
Form
>
</
Form
>
</
Modal
>
</
Modal
>
);
);
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/baseInfo/index.scss
浏览文件 @
1685253b
...
@@ -8,3 +8,17 @@
...
@@ -8,3 +8,17 @@
transform
:
translate
(
50%
,-
25%
);
transform
:
translate
(
50%
,-
25%
);
}
}
}
}
.gambit-choose
{
display
:
flex
;
marginLeft
:
200px
;
width
:
800px
;
flex-wrap
:
nowrap
;
.Form-item
{
width
:
300px
;
margin-right
:
20px
;
padding-left
:
20px
;
.Select
{
padding-left
:
400px
;
}
}
}
\ No newline at end of file
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
浏览文件 @
1685253b
...
@@ -3,16 +3,19 @@ import { Uploader } from '~/components/uploader';
...
@@ -3,16 +3,19 @@ import { Uploader } from '~/components/uploader';
import
type
{
RadioChangeEvent
}
from
'antd'
;
import
type
{
RadioChangeEvent
}
from
'antd'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
React
,
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
React
,
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
InterDataType
,
InterListType
}
from
'~/api/interface'
;
import
{
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
{
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
,
ForumManageAPI
}
from
'~/api'
;
import
deletePng
from
'~/assets/image/delete.png'
;
import
deletePng
from
'~/assets/image/delete.png'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
{
useSelector
}
from
'react-redux'
;
import
{
useSelector
}
from
'react-redux'
;
import
AddTopicModal
from
'~/pages/forumManage/topicList/components/addTopicModal'
;
import
{
listGambitType
}
from
'~/api/interface/forumManageType'
;
//分类返回类型
//分类返回类型
type
categoryType
=
InterDataType
<
categoryListRespType
>
[
'list'
];
type
categoryType
=
InterDataType
<
categoryListRespType
>
[
'list'
];
// 话题列表返回类型
type
topicListType
=
InterListType
<
listGambitType
>
;
interface
selfProps
{
interface
selfProps
{
ref
:
any
;
ref
:
any
;
}
}
...
@@ -38,18 +41,27 @@ export type baseInfoType = {
...
@@ -38,18 +41,27 @@ export type baseInfoType = {
uid
:
number
;
uid
:
number
;
url
:
string
;
url
:
string
;
}[];
}[];
gambitId
:
number
;
categoryId
:
number
[];
categoryId
:
number
[];
shelfStatus
:
number
;
shelfStatus
:
number
;
labelShow
:
number
;
labelShow
:
number
;
goodsLabel
:
string
;
goodsLabel
:
string
;
};
};
const
{
Option
}
=
Select
;
const
BaseInfo
=
forwardRef
<
any
,
selfProps
>
((
_props
,
ref
)
=>
{
const
BaseInfo
=
forwardRef
<
any
,
selfProps
>
((
_props
,
ref
)
=>
{
const
{
userInfo
}
=
useSelector
((
state
:
any
)
=>
state
.
UserInfo
);
const
{
userInfo
}
=
useSelector
((
state
:
any
)
=>
state
.
UserInfo
);
const
[
baseInfoForm
]
=
Form
.
useForm
<
baseInfoType
>
();
const
[
baseInfoForm
]
=
Form
.
useForm
<
baseInfoType
>
();
const
[
labelShow
,
setLabelShow
]
=
useState
<
boolean
>
(
false
);
const
[
labelShow
,
setLabelShow
]
=
useState
<
boolean
>
(
false
);
//分类列表
//分类列表
const
[
categoryList
,
setCategoryList
]
=
useState
<
categoryType
>
([]);
const
[
categoryList
,
setCategoryList
]
=
useState
<
categoryType
>
([]);
const
[
addTopicModalShow
,
setAddTopicModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
currentTopicItem
,
setCurrentTopicItem
]
=
useState
<
topicListType
[
0
]
>
();
const
[
gambitList
,
setGambitList
]
=
useState
<
{
id
:
number
;
name
:
string
;
}[]
>
([]);
//主图
//主图
const
[
mainFileList
,
setMainFileList
]
=
useState
<
const
[
mainFileList
,
setMainFileList
]
=
useState
<
{
{
...
@@ -125,6 +137,32 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -125,6 +137,32 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
setCategoryList
(
result
.
list
||
[]);
setCategoryList
(
result
.
list
||
[]);
});
});
};
};
const
getGambitList
=
()
=>
{
ForumManageAPI
.
getTopicList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
// 使用map方法创建新的数组,仅包含id和gambitName字段
const
gambitTempList
=
result
.
list
.
map
((
item
)
=>
({
id
:
item
.
id
,
name
:
item
.
gambitName
,
}));
const
gambitListWithDefinedNames
=
gambitTempList
.
map
((
item
)
=>
({
...
item
,
name
:
item
.
name
||
''
,
}));
setGambitList
(
gambitListWithDefinedNames
);
});
};
const
addTopicModalShowOk
=
()
=>
{
setAddTopicModalShow
(
false
);
};
const
addTopicModalCancel
=
()
=>
{
setAddTopicModalShow
(
false
);
};
const
addTopicModalShowClick
=
(
record
?:
topicListType
[
0
])
=>
{
setCurrentTopicItem
(
record
?
{
...
record
}
:
undefined
);
setAddTopicModalShow
(
true
);
};
//视频删除
//视频删除
const
deleteVideo
=
()
=>
{
const
deleteVideo
=
()
=>
{
setVideoFileList
([]);
setVideoFileList
([]);
...
@@ -133,8 +171,8 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -133,8 +171,8 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
getCategoryList
();
getCategoryList
();
getGambitList
();
},
[]);
},
[]);
return
(
return
(
<
div
className=
'base-info'
>
<
div
className=
'base-info'
>
<
Form
<
Form
...
@@ -185,6 +223,7 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -185,6 +223,7 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
<
Form
.
Item
label=
'商品视频'
name=
'videoList'
>
<
Form
.
Item
label=
'商品视频'
name=
'videoList'
>
{
videoFileList
.
length
?
(
{
videoFileList
.
length
?
(
<
div
className=
'goods-video-wrap'
>
<
div
className=
'goods-video-wrap'
>
{
/* eslint-disable-next-line jsx-a11y/media-has-caption */
}
<
video
<
video
src=
{
videoFileList
[
0
].
url
}
src=
{
videoFileList
[
0
].
url
}
style=
{
{
width
:
'200px'
,
height
:
'200px'
}
}
style=
{
{
width
:
'200px'
,
height
:
'200px'
}
}
...
@@ -248,6 +287,35 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -248,6 +287,35 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
<
Radio
value=
{
0
}
>
不显示
</
Radio
>
<
Radio
value=
{
0
}
>
不显示
</
Radio
>
</
Radio
.
Group
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
className=
'flex-start gambit-choose'
>
<
Form
.
Item
label=
'关联话题'
name=
'gambitId'
rules=
{
[{
required
:
false
,
message
:
'请选择话题'
}]
}
>
<
Select
placeholder=
'请选择话题'
showSearch
optionFilterProp=
'children'
// 指定筛选的字段
filterOption=
{
(
input
,
option
)
=>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
option
?.
children
?.
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
// value={baseInfoForm.getFieldValue('gambitId')}
// onSelect={(e) => baseInfoForm.setFieldValue('gambitId', e)}
>
{
gambitList
.
map
((
i
,
j
)
=>
(
<
Option
key=
{
j
}
value=
{
i
.
id
}
>
{
i
.
name
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Button
type=
'primary'
onClick=
{
()
=>
addTopicModalShowClick
()
}
>
新建
</
Button
>
</
div
>
{
labelShow
?
(
{
labelShow
?
(
<
Form
.
Item
<
Form
.
Item
label=
'商品标签'
label=
'商品标签'
...
@@ -259,6 +327,13 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -259,6 +327,13 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
)
:
(
)
:
(
''
''
)
}
)
}
<
AddTopicModal
open=
{
addTopicModalShow
}
onCancel=
{
addTopicModalCancel
}
onOk=
{
addTopicModalShowOk
}
currentTopicItem=
{
currentTopicItem
}
showProperty=
{
false
}
/>
</
Form
>
</
Form
>
</
div
>
</
div
>
);
);
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
1685253b
...
@@ -101,12 +101,19 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -101,12 +101,19 @@ const GoodsAddOrEditOrDetail = () => {
])
])
.
then
((
values
:
any
)
=>
{
.
then
((
values
:
any
)
=>
{
const
addGoodsEditReq
=
{
const
addGoodsEditReq
=
{
...
filterObjAttr
(
values
[
0
],
[
'mainImgList'
,
'subImgList'
,
'videoList'
,
'categoryId'
]),
...
filterObjAttr
(
values
[
0
],
[
'mainImgList'
,
'subImgList'
,
'videoList'
,
'gambitList'
,
'categoryId'
,
]),
resourcesList
:
[
resourcesList
:
[
...
values
[
0
].
mainImgList
.
map
((
v
:
any
)
=>
({
type
:
0
,
url
:
v
.
url
})),
...
values
[
0
].
mainImgList
.
map
((
v
:
any
)
=>
({
type
:
0
,
url
:
v
.
url
})),
...(
values
[
0
].
subImgList
?.
map
((
v
:
any
)
=>
({
type
:
1
,
url
:
v
.
url
}))
||
[]),
...(
values
[
0
].
subImgList
?.
map
((
v
:
any
)
=>
({
type
:
1
,
url
:
v
.
url
}))
||
[]),
...(
values
[
0
].
videoList
?.
map
((
v
:
any
)
=>
({
type
:
2
,
url
:
v
.
url
}))
||
[]),
...(
values
[
0
].
videoList
?.
map
((
v
:
any
)
=>
({
type
:
2
,
url
:
v
.
url
}))
||
[]),
],
],
gambitId
:
values
[
0
].
gambitId
,
categoryPrimaryId
:
values
[
0
].
categoryId
[
0
],
categoryPrimaryId
:
values
[
0
].
categoryId
[
0
],
categorySubId
:
values
[
0
].
categoryId
.
length
===
2
?
values
[
0
].
categoryId
[
1
]
:
undefined
,
categorySubId
:
values
[
0
].
categoryId
.
length
===
2
?
values
[
0
].
categoryId
[
1
]
:
undefined
,
goodsDetails
,
goodsDetails
,
...
@@ -166,6 +173,7 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -166,6 +173,7 @@ const GoodsAddOrEditOrDetail = () => {
goodsLabel
:
result
.
goodsLabel
||
undefined
,
goodsLabel
:
result
.
goodsLabel
||
undefined
,
priceShow
:
result
.
priceShow
,
priceShow
:
result
.
priceShow
,
recommend
:
result
.
recommend
,
recommend
:
result
.
recommend
,
gambitId
:
result
.
gambitId
,
});
});
baseInfoRef
.
current
.
setLabelShow
(
!!
result
.
labelShow
);
baseInfoRef
.
current
.
setLabelShow
(
!!
result
.
labelShow
);
baseInfoRef
.
current
.
mediaData
.
setMainFileList
(
mainImgList
);
baseInfoRef
.
current
.
mediaData
.
setMainFileList
(
mainImgList
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论