Merge pull request #10181 from dataease/pr@dev-v2_st

fix(移动端): 数据大屏的公共链接通过手机打开会显示“资源不存在或已经被删除” #9971
This commit is contained in:
dataeaseShu 2024-06-11 14:13:49 +08:00 committed by GitHub
commit a8096fdc5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 30 deletions

View File

@ -39,6 +39,8 @@ router.beforeEach(async (to, from, next) => {
loadDone() loadDone()
if (to.name === 'link') { if (to.name === 'link') {
window.location.href = window.origin + '/mobile.html#' + to.path window.location.href = window.origin + '/mobile.html#' + to.path
} else if (to.path === '/dvCanvas') {
window.location.href = window.origin + '/mobile.html#' + to.path
} else if ( } else if (
wsCache.get('user.token') || wsCache.get('user.token') ||
isDesktop || isDesktop ||

View File

@ -17,7 +17,7 @@ const { start, done } = useNProgress()
const interactiveStore = interactiveStoreWithOut() const interactiveStore = interactiveStoreWithOut()
const { loadStart, loadDone } = usePageLoading() const { loadStart, loadDone } = usePageLoading()
const whiteList = ['/login', '/panel'] // 不重定向白名单 const whiteList = ['/login', '/panel', '/dvCanvas'] // 不重定向白名单
router.beforeEach(async (to, _, next) => { router.beforeEach(async (to, _, next) => {
start() start()

View File

@ -51,6 +51,13 @@ export const routes: AppRouteRecordRaw[] = [
hidden: true, hidden: true,
meta: {}, meta: {},
component: () => import('@/views/mobile/panel/Mobile.vue') component: () => import('@/views/mobile/panel/Mobile.vue')
},
{
path: '/dvCanvas',
name: 'dv',
hidden: true,
meta: {},
component: () => import('@/views/mobile/panel/NotSupport.vue')
} }
] ]

View File

@ -0,0 +1,14 @@
<template>
<div class="not-support">请注意数据大屏不支持在移动端查阅</div>
</template>
<style lang="less" scoped>
.not-support {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
}
</style>

View File

@ -1,8 +1,5 @@
<template> <template>
<div <div class="mobile-link-container" v-loading="loading">
:class="curType === 'dashboard' ? 'mobile-link-container' : 'link-container'"
v-loading="loading"
>
<LinkError v-if="!loading && !linkExist" /> <LinkError v-if="!loading && !linkExist" />
<Exp v-else-if="!loading && linkExp" /> <Exp v-else-if="!loading && linkExp" />
<PwdTips v-else-if="!loading && !pwdValid" /> <PwdTips v-else-if="!loading && !pwdValid" />
@ -15,22 +12,16 @@
:dv-info="state.dvInfo" :dv-info="state.dvInfo"
:cur-gap="state.curPreviewGap" :cur-gap="state.curPreviewGap"
></de-preview> ></de-preview>
<PreviewCanvas
v-else-if="curType !== 'dashboard'"
:class="{ 'hidden-link': loading }"
ref="pcanvas"
public-link-status="true"
/>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, nextTick, ref, reactive } from 'vue' import { onMounted, nextTick, ref, reactive } from 'vue'
import { initCanvasDataMobile } from '@/utils/canvasUtils' import { initCanvasDataMobile } from '@/utils/canvasUtils'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import PreviewCanvas from '@/views/data-visualization/PreviewCanvas.vue'
import DePreview from '@/components/data-visualization/canvas/DePreview.vue' import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
import { ProxyInfo, shareProxy } from './ShareProxy' import { ProxyInfo, shareProxy } from './ShareProxy'
import Exp from './exp.vue' import Exp from './exp.vue'
import router from '@/router/mobile'
import LinkError from './error.vue' import LinkError from './error.vue'
import PwdTips from './pwd.vue' import PwdTips from './pwd.vue'
const linkExist = ref(false) const linkExist = ref(false)
@ -83,8 +74,6 @@ const loadCanvasData = (dvId, weight?) => {
} }
const curType = ref('') const curType = ref('')
const pcanvas = ref(null)
onMounted(async () => { onMounted(async () => {
const proxyInfo = (await shareProxy.loadProxy()) as ProxyInfo const proxyInfo = (await shareProxy.loadProxy()) as ProxyInfo
curType.value = proxyInfo.type || 'dashboard' curType.value = proxyInfo.type || 'dashboard'
@ -102,11 +91,8 @@ onMounted(async () => {
dvMainStore.setPublicLinkStatus(true) dvMainStore.setPublicLinkStatus(true)
loading.value = false loading.value = false
} else { } else {
const method = pcanvas?.value?.loadCanvasDataAsync
if (method) {
method(proxyInfo.resourceId, proxyInfo.type, null)
}
loading.value = false loading.value = false
router.push('/dvCanvas')
} }
}) })
}) })
@ -119,15 +105,3 @@ onMounted(async () => {
position: relative; position: relative;
} }
</style> </style>
<style lang="less" scoped>
.link-container {
position: absolute !important;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.hidden-link {
display: none !important;
}
</style>