|
@@ -31,7 +31,7 @@ const getHeaders = () => ({
|
|
|
caseId: params.value.caseId || "",
|
|
|
"page-type": "edit",
|
|
|
});
|
|
|
-const get = (url: string, params: Record<string, any>) => {
|
|
|
+export const get = (url: string, params: Record<string, any>) => {
|
|
|
const p = new URLSearchParams();
|
|
|
for (const key in params) {
|
|
|
p.append(key, params[key]);
|
|
@@ -40,7 +40,7 @@ const get = (url: string, params: Record<string, any>) => {
|
|
|
return after(fetch(l, { method: "get", headers: getHeaders() }));
|
|
|
};
|
|
|
|
|
|
-const post = (url: string, data: Record<string, any>) => {
|
|
|
+export const post = (url: string, data: Record<string, any>) => {
|
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}`;
|
|
|
return after(
|
|
|
fetch(l, {
|
|
@@ -122,7 +122,7 @@ const after = async (fet: Promise<Response>) => {
|
|
|
const res = await fet.then((res) => res.json());
|
|
|
if ([4008, 4010, 7012].includes(res.code)) {
|
|
|
setTimeout(() => {
|
|
|
- login(res.code !== 7012);
|
|
|
+ window.platform.login(res.code !== 7012);
|
|
|
}, 1000);
|
|
|
throw res.message;
|
|
|
} else if (res.code !== 0) {
|
|
@@ -227,7 +227,7 @@ const getTabulationData = genLoading(async (id: string) => {
|
|
|
|
|
|
if (!params.value.caseId || !token) {
|
|
|
ElMessage.error("当前项目号不存在!");
|
|
|
- login(!!params.value.caseId);
|
|
|
+ window.platform.login(!!params.value.caseId);
|
|
|
} else {
|
|
|
setTimeout(() => getSceneList(""), 500);
|
|
|
}
|
|
@@ -272,6 +272,7 @@ const uploadResourse = genLoading(async (file: File) => {
|
|
|
});
|
|
|
|
|
|
window.platform = {
|
|
|
+ login,
|
|
|
resourceURLS,
|
|
|
viewURLS,
|
|
|
getOverviewData,
|