Commit c909411a3cfbc7c848aececca2a30c3309f72849

Authored by ww
1 parent a5d9bfb1

perf(share): 修复分享暂无数据局中

Showing 1 changed file with 7 additions and 4 deletions
1 1 <template>
2 2 <section>
3 3 <preview v-if="!allowLoadPreviewPage" :key="key"></preview>
  4 + <NEmpty v-if="isEmpty" style="position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);" />
4 5 <NModal :show="showModal" :maskClosable="false" :closable="false" style="width: 300px;">
5 6 <NCard>
6 7 <NForm @keyup.enter="handleSubmit">
... ... @@ -9,8 +10,8 @@
9 10 <NInput v-model:value="accessCredentials" show-password-on="mousedown" type="password"
10 11 style="width: 70%;" />
11 12 <NButton :loading="loading" type="primary" style="width: 30%;" @click="handleSubmit">
12   - <svg style="transform: rotate(180deg);" t="1682068997810" class="icon" viewBox="0 0 1024 1024" version="1.1"
13   - xmlns="http://www.w3.org/2000/svg" p-id="79416" width="24" height="24">
  13 + <svg style="transform: rotate(180deg);" t="1682068997810" class="icon" viewBox="0 0 1024 1024"
  14 + version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="79416" width="24" height="24">
14 15 <path
15 16 d="M512 928H128c-19.2 0-32-12.8-32-32V128c0-19.2 12.8-32 32-32h384c19.2 0 32 12.8 32 32s-12.8 32-32 32H160v704h352c19.2 0 32 12.8 32 32s-12.8 32-32 32z"
16 17 fill="#fff" p-id="79417" />
... ... @@ -30,7 +31,7 @@
30 31 </template>
31 32
32 33 <script setup lang="ts">
33   -import { NModal, NCard, NForm, NFormItem, NInput, NButton, NInputGroup } from 'naive-ui'
  34 +import { NEmpty, NCard, NForm, NFormItem, NInput, NButton, NInputGroup } from 'naive-ui'
34 35 import { getSessionStorageInfo } from '../preview/utils'
35 36 import type { ChartEditStorageType } from '../preview/index.d'
36 37 import { SavePageEnum } from '@/enums/editPageEnum'
... ... @@ -76,6 +77,7 @@ const sharePageHandlerProcess = async () => {
76 77 }
77 78 }
78 79
  80 +const isEmpty = ref(false)
79 81 const getSharePageContentData = async () => {
80 82 try {
81 83 const { params } = ROUTE
... ... @@ -83,7 +85,8 @@ const getSharePageContentData = async () => {
83 85 loading.value = true
84 86 const res = await getShareContentData({ id, accessCredentials: unref(accessCredentials) })
85 87 const { dataViewContent, dataViewName, dataViewId } = res.data
86   - const content = JSONParse(dataViewContent.content) as ChartEditStorageType
  88 + if (!dataViewContent.content) isEmpty.value = true
  89 + const content = JSONParse(dataViewContent.content || '{}') as ChartEditStorageType
87 90 if (content) {
88 91 const { editCanvasConfig, requestGlobalConfig, componentList } = content
89 92 chartEditStore.editCanvasConfig = editCanvasConfig
... ...