Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
e950fa02
Commit
e950fa02
authored
Dec 08, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:修改课程分类的编辑子分类
parent
afe9fe10
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
24 deletions
+37
-24
src/data-source/store/request-apis.ts
+2
-2
src/modules/store-manege/CourseCatalogPage.tsx
+11
-18
src/modules/store-manege/modal/CatalogAddOrEditModal.tsx
+2
-1
src/modules/store-manege/modal/SecondCatalogAddOrEditModal.tsx
+22
-3
No files found.
src/data-source/store/request-apis.ts
View file @
e950fa02
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
4 11:11:50
* @LastEditTime: 2020-12-0
8 15:12:57
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -37,7 +37,7 @@ export function deleteEmployee(params: object) {
}
export
function
getCourseCatalogList
(
params
:
object
)
{
return
Service
.
Hades
(
"public/hades/get
Parent
CategoryPage"
,
params
);
return
Service
.
Hades
(
"public/hades/getCategoryPage"
,
params
);
}
export
function
getAllSonCategory
(
params
:
object
)
{
...
...
src/modules/store-manege/CourseCatalogPage.tsx
View file @
e950fa02
...
...
@@ -18,7 +18,7 @@ import "./CourseCatalogPage.less";
import
User
from
'@/common/js/user'
;
const
{
confirm
}
=
Modal
;
interface
RecordTypes
{
child
:
any
;
sonCategoryList
:
any
;
}
function
CourseCatalogPage
()
{
...
...
@@ -228,11 +228,13 @@ function CourseCatalogPage() {
listData
.
map
((
item
:
any
,
index
:
any
)
=>
{
item
.
type
=
"parent"
item
.
key
=
item
.
id
;
// item.child.map((_item:any,_index:any) =>{
// _item.type = "child";
// _item.key=_item.id
// return _item
// });
if
(
item
.
sonCategoryList
){
item
.
sonCategoryList
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
_item
.
type
=
"child"
;
_item
.
key
=
_item
.
id
return
_item
});
}
return
item
})
return
listData
...
...
@@ -264,8 +266,6 @@ function CourseCatalogPage() {
// return
// });
// }
return
(
<
div
className=
" page course-catalog-page"
>
<
div
className=
"page-content"
>
...
...
@@ -285,23 +285,16 @@ function CourseCatalogPage() {
columns=
{
parseColumn
()
}
pagination=
{
false
}
expandedRowRender=
{
(
record
:
RecordTypes
)
=>
{
if
(
!
record
.
child
){
if
(
!
record
.
sonCategoryList
){
return
<
div
>
还未添加任何子分类
</
div
>;
}
if
(
record
.
child
.
length
!==
0
){
return
<
Table
columns=
{
parseColumn
()
}
dataSource=
{
record
.
child
}
pagination=
{
false
}
className=
"child-table"
/>
// return <div>
{
// record.child.map((item:any,index:any)=>
{
// return <span>
{
item
.
categoryName
}<
/
span
>
// })
// }
//
</
div
>
if
(
record
.
sonCategoryList
.
length
!==
0
){
return
<
Table
columns=
{
parseColumn
()
}
dataSource=
{
record
.
sonCategoryList
}
pagination=
{
false
}
className=
"child-table"
/>
}
else
{
return
<
div
>
还未添加任何子分类
</
div
>;
}
}
}
dataSource=
{
courseCatalogList
}
// onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)}
/>
</
div
>
<
div
className=
"box-footer"
>
...
...
src/modules/store-manege/modal/CatalogAddOrEditModal.tsx
View file @
e950fa02
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-08 1
4:12:20
* @LastEditTime: 2020-12-08 1
5:17:37
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -20,6 +20,7 @@ interface CatalogAddOrEditModalProps {
function
CatalogAddOrEditModal
(
props
:
CatalogAddOrEditModalProps
)
{
const
{
onClose
,
modalType
,
refreshCatalogList
,
choosedItem
}
=
props
;
const
[
catalogName
,
setCatalogName
]
=
useState
(
choosedItem
.
categoryName
);
useEffect
(()
=>
{
});
...
...
src/modules/store-manege/modal/SecondCatalogAddOrEditModal.tsx
View file @
e950fa02
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-08 1
4:11:44
* @LastEditTime: 2020-12-08 1
5:34:07
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -26,6 +26,7 @@ interface SecondCatalogAddOrEditModalProps {
function
SecondCatalogAddOrEditModal
(
props
:
SecondCatalogAddOrEditModalProps
)
{
const
{
onClose
,
modalType
,
parentId
,
refreshCatalogList
,
choosedItem
}
=
props
;
console
.
log
(
'choosedItem'
,
choosedItem
);
const
[
secondCatalogName
,
setSecondCatalogName
]
=
useState
(
choosedItem
.
categoryName
);
const
[
selectParentId
,
setSelectParentId
]
=
useState
(
parentId
);
const
[
optionList
,
setOptionList
]
=
useState
([]);
...
...
@@ -36,14 +37,32 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
});
useEffect
(()
=>
{
getOptionList
();
console
.
log
(
''
)
},[
query
]);
function
getOptionList
():
any
{
let
_query
=
_
.
clone
(
query
);
_query
.
current
=
query
.
current
+
1
;
StoreService
.
getCourseCatalogList
(
_query
).
then
((
res
:
any
)
=>
{
setOptionList
(
res
.
result
.
records
);
let
resultData
=
handleCatalogListData
(
res
.
result
.
records
)
setOptionList
(
resultData
);
});
}
function
handleCatalogListData
(
listData
:
any
){
listData
.
map
((
item
:
any
,
index
:
any
)
=>
{
item
.
type
=
"parent"
item
.
key
=
item
.
id
;
if
(
item
.
sonCategoryList
){
item
.
sonCategoryList
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
_item
.
type
=
"child"
;
_item
.
key
=
_item
.
id
return
_item
});
}
return
item
})
return
listData
}
function
handleConfirm
(){
if
(
modalType
===
"add"
){
addSecondcatalog
();
...
...
@@ -119,7 +138,7 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
placeholder=
"请输入子分类名称,最多10个字"
maxLength=
{
10
}
style=
{
{
width
:
240
}
}
v
alue=
{
secondCatalogName
}
defaultV
alue=
{
secondCatalogName
}
onChange=
{
(
e
)
=>
{
setSecondCatalogName
(
e
.
target
.
value
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment