feat: 优化接口和组件类型定义,调整参数类型以增强类型安全性

This commit is contained in:
xudan 2025-10-10 17:28:27 +08:00
parent 1c38b4e3dc
commit f3cf800aa1
6 changed files with 8 additions and 9 deletions

View File

@ -4,7 +4,7 @@ const enum API {
// 控制接口 - 只包含右键菜单需要的
AMR = '/amr/control',
= '/amr/controlAmr',
// 设置接单状态 = '/amr/acceptTask',
= '/amr/acceptTask',
= '/amr/manuallSetCharging',
}

View File

@ -136,7 +136,7 @@ const setUserInteraction = () => {
}, 2000); // 2
};
const handleHourChange = (newHour: number) => {
const handleHourChange = (newHour: any) => {
setUserInteraction();
selectedHour.value = newHour;
const newTime = newHour * HOUR_IN_MS;

View File

@ -6,10 +6,10 @@ import { computed, reactive, type Ref, ref, watch } from 'vue';
// --- Type Definitions ---
interface IrayParams {
mapWidth: number | null;
mapHeight: number | null;
xAttrMin: number | null;
yAttrMin: number | null;
mapWidth: number;
mapHeight: number;
xAttrMin: number;
yAttrMin: number;
}
export type ExportFormat = 'smap' | 'iray';

View File

@ -108,7 +108,7 @@ const convertMap = async (convertType: string, formData: FormData) => {
// iray
if (convertType === 'iray') {
const response = await http.post(apiUrl, formData, {
const response = await http.post<any>(apiUrl, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
responseType: 'blob',
});

View File

@ -42,7 +42,7 @@ const container = shallowRef<HTMLDivElement>();
const editor = shallowRef<EditorService>();
provide(EDITOR_KEY, editor);
onMounted(() => {
editor.value = new EditorService(container.value!);
editor.value = new EditorService(container.value!, props.sid);
});
const editable = ref<boolean>(false);

View File

@ -230,7 +230,6 @@ const handleExportConfirm = async (payload: ExportConfirmPayload) => {
});
await exportSceneToSmap(sceneFile, payload.smapFile, payload.smapFile.name.replace(/\.smap$/i, ''));
} else if (payload.format === 'iray') {
// @ts-expect-error iray params are not typed
await convertSceneToIray(sceneJson, payload.smapFile, title.value || 'unknown', payload.irayParams);
}
};