perf:调整分页
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiesheng/npm-tool",
|
"name": "@tiesheng/npm-tool",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"description": "npm tool package",
|
"description": "npm tool package",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ const request = extend({
|
|||||||
const dealParamsBody = (options) => {
|
const dealParamsBody = (options) => {
|
||||||
// 存在分页器的时候
|
// 存在分页器的时候
|
||||||
if (options.params?.pagination) {
|
if (options.params?.pagination) {
|
||||||
options.params.length = options.params.pagination.pageSize;
|
options.params.pageSize = options.params.pagination.pageSize;
|
||||||
options.params.start = options.params.length * (options.params.pagination.current - 1);
|
options.params.pageNum = options.params.pagination.current;
|
||||||
delete options.params['pagination'];
|
delete options.params['pagination'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ async function req(url, options) {
|
|||||||
data = crypto.decrypt(data);
|
data = crypto.decrypt(data);
|
||||||
data = Common.parseJSON(data, data);
|
data = Common.parseJSON(data, data);
|
||||||
}
|
}
|
||||||
resolve({data,recordsTotal: res.recordsTotal})
|
resolve({data, recordsTotal: res.recordsTotal})
|
||||||
} else {
|
} else {
|
||||||
GlobalConfig.getConfig().onHttpError(res);
|
GlobalConfig.getConfig().onHttpError(res);
|
||||||
reject(res)
|
reject(res)
|
||||||
|
|||||||
Reference in New Issue
Block a user