e248b6e43a
- SPA 化:22 个 MPA html 入口与 *-main.ts 合并为 index.html + vue-router(URL 无 .html 后缀), 页面跳转全部 router-link,/new_web_source/xxx.html 旧路径归一为 /xxx - 任务面板统一:共享 TaskCenterPanel/TaskItemCard/TaskStatCards/HistoryTaskLayer, 16 个工具页右侧统一为统计卡 + 当前任务 + 历史任务弹层(任务ID/开始/结束/状态必展示) - 历史记录支持单条删除 + 批量勾选删除(确认框/全选/失败提示) - Java 7 模块(dedupe/convert/split/productrisk/shopmatch/pricetrack/deletebrand) history 接口补齐任务时间字段(VO+Service,复用 biz_file_task 列) - 图片工作台/API 层(brand/permission/user)既有未提交改动一并提交
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
export const ALLOWED_IMAGE_TYPES = ['image/jpeg', 'image/jpg', 'image/png', 'image/bmp']
|
|
|
|
/** 读取多个文件为 data URL,返回解析完的数组。 */
|
|
export function readFilesAsDataUrls(files: Blob[] | FileList): Promise<string[]> {
|
|
const list = Array.from(files)
|
|
return Promise.all(
|
|
list.map(
|
|
(file) =>
|
|
new Promise<string>((resolve, reject) => {
|
|
const reader = new FileReader()
|
|
reader.onload = () => resolve(String(reader.result || ''))
|
|
reader.onerror = () => reject(reader.error || new Error('读取文件失败'))
|
|
reader.readAsDataURL(file)
|
|
}),
|
|
),
|
|
)
|
|
}
|
|
|
|
/** 从剪贴板读取图片文件。 */
|
|
export async function pasteClipboardImages(): Promise<Blob[]> {
|
|
try {
|
|
const items = await navigator.clipboard.read()
|
|
const images: Blob[] = []
|
|
for (const item of items) {
|
|
if (item.types.includes('image/png')) {
|
|
images.push(await item.getType('image/png'))
|
|
} else if (item.types.includes('image/jpeg')) {
|
|
images.push(await item.getType('image/jpeg'))
|
|
}
|
|
}
|
|
return images
|
|
} catch (err) {
|
|
console.warn('粘贴图片失败:', err)
|
|
return []
|
|
}
|
|
}
|