docs: 更新 AGENTS/README 平台架构说明与月度总结,运行日志视图支持已取消状态
This commit is contained in:
@@ -264,6 +264,60 @@ import './style.css' // 必须在 element-plus 之后,才能覆盖 --el-*
|
||||
- 因此:**`plugin.json.fields` 不要再加 remark / note 之类备注字段**,插件 UI 内也不要自绘备注框(会与壳子重复且两处不一致)。
|
||||
备注能力对全部插件(含新插件)自动生效,插件侧零改动。
|
||||
|
||||
### 5.5 路径字段必须配「选择文件夹」按钮(硬要求)
|
||||
|
||||
任何目录 / 文件路径字段(`save_dir`、`base_dir`、输出目录、花名册路径…)**不能只给一个手输框**,
|
||||
必须配一个调壳子原生目录对话框的按钮。参照实现:`XQ0002`、`XQ0048`、`XQ0065`。
|
||||
|
||||
```vue
|
||||
<el-form-item label="保存目录">
|
||||
<div class="dir-ctrl">
|
||||
<el-input v-model="form.save_dir" class="dir-input" :disabled="running" clearable
|
||||
placeholder="留空 = D:\资料\财务\抖音平台核对" />
|
||||
<el-button class="dir-btn" :disabled="running || picking" :loading="picking"
|
||||
@click="pickDir">选择</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
```
|
||||
|
||||
```js
|
||||
// 调用壳子本机接口打开原生「选择文件夹」对话框(壳子 /api/dialog/directory,仅返回路径)
|
||||
const picking = ref(false)
|
||||
async function pickDir() {
|
||||
picking.value = true
|
||||
try {
|
||||
const r = await fetch('/api/dialog/directory', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ title: '选择保存目录', current: form.save_dir || '' }),
|
||||
})
|
||||
const d = await r.json().catch(() => ({}))
|
||||
if (!r.ok) throw new Error(d.detail || d.error || ('HTTP ' + r.status))
|
||||
if (d.path) form.save_dir = d.path
|
||||
} catch (e) {
|
||||
ElMessage.warning('打开文件夹选择失败:' + e.message)
|
||||
} finally {
|
||||
picking.value = false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
/* App.vue 的 <style scoped>,只用 token,不写字面色值 */
|
||||
.dir-ctrl { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
|
||||
.dir-ctrl .dir-input { flex: 1 1 auto; min-width: 0; }
|
||||
.dir-ctrl .dir-btn { flex: 0 0 auto; }
|
||||
```
|
||||
|
||||
约束:
|
||||
|
||||
- 接口契约:`POST /api/dialog/directory`,body `{title, current}` → `{ok, canceled, path}`;壳子(Electron)用原生
|
||||
`showOpenDialog({properties:['openDirectory','createDirectory']})`,**只回路径、不写盘**。`npm run dev` 经 8799 代理同样可用;
|
||||
纯浏览器打开时无壳子接口,按钮会提示失败,属正常。
|
||||
- 按钮文案统一「选择」,`running || picking` 时禁用并 `loading`;用户取消(`canceled=true` / `path` 为空)**不报错、不清空已填值**。
|
||||
- 纵向排布:路径字段可以和相邻开关排同一行省空间
|
||||
(`.grid` 加修饰类,例:`grid-template-columns: 104px 104px minmax(220px, 1fr)` = 两个窄开关 + 路径撑满)。
|
||||
|
||||
## 6. kit v2 契约(`usePluginUI.js`)
|
||||
|
||||
```js
|
||||
@@ -769,6 +823,7 @@ npm run build # 产物 → ../ui/
|
||||
- [ ] 页面只有 工具条 / 提示 / 分区卡 / 操作区,**没有**重复插件名、结果横幅、进度条、外层卡片边框
|
||||
- [ ] `.page` 没有左右 padding(避免与壳子 24px 叠加)
|
||||
- [ ] 分区用 `.sec` + `.sec-head`(浅灰卡头)+ `.sec-body`,卡片无阴影
|
||||
- [ ] **路径类字段配了「选择文件夹」按钮**(`.dir-ctrl` + `POST /api/dialog/directory`,见 §5.5)
|
||||
- [ ] 方案工具条存在(下拉 + 存为方案 + 删除)
|
||||
- [ ] `restoreLastFields` 按钮已接
|
||||
- [ ] 执行中禁用所有输入,`running` 时主按钮显示「执行中 N%」
|
||||
|
||||
Reference in New Issue
Block a user