From e72d29621f7a68062018d3e3accc127d78cd12d2 Mon Sep 17 00:00:00 2001
From: p <1332606303@qq.com>
Date: Sat, 17 Jan 2026 20:52:33 +0800
Subject: [PATCH] fix:project over the title and close backgroud task
---
frontend/src/views/HomeView.vue | 74 +++++++++++++++++++++++++++---
frontend/src/views/ProjectView.vue | 2 +-
2 files changed, 68 insertions(+), 8 deletions(-)
diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue
index 6a97d01..da9afd2 100644
--- a/frontend/src/views/HomeView.vue
+++ b/frontend/src/views/HomeView.vue
@@ -2,7 +2,7 @@
@@ -10,11 +10,14 @@
- {{ project.description || 'No description' }}
+ {{ project.description || 'No description' }}
@@ -22,7 +25,7 @@
-
+
@@ -33,7 +36,7 @@
Cancel
- Create
+ {{ isEdit ? 'Save' : 'Create' }}
@@ -48,7 +51,8 @@ import { ElMessage } from 'element-plus'
const router = useRouter()
const projects = ref([])
const dialogVisible = ref(false)
-const form = ref({ title: '', description: '' })
+const isEdit = ref(false)
+const form = ref({ id: '', title: '', description: '' })
const fetchProjects = async () => {
try {
@@ -59,6 +63,26 @@ const fetchProjects = async () => {
}
}
+const openCreateDialog = () => {
+ isEdit.value = false
+ form.value = { title: '', description: '' }
+ dialogVisible.value = true
+}
+
+const openEditDialog = (project) => {
+ isEdit.value = true
+ form.value = { id: project.id, title: project.title, description: project.description }
+ dialogVisible.value = true
+}
+
+const saveProject = async () => {
+ if (isEdit.value) {
+ await updateProject()
+ } else {
+ await createProject()
+ }
+}
+
const createProject = async () => {
try {
const res = await axios.post('/api/v1/projects/', form.value)
@@ -70,6 +94,20 @@ const createProject = async () => {
}
}
+const updateProject = async () => {
+ try {
+ await axios.put(`/api/v1/projects/${form.value.id}`, {
+ title: form.value.title,
+ description: form.value.description
+ })
+ ElMessage.success('Updated successfully')
+ dialogVisible.value = false
+ fetchProjects()
+ } catch (error) {
+ ElMessage.error('Failed to update project')
+ }
+}
+
const deleteProject = async (id) => {
try {
await axios.delete(`/api/v1/projects/${id}`)
@@ -106,4 +144,26 @@ onMounted(fetchProjects)
justify-content: space-between;
align-items: center;
}
+.project-title {
+ font-weight: bold;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ max-width: 60%;
+ display: inline-block;
+}
+.actions {
+ display: flex;
+ gap: 4px;
+}
+.project-desc {
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ height: 3em;
+ color: #666;
+ font-size: 0.9em;
+}
diff --git a/frontend/src/views/ProjectView.vue b/frontend/src/views/ProjectView.vue
index 5e03581..9a95379 100644
--- a/frontend/src/views/ProjectView.vue
+++ b/frontend/src/views/ProjectView.vue
@@ -113,7 +113,7 @@ const imageVersion = ref(Date.now())
// Task State
const activeTasks = ref([])
-const isTaskManagerCollapsed = ref(false)
+const isTaskManagerCollapsed = ref(true)
const taskPollingInterval = ref(null)
// Dialog State