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 = '/amr/control',
= '/amr/controlAmr', = '/amr/controlAmr',
// 设置接单状态 = '/amr/acceptTask', = '/amr/acceptTask',
= '/amr/manuallSetCharging', = '/amr/manuallSetCharging',
} }

View File

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

View File

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

View File

@ -108,7 +108,7 @@ const convertMap = async (convertType: string, formData: FormData) => {
// iray // iray
if (convertType === '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' }, headers: { 'Content-Type': 'multipart/form-data' },
responseType: 'blob', responseType: 'blob',
}); });

View File

@ -42,7 +42,7 @@ const container = shallowRef<HTMLDivElement>();
const editor = shallowRef<EditorService>(); const editor = shallowRef<EditorService>();
provide(EDITOR_KEY, editor); provide(EDITOR_KEY, editor);
onMounted(() => { onMounted(() => {
editor.value = new EditorService(container.value!); editor.value = new EditorService(container.value!, props.sid);
}); });
const editable = ref<boolean>(false); 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, '')); await exportSceneToSmap(sceneFile, payload.smapFile, payload.smapFile.name.replace(/\.smap$/i, ''));
} else if (payload.format === 'iray') { } else if (payload.format === 'iray') {
// @ts-expect-error iray params are not typed
await convertSceneToIray(sceneJson, payload.smapFile, title.value || 'unknown', payload.irayParams); await convertSceneToIray(sceneJson, payload.smapFile, title.value || 'unknown', payload.irayParams);
} }
}; };