|
@@ -24,20 +24,22 @@ const viewURLS = {
|
|
[SCENE_TYPE.fuse]: import.meta.env.VITE_FUSE_VIEW,
|
|
[SCENE_TYPE.fuse]: import.meta.env.VITE_FUSE_VIEW,
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const token = (params.token || localStorage.getItem("token")) as string;
|
|
|
|
+const headers = { token, caseId: params.caseId, 'page-type': 'edit' }
|
|
const get = (url: string, params: Record<string, any>) => {
|
|
const get = (url: string, params: Record<string, any>) => {
|
|
const p = new URLSearchParams();
|
|
const p = new URLSearchParams();
|
|
for (const key in params) {
|
|
for (const key in params) {
|
|
p.append(key, params[key]);
|
|
p.append(key, params[key]);
|
|
}
|
|
}
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}?${p.toString()}`;
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}?${p.toString()}`;
|
|
- return after(fetch(l, { method: "get", headers: { token } }));
|
|
|
|
|
|
+ return after(fetch(l, { method: "get", headers} ));
|
|
};
|
|
};
|
|
|
|
|
|
const post = (url: string, data: Record<string, any>) => {
|
|
const post = (url: string, data: Record<string, any>) => {
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}`;
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}`;
|
|
return after(
|
|
return after(
|
|
fetch(l, {
|
|
fetch(l, {
|
|
- headers: { token, "Content-Type": "application/json;charset=UTF-8" },
|
|
|
|
|
|
+ headers: { "Content-Type": "application/json;charset=UTF-8", ...headers },
|
|
method: "post",
|
|
method: "post",
|
|
body: JSON.stringify(data),
|
|
body: JSON.stringify(data),
|
|
})
|
|
})
|
|
@@ -53,7 +55,7 @@ const postFile = (url: string, data: Record<string, any>) => {
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}`;
|
|
const l = `${resourceURLS[SCENE_TYPE.fuse]}${url}`;
|
|
return after(
|
|
return after(
|
|
fetch(l, {
|
|
fetch(l, {
|
|
- headers: { token },
|
|
|
|
|
|
+ headers,
|
|
method: "post",
|
|
method: "post",
|
|
body: formData,
|
|
body: formData,
|
|
})
|
|
})
|
|
@@ -89,7 +91,6 @@ const after = async (fet: Promise<Response>) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-const token = (params.token || localStorage.getItem("token")) as string;
|
|
|
|
if (!params.caseId || !token) {
|
|
if (!params.caseId || !token) {
|
|
login(!!params.caseId);
|
|
login(!!params.caseId);
|
|
}
|
|
}
|
|
@@ -105,6 +106,7 @@ const getSceneList = genLoading(async (keyword: string): Promise<Scene[]> => {
|
|
m: item.num,
|
|
m: item.num,
|
|
title: item.name,
|
|
title: item.name,
|
|
id: item.id.toString(),
|
|
id: item.id.toString(),
|
|
|
|
+ token
|
|
}));
|
|
}));
|
|
});
|
|
});
|
|
|
|
|
|
@@ -144,6 +146,7 @@ const getTabulationId = async (id: string) => {
|
|
const list = await get("fusion/caseTabulation/getByOverviewId", {
|
|
const list = await get("fusion/caseTabulation/getByOverviewId", {
|
|
overviewId: id,
|
|
overviewId: id,
|
|
});
|
|
});
|
|
|
|
+ console.log(list)
|
|
return list[0]?.id;
|
|
return list[0]?.id;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -194,7 +197,15 @@ const saveTabulationData = genLoading(
|
|
);
|
|
);
|
|
|
|
|
|
const uploadResourse = genLoading(async (file: File) => {
|
|
const uploadResourse = genLoading(async (file: File) => {
|
|
- return postFile(`fusion/upload/file`, { file });
|
|
|
|
|
|
+ const url = await postFile(`fusion/upload/file`, { file });
|
|
|
|
+ if (url.includes('//')) {
|
|
|
|
+ return url
|
|
|
|
+ }
|
|
|
|
+ if (import.meta.env.DEV && import.meta.env.VITE_MOCK_PROXY) {
|
|
|
|
+ return `${import.meta.env.VITE_MOCK_PROXY}${url}`
|
|
|
|
+ } else {
|
|
|
|
+ return url
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
window.platform = {
|
|
window.platform = {
|