Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
aa9b7a11
Commit
aa9b7a11
authored
Jul 26, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 请求接口的页码是从零开始的
parent
a069f210
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
MyPagination.tsx
src/components/mui/MyPagination.tsx
+3
-2
util.ts
src/utils/util.ts
+1
-1
index.tsx
src/views/Project/ProjectData/SeeDataset/index.tsx
+5
-5
No files found.
src/components/mui/MyPagination.tsx
View file @
aa9b7a11
...
@@ -28,14 +28,15 @@ type IMyPaginationProps = {
...
@@ -28,14 +28,15 @@ type IMyPaginationProps = {
const
MyPagination
=
(
props
:
IMyPaginationProps
)
=>
{
const
MyPagination
=
(
props
:
IMyPaginationProps
)
=>
{
const
{
page
,
pageChange
,
count
}
=
props
;
const
{
page
,
pageChange
,
count
}
=
props
;
const
handlePageChange
=
(
e
:
any
,
value
:
number
)
=>
{
const
handlePageChange
=
(
e
:
any
,
value
:
number
)
=>
{
pageChange
&&
pageChange
(
value
);
pageChange
&&
pageChange
(
value
);
};
};
return
(
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
ThemeProvider
theme=
{
theme
}
>
<
Pagination
<
Pagination
page=
{
page
}
page=
{
page
+
1
}
// 请求接口的页码是从0开始的
count=
{
count
}
count=
{
count
+
1
}
shape=
"rounded"
shape=
"rounded"
onChange=
{
handlePageChange
}
onChange=
{
handlePageChange
}
/>
/>
...
...
src/utils/util.ts
View file @
aa9b7a11
...
@@ -103,7 +103,7 @@ export const getToken = (): string => {
...
@@ -103,7 +103,7 @@ export const getToken = (): string => {
export
const
getUrlThroughParams
=
(
params
:
any
,
encodeArr
:
Array
<
string
>
=
[],
initUrl
=
''
):
string
=>
{
// params 是要穿的参数 是个对象 encodeArr 需要通过encodeURIComponent转换的字段数组
export
const
getUrlThroughParams
=
(
params
:
any
,
encodeArr
:
Array
<
string
>
=
[],
initUrl
=
''
):
string
=>
{
// params 是要穿的参数 是个对象 encodeArr 需要通过encodeURIComponent转换的字段数组
let
url
=
initUrl
let
url
=
initUrl
Object
.
keys
(
params
).
forEach
((
item
:
string
,
index
)
=>
{
Object
.
keys
(
params
).
forEach
((
item
:
string
,
index
)
=>
{
if
(
params
[
item
])
{
if
(
params
[
item
]
||
params
[
item
]
===
0
)
{
let
value
=
params
[
item
]
let
value
=
params
[
item
]
if
(
encodeArr
.
some
(
encodeItem
=>
encodeItem
=
item
))
{
if
(
encodeArr
.
some
(
encodeItem
=>
encodeItem
=
item
))
{
value
=
encodeURIComponent
(
params
[
item
])
value
=
encodeURIComponent
(
params
[
item
])
...
...
src/views/Project/ProjectData/SeeDataset/index.tsx
View file @
aa9b7a11
...
@@ -39,9 +39,9 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
...
@@ -39,9 +39,9 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
const
[
sort
,
setSort
]
=
useState
(
"null"
);
// 排序方式
const
[
sort
,
setSort
]
=
useState
(
"null"
);
// 排序方式
const
[
keyword
,
setKeyword
]
=
useState
(
""
);
// 关键字
const
[
keyword
,
setKeyword
]
=
useState
(
""
);
// 关键字
const
[
searchDataType
,
setSearchDataType
]
=
useState
<
any
>
(
null
);
// 搜索的数据属性
const
[
searchDataType
,
setSearchDataType
]
=
useState
<
any
>
(
null
);
// 搜索的数据属性
const
[
page
,
setPage
]
=
useState
(
1
);
// 当前页码
const
[
page
,
setPage
]
=
useState
(
0
);
// 当前页码 // 请求接口的页码是从0开始的
const
size
=
8
;
// 每页数量
const
size
=
8
;
// 每页数量
const
[
count
,
setCount
]
=
useState
(
1
);
// 总页数
const
[
count
,
setCount
]
=
useState
(
0
);
// 总页数
const
[
list
,
setList
]
=
useState
<
Array
<
any
>>
([]);
// 分子列表
const
[
list
,
setList
]
=
useState
<
Array
<
any
>>
([]);
// 分子列表
const
[
selectItems
,
setSelectItems
]
=
useState
<
Array
<
any
>>
([]);
const
[
selectItems
,
setSelectItems
]
=
useState
<
Array
<
any
>>
([]);
const
[
saveOpen
,
setSaveOpen
]
=
useState
(
false
);
// 另存为弹窗显示控制
const
[
saveOpen
,
setSaveOpen
]
=
useState
(
false
);
// 另存为弹窗显示控制
...
@@ -66,7 +66,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
...
@@ -66,7 +66,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
};
};
const
pageChange
=
(
value
:
number
)
=>
{
const
pageChange
=
(
value
:
number
)
=>
{
setPage
(
value
);
setPage
(
value
-
1
);
};
};
// 空盒子用于布局
// 空盒子用于布局
...
@@ -81,7 +81,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
...
@@ -81,7 +81,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
// 获取分子列表
// 获取分子列表
const
getList
=
useCallback
(
const
getList
=
useCallback
(
(
paramsPage
=
1
)
=>
{
(
paramsPage
=
0
)
=>
{
setPage
(
paramsPage
);
setPage
(
paramsPage
);
CloudEController
.
GetDatasetItemsList
({
CloudEController
.
GetDatasetItemsList
({
type
:
productId
as
string
,
type
:
productId
as
string
,
...
@@ -97,7 +97,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
...
@@ -97,7 +97,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
query
:
keyword
,
query
:
keyword
,
})?.
then
((
res
)
=>
{
})?.
then
((
res
)
=>
{
setList
(
res
.
data
.
list
);
setList
(
res
.
data
.
list
);
setCount
(
res
.
data
.
totalPage
);
setCount
(
res
.
data
.
totalPage
-
1
);
if
(
res
.
data
.
list
)
{
if
(
res
.
data
.
list
)
{
if
(
res
.
data
.
list
[
0
].
meta
)
{
if
(
res
.
data
.
list
[
0
].
meta
)
{
const
meta
=
res
.
data
.
list
[
0
].
meta
;
const
meta
=
res
.
data
.
list
[
0
].
meta
;
...
...
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