wangfukang 2 days ago
parent
commit
8eeb5abf24
  1. 30
      pages/index/index.vue

30
pages/index/index.vue

@ -454,6 +454,9 @@
<view class="swiper-page" v-show="currentIndex == 1">
<de-livery ref="deLiveryPage" @tabbar-visible-change="setTabBarVisible"></de-livery>
</view>
<view class="swiper-page" v-show="currentIndex == 2">
<release-page ref="releasePage"></release-page>
</view>
<view class="swiper-page" v-show="currentIndex == 3">
<post-list ref="postListPage"></post-list>
</view>
@ -540,6 +543,7 @@
<script>
import tabBar from "@/components/tab-bar/tab-bar.vue";
import deLivery from "@/components/tab-bar/delivery.vue";
import releasePage from "@/components/tab-bar/release.vue";
import postList from "@/components/tab-bar/postList.vue";
import myCenter from "@/components/tab-bar/myCenter.vue";
import { resolveHomeShareTarget, normalizeShareTargetPath } from '@/utils/sharePath.js'
@ -653,7 +657,7 @@
url: '/package2/shop/merchantRegister'
}, {
name: '发布',
url: '/package1/tabbar/release'
url: '/pages/index/index?tabIndex=2'
}, {
name: '农场',
url: '/package1/farm/farm'
@ -770,6 +774,7 @@
components: {
tabBar,
deLivery,
releasePage,
postList,
myCenter
},
@ -877,6 +882,7 @@
}
},
onShow() {
this.startDeliveryTimeTimer()
this.runHomeInit()
if (this.openShareTargetIfNeeded()) return
if (this.pendingTabIndex !== null) {
@ -895,6 +901,9 @@
} else {
this.$nextTick(() => {
Promise.resolve(this.refreshTabCounts()).then(() => {
if (this.currentIndex == 1 && this.$refs.deLiveryPage) {
this.$refs.deLiveryPage.init()
}
if (this.currentIndex == 4 && this.$refs.myCenterPage) {
this.$refs.myCenterPage.init()
}
@ -908,6 +917,7 @@
},
onHide() {
this.closeProductPopup()
this.stopDeliveryTimeTimer()
},
onReady() {
//
@ -917,10 +927,7 @@
},
onUnload() {
this.closeProductPopup()
if (this.deliveryTimer) {
clearInterval(this.deliveryTimer);
this.deliveryTimer = null;
}
this.stopDeliveryTimeTimer()
},
methods: {
setTabBarVisible(visible) {
@ -1200,6 +1207,11 @@
this.deliveryNowTime = Date.now()
}, 60 * 1000)
},
stopDeliveryTimeTimer() {
if (!this.deliveryTimer) return
clearInterval(this.deliveryTimer)
this.deliveryTimer = null
},
isSwipeOrderActive(item, index) {
if (!item) return false
return this.swipeOrder.id === item.id && this.swipeOrder.index === index && this.swipeOrder.progress > 0
@ -1934,9 +1946,7 @@
if (index != 0) {
this.closeProductPopup()
}
if(index != 2){
this.currentIndex = index
}
switch (index) {
case 0:
@ -1946,8 +1956,10 @@
that.$refs.deLiveryPage.init()
break;
case 2:
uni.navigateTo({
url: '/package1/tabbar/release'
that.$nextTick(() => {
if (that.$refs.releasePage && that.$refs.releasePage.init) {
that.$refs.releasePage.init()
}
})
break;
case 3:

Loading…
Cancel
Save