From 7e74af93a01482046b826bf83a37242ece0ed5ce Mon Sep 17 00:00:00 2001 From: MoeSnowyFox Date: Tue, 23 Sep 2025 23:32:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor(plan):=20=E7=BB=9F=E4=B8=80=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20MaaPlanConfig=20=E4=BD=9C=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=AE=A1=E5=88=92=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/composables/usePlanApi.ts | 11 ++++++----- frontend/src/views/plan/components/PlanHeader.vue | 11 ++++++----- frontend/src/views/plan/components/PlanSelector.vue | 11 ++--------- frontend/src/views/plan/index.vue | 5 ++--- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/frontend/src/composables/usePlanApi.ts b/frontend/src/composables/usePlanApi.ts index 59aa7e1..f67a406 100644 --- a/frontend/src/composables/usePlanApi.ts +++ b/frontend/src/composables/usePlanApi.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' import { message } from 'ant-design-vue' +import type { PlanCreateIn, PlanDeleteIn, PlanGetIn, PlanReorderIn, PlanUpdateIn } from '../api' import { Service } from '../api' -import type { PlanCreateIn, PlanGetIn, PlanUpdateIn, PlanDeleteIn, PlanReorderIn } from '../api' export function usePlanApi() { const loading = ref(false) @@ -26,10 +26,12 @@ export function usePlanApi() { const createPlan = async (type: string) => { loading.value = true try { + if (type === 'MaaPlanConfig') { + type = 'MaaPlan' + } const params: PlanCreateIn = { type } - const response = await Service.addPlanApiPlanAddPost(params) // message.success('创建计划成功') - return response + return await Service.addPlanApiPlanAddPost(params) } catch (error) { console.error('创建计划失败:', error) message.error('创建计划失败') @@ -44,9 +46,8 @@ export function usePlanApi() { loading.value = true try { const params: PlanUpdateIn = { planId, data } - const response = await Service.updatePlanApiPlanUpdatePost(params) // message.success('更新计划成功') - return response + return await Service.updatePlanApiPlanUpdatePost(params) } catch (error) { console.error('更新计划失败:', error) message.error('更新计划失败') diff --git a/frontend/src/views/plan/components/PlanHeader.vue b/frontend/src/views/plan/components/PlanHeader.vue index dbce777..f45a4e5 100644 --- a/frontend/src/views/plan/components/PlanHeader.vue +++ b/frontend/src/views/plan/components/PlanHeader.vue @@ -9,7 +9,7 @@