fix: 优化 JSON 序列化无法处理函数的问题
This commit is contained in:
parent
15c12ca367
commit
327d23ebac
@ -1,6 +1,6 @@
|
||||
import { onUnmounted } from 'vue';
|
||||
import html2canvas from 'html2canvas'
|
||||
import { getUUID, httpErrorHandle, fetchRouteParamsLocation, base64toFile } from '@/utils'
|
||||
import { getUUID, httpErrorHandle, fetchRouteParamsLocation, base64toFile, JSONStringify, JSONParse } from '@/utils'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { EditCanvasTypeEnum, ChartEditStoreEnum, ProjectInfoEnum, ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'
|
||||
@ -245,7 +245,7 @@ export const useSync = () => {
|
||||
if (res.data) {
|
||||
updateStoreInfo(res.data)
|
||||
// 更新全局数据
|
||||
await updateComponent(JSON.parse(res.data.content))
|
||||
await updateComponent(JSONParse(res.data.content))
|
||||
return
|
||||
}else {
|
||||
chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation())
|
||||
@ -305,7 +305,7 @@ export const useSync = () => {
|
||||
// 保存数据
|
||||
let params = new FormData()
|
||||
params.append('projectId', projectId)
|
||||
params.append('content', JSON.stringify(chartEditStore.getStorageInfo || {}))
|
||||
params.append('content', JSONStringify(chartEditStore.getStorageInfo || {}))
|
||||
const res= await saveProjectApi(params)
|
||||
|
||||
if (res && res.code === ResultEnum.SUCCESS) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getSessionStorage, fetchRouteParamsLocation, httpErrorHandle } from '@/utils'
|
||||
import { getSessionStorage, fetchRouteParamsLocation, httpErrorHandle, JSONParse } from '@/utils'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
@ -23,7 +23,7 @@ export const getSessionStorageInfo = async () => {
|
||||
// 跳转未发布页
|
||||
return { isRelease: false }
|
||||
}
|
||||
return { ...JSON.parse(content), id }
|
||||
return { ...JSONParse(content), id }
|
||||
} else {
|
||||
httpErrorHandle()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user