|
@@ -1,30 +1,69 @@
|
|
|
-import { UPLOAD_FILE, UPLOAD_HEADS, CASE_INFO } from './constant'
|
|
|
-import { axios } from './instance'
|
|
|
-import { jsonToForm } from '@/utils'
|
|
|
-import { params } from '@/env'
|
|
|
+import { UPLOAD_FILE, UPLOAD_HEADS, CASE_INFO, AUTH_PWD } from "./constant";
|
|
|
+import { axios } from "./instance";
|
|
|
+import { jsonToForm } from "@/utils";
|
|
|
+import { params } from "@/env";
|
|
|
|
|
|
-type UploadFile = LocalFile | string
|
|
|
+type UploadFile = LocalFile | string;
|
|
|
|
|
|
-export const blobToFile = (blob: Blob, suffix = '.png') => new File([blob], `aaa${suffix}`)
|
|
|
+export const blobToFile = (blob: Blob, suffix = ".png") =>
|
|
|
+ new File([blob], `aaa${suffix}`);
|
|
|
|
|
|
-export const uploadFile = async (file: UploadFile, suffix = '.png') => {
|
|
|
- if (typeof file === 'string') {
|
|
|
- return file
|
|
|
+export const uploadFile = async (file: UploadFile, suffix = ".png") => {
|
|
|
+ if (typeof file === "string") {
|
|
|
+ return file;
|
|
|
} else {
|
|
|
- const uploadFile = file.blob instanceof File ? file.blob : blobToFile(file.blob, suffix)
|
|
|
+ const uploadFile =
|
|
|
+ file.blob instanceof File ? file.blob : blobToFile(file.blob, suffix);
|
|
|
const url = await axios<string>({
|
|
|
- method: 'POST',
|
|
|
- url: UPLOAD_FILE,
|
|
|
+ method: "POST",
|
|
|
+ url: UPLOAD_FILE,
|
|
|
data: jsonToForm({ file: uploadFile }),
|
|
|
- headers: {...UPLOAD_HEADS}
|
|
|
- })
|
|
|
- return url
|
|
|
+ headers: { ...UPLOAD_HEADS },
|
|
|
+ });
|
|
|
+ return url;
|
|
|
}
|
|
|
+};
|
|
|
+
|
|
|
+export enum FireStatus {
|
|
|
+ incomplete = 0,
|
|
|
+ complete = 1,
|
|
|
}
|
|
|
|
|
|
+export type FireProject = {
|
|
|
+ accidentDate: string;
|
|
|
+ createTime: string;
|
|
|
+ creatorDeptId: string;
|
|
|
+ caseId: number;
|
|
|
+ creatorId: string;
|
|
|
+ creatorName: string;
|
|
|
+ deptId: string;
|
|
|
+ editTime: string;
|
|
|
+ editorId: string;
|
|
|
+ editorName: string;
|
|
|
+ fireReason: string;
|
|
|
+ id: string;
|
|
|
+ isTeached: number;
|
|
|
+ organizerDeptName: string;
|
|
|
+ organizerUsers: string;
|
|
|
+ projectAddress: string;
|
|
|
+ projectName: string;
|
|
|
+ projectSite: string;
|
|
|
+ projectSiteCode: string;
|
|
|
+ projectSn: string;
|
|
|
+ status: FireStatus;
|
|
|
+ statusDesc: string;
|
|
|
+ updateTime: string;
|
|
|
+ isDelete?: number;
|
|
|
+};
|
|
|
+
|
|
|
export interface Case {
|
|
|
- caseTitle: string
|
|
|
+ caseTitle: string;
|
|
|
+ tmProject?: FireProject;
|
|
|
}
|
|
|
|
|
|
-export const getCaseInfo = () =>
|
|
|
- axios.get<Case>(CASE_INFO, { params: { caseId: params.caseId } })
|
|
|
+export const getCaseInfo = () =>
|
|
|
+ axios.get<Case>(CASE_INFO, { params: { caseId: params.caseId } });
|
|
|
+
|
|
|
+// 校验密码
|
|
|
+export const authSharePassword = (randCode: string) =>
|
|
|
+ axios<boolean>(AUTH_PWD, { params: { randCode, caseId: params.caseId } });
|