|
|
@@ -34,7 +34,7 @@ const props = defineProps({
|
|
|
iosUpdateUrl: String
|
|
|
})
|
|
|
|
|
|
-const { route, routerTo, getGlobalUrlParams, setGlobalUrlParams } = useNavigation()
|
|
|
+const { route, routerTo } = useNavigation()
|
|
|
const { userLogin } = useLogin()
|
|
|
const loginStore = useLoginStore()
|
|
|
const cssTransition = shallowRef(true) // 是否使用css动画
|
|
|
@@ -44,18 +44,13 @@ const tabIndex = computed(() => props.tabs.findIndex((e) => e.name === route.nam
|
|
|
|
|
|
const onTabClick = (index: number) => {
|
|
|
const { name } = props.tabs[index]
|
|
|
- cssTransition.value = false
|
|
|
-
|
|
|
- if (name === 'home-index' || loginStore.token) {
|
|
|
- currentTab.value = index
|
|
|
+ if (index === 0 || loginStore.token) {
|
|
|
routerTo(name, true)
|
|
|
} else {
|
|
|
fullloading((hideLoading) => {
|
|
|
userLogin(true).then(() => {
|
|
|
- currentTab.value = index
|
|
|
routerTo(name, true)
|
|
|
}).catch(() => {
|
|
|
- cssTransition.value = true
|
|
|
routerTo('user-login')
|
|
|
}).finally(() => {
|
|
|
hideLoading()
|
|
|
@@ -75,12 +70,9 @@ const tradeServerReconnectSuccessNotify = eventBus.$on('TradeServerReconnectSucc
|
|
|
})
|
|
|
|
|
|
watch(() => route.name, () => {
|
|
|
- const params = getGlobalUrlParams()
|
|
|
- if (params.tabIndex > -1) {
|
|
|
- onTabClick(params.tabIndex)
|
|
|
- } else {
|
|
|
- // 如果参数不是 tabIndex ,需要保留到下一个路由
|
|
|
- setGlobalUrlParams(params)
|
|
|
+ if (tabIndex.value > -1) {
|
|
|
+ cssTransition.value = false
|
|
|
+ currentTab.value = tabIndex.value
|
|
|
}
|
|
|
nextTick(() => {
|
|
|
cssTransition.value = true
|
|
|
@@ -88,13 +80,7 @@ watch(() => route.name, () => {
|
|
|
})
|
|
|
|
|
|
onMounted(() => {
|
|
|
- // 页面初始化时判断底部导航位置
|
|
|
- const params = getGlobalUrlParams()
|
|
|
- if (params.tabIndex > -1) {
|
|
|
- onTabClick(params.tabIndex)
|
|
|
- } else {
|
|
|
- currentTab.value = tabIndex.value
|
|
|
- }
|
|
|
+ currentTab.value = tabIndex.value
|
|
|
})
|
|
|
|
|
|
onUnmounted(() => {
|