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

32
pages/index/index.vue

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

Loading…
Cancel
Save