Commit c909411a3cfbc7c848aececca2a30c3309f72849

Authored by ww
1 parent a5d9bfb1

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

Showing 1 changed file with 7 additions and 4 deletions
1 <template> 1 <template>
2 <section> 2 <section>
3 <preview v-if="!allowLoadPreviewPage" :key="key"></preview> 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 <NModal :show="showModal" :maskClosable="false" :closable="false" style="width: 300px;"> 5 <NModal :show="showModal" :maskClosable="false" :closable="false" style="width: 300px;">
5 <NCard> 6 <NCard>
6 <NForm @keyup.enter="handleSubmit"> 7 <NForm @keyup.enter="handleSubmit">
@@ -9,8 +10,8 @@ @@ -9,8 +10,8 @@
9 <NInput v-model:value="accessCredentials" show-password-on="mousedown" type="password" 10 <NInput v-model:value="accessCredentials" show-password-on="mousedown" type="password"
10 style="width: 70%;" /> 11 style="width: 70%;" />
11 <NButton :loading="loading" type="primary" style="width: 30%;" @click="handleSubmit"> 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 <path 15 <path
15 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 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 fill="#fff" p-id="79417" /> 17 fill="#fff" p-id="79417" />
@@ -30,7 +31,7 @@ @@ -30,7 +31,7 @@
30 </template> 31 </template>
31 32
32 <script setup lang="ts"> 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 import { getSessionStorageInfo } from '../preview/utils' 35 import { getSessionStorageInfo } from '../preview/utils'
35 import type { ChartEditStorageType } from '../preview/index.d' 36 import type { ChartEditStorageType } from '../preview/index.d'
36 import { SavePageEnum } from '@/enums/editPageEnum' 37 import { SavePageEnum } from '@/enums/editPageEnum'
@@ -76,6 +77,7 @@ const sharePageHandlerProcess = async () => { @@ -76,6 +77,7 @@ const sharePageHandlerProcess = async () => {
76 } 77 }
77 } 78 }
78 79
  80 +const isEmpty = ref(false)
79 const getSharePageContentData = async () => { 81 const getSharePageContentData = async () => {
80 try { 82 try {
81 const { params } = ROUTE 83 const { params } = ROUTE
@@ -83,7 +85,8 @@ const getSharePageContentData = async () => { @@ -83,7 +85,8 @@ const getSharePageContentData = async () => {
83 loading.value = true 85 loading.value = true
84 const res = await getShareContentData({ id, accessCredentials: unref(accessCredentials) }) 86 const res = await getShareContentData({ id, accessCredentials: unref(accessCredentials) })
85 const { dataViewContent, dataViewName, dataViewId } = res.data 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 if (content) { 90 if (content) {
88 const { editCanvasConfig, requestGlobalConfig, componentList } = content 91 const { editCanvasConfig, requestGlobalConfig, componentList } = content
89 chartEditStore.editCanvasConfig = editCanvasConfig 92 chartEditStore.editCanvasConfig = editCanvasConfig