2 Commits
Author SHA1 Message Date
hz4th_coder ea8165bbd8 修复启动脚本: 改用 openclaw conda 环境 python3 (系统 python3.10 无 flask 导致启动失败) (v2.2.2) 2026-09-12 12:33:51 +08:00
hz4th_coder 2d5abe5975 修复分类编辑弹窗内按钮触发表单提交导致跳转首页的问题 (v2.2.1)
- 根因: 编辑分类弹窗里的子类别/参数字段列表按钮渲染在 <form id=itemForm> 内且无 type=button,HTML 按钮默认 type=submit,点击时同时触发表单 GET 提交 → 页面刷新跳转到 /admin 首页
- 修复: 给 renderSubcategoriesList/renderFieldsList 的编辑/删除按钮、getImageUploadComponent 的图片操作按钮补 type=button
- 加固: 全局拦截 itemForm 原生 submit (preventDefault),保存统一走 saveItem,杜绝同类按钮再次引发页面跳转
2026-09-10 01:46:59 +08:00
2 changed files with 31 additions and 7 deletions
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# param-hub 启动脚本(setsid 完全脱离终端,确保持久运行)
APP_DIR="$(cd "$(dirname "$0")" && pwd)"
PID_FILE="$APP_DIR/app.pid"
PYTHON="/home/hz1/miniconda3/envs/openclaw/bin/python3"
cd "$APP_DIR"
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p $PID > /dev/null 2>&1; then
echo "param-hub 已在运行 (PID: $PID)"
exit 0
fi
fi
setsid nohup "$PYTHON" app.py > logs/app.log 2>&1 &
echo $! > "$PID_FILE"
sleep 2
echo "param-hub 已启动 (PID: $(cat $PID_FILE))"
+14 -7
View File
@@ -1586,7 +1586,7 @@
${imageUrls.map((url, idx) => `
<div class="relative w-24 h-24 border rounded-lg overflow-hidden group">
<img src="${url}" class="w-full h-full object-cover">
<button onclick="removeImage(${idx})" class="absolute top-1 right-1 w-6 h-6 bg-red-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
<button type="button" onclick="removeImage(${idx})" class="absolute top-1 right-1 w-6 h-6 bg-red-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
<i class="ri-close-line"></i>
</button>
</div>
@@ -1594,10 +1594,10 @@
</div>
<div class="flex gap-2">
<input type="file" id="imageInput" accept="image/*" multiple class="hidden" onchange="handleImageUpload(event, '${type}')">
<button onclick="document.getElementById('imageInput').click()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<button type="button" onclick="document.getElementById('imageInput').click()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<i class="ri-image-add-line mr-1"></i>选择图片
</button>
<button onclick="pasteImageFromClipboard('${type}')'" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<button type="button" onclick="pasteImageFromClipboard('${type}')'" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<i class="ri-clipboard-line mr-1"></i>粘贴图片
</button>
</div>
@@ -1843,10 +1843,10 @@
</div>
</div>
<div class="flex gap-2 opacity-0 group-hover:opacity-100 transition">
<button onclick="editSubcategory(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<button type="button" onclick="editSubcategory(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<i class="ri-edit-line"></i>
</button>
<button onclick="deleteSubcategory(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<button type="button" onclick="deleteSubcategory(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<i class="ri-delete-bin-line"></i>
</button>
</div>
@@ -1884,10 +1884,10 @@
</div>
</div>
<div class="flex gap-2 opacity-0 group-hover:opacity-100 transition">
<button onclick="editField(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<button type="button" onclick="editField(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<i class="ri-edit-line"></i>
</button>
<button onclick="deleteField(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<button type="button" onclick="deleteField(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<i class="ri-delete-bin-line"></i>
</button>
</div>
@@ -2239,6 +2239,13 @@
document.getElementById('smartUpdateModal').addEventListener('click', function(e) { if (e.target === this) closeSmartUpdateModal(); });
document.getElementById('fieldModal').addEventListener('click', function(e) { if (e.target === this) closeFieldModal(); });
// 防止 itemForm 原生提交(保存统一走 saveItem,避免表单 GET 提交导致页面跳转/刷新)
document.addEventListener('submit', function(e) {
if (e.target && e.target.id === 'itemForm') {
e.preventDefault();
}
});
// ============ 智能添加功能 ============
let smartAddType = '';