|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="home g-flex">
|
|
|
|
|
|
|
+ <div ref="homeRef" class="home g-flex">
|
|
|
<router-view v-slot="{ Component }">
|
|
<router-view v-slot="{ Component }">
|
|
|
<RouterTransition :css="cssTransition">
|
|
<RouterTransition :css="cssTransition">
|
|
|
<!-- 缓存所有组件 -->
|
|
<!-- 缓存所有组件 -->
|
|
@@ -8,7 +8,8 @@
|
|
|
</keep-alive>
|
|
</keep-alive>
|
|
|
</RouterTransition>
|
|
</RouterTransition>
|
|
|
</router-view>
|
|
</router-view>
|
|
|
- <FloatingBubble v-model:offset="offset" icon="chat" v-if="false" />
|
|
|
|
|
|
|
+ <FloatingBubble class="home-line-chat" v-model:offset="offset" :icon="Line" @click="openChat"
|
|
|
|
|
+ v-if="loginStore.token" />
|
|
|
<app-tabbar :data-list="tabList" :data-index="currentTab" @click="onTabClick" />
|
|
<app-tabbar :data-list="tabList" :data-index="currentTab" @click="onTabClick" />
|
|
|
<app-updater :ios-update-url="iosUpdateUrl" />
|
|
<app-updater :ios-update-url="iosUpdateUrl" />
|
|
|
</div>
|
|
</div>
|
|
@@ -19,11 +20,13 @@ import { shallowRef, nextTick, watch, onMounted, computed } from 'vue'
|
|
|
import { FloatingBubble } from 'vant'
|
|
import { FloatingBubble } from 'vant'
|
|
|
import { Tabbar } from '@mobile/components/base/tabbar/types'
|
|
import { Tabbar } from '@mobile/components/base/tabbar/types'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
-import { useLoginStore } from '@/stores'
|
|
|
|
|
|
|
+import { useLoginStore, useUserStore } from '@/stores'
|
|
|
import { i18n } from '@/stores'
|
|
import { i18n } from '@/stores'
|
|
|
import AppTabbar from '@mobile/components/base/tabbar/index.vue'
|
|
import AppTabbar from '@mobile/components/base/tabbar/index.vue'
|
|
|
import AppUpdater from '@mobile/components/base/updater/index.vue'
|
|
import AppUpdater from '@mobile/components/base/updater/index.vue'
|
|
|
import RouterTransition from '@mobile/components/base/router-transition/index.vue'
|
|
import RouterTransition from '@mobile/components/base/router-transition/index.vue'
|
|
|
|
|
+import plus from '@/utils/h5plus'
|
|
|
|
|
+import Line from '../../assets/images/icons/line.svg'
|
|
|
|
|
|
|
|
defineProps({
|
|
defineProps({
|
|
|
iosUpdateUrl: String
|
|
iosUpdateUrl: String
|
|
@@ -33,10 +36,12 @@ const { t } = i18n.global
|
|
|
|
|
|
|
|
const { route, routerTo } = useNavigation()
|
|
const { route, routerTo } = useNavigation()
|
|
|
const loginStore = useLoginStore()
|
|
const loginStore = useLoginStore()
|
|
|
|
|
+const userStore = useUserStore()
|
|
|
const cssTransition = shallowRef(true) // 是否使用css动画
|
|
const cssTransition = shallowRef(true) // 是否使用css动画
|
|
|
const currentTab = shallowRef(0)
|
|
const currentTab = shallowRef(0)
|
|
|
const marketSection = shallowRef() // 当前选中的板块
|
|
const marketSection = shallowRef() // 当前选中的板块
|
|
|
|
|
|
|
|
|
|
+const homeRef = shallowRef<HTMLDivElement>()
|
|
|
const offset = shallowRef({ x: 0, y: 0 })
|
|
const offset = shallowRef({ x: 0, y: 0 })
|
|
|
|
|
|
|
|
const tabIndex = computed(() => {
|
|
const tabIndex = computed(() => {
|
|
@@ -92,6 +97,28 @@ const onTabClick = (index: number) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const openChat = () => {
|
|
|
|
|
+ const userAccount = userStore.getUserDataInfo('userAccount')
|
|
|
|
|
+ const lineUrl = 'https://line.me/R/oaMessage/@' + userAccount.memberlinecsaccount
|
|
|
|
|
+ // const lineProtocolUrl = 'line://ti/p/@' + userAccount.memberlinecsaccount
|
|
|
|
|
+
|
|
|
|
|
+ // if (plus.getSystemInfo('os') === 'Web') {
|
|
|
|
|
+ // plus.openURL(lineUrl)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // // 优先尝试 Line 协议
|
|
|
|
|
+ // plus.openURL(lineProtocolUrl)
|
|
|
|
|
+
|
|
|
|
|
+ // // 如果失败,回退到通用链接
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // if (!document.hidden) {
|
|
|
|
|
+ // plus.openURL(lineUrl)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }, 500)
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ plus.openURL(lineUrl)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
watch(() => route.name, () => {
|
|
watch(() => route.name, () => {
|
|
|
if (tabIndex.value > -1) {
|
|
if (tabIndex.value > -1) {
|
|
|
cssTransition.value = false
|
|
cssTransition.value = false
|
|
@@ -105,9 +132,12 @@ watch(() => route.name, () => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
currentTab.value = tabIndex.value
|
|
currentTab.value = tabIndex.value
|
|
|
|
|
|
|
|
- offset.value = {
|
|
|
|
|
- x: -1,
|
|
|
|
|
- y: document.body.clientHeight - 120
|
|
|
|
|
|
|
+ const el = homeRef.value
|
|
|
|
|
+ if (el) {
|
|
|
|
|
+ offset.value = {
|
|
|
|
|
+ x: -1,
|
|
|
|
|
+ y: el.clientHeight - 120
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|