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
dfb9c73a
Commit
dfb9c73a
authored
Dec 08, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:更改接口的名称
parent
42b977ca
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
148 deletions
+162
-148
src/modules/personalInfo/index.tsx
+7
-4
src/modules/root/Login.jsx
+2
-2
src/modules/store-manege/CourseCatalogPage.tsx
+122
-113
src/modules/store-manege/modal/CatalogAddOrEditModal.tsx
+14
-13
src/modules/store-manege/modal/SecondCatalogAddOrEditModal.tsx
+17
-16
No files found.
src/modules/personalInfo/index.tsx
View file @
dfb9c73a
/*
* @Author: zhangleyuan
* @Date: 2020-11-27 15:06:31
* @LastEditors:
wuf
an
* @LastEditTime: 2020-12-0
7 20:09:22
* @LastEditors:
zhangleyu
an
* @LastEditTime: 2020-12-0
8 11:55:09
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -42,11 +42,14 @@ function PersonalInfoPage() {
storeUserId
:
User
.
getStoreUserId
()
}
BaseService
.
getStoreUser
(
param
).
then
((
res
)
=>
{
const
{
nickName
,
phone
,
roleCodes
,
avatar
}
=
res
.
result
;
const
{
nickName
,
phone
,
roleCodes
}
=
res
.
result
;
setNickName
(
nickName
);
setPhone
(
phone
);
setRoleCodes
(
roleCodes
)
setAvatar
(
avatar
)
if
(
res
.
result
.
avatar
){
setAvatar
(
res
.
result
.
avatar
)
}
});
}
function
_handleUpdateAvatar
(
e
:
any
):
any
{
...
...
src/modules/root/Login.jsx
View file @
dfb9c73a
...
...
@@ -49,7 +49,7 @@ function Login(props) {
scene
:
'nc_login'
,
serverType
:
"CLOUD_CLASS_LOGIN"
,
}
axios
.
post
(
'https://dev-heimdall.xiaomai5.com/hades/anon/
store
/sendLoginAuthCode'
,
params
).
then
((
res
)
=>
{
axios
.
post
(
'https://dev-heimdall.xiaomai5.com/hades/anon/
hades
/sendLoginAuthCode'
,
params
).
then
((
res
)
=>
{
if
(
!
res
.
data
.
success
)
{
setErrorMessage
(
res
.
data
.
message
);
}
else
{
...
...
@@ -84,7 +84,7 @@ function Login(props) {
authCode
:
phoneverify
,
appTermEnum
:
"XIAOMAI_CLOUD_CLASS_PC_WEB"
}
axios
.
post
(
'https://dev-heimdall.xiaomai5.com/hades/anon/
store
/login'
,
params
).
then
((
res
)
=>
{
axios
.
post
(
'https://dev-heimdall.xiaomai5.com/hades/anon/
hades
/login'
,
params
).
then
((
res
)
=>
{
const
data
=
res
.
data
;
if
(
!
data
.
success
)
{
setErrorMessage
(
data
.
message
);
...
...
src/modules/store-manege/CourseCatalogPage.tsx
View file @
dfb9c73a
...
...
@@ -37,6 +37,7 @@ function CourseCatalogPage() {
const
[
secondCatalogModalType
,
setSecondCatalogModalType
]
=
useState
(
''
);
const
[
parentCatalogId
,
setParentCatalogId
]
=
useState
(
''
);
const
[
choosedItem
,
setChooseItem
]
=
useState
({});
const
[
expandedRowKeys
,
setexpandedRowKeys
]
=
useState
(
''
);
useEffect
(()
=>
{
getCourseCatalogList
();
},
[
query
]);
...
...
@@ -71,29 +72,30 @@ function CourseCatalogPage() {
categoryId
:
record
.
id
}
StoreService
.
delCourseCategory
(
param
).
then
((
res
:
any
)
=>
{
if
(
record
.
type
===
'parent'
){
let
_courseCatalogList
:
any
=
[...
courseCatalogList
];
for
(
let
i
=
0
;
i
<
_courseCatalogList
.
length
;
i
++
){
if
(
_courseCatalogList
[
i
].
id
===
record
.
id
){
_courseCatalogList
.
splice
(
i
,
1
);
}
}
setCourseCatalogList
(
_courseCatalogList
);
setTotal
(
_courseCatalogList
.
length
);
}
else
{
let
_courseCatalogListClone
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
courseCatalogList
));
for
(
let
i
=
0
;
i
<
_courseCatalogListClone
.
length
;
i
++
){
if
(
_courseCatalogListClone
[
i
].
child
){
for
(
let
j
=
0
;
j
<
_courseCatalogListClone
[
i
].
child
.
length
;
j
++
){
if
(
_courseCatalogListClone
[
i
].
child
[
j
].
id
===
record
.
id
){
_courseCatalogListClone
[
i
].
child
.
splice
(
j
,
1
);
}
}
}
}
setCourseCatalogList
(
_courseCatalogListClone
)
}
getCourseCatalogList
();
// if(record.type ==='parent'){
// let _courseCatalogList:any = [...courseCatalogList];
// for(let i=0;i<_courseCatalogList.length;i++){
// if(_courseCatalogList[i].id === record.id){
// _courseCatalogList.splice(i,1);
// }
// }
// setCourseCatalogList(_courseCatalogList);
// setTotal(_courseCatalogList.length);
// getCourseCatalogList();
// }else{
// let _courseCatalogListClone:any = JSON.parse(JSON.stringify(courseCatalogList));
// for(let i=0;i<_courseCatalogListClone.length;i++){
// if(_courseCatalogListClone[i].child){
// for(let j=0;j<_courseCatalogListClone[i].child.length;j++){
// if(_courseCatalogListClone[i].child[j].id === record.id){
// _courseCatalogListClone[i].child.splice(j,1);
// }
// }
// }
// }
// setCourseCatalogList(_courseCatalogListClone)
// }
message
.
success
(
"分类已删除"
);
});
}
...
...
@@ -149,83 +151,90 @@ function CourseCatalogPage() {
setTotal
(
res
.
result
.
total
);
});
}
function
refreshCatalogList
(
data
:
any
):
any
{
let
_courseCatalogList
:
any
=
[...
courseCatalogList
];
const
{
type
}
=
data
;
switch
(
type
){
case
'addCatalog'
:
const
item
=
{
categoryName
:
data
.
catalogName
,
id
:
data
.
id
,
hasSon
:
false
,
key
:
data
.
id
,
type
:
'parent'
}
_courseCatalogList
.
push
(
item
);
setCourseCatalogList
(
_courseCatalogList
);
setTotal
(
_courseCatalogList
.
length
);
break
;
case
'editCatalog'
:
_courseCatalogList
.
map
((
item
:
any
,
index
:
any
)
=>
{
if
(
item
.
id
===
data
.
id
){
item
.
categoryName
=
data
.
catalogName
}
return
item
});
setCourseCatalogList
(
_courseCatalogList
)
break
;
case
'addSecondCatalog'
:
const
secondItem
=
{
categoryName
:
data
.
catalogName
,
id
:
data
.
id
,
key
:
data
.
id
}
let
_courseCatalogListClone
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
courseCatalogList
));
_courseCatalogListClone
.
map
((
item
:
any
,
index
:
any
)
=>
{
if
(
item
.
id
===
data
.
parentId
){
if
(
!
item
.
child
){
item
.
child
=
[];
}
item
.
child
.
push
(
secondItem
)
}
return
item
});
setCourseCatalogList
(
_courseCatalogListClone
)
break
;
case
'editSecondCatalog'
:
const
secondEditItem
=
{
categoryName
:
data
.
catalogName
,
id
:
data
.
id
,
key
:
data
.
id
}
let
_courseCatalogListEditClone
:
any
=
JSON
.
parse
(
JSON
.
stringify
(
courseCatalogList
));
_courseCatalogListEditClone
.
map
((
item
:
any
,
index
:
any
)
=>
{
if
(
item
.
id
===
data
.
parentId
){
if
(
item
.
child
){
item
.
child
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
if
(
_item
.
id
===
data
.
id
){
_item
.
categoryName
=
data
.
catalogName
;
}
})
}
}
return
item
});
break
;
default
:
break
;
}
}
// function refreshCatalogList(data:any):any{
// let _courseCatalogList:any = [...courseCatalogList];
// const { type} = data;
// switch (type){
// case 'addCatalog':
// const item = {
// categoryName:data.catalogName,
// id:data.id,
// hasSon:false,
// key:data.id,
// type:'parent'
// }
// _courseCatalogList.push(item);
// setTotal(_courseCatalogList.length);
// if(_courseCatalogList.length>10){
// setCourseCatalogList(_courseCatalogList.splice(0,9));
// }else{
// setCourseCatalogList(_courseCatalogList);
// }
// // getCourseCatalogList();
// break;
// case 'editCatalog':
// _courseCatalogList.map((item:any,index:any)=>{
// if(item.id === data.id){
// item.categoryName = data.catalogName
// }
// return item
// });
// setCourseCatalogList(_courseCatalogList)
// break;
// case 'addSecondCatalog':
// const secondItem = {
// categoryName:data.catalogName,
// id:data.id,
// key:data.id
// }
// let _courseCatalogListClone:any = JSON.parse(JSON.stringify(courseCatalogList));
// _courseCatalogListClone.map((item:any,index:any)=>{
// if(item.id === data.parentId){
// if(!item.child){
// item.child=[];
// }
// item.child.push(secondItem)
// }
// return item
// });
// setCourseCatalogList(_courseCatalogListClone)
// break;
// case 'editSecondCatalog':
// const secondEditItem = {
// categoryName:data.catalogName,
// id:data.id,
// key:data.id
// }
// let _courseCatalogListEditClone:any = JSON.parse(JSON.stringify(courseCatalogList));
// _courseCatalogListEditClone.map((item:any,index:any)=>{
// if(item.id === data.parentId){
// if(item.child){
// item.child.map((_item:any,_index:any)=>{
// if(_item.id === data.id){
// _item.categoryName =data.catalogName;
// }
// })
// }
// }
// return item
// });
// break;
// default:
// break;
// }
// }
function
handleCatalogListData
(
listData
:
any
){
listData
.
map
((
item
:
any
,
index
:
any
)
=>
{
item
.
type
=
"parent"
item
.
key
=
item
.
id
;
item
.
child
=
[];
// item.child.map((_item:any,_index:any) =>{
// _item.type = "child";
// _item.key=_item.id
// return _item
// });
return
item
})
return
listData
}
...
...
@@ -239,21 +248,22 @@ function CourseCatalogPage() {
}
setChooseItem
(
record
);
}
function
expandSecondCatalog
(
expanded
:
boolean
,
record
:
any
){
const
parentId
=
record
.
id
;
const
param
=
{
parentId
,
}
StoreService
.
getAllSonCategory
(
param
).
then
((
res
:
any
)
=>
{
record
.
child
=
res
.
result
||
[];
record
.
child
.
map
((
item
:
any
,
index
:
any
)
=>
{
item
.
key
=
item
.
id
return
item
})
const
_courseCatalogList
=
[...
courseCatalogList
];
setCourseCatalogList
(
_courseCatalogList
)
});
}
// function expandSecondCatalog(expanded:boolean,record:any){
// const parentId = record.id;
// const param = {
// parentId,
// }
// StoreService.getAllSonCategory(param).then((res: any) => {
// record.child= res.result || [];
// record.child.map((item:any,index:any) => {
// item.key= item.id
// return item
// })
// const _courseCatalogList =[...courseCatalogList];
// setCourseCatalogList(_courseCatalogList);
// return
// });
// }
return
(
...
...
@@ -276,10 +286,9 @@ function CourseCatalogPage() {
pagination=
{
false
}
expandedRowRender=
{
(
record
:
RecordTypes
)
=>
{
if
(
!
record
.
child
){
return
return
<
div
>
还未添加任何子分类
</
div
>;
}
if
(
record
.
child
.
length
!==
0
){
console
.
log
(
"record.child"
,
record
.
child
);
return
<
Table
columns=
{
parseColumn
()
}
dataSource=
{
record
.
child
}
pagination=
{
false
}
className=
"child-table"
/>
// return <div>
{
// record.child.map((item:any,index:any)=>
{
...
...
@@ -292,7 +301,7 @@ function CourseCatalogPage() {
}
}
}
dataSource=
{
courseCatalogList
}
onExpand=
{
(
expanded
,
record
)
=>
expandSecondCatalog
(
expanded
,
record
)
}
//
onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)}
/>
</
div
>
<
div
className=
"box-footer"
>
...
...
@@ -310,10 +319,10 @@ function CourseCatalogPage() {
</
div
>
</
div
>
{
catalogModalVisible
&&
<
CatalogAddOrEditModal
modalType=
{
catalogModalType
}
onClose=
{
()
=>
{
setCatalogModalVisible
(
false
)}
}
refreshCatalogList=
{
refresh
CatalogList
}
choosedItem=
{
choosedItem
}
/>
catalogModalVisible
&&
<
CatalogAddOrEditModal
modalType=
{
catalogModalType
}
onClose=
{
()
=>
{
setCatalogModalVisible
(
false
)}
}
refreshCatalogList=
{
getCourse
CatalogList
}
choosedItem=
{
choosedItem
}
/>
}
{
secondCatalogModalVisible
&&
<
SecondCatalogAddOrEditModal
modalType=
{
secondCatalogModalType
}
parentId=
{
parentCatalogId
}
onClose=
{
()
=>
{
setSecondCatalogModalVisible
(
false
)}
}
choosedItem=
{
choosedItem
}
refreshCatalogList=
{
refresh
CatalogList
}
/>
secondCatalogModalVisible
&&
<
SecondCatalogAddOrEditModal
modalType=
{
secondCatalogModalType
}
parentId=
{
parentCatalogId
}
onClose=
{
()
=>
{
setSecondCatalogModalVisible
(
false
)}
}
choosedItem=
{
choosedItem
}
refreshCatalogList=
{
getCourse
CatalogList
}
/>
}
</
div
>
</
div
>
...
...
src/modules/store-manege/modal/CatalogAddOrEditModal.tsx
View file @
dfb9c73a
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
7 19:05:11
* @LastEditTime: 2020-12-0
8 14:12:20
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -36,13 +36,14 @@ function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
categoryName
:
catalogName
}
StoreService
.
addCourseCategory
(
param
).
then
((
res
:
any
)
=>
{
// const data = {
// type:'addCatalog',
// catalogName:catalogName,
// id:res.result
// }
refreshCatalogList
();
onClose
();
const
data
=
{
type
:
'addCatalog'
,
catalogName
:
catalogName
,
id
:
res
.
result
}
refreshCatalogList
(
data
);
});
}
function
editCatalog
():
any
{
...
...
@@ -51,12 +52,12 @@ function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
categoryName
:
catalogName
,
}
StoreService
.
editCourseCategory
(
param
).
then
((
res
:
any
)
=>
{
const
data
=
{
type
:
'editCatalog'
,
catalogName
:
catalogName
,
id
:
choosedItem
.
id
}
refreshCatalogList
(
data
);
//
const data = {
//
type:'editCatalog',
//
catalogName:catalogName,
//
id:choosedItem.id
//
}
refreshCatalogList
();
onClose
();
});
}
...
...
src/modules/store-manege/modal/SecondCatalogAddOrEditModal.tsx
View file @
dfb9c73a
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
7 19:51:03
* @LastEditTime: 2020-12-0
8 14:11:44
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -26,7 +26,7 @@ interface SecondCatalogAddOrEditModalProps {
function
SecondCatalogAddOrEditModal
(
props
:
SecondCatalogAddOrEditModalProps
)
{
const
{
onClose
,
modalType
,
parentId
,
refreshCatalogList
,
choosedItem
}
=
props
;
const
[
secondCatalogName
,
setSecondCatalogName
]
=
useState
(
''
);
const
[
secondCatalogName
,
setSecondCatalogName
]
=
useState
(
choosedItem
.
categoryName
);
const
[
selectParentId
,
setSelectParentId
]
=
useState
(
parentId
);
const
[
optionList
,
setOptionList
]
=
useState
([]);
const
[
query
,
setQuery
]
=
useState
({
...
...
@@ -58,13 +58,13 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
categoryName
:
secondCatalogName
}
StoreService
.
addCourseCategory
(
param
).
then
((
res
:
any
)
=>
{
const
data
=
{
type
:
'addSecondCatalog'
,
catalogName
:
secondCatalogName
,
parentId
:
selectParentId
,
id
:
res
.
result
}
refreshCatalogList
(
data
);
//
const data = {
//
type:'addSecondCatalog',
//
catalogName:secondCatalogName,
//
parentId:selectParentId,
//
id:res.result
//
}
refreshCatalogList
();
onClose
();
});
}
...
...
@@ -75,13 +75,13 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
categoryName
:
secondCatalogName
,
}
StoreService
.
editCourseCategory
(
param
).
then
((
res
:
any
)
=>
{
const
data
=
{
type
:
'editSecondCatalog'
,
catalogName
:
secondCatalogName
,
id
:
choosedItem
.
id
,
parentId
:
selectParentId
,
}
refreshCatalogList
(
data
);
//
const data = {
//
type:'editSecondCatalog',
//
catalogName:secondCatalogName,
//
id:choosedItem.id,
//
parentId:selectParentId,
//
}
refreshCatalogList
();
onClose
();
});
}
...
...
@@ -119,6 +119,7 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
placeholder=
"请输入子分类名称,最多10个字"
maxLength=
{
10
}
style=
{
{
width
:
240
}
}
value=
{
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