feat: 更新Type类型

This commit is contained in:
a876691666
2022-11-27 11:40:00 +08:00
parent 8230757bd1
commit 02ec3c78d6
11 changed files with 36 additions and 26 deletions
@@ -282,9 +282,9 @@ const customRequest = (options: UploadCustomRequestOptions) => {
)
let uploadParams = new FormData()
uploadParams.append('object', newNameFile)
const uploadRes = await uploadFile(uploadParams) as unknown as MyResponseType
const uploadRes = await uploadFile(uploadParams)
if(uploadRes.code === ResultEnum.SUCCESS) {
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
chartEditStore.setEditCanvasConfig(
EditCanvasConfigEnum.BACKGROUND_IMAGE,
`${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}?time=${new Date().getTime()}`
@@ -152,9 +152,9 @@ const sendHandle = async () => {
id: fetchRouteParamsLocation(),
// 反过来
state: release.value ? -1 : 1,
})) as unknown as MyResponseType
}))
if (res.code === ResultEnum.SUCCESS) {
if (res && res.code === ResultEnum.SUCCESS) {
modelShowHandle()
if (!release.value) {
copyPreviewPath('发布成功!已复制地址到剪贴板~', '发布成功!')
@@ -67,8 +67,8 @@ const handleBlur = async () => {
const res = (await updateProjectApi({
id: fetchRouteParamsLocation(),
projectName: title.value
})) as unknown as MyResponseType
if (res.code === ResultEnum.SUCCESS) {
}))
if (res && res.code === ResultEnum.SUCCESS) {
dataSyncUpdate()
} else {
httpErrorHandle()
+6 -6
View File
@@ -229,8 +229,8 @@ export const useSync = () => {
chartEditStore.componentList = []
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.START)
try {
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() }) as unknown as MyResponseType
if (res.code === ResultEnum.SUCCESS) {
const res = await fetchProjectApi({ projectId: fetchRouteParamsLocation() })
if (res && res.code === ResultEnum.SUCCESS) {
if (res.data) {
updateStoreInfo(res.data)
// 更新全局数据
@@ -278,9 +278,9 @@ export const useSync = () => {
// 上传预览图
let uploadParams = new FormData()
uploadParams.append('object', base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`))
const uploadRes = await uploadFile(uploadParams) as unknown as MyResponseType
const uploadRes = await uploadFile(uploadParams)
// 保存预览图
if(uploadRes.code === ResultEnum.SUCCESS) {
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
await updateProjectApi({
id: fetchRouteParamsLocation(),
indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}`
@@ -295,9 +295,9 @@ export const useSync = () => {
let params = new FormData()
params.append('projectId', projectId)
params.append('content', JSON.stringify(chartEditStore.getStorageInfo || {}))
const res= await saveProjectApi(params) as unknown as MyResponseType
const res= await saveProjectApi(params)
if (res.code === ResultEnum.SUCCESS) {
if (res && res.code === ResultEnum.SUCCESS) {
// 成功状态
setTimeout(() => {
chartEditStore.setEditCanvas(EditCanvasTypeEnum.SAVE_STATUS, SyncEnum.SUCCESS)