From a51018c6969f7347803e7cb19e3a1f303a5015dd Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 28 Oct 2025 00:21:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A1=B5=E9=9D=A2=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=8D=E7=AB=AF=E8=A6=81=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=A8=A1=E6=9D=BF=E7=9A=84=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jingrow/frontend/src/locales/zh-CN.json | 3 + .../src/views/dev/CreatePagetypeTemplate.vue | 66 +++++++++++++++---- apps/jingrow/jingrow/api/dev.py | 52 ++++++++++++--- 3 files changed, 101 insertions(+), 20 deletions(-) diff --git a/apps/jingrow/frontend/src/locales/zh-CN.json b/apps/jingrow/frontend/src/locales/zh-CN.json index 146c2d4..e879e63 100644 --- a/apps/jingrow/frontend/src/locales/zh-CN.json +++ b/apps/jingrow/frontend/src/locales/zh-CN.json @@ -700,6 +700,9 @@ "Create Frontend": "创建前端", "Create Backend": "创建后端", "Please select PageType": "请选择页面类型", + "Toolbar": "工具栏", + "Sidebar": "侧边栏", + "Page": "页面", "Media Resources": "媒体资源", "Attachments": "附件", diff --git a/apps/jingrow/frontend/src/views/dev/CreatePagetypeTemplate.vue b/apps/jingrow/frontend/src/views/dev/CreatePagetypeTemplate.vue index 6b1135a..15745e4 100644 --- a/apps/jingrow/frontend/src/views/dev/CreatePagetypeTemplate.vue +++ b/apps/jingrow/frontend/src/views/dev/CreatePagetypeTemplate.vue @@ -6,7 +6,17 @@ - + + + + + + + + + + + @@ -16,7 +26,10 @@
-
{{ t('Frontend') }}: {{ frontendPath }}
+
+
{{ t('Frontend') }}:
+
{{ frontendPath }}
+
{{ t('Backend') }}: {{ backendPath }}
@@ -37,31 +50,41 @@ \n", encoding="utf-8") - frontend_path = str(fp) + # 工具栏 + if "toolbar" in frontend_options: + fp = root / "apps" / app / "frontend" / "src" / "views" / "pagetype" / slug / f"{slug}_toolbar.vue" + fp.parent.mkdir(parents=True, exist_ok=True) + if fp.exists(): + frontend_exists = True + else: + toolbar_content = "\n\n" + fp.write_text(toolbar_content, encoding="utf-8") + frontend_paths.append(str(fp)) + + # 侧边栏 + if "sidebar" in frontend_options: + fp = root / "apps" / app / "frontend" / "src" / "views" / "pagetype" / slug / f"{slug}_sidebar.vue" + fp.parent.mkdir(parents=True, exist_ok=True) + if fp.exists(): + frontend_exists = True + else: + sidebar_content = "\n\n\n" + fp.write_text(sidebar_content, encoding="utf-8") + frontend_paths.append(str(fp)) + + # 页面 + if "page" in frontend_options: + fp = root / "apps" / app / "frontend" / "src" / "views" / "pagetype" / slug / f"{slug}.vue" + fp.parent.mkdir(parents=True, exist_ok=True) + if fp.exists(): + frontend_exists = True + else: + page_content = "\n\n\n" + fp.write_text(page_content, encoding="utf-8") + frontend_paths.append(str(fp)) + + # 字段类型控件目录 + if "field_types" in frontend_options: + fp = root / "apps" / app / "frontend" / "src" / "views" / "pagetype" / slug / "form" / "controls" + fp.mkdir(parents=True, exist_ok=True) + frontend_paths.append(f"{str(fp)} (创建自定义字段控件)") + + frontend_path = "\n".join(frontend_paths) if frontend_paths else None + else: + frontend_path = None if create_backend: bp = root / "apps" / app / app / module / "pagetype" / slug / f"{slug}.py"