diff --git a/pages/home/index.vue b/pages/home/index.vue index d9dc43e..45d81f8 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -332,12 +332,14 @@ export default { } that.initSelectedCityByAgencyInfo().then(() => { that.loadSelectedCityFromCache().then(() => { + that.restoreActiveTab(); that.getList(); }); }); } else { that.initSelectedCityByAgencyInfo().then(() => { that.loadSelectedCityFromCache().then(() => { + that.restoreActiveTab(); this.getList(); }); }); @@ -1122,7 +1124,7 @@ export default { }); }, goDetail($item) { - // console.log("前往详情页", $item); + uni.setStorageSync("HOME_ACTIVE_TAB", this.tabInfo.active); uni.navigateTo({ url: "/root/detail/job?id=" + $item.id, }); @@ -1275,6 +1277,24 @@ export default { // console.log(this.whichPage); this.getList(); }, + restoreActiveTab() { + let savedTab = uni.getStorageSync("HOME_ACTIVE_TAB"); + if (savedTab !== "" && savedTab !== null && savedTab !== undefined) { + uni.removeStorageSync("HOME_ACTIVE_TAB"); + if (savedTab !== this.tabInfo.active && savedTab < this.tabInfo.list.length) { + this.tabInfo.active = savedTab; + this.query.list = []; + this.loading = true; + this.query.page = 1; + this.speed = -1; + if (this.tabInfo.list[this.tabInfo.active].classify == 2) { + this.query.ujc = 1; + } else { + this.query.ujc = 0; + } + } + } + }, handleUpdateTab(e) { // console.log("获取tab数据:", e); let that = this;