feat(web): 用户端骨架——登录、工作台、新建项目、解析进度、读标清单
- packages/api-client:从 openapi.yaml 生成类型;cookie + CSRF / Bearer 两种鉴权、 分片上传、fetch 读事件流(API2) - apps/web:Vue 3 + Vite + TanStack Query,样式只来自 tokens.css / components.css(AR10); 扣点说明放在「开始解析」旁边(红线 9);接口地址、路由方式运行时可配(架构 §5.2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
27
apps/web/src/platform/index.ts
Normal file
27
apps/web/src/platform/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 平台能力抽象(架构 §5.2 第 4 条):文件选择等都从这里走。现在只有网页版实现;
|
||||
* 以后迁到 packages/platform,桌面外壳另给一份实现,业务代码不用改。
|
||||
*/
|
||||
export interface PickFileOptions {
|
||||
/** 例如 [".pdf", ".docx"];只是选择框的过滤建议,真实格式以服务端按文件头识别为准 */
|
||||
accept: readonly string[];
|
||||
}
|
||||
|
||||
export interface Platform {
|
||||
pickFile(opts: PickFileOptions): Promise<File | null>;
|
||||
}
|
||||
|
||||
const web: Platform = {
|
||||
pickFile({ accept }) {
|
||||
return new Promise((resolve) => {
|
||||
const input = document.createElement("input");
|
||||
input.type = "file";
|
||||
input.accept = accept.join(",");
|
||||
input.addEventListener("change", () => resolve(input.files?.[0] ?? null), { once: true });
|
||||
input.addEventListener("cancel", () => resolve(null), { once: true });
|
||||
input.click();
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export const platform: Platform = web;
|
||||
Reference in New Issue
Block a user