|
|
|
@ -489,7 +489,7 @@ |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="swiper-page" v-show="currentIndex == 1"> |
|
|
|
<de-livery ref="deLiveryPage"></de-livery> |
|
|
|
<de-livery ref="deLiveryPage" @tabbar-visible-change="setTabBarVisible"></de-livery> |
|
|
|
</view> |
|
|
|
<view class="swiper-page" v-show="currentIndex == 3"> |
|
|
|
<post-list ref="postListPage"></post-list> |
|
|
|
@ -582,7 +582,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-popup> |
|
|
|
<tab-bar ref="tabBar" :width="width" @tab-index="changeIndex" :currentIndex="currentIndex"></tab-bar> |
|
|
|
<tab-bar v-if="isTabBarVisible" ref="tabBar" :width="width" @tab-index="changeIndex" :currentIndex="currentIndex"></tab-bar> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
@ -590,6 +590,7 @@ |
|
|
|
import deLivery from "@/components/tab-bar/delivery.vue"; |
|
|
|
import postList from "@/components/tab-bar/postList.vue"; |
|
|
|
import myCenter from "@/components/tab-bar/myCenter.vue"; |
|
|
|
import { resolveHomeShareTarget, normalizeShareTargetPath } from '@/utils/sharePath.js' |
|
|
|
|
|
|
|
const HOME_AD_IMAGE_CACHE_KEY = 'home_ad_image_cache_v1' |
|
|
|
const HOME_AD_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000 |
|
|
|
@ -732,7 +733,9 @@ |
|
|
|
markers: [], // 标记点,可以包括配送员位置和用户位置 |
|
|
|
polyline: [], // 路线,如果需要显示配送员路线 |
|
|
|
currentIndex: 0, |
|
|
|
isTabBarVisible: true, |
|
|
|
pendingTabIndex: null, |
|
|
|
pendingShareTargetPath: '', |
|
|
|
width: 0, |
|
|
|
dataTabList: [{ |
|
|
|
name: '猜你喜欢', |
|
|
|
@ -908,9 +911,15 @@ |
|
|
|
this.pendingTabIndex = tabIndex |
|
|
|
} |
|
|
|
} |
|
|
|
const shareTargetPath = resolveHomeShareTarget(option) |
|
|
|
if (shareTargetPath) { |
|
|
|
this.pendingShareTargetPath = shareTargetPath |
|
|
|
uni.setStorageSync('pendingShareTargetPath', shareTargetPath) |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
this.runHomeInit() |
|
|
|
if (this.openShareTargetIfNeeded()) return |
|
|
|
if (this.pendingTabIndex !== null) { |
|
|
|
const tabIndex = this.pendingTabIndex |
|
|
|
this.pendingTabIndex = null |
|
|
|
@ -936,6 +945,9 @@ |
|
|
|
}, 500); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
setTabBarVisible(visible) { |
|
|
|
this.isTabBarVisible = visible |
|
|
|
}, |
|
|
|
refreshTabCounts() { |
|
|
|
if (this.$refs.tabBar && this.$refs.tabBar.getWorkerCounts) { |
|
|
|
return this.$refs.tabBar.getWorkerCounts() |
|
|
|
@ -949,6 +961,64 @@ |
|
|
|
this.refreshDaimaiStickyPosition() |
|
|
|
}) |
|
|
|
}, |
|
|
|
normalizeShareTargetPath(value) { |
|
|
|
return normalizeShareTargetPath(value) |
|
|
|
}, |
|
|
|
resolveShareTargetPath(value) { |
|
|
|
let targetPath = String(value || '') |
|
|
|
if (targetPath.indexOf('/pages/index/index') === 0 || targetPath.indexOf('pages/index/index') === 0) { |
|
|
|
const queryIndex = targetPath.indexOf('?') |
|
|
|
if (queryIndex !== -1) { |
|
|
|
const query = targetPath.slice(queryIndex + 1).split('&') |
|
|
|
for (let i = 0; i < query.length; i++) { |
|
|
|
const pair = query[i].split('=') |
|
|
|
if (pair[0] === 'targetPath') { |
|
|
|
targetPath = pair.slice(1).join('=') |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return this.normalizeShareTargetPath(targetPath) |
|
|
|
}, |
|
|
|
openShareTargetIfNeeded() { |
|
|
|
if (!this.pendingShareTargetPath) { |
|
|
|
this.pendingShareTargetPath = this.resolveShareTargetPath(uni.getStorageSync('pendingShareTargetPath') || '') |
|
|
|
if (this.pendingShareTargetPath) { |
|
|
|
uni.setStorageSync('pendingShareTargetPath', this.pendingShareTargetPath) |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.pendingShareTargetPath) return false |
|
|
|
if (!uni.getStorageSync('area')) return true |
|
|
|
const targetPath = this.pendingShareTargetPath |
|
|
|
this.pendingShareTargetPath = '' |
|
|
|
uni.removeStorageSync('pendingShareTargetPath') |
|
|
|
uni.removeStorageSync('authPendingTargetPath') |
|
|
|
this.$nextTick(() => { |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: targetPath, |
|
|
|
fail: () => { |
|
|
|
this.pendingShareTargetPath = targetPath |
|
|
|
uni.setStorageSync('pendingShareTargetPath', targetPath) |
|
|
|
uni.redirectTo({ |
|
|
|
url: targetPath, |
|
|
|
success: () => { |
|
|
|
uni.removeStorageSync('pendingShareTargetPath') |
|
|
|
}, |
|
|
|
fail: () => { |
|
|
|
uni.showToast({ |
|
|
|
title: '进入分享页面失败,请重试', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, 300) |
|
|
|
}) |
|
|
|
return true |
|
|
|
}, |
|
|
|
refreshDaimaiStickyPosition() { |
|
|
|
const query = uni.createSelectorQuery().in(this); |
|
|
|
query.select('#menuList').boundingClientRect(rect => { |
|
|
|
@ -1584,6 +1654,10 @@ |
|
|
|
} |
|
|
|
|
|
|
|
this.$refs.areaPopup.close() |
|
|
|
this.pendingShareTargetPath = uni.getStorageSync('pendingShareTargetPath') || this.pendingShareTargetPath |
|
|
|
setTimeout(() => { |
|
|
|
this.openShareTargetIfNeeded() |
|
|
|
}, 300) |
|
|
|
}, |
|
|
|
checkArea() { |
|
|
|
this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => { |
|
|
|
@ -1757,6 +1831,7 @@ |
|
|
|
//底部tab切换组件状态改变 |
|
|
|
changeIndex(index) { |
|
|
|
let that = this; |
|
|
|
this.isTabBarVisible = true |
|
|
|
this.lastIndex = this.currentIndex |
|
|
|
if(index != 2){ |
|
|
|
this.currentIndex = index |
|
|
|
|