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
1b108c8b
Commit
1b108c8b
authored
Dec 15, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:修改分页显示
parent
dc431f20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
src/modules/store-manage/CourseCatalogPage.tsx
+10
-13
No files found.
src/modules/store-manage/CourseCatalogPage.tsx
View file @
1b108c8b
...
...
@@ -23,10 +23,9 @@ interface RecordTypes {
function
CourseCatalogPage
()
{
const
[
courseCatalogList
,
setCourseCatalogList
]
=
useState
([]);
const
[
size
,
setSize
]
=
useState
(
10
)
const
[
query
,
setQuery
]
=
useState
({
current
:
0
,
size
:
10
,
storeId
:
User
.
getStoreId
(),
});
...
...
@@ -40,7 +39,7 @@ function CourseCatalogPage() {
const
[
choosedItem
,
setChooseItem
]
=
useState
({});
useEffect
(()
=>
{
getCourseCatalogList
();
},
[
query
]);
},
[
query
,
size
]);
function
addCatalog
(){
setChooseItem
({});
...
...
@@ -121,9 +120,10 @@ function CourseCatalogPage() {
]
}
function
getCourseCatalogList
():
any
{
console
.
log
(
"query"
,
query
);
let
_query
=
_
.
clone
(
query
);
_query
.
current
=
query
.
current
+
1
;
StoreService
.
getCourseCatalogList
(
_query
).
then
((
res
:
any
)
=>
{
StoreService
.
getCourseCatalogList
(
{...
_query
,
size
}
).
then
((
res
:
any
)
=>
{
let
resultData
=
handleCatalogListData
(
res
.
result
.
records
)
setCourseCatalogList
(
resultData
);
setTotal
(
res
.
result
.
total
);
...
...
@@ -158,14 +158,10 @@ function CourseCatalogPage() {
}
setChooseItem
(
record
);
}
function
onShowSizeChange
(
current
:
any
,
size
:
any
)
{
if
(
current
==
size
)
{
return
;
}
let
_query
=
{
...
query
};
_query
.
size
=
size
;
setQuery
(
_query
);
function
onShowSizeChange
(
current
:
any
,
theSize
:
any
)
{
setSize
(
theSize
);
}
return
(
<
div
className=
" page course-catalog-page"
>
<
div
className=
"page-content"
>
...
...
@@ -200,15 +196,16 @@ function CourseCatalogPage() {
<
div
className=
"box-footer"
>
<
PageControl
current=
{
query
.
current
}
pageSize=
{
query
.
size
}
pageSize=
{
size
}
total=
{
total
}
showSizeChanger=
{
true
}
onShowSizeChange=
{
onShowSizeChange
}
toPage=
{
(
page
:
any
)
=>
{
const
queryStates
=
_
.
clone
(
query
);
queryStates
.
current
=
page
;
console
.
log
(
"queryStates"
,
queryStates
);
setQuery
(
queryStates
);
}
}
/>
</
div
>
</
div
>
...
...
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