Browse Source

10. 接入预览的功能

YunaiV 2 years ago
parent
commit
099263d3d9
2 changed files with 5 additions and 6 deletions
  1. 2 3
      src/views/preview/suspenseIndex.vue
  2. 3 3
      src/views/preview/utils/storage.ts

+ 2 - 3
src/views/preview/suspenseIndex.vue

@@ -50,12 +50,11 @@ const storageList: ChartEditStorageType[] = getSessionStorage(
 )
 
 const localStorageInfo = await getSessionStorageInfo() as unknown as ChartEditStorageType
-setTitle(`预览-${localStorageInfo.editCanvasConfig.projectName}`)
-
 // @ts-ignore
-if(localStorageInfo.isRelease === false) {
+if (localStorageInfo.isRelease === false) {
   routerTurnByName(PageEnum.REDIRECT_UN_PUBLISH_NAME, true, false)
 }
+setTitle(`预览-${localStorageInfo?.editCanvasConfig.projectName}`)
 
 const previewRefStyle = computed(() => {
   return {

+ 3 - 3
src/views/preview/utils/storage.ts

@@ -16,10 +16,10 @@ export const getSessionStorageInfo = async () => {
   // 是否本地预览
   if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
     // 接口调用
-    const res = await fetchProjectApi({ projectId: id })
+    const res = await fetchProjectApi({ id: id })
     if (res && res.code === ResultEnum.SUCCESS) {
-      const { content, state } = res.data
-      if (state === -1) {
+      const { content, status } = res.data
+      if (status === 1) {
         // 跳转未发布页
         return { isRelease: false }
       }