From 00dd25320295e849822b0b8c1e5c3c4c9d7d781c Mon Sep 17 00:00:00 2001 From: zlong <953829746@qq.com> Date: Wed, 20 Nov 2024 22:47:33 +0800 Subject: [PATCH] add --- components.d.ts | 1 + src/components/ImageUpload.vue | 39 ++++++++++++++++++++++++++++++++++ src/model/carousals.ts | 6 +++--- src/pages/carousal/index.vue | 22 +++++++++++++------ 4 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 src/components/ImageUpload.vue diff --git a/components.d.ts b/components.d.ts index bbec505..9050c68 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,6 +8,7 @@ export {} declare module 'vue' { export interface GlobalComponents { Copyright: typeof import('./src/components/Copyright.vue')['default'] + ImageUpload: typeof import('./src/components/ImageUpload.vue')['default'] RegularPage: typeof import('./src/components/RegularPage.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/components/ImageUpload.vue b/src/components/ImageUpload.vue new file mode 100644 index 0000000..ae5c980 --- /dev/null +++ b/src/components/ImageUpload.vue @@ -0,0 +1,39 @@ + + + + + \ No newline at end of file diff --git a/src/model/carousals.ts b/src/model/carousals.ts index 1c132ea..f5b4da9 100644 --- a/src/model/carousals.ts +++ b/src/model/carousals.ts @@ -5,8 +5,8 @@ export interface CreateCarousalsRequest { targetId:string } export interface GetCarousalsRequest { - page:string, - size:string, - order?:string + page:number, + size:number, + order?:[string] } diff --git a/src/pages/carousal/index.vue b/src/pages/carousal/index.vue index e3dc60b..807e376 100644 --- a/src/pages/carousal/index.vue +++ b/src/pages/carousal/index.vue @@ -4,7 +4,7 @@ import { onMounted, ref, reactive } from 'vue' import type { BaseTableColumns } from 'tdesign-vue-next' import type { Classify } from '@/model/classify' import ClassifyDialog from '@/pages/carousal/components/CarousalDialog.vue' -import { createCarousal } from '@/api/carousal' +import { getCarousalList } from '@/api/carousal' const columns: BaseTableColumns = [ { @@ -19,7 +19,7 @@ const columns: BaseTableColumns = [ }, { title: '显示状态', - colKey: 'targetType', + colKey: 'status', width: 100 }, { @@ -32,15 +32,23 @@ const loading = ref(false) const data = ref([]) const pagination = reactive({ page: 1, - size: 10 + size: 10, + total:0 +}) +const query = reactive({ + page:1, + size:10, }) const classifyDialogVisible = ref(false) const isEdit = ref(false) -const currentTableData = ref({}) -const fetchClassifyTableData = () => { +const currentTableData = ref<{}>({}) +const fetchClassifyTableData = async () => { /* TODO: 获取轮播图表格数据 */ - const createCarousalApi = createCarousal(pagination) - console.log(createCarousalApi,'api') + query.page = pagination.page + query.size = pagination.size + const getCarousalListApi = await getCarousalList(query) + currentTableData.value = getCarousalListApi.data + pagination.total = getCarousalListApi.pagination.total } onMounted(fetchClassifyTableData) const editClick = (classify: Classify) => {