接口对接
This commit is contained in:
@@ -23,17 +23,18 @@ export default {
|
||||
status: "more",
|
||||
empty: false,
|
||||
total: 0,
|
||||
header: {},
|
||||
header: {
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
},
|
||||
params: {
|
||||
pages: 1,
|
||||
step: 20,
|
||||
entity: {},
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
},
|
||||
reload () {
|
||||
this.data = [];
|
||||
this.status = "loading";
|
||||
this.empty = false;
|
||||
this.params.pages = 1;
|
||||
this.params.currentPage = 1;
|
||||
this.next();
|
||||
},
|
||||
callBack: null,
|
||||
@@ -42,47 +43,33 @@ export default {
|
||||
next () {
|
||||
me.$request({
|
||||
url: url,
|
||||
data: Object.assign(
|
||||
{
|
||||
// page: {
|
||||
// current: this.params.pages,
|
||||
// orders: [],
|
||||
// size: this.params.step,
|
||||
// total: 0,
|
||||
// },
|
||||
offset: this.params.pages,
|
||||
limit: this.params.step,
|
||||
current: this.params.pages,
|
||||
pageSize: this.params.step,
|
||||
},
|
||||
this.params
|
||||
),
|
||||
data: this.params,
|
||||
header: this.header,
|
||||
method: "POST",
|
||||
}).then((res) => {
|
||||
console.warn(res);
|
||||
let resultData = res.rows || res.data?.list || res.data?.result?.records || [];
|
||||
if (this.params.pages == 1) {
|
||||
let resultData = res.rows || res.data?.list || res.data?.records || [];
|
||||
if (this.params.currentPage == 1) {
|
||||
this.data = resultData;
|
||||
if (resultData.length == 0 || resultData == 0) {
|
||||
this.empty = true;
|
||||
} else if (resultData.length < this.params.step) {
|
||||
} else if (resultData.length < this.params.pageSize) {
|
||||
this.status = "noMore";
|
||||
} else if (res.total == resultData.length) {
|
||||
this.status = "noMore";
|
||||
}
|
||||
} else {
|
||||
this.data.push(...resultData);
|
||||
if (resultData.length < this.params.step) {
|
||||
if (resultData.length < this.params.pageSize) {
|
||||
this.status = "noMore";
|
||||
}
|
||||
}
|
||||
|
||||
if (this.params.pages == 1) {
|
||||
if (this.params.currentPage == 1) {
|
||||
this.firstCallBack && this.firstCallBack();
|
||||
}
|
||||
this.loadedCallback && this.loadedCallback();
|
||||
this.params.pages++;
|
||||
this.params.currentPage++;
|
||||
this.total = res.total;
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user