From 1a681534e601e2072d8a5763723247bd2f9f7493 Mon Sep 17 00:00:00 2001 From: IchliebedichZhu <54796446@qq.com> Date: Wed, 6 Mar 2024 23:00:28 +0000 Subject: [PATCH] feat: convert panel/wrap components to composition API --- src/api/home.ts | 17 +- src/common/methods/DesignFeatures/setImage.ts | 9 +- src/components/modules/panel/types/wrap.d.ts | 24 ++ .../modules/panel/wrap/TempListWrap.vue | 236 +++++++------ .../panel/wrap/components/classHeader.vue | 46 ++- .../panel/wrap/components/imageTip.vue | 27 +- .../panel/wrap/components/imgWaterFall.vue | 152 +++++---- .../panel/wrap/components/photoList.vue | 318 ++++++++++-------- .../panel/wrap/components/searchHeader.vue | 103 +++--- 9 files changed, 530 insertions(+), 402 deletions(-) create mode 100644 src/components/modules/panel/types/wrap.d.ts diff --git a/src/api/home.ts b/src/api/home.ts index 3df9c66..bfff2c2 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -15,22 +15,31 @@ type IGetTempListParam = { search: string page: number pageSize: number - cate:number + cate: number | string } -type IGetTempListData = { +export type IGetTempListData = { cover: string height: number id: number state: number title: string width: number + isDelect: boolean + fail: boolean + top: number + left: number + data?: string } -type IGetTempListResult = TCommResResult +type IGetTempListResult = TPageRequestResult // 获取模板列表 export const getTempList = (params: IGetTempListParam) => fetch('design/list', params, 'get') -export const getTempDetail = (params: Type.Object = {}) => fetch('design/temp', params, 'get') +type TGetTempDetail = { + id: number +} + +export const getTempDetail = (params: TGetTempDetail) => fetch<{data: string}>('design/temp', params, 'get') type TGetCategoriesParams = { type?: number diff --git a/src/common/methods/DesignFeatures/setImage.ts b/src/common/methods/DesignFeatures/setImage.ts index 9e7d0cf..c016394 100644 --- a/src/common/methods/DesignFeatures/setImage.ts +++ b/src/common/methods/DesignFeatures/setImage.ts @@ -13,9 +13,16 @@ export type TItem2DataParam = { height: number url: string model?: string + canvasWidth?: number } -export default async function setItem2Data(item: TItem2DataParam) { +export type TItem2DataResult = { + width: number + height: number + canvasWidth: number +} + +export default async function setItem2Data(item: TItem2DataParam): Promise> { const cloneItem = JSON.parse(JSON.stringify(item)) const { width: screenWidth, height: screenHeight } = store.getters.dPage let { width: imgWidth, height: imgHeight } = item diff --git a/src/components/modules/panel/types/wrap.d.ts b/src/components/modules/panel/types/wrap.d.ts new file mode 100644 index 0000000..f0ea887 --- /dev/null +++ b/src/components/modules/panel/types/wrap.d.ts @@ -0,0 +1,24 @@ + + +type TCommonImgListData = { + isDelect: boolean + cover: string + fail: boolean + top: number + left: number + width: number + height: number + title: string +} + +type TCommonPhotoListData = { + listWidth: number + gap: number + thumb?: string + url: string + color: string + isDelect: boolean + width: number + height: number + model: string +} diff --git a/src/components/modules/panel/wrap/TempListWrap.vue b/src/components/modules/panel/wrap/TempListWrap.vue index 71e13ae..08a963a 100644 --- a/src/components/modules/panel/wrap/TempListWrap.vue +++ b/src/components/modules/panel/wrap/TempListWrap.vue @@ -2,137 +2,148 @@ * @Author: ShawnPhang * @Date: 2021-08-27 15:16:07 * @Description: 模板列表 - * @LastEditors: ShawnPhang - * @LastEditTime: 2023-11-22 09:55:59 + * @LastEditors: ShawnPhang , Jeremy Yu + * @Date: 2024-03-06 21:16:00 --> -