!2587 修复:导入模板没有封面Logo时使用默认封面

pull/2580/MERGE
林三 7 months ago committed by ChenX
parent c66a2555cb
commit 5d96ef49cd

@ -34,6 +34,7 @@ export enum RequestStatus
None = -1, //未知错误
OffLine = 44444, //踢下线
NoToken = 6600, //酷家乐未授权
CreateTempNoLogo = 802, //导入模板时未查询到json文件logo
}
export interface IResponseData
{
@ -113,6 +114,13 @@ export async function Post(url: string, body?: BodyInit, isShowErrMsg = true): P
case RequestStatus.NoBuy4://如果不吃掉这个,那么会疯狂的显示错误,(例如判断是不是有渲染器的权限)
case RequestStatus.Ok:
break;
case RequestStatus.CreateTempNoLogo:
AppToaster.show({
message: "模板封边LOGO不存在,将使用默认图标",
timeout: 5000,
intent: Intent.WARNING,
}, "error_fetch");
break;
default:
if (isShowErrMsg)
ShowLinesToaster([`服务器返回错误`, `URL: ${url}`].concat(result.err_msg.split("<BR>")), {

@ -5,7 +5,7 @@ import pako from "pako";
import React from "react";
import { app } from "../../../ApplicationServices/Application";
import { TemplateUrls } from "../../../Common/HostUrl";
import { PostJson } from "../../../Common/Request";
import { PostJson, RequestStatus } from "../../../Common/Request";
import { StoreageKeys } from "../../../Common/StoreageKeys";
import { CADFiler } from "../../../DatabaseServices/CADFiler";
import { FileServer } from "../../../DatabaseServices/FileServer";
@ -107,14 +107,31 @@ export class ImportFile extends React.Component<{ commonPanel: CommonPanel, type
}
else
{
await PostJson(TemplateUrls.create, {
name: f.name.replace(".json", ""),
let name = f.name.replace(".json", "");
let zip_type = "gzip";
let res = await PostJson(TemplateUrls.create, {
name,
dir_id,
logo,
props,
file,
zip_type: "gzip",
zip_type
});
//返回状态码802 没有封面Logo 使用默认Logo
if (res.err_code === RequestStatus.CreateTempNoLogo)
{
logo = "CAD/images/default.svg";
await PostJson(TemplateUrls.create, {
name,
dir_id,
logo,
props,
file,
zip_type
});
}
}
}
else

Loading…
Cancel
Save