From d3e4f85a8eba7c222f35da24486a56916a7c2848 Mon Sep 17 00:00:00 2001 From: lzx_win <2602107437@qq.com> Date: Thu, 9 Oct 2025 15:10:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=89=8D=E7=AB=AF):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=A1=B5=E9=9D=A2=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为删除页面功能添加二次确认对话框,防止误操作 优化页面列表项的宽度自适应和文本显示样式 调整操作按钮布局防止挤压内容 --- .../src/main/resources/application-dev.yml | 2 +- .../applet/course-page/AppletCoursePageList.vue | 98 ++++++++++++---------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index d6e92ab..1054ba7 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8003 + port: 8002 undertow: # max-http-post-size: 10MB # 平替 tomcat server.tomcat.max-swallow-siz, undertow该值默认为-1 worker-threads: 16 # 4核CPU标准配置 diff --git a/jeecgboot-vue3/src/views/applet/course-page/AppletCoursePageList.vue b/jeecgboot-vue3/src/views/applet/course-page/AppletCoursePageList.vue index b84f332..95ea77a 100644 --- a/jeecgboot-vue3/src/views/applet/course-page/AppletCoursePageList.vue +++ b/jeecgboot-vue3/src/views/applet/course-page/AppletCoursePageList.vue @@ -262,7 +262,7 @@ import WordTable from './components/WordTable.vue'; const route = useRoute(); const router = useRouter(); -const { createMessage } = useMessage(); +const { createMessage, createConfirm } = useMessage(); // 课程页面列表 const pageList = ref([]); @@ -498,50 +498,59 @@ function editPage(page: any) { } /** - * 删除页面 + * 删除页面(二次确认) */ async function deletePage(page: any) { - if (!page.id) { - // 如果是新页面(未保存),直接从列表中移除 - const index = pageList.value.findIndex(p => p === page); - if (index > -1) { - pageList.value.splice(index, 1); - // 重新设置排序值 - updatePageSortOrder(); - // 如果删除的是当前页面,选择其他页面 - if (currentPageId.value === page.id || currentPageId.value === '') { - if (pageList.value.length > 0) { - selectPage(pageList.value[0]); - } else { - // 没有页面了,创建新页面 - handleAddPage(); + createConfirm({ + iconType: 'warning', + title: '确认删除', + content: '删除后不可恢复,是否继续?', + okText: '删除', + cancelText: '取消', + onOk: async () => { + if (!page.id) { + // 如果是新页面(未保存),直接从列表中移除 + const index = pageList.value.findIndex(p => p === page); + if (index > -1) { + pageList.value.splice(index, 1); + // 重新设置排序值 + updatePageSortOrder(); + // 如果删除的是当前页面,选择其他页面 + if (currentPageId.value === page.id || currentPageId.value === '') { + if (pageList.value.length > 0) { + selectPage(pageList.value[0]); + } else { + // 没有页面了,创建新页面 + await handleAddPage(); + } + } } + return; } - } - return; - } - try { - await deleteOne({ id: page.id }, () => { - createMessage.success('删除成功'); - // 重新加载页面列表 - loadPageList(); - // 如果删除的是当前页面,选择其他页面 - if (currentPageId.value === page.id) { - if (pageList.value.length > 1) { - const index = pageList.value.findIndex(p => p.id === page.id); - const nextPage = pageList.value[index === 0 ? 1 : index - 1]; - selectPage(nextPage); - } else { - // 没有其他页面了,创建新页面 - handleAddPage(); - } + try { + await deleteOne({ id: page.id }, () => { + createMessage.success('删除成功'); + // 重新加载页面列表 + loadPageList(); + // 如果删除的是当前页面,选择其他页面 + if (currentPageId.value === page.id) { + if (pageList.value.length > 1) { + const index = pageList.value.findIndex(p => p.id === page.id); + const nextPage = pageList.value[index === 0 ? 1 : index - 1]; + selectPage(nextPage); + } else { + // 没有其他页面了,创建新页面 + handleAddPage(); + } + } + }); + } catch (error) { + console.error('删除页面失败:', error); + createMessage.error('删除失败'); } - }); - } catch (error) { - console.error('删除页面失败:', error); - createMessage.error('删除失败'); - } + }, + }); } /** @@ -887,8 +896,10 @@ function getPageTypeName(type: string) { .page-item { display: flex; align-items: center; - min-width: 160px; - width: 160px; + /* 自适应内容宽度,保留一个合理的最小宽度 */ + flex: 0 0 auto; + width: auto; + min-width: 120px; padding: 8px; background: #fff; border: 1px solid #d9d9d9; @@ -933,9 +944,8 @@ function getPageTypeName(type: string) { font-weight: 500; color: #262626; margin-bottom: 6px; + /* 保持单行显示,允许容器宽度随内容扩展 */ white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; } .page-meta { @@ -954,6 +964,8 @@ function getPageTypeName(type: string) { display: flex; justify-content: center; gap: 8px; + /* 防止操作按钮挤压内容,保持自身宽度 */ + flex-shrink: 0; } .empty-page-list {