Commit e9c37b5733aae79294614d63715798c71724fef7

Authored by fengwotao
1 parent 7de4162d

feat:大屏新增预览

... ... @@ -251,10 +251,8 @@ export const useSync = () => {
251 251 updateStoreInfo(res)
252 252 // 更新全局数据
253 253 await updateComponent(JSONParse(res.dataViewContent.content))
254   - return
255   - // else {
256   - // chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation())
257   - // }
  254 +
  255 + chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, res.dataViewId)
258 256 setTimeout(() => {
259 257 chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.SUCCESS)
260 258 }, 1000)
... ... @@ -322,9 +320,10 @@ export const useSync = () => {
322 320 content: JSONStringify(chartEditStore.getStorageInfo || {})
323 321 },
324 322 dataViewName,
325   - dataViewId: projectId
  323 + dataViewId: projectId,
  324 + projectId
326 325 }
327   - const res = await contentUpdateApi(saveContent)
  326 + await contentUpdateApi(saveContent)
328 327 window['$message'].success('保存成功!')
329 328 // 成功状态
330 329 setTimeout(() => {
... ...
1 1 import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
2 2
3 3 export interface ChartEditStorageType extends ChartEditStorage {
  4 + // THINGS_KIT
4 5 id: string
5   -}
\ No newline at end of file
  6 + isRelease?: boolean
  7 +}
... ...
... ... @@ -43,13 +43,12 @@ import type { ChartEditStorageType } from './index.d'
43 43 const storageList: ChartEditStorageType[] = getSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST)
44 44 // THINGS_KIT
45 45 const localStorageInfo = (await getSessionStorageInfo()) as unknown as ChartEditStorageType
46   -console.log(localStorageInfo)
47 46 setTitle(`预览-${localStorageInfo?.projectName}`)
48 47 // THINGS_KIT
49 48 // @ts-ignore
50   -if (localStorageInfo.isRelease === false) {
51   - // routerTurnByName(PageEnum.REDIRECT_UN_PUBLISH_NAME, true, false)
52   -}
  49 +// if (localStorageInfo.isRelease === false) {
  50 +// routerTurnByName(PageEnum.REDIRECT_UN_PUBLISH_NAME, true, false)
  51 +// }
53 52
54 53 const previewRefStyle = computed(() => {
55 54 return {
... ...
... ... @@ -11,8 +11,10 @@ export interface ChartEditStorageType extends ChartEditStorage {
11 11 export const getSessionStorageInfo = async () => {
12 12 const id = fetchRouteParamsLocation()
13 13 const storageList: ChartEditStorageType[] = getSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST)
  14 + console.log(id)
  15 + console.log(storageList)
14 16 // 是否本地预览
15   - if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
  17 + // if (!storageList || storageList.findIndex(e => e.id === id.toString()) === -1) {
16 18 // 接口调用
17 19 const res = await getDataView(id)
18 20 if (res) {
... ... @@ -22,13 +24,14 @@ export const getSessionStorageInfo = async () => {
22 24 // return { isRelease: false }
23 25 // }
24 26 return { ...JSONParse(dataViewContent?.content), id: dataViewId, projectName: dataViewName }
25   - } else {
26   - // 本地读取
27   - for (let i = 0; i < storageList.length; i++) {
28   - if (id.toString() === storageList[i]['id']) {
29   - return storageList[i]
30   - }
31   - }
32   - }
  27 + // } else {
  28 + // console.log('本地读取')
  29 + // // 本地读取
  30 + // for (let i = 0; i < storageList.length; i++) {
  31 + // if (id.toString() === storageList[i]['id']) {
  32 + // return storageList[i]
  33 + // }
  34 + // }
  35 + // }
33 36 }
34 37 }
... ...