fix(map-converter): 修复 API 路径,调整文件扩展名处理逻辑,优化代码格式
This commit is contained in:
parent
1387a72a76
commit
2978c58b42
@ -1,4 +1,5 @@
|
||||
import axios from 'axios';
|
||||
|
||||
import { decodeTextFile } from './utils';
|
||||
|
||||
export type ProcessJsonListItem = {
|
||||
@ -22,8 +23,8 @@ export async function collectOriginalProperties(
|
||||
const currentScenesArray: any[] = Array.isArray(currentFloorScenes)
|
||||
? currentFloorScenes
|
||||
: currentFloorScenes
|
||||
? [currentFloorScenes]
|
||||
: [];
|
||||
? [currentFloorScenes]
|
||||
: [];
|
||||
|
||||
const list = await Promise.all(
|
||||
floorImportList.map(async (_floor, idx) => {
|
||||
@ -65,7 +66,11 @@ export async function buildProcessJsonListPayload(
|
||||
const content = await decodeTextFile(file);
|
||||
if (!content) throw new Error(`楼层 ${floor.name} 的文件 ${file?.name} 读取为空`);
|
||||
placeholders.push(content);
|
||||
const ext = String(file?.name || '').toLowerCase().split('.').pop() || '';
|
||||
const ext =
|
||||
String(file?.name || '')
|
||||
.toLowerCase()
|
||||
.split('.')
|
||||
.pop() || '';
|
||||
exts.push(ext);
|
||||
}
|
||||
|
||||
@ -109,7 +114,7 @@ export async function buildProcessJsonListPayload(
|
||||
|
||||
export async function postProcessJsonList(payload: ProcessJsonListItem[]): Promise<ProcessJsonListResult> {
|
||||
const client = axios.create();
|
||||
const url = '/api/map-converter/process-json-list';
|
||||
const url = '/vwedApi/api/map-converter/process-json-list';
|
||||
const response = await client.post(url, payload, { responseType: 'blob' });
|
||||
|
||||
const contentType = (response.headers?.['content-type'] || '').toString().toLowerCase();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user