Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
d2463ef1
提交
d2463ef1
authored
4月 20, 2024
作者:
刘明祎-运维用途
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:后台管理页面添加商品绑定多个课程 以及可以上传商品使用说明文件
上级
90a77338
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
77 行增加
和
1 行删除
+77
-1
goodsType.ts
src/api/interface/goodsType.ts
+4
-0
index.tsx
...oods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
+69
-1
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+4
-0
没有找到文件。
src/api/interface/goodsType.ts
浏览文件 @
d2463ef1
...
...
@@ -134,6 +134,10 @@ type goodsItemType = {
skuUnitId
:
number
;
specName
:
string
;
}[];
curriculumIds
:
{
id
:
number
;
}[];
instructionsUrl
:
string
;
labelShow
:
number
;
resourcesList
:
{
id
:
number
;
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
浏览文件 @
d2463ef1
...
...
@@ -5,7 +5,7 @@ import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
import
React
,
{
forwardRef
,
useEffect
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
InterDataType
,
InterListType
}
from
'~/api/interface'
;
import
{
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
{
CategoryManageAPI
,
ForumManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
,
ForumManageAPI
,
MallManageAPI
}
from
'~/api'
;
import
deletePng
from
'~/assets/image/delete.png'
;
import
'./index.scss'
;
import
{
useSelector
}
from
'react-redux'
;
...
...
@@ -41,6 +41,10 @@ export type baseInfoType = {
uid
:
number
;
url
:
string
;
}[];
curriculumIds
:
{
id
:
number
;
}[];
instructionsUrl
:
string
;
gambitId
:
number
;
categoryId
:
number
[];
shelfStatus
:
number
;
...
...
@@ -56,12 +60,20 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
const
[
categoryList
,
setCategoryList
]
=
useState
<
categoryType
>
([]);
const
[
addTopicModalShow
,
setAddTopicModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
currentTopicItem
,
setCurrentTopicItem
]
=
useState
<
topicListType
[
0
]
>
();
// 文件列表
const
[
suggestFileList
,
setSuggestFileList
]
=
useState
<
{
url
:
string
}[]
>
();
const
[
gambitList
,
setGambitList
]
=
useState
<
{
id
:
number
;
name
:
string
;
}[]
>
([]);
const
[
curriculumList
,
setCurriculumList
]
=
useState
<
{
id
:
number
;
name
:
string
;
}[]
>
([]);
//主图
const
[
mainFileList
,
setMainFileList
]
=
useState
<
{
...
...
@@ -152,6 +164,22 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
setGambitList
(
gambitListWithDefinedNames
);
});
};
const
getCurriculumList
=
()
=>
{
MallManageAPI
.
queryCurriculumInfoList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
const
curriculumListTemp
=
result
.
list
.
map
((
item
)
=>
({
id
:
item
.
id
,
name
:
item
.
curriculumName
,
}));
setCurriculumList
(
curriculumListTemp
);
});
};
const
suggestFileChange
=
(
e
:
{
url
:
string
}[])
=>
{
setSuggestFileList
(
e
);
baseInfoForm
.
setFieldValue
(
'instructionsUrl'
,
e
[
0
].
url
);
// console.log('方案文件回调 --->', e);
};
const
addTopicModalShowOk
=
()
=>
{
setAddTopicModalShow
(
false
);
};
...
...
@@ -172,6 +200,8 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
useEffect
(()
=>
{
getCategoryList
();
getGambitList
();
getCurriculumList
();
setSuggestFileList
([{
url
:
baseInfoForm
.
getFieldValue
(
'instructionsUrl'
)
}]);
},
[]);
return
(
<
div
className=
'base-info'
>
...
...
@@ -287,6 +317,44 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
<
Radio
value=
{
0
}
>
不显示
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
'关联课程'
name=
'curriculumIds'
>
<
Select
mode=
'multiple'
placeholder=
'请选择关联课程'
value=
{
baseInfoForm
.
getFieldValue
(
'curriculumIds'
)
}
// 使用defaultCourseIds作为初始值
// onChange={handleCourseSelectionChange} // 假设已有处理课程选择变化的函数
showSearch
optionFilterProp=
'children'
filterOption=
{
(
input
,
option
)
=>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
option
?.
children
?.
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
>
{
curriculumList
.
map
((
item
)
=>
(
<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
>
{
item
.
name
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
'方案文件'
name=
'instructionsUrl'
rules=
{
[{
required
:
true
,
message
:
'请输入方案文件'
}]
}
>
<
Uploader
fileUpload
listType=
'picture-card'
defaultFileList=
{
suggestFileList
}
onChange=
{
suggestFileChange
}
fileType=
{
[
'application/pdf'
]
}
fileLength=
{
1
}
fileSize=
{
100
}
>
<
UploadOutlined
/>
</
Uploader
>
</
Form
.
Item
>
<
div
className=
'flex-start gambit-item'
>
<
Form
.
Item
label=
'关联话题'
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
d2463ef1
...
...
@@ -113,6 +113,8 @@ const GoodsAddOrEditOrDetail = () => {
...(
values
[
0
].
subImgList
?.
map
((
v
:
any
)
=>
({
type
:
1
,
url
:
v
.
url
}))
||
[]),
...(
values
[
0
].
videoList
?.
map
((
v
:
any
)
=>
({
type
:
2
,
url
:
v
.
url
}))
||
[]),
],
curriculumIds
:
values
[
0
].
curriculumIds
,
instructionsUrl
:
values
[
0
].
instructionsUrl
,
gambitId
:
values
[
0
].
gambitId
,
categoryPrimaryId
:
values
[
0
].
categoryId
[
0
],
categorySubId
:
values
[
0
].
categoryId
.
length
===
2
?
values
[
0
].
categoryId
[
1
]
:
undefined
,
...
...
@@ -174,6 +176,8 @@ const GoodsAddOrEditOrDetail = () => {
priceShow
:
result
.
priceShow
,
recommend
:
result
.
recommend
,
gambitId
:
result
.
gambitId
,
curriculumIds
:
result
.
curriculumIds
,
instructionsUrl
:
result
.
instructionsUrl
,
});
baseInfoRef
.
current
.
setLabelShow
(
!!
result
.
labelShow
);
baseInfoRef
.
current
.
mediaData
.
setMainFileList
(
mainImgList
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论