Commit cf6d3f04 authored by tangfh's avatar tangfh

+

parent 40ca9b14
......@@ -58,15 +58,18 @@
},
methods: {
init(option) {
this.onRefresh()
let _this = this;
setTimeout(() => {
_this.refresherTriggered = true;
}, 35)
},
onNavBarLeftClick() {
uni.navigateBack();
},
refreshInit() {
this.page = 1;
this.total_pagetotal_page = 1;
this.status = 'noMore';
this.total_page = 1;
this.loadMoreStatus = constant.LOAD_STATUS.noMore;
},
onEmptyClick() {
this.onRefresh();
......@@ -77,10 +80,10 @@
this.request();
},
onLoadMore(e) {
if ('noMore' == this.status) {
if (constant.LOAD_STATUS.noMore == this.loadMoreStatus) {
return;
}
this.status = 'loading';
this.loadMoreStatus = constant.LOAD_STATUS.loading;
this.request();
},
onBottomBtnClick() {
......@@ -125,8 +128,8 @@
}
if (this.refresherTriggered || this.isOnFilter || this.items.length == 0) {
this.items = list;
this.status = this.total_page == 1 ? constant.LOAD_STATUS.noMore : constant.LOAD_STATUS.more;
} else if (this.status == 'loading') {
this.loadMoreStatus = this.total_page == 1 ? constant.LOAD_STATUS.noMore : constant.LOAD_STATUS.more;
} else if (this.loadMoreStatus == 'loading') {
if (list.length > 0) {
this.items = this.items.concat(list);
}
......@@ -140,14 +143,14 @@
if (this.refresherTriggered) {
this.refresherTriggered = false;
if (this.total_page > 1) {
this.status = constant.LOAD_STATUS.more;
this.loadMoreStatus = constant.LOAD_STATUS.more;
}
} else if (this.status == constant.LOAD_STATUS.loading) {
} else if (this.loadMoreStatus == constant.LOAD_STATUS.loading) {
if (this.page > this.total_page) {
this.status = constant.LOAD_STATUS.noMore;
this.loadMoreStatus = constant.LOAD_STATUS.noMore;
this.page = this.total_page
} else {
this.status = constant.LOAD_STATUS.more;
this.loadMoreStatus = constant.LOAD_STATUS.more;
}
}
this.firstRequest = false
......
......@@ -16,7 +16,8 @@
<view class="view-tmp1 active" v-for="(item2, index2) in tab.data" :index="index2" :key="index2"
:item="item2" @onItemClick="onItemClick"></view>
</view>
<c-empty v-if="tab.data.length == 0" @onEmptyClick="onEmptyClick"></c-empty>
<c-status-view v-if="tab.data.length == 0 && !tab.firstRequest" :status="tab.contentStatus"
@onStatusClick="onStatusClick"></c-status-view>
<uni-load-more :status="tab.loadStatus" :icon-size="16" v-if="tab.isLoading || tab.data.length > 0"
:content-text="loadMoreViewContentText" />
</scroll-view>
......@@ -86,7 +87,6 @@
date: "2023-05-06-08 13:16",
item: "公共照明",
},
firstRequest: true,
}
},
onLoad(option) {
......@@ -146,24 +146,24 @@
}
_this.tabList.push(tab);
});
_this.onRefresh();
var tab = _this.tabList[_this.tabIndex];
setTimeout(() => {
tab.refreshing = true;
}, 35)
}, 350)
},
onNavBarLeftClick() {
uni.navigateBack();
},
onEmptyClick() {
onStatusClick() {
var tab = this.tabList[this.tabIndex];
tab.refreshing = true;
this.onRefresh();
},
onRefresh(e) {
var tab = this.tabList[this.tabIndex];
if (!tab.refreshFlag) {
return;
}
tab.page = 1;
setTimeout(function() {
tab.refreshing = true;
}, 30);
tab.refreshing = true;
tab.loadStatus = tab.page == tab.total_pages ? constant.LOAD_STATUS.noMore : constant.LOAD_STATUS.more;
this.getList(this.tabIndex)
},
......@@ -210,13 +210,15 @@
this.tabList[this.tabIndex].data = this.tabList[this.tabIndex].data.concat(data.list);
},
requestFail(res, status) {
this.contentStatus = status;
if (this.tabList[this.tabIndex].data.length == 0) {
this.tabList[this.tabIndex].contentStatus = status;
}
},
requestComplete() {
if (this.refresherTriggered) {
this.refresherTriggered = false;
}
this.firstRequest = false;
this.tabList[this.tabIndex].firstRequest = false;
var tab = this.tabList[this.tabIndex];
tab.refreshing = false;
tab.isRequestComplete = true;
uni.hideLoading()
},
onLoadMore(e) {
......@@ -235,7 +237,10 @@
if (this.tabList[index].data.length > 0) {
return;
}
this.getList(index);
var tab = this.tabList[this.tabIndex];
setTimeout(() => {
tab.refreshing = true;
}, 35)
},
switchTab(index) {
if (this.tabIndex === index) {
......@@ -285,7 +290,6 @@
})
},
ensure() {
uni.$emit("onRepairItemSelected", this.seletedItem)
uni.navigateBack();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment