Merge pull request #8281 from dataease/pr@dev-v2_dzz_mobile

fix(移动端): 查看仪表板后,返回时建议能返回到查看操作发起的页面
This commit is contained in:
dataeaseShu 2024-03-01 18:58:06 +08:00 committed by GitHub
commit 0c82effa01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 39 additions and 7 deletions

View File

@ -2,6 +2,7 @@
import { ref, computed, onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { useCache } from '@/hooks/web/useCache'
import { BusiTreeRequest } from '@/models/tree/TreeNode'
import { interactiveStoreWithOut } from '@/store/modules/interactive'
import DashboardCell from '@/views/mobile/components/DashboardCell.vue'
@ -19,6 +20,7 @@ const activeDirectName = ref('')
const interactiveStore = interactiveStoreWithOut()
const dvMainStore = dvMainStoreWithOut()
const { dvInfo } = storeToRefs(dvMainStore)
const { wsCache } = useCache('sessionStorage')
const dfsTree = (ids, arr) => {
const id = ids.shift()
@ -50,6 +52,10 @@ const onClickLeft = () => {
const router = useRouter()
const handleCellClick = ele => {
wsCache.set('directName', directName.value)
wsCache.set('activeDirectName', activeDirectName.value)
wsCache.set('activeTabbar', 'direct')
wsCache.set('directId', directId.value)
router.push({
path: '/panel/mobile',
query: {
@ -59,13 +65,14 @@ const handleCellClick = ele => {
}
const dataClick = val => {
directName.value.push(val.name)
activeDirectName.value = val.name
directId.value.push(val.id)
if (val.leaf) {
emits('hiddenTabbar', true)
handleCellClick(val)
return
}
directName.value.push(val.name)
activeDirectName.value = val.name
directId.value.push(val.id)
}
const getTree = async () => {
@ -87,6 +94,14 @@ const getTree = async () => {
onMounted(() => {
getTree()
activeDirectName.value = wsCache.get('activeDirectName')
if (wsCache.get('activeTabbar') !== 'direct' || !activeDirectName.value) return
directName.value = wsCache.get('directName')
directId.value = wsCache.get('directId')
wsCache.set('directName', [])
wsCache.set('activeDirectName', '')
wsCache.set('directId', [])
wsCache.set('activeTabbar', '')
})
</script>

View File

@ -4,6 +4,7 @@ import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { useI18n } from '@/hooks/web/useI18n'
import { shortcutOption } from '@/views/workbranch/ShortcutOption'
import { useRouter } from 'vue-router'
import { useCache } from '@/hooks/web/useCache'
import Workbranch from '@/views/mobile/components/Workbranch.vue'
import request from '@/config/axios'
import nothingNone from '@/assets/img/none.png'
@ -18,6 +19,7 @@ import 'vant/es/tabs/style'
const router = useRouter()
const { t } = useI18n()
const { wsCache } = useCache('sessionStorage')
const activeTab = ref('recent')
const emptyTips = ref('')
@ -104,14 +106,17 @@ const handleClick = ({ name, disabled }) => {
}
}
onMounted(() => {
activeTab.value = wsCache.get('activeTab') || 'recent'
wsCache.set('activeTab', '')
!!busiAuthList.length &&
handleClick({
name: 'recent',
name: activeTab.value,
disabled: false
})
})
const handleCellClick = ele => {
wsCache.set('activeTab', activeTab.value)
router.push({
path: '/panel/mobile',
query: {

View File

@ -1,7 +1,8 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { ref, onBeforeMount } from 'vue'
import Home from './home/index.vue'
import Directory from './directory/index.vue'
import { useCache } from '@/hooks/web/useCache'
import Personal from './personal/index.vue'
import VanTabbar from 'vant/es/tabbar'
import VanTabbarItem from 'vant/es/tabbar-item'
@ -15,6 +16,11 @@ import 'vant/es/loading/style'
const activeTabbar = ref('home')
const showLoading = ref(false)
const hiddenTabbar = ref(false)
const { wsCache } = useCache('sessionStorage')
onBeforeMount(() => {
activeTabbar.value = wsCache.get('activeTabbar') || 'home'
})
</script>
<template>

View File

@ -50,16 +50,22 @@ const loadCanvasData = (dvId, weight?) => {
const route = useRoute()
const router = useRouter()
let fromPage, cache
onBeforeMount(() => {
dvMainStore.setMobileInPc(true)
const dvId = route.query.dvId as unknown as string
fromPage = route.query.from as unknown as string
cache = route.query.cache as unknown as string
loadCanvasData(dvId)
})
const onClickLeft = () => {
router.replace({
path: '/index'
path: '/index',
query: {
from: fromPage,
cache: cache
}
})
}
</script>