From 3ede84b678b88b0d5e93ef9663588a68d1f5b7a5 Mon Sep 17 00:00:00 2001 From: liqi Date: Wed, 7 May 2025 23:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/frontend/Home.vue | 76 ++++++++++++++++------------- src/views/frontend/Projects.vue | 86 +++++++++++++++++++-------------- 2 files changed, 94 insertions(+), 68 deletions(-) diff --git a/src/views/frontend/Home.vue b/src/views/frontend/Home.vue index c464814..1989673 100644 --- a/src/views/frontend/Home.vue +++ b/src/views/frontend/Home.vue @@ -42,35 +42,7 @@ const projects = ref([ } ]) -const carousel = ref([ - { - id: 1, - title: '电商平台', - labels: ['Vue3', 'Node.js', 'PHP'], - category: ['Web', 'Uni app', '微信小程序'], - description: '基于Vue3和Node.js开发的电商平台,提供完整的购物流程,包括注册、登录、购物、支付等功能。', - cover: 'https://pic.rmb.bdstatic.com/bjh/80852bfe7c321988191838517ba64e309354.jpeg@h_1280', - route: '1' - }, - { - id: 2, - title: 'OA系统', - labels: ['React', 'PHP'], - category: ['Web', 'Uni app', '微信小程序'], - description: '基于React和PHP开发的OA系统,提供完整的流程管理、审批、报表等功能。亮点:1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统', - cover: 'https://img2.baidu.com/it/u=1629222614,1358629025&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500', - route: '2' - }, - { - id: 2, - title: '团购app', - labels: ['React', 'PHP'], - category: ['Web', 'Uni app', '微信小程序'], - description: '基于React和PHP开发的OA系统,提供完整的流程管理、审批、报表等功能。亮点:1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统1、100万用户、2、Saas系统', - cover: 'https://img1.baidu.com/it/u=362305842,3264792867&fm=253&fmt=auto?w=712&h=712', - route: '2' - } -]) +const carousel = ref([]) const testimonials = [ { @@ -102,21 +74,27 @@ const partners = [ { name: 'Microsoft', logo: 'https://pic.rmb.bdstatic.com/bjh/80852bfe7c321988191838517ba64e309354.jpeg@h_1280' }, ] +const projectLoading = ref(false); const getProjectList = () => { + projectLoading.value = true; homeProjectListApi({ page: 1, pageSize: 6 }).then((res) => { - projects.value = res.items + projects.value = res.items; + projectLoading.value = false }) } +const swiperOptionsLoading = ref(false); const getCarouseList = () => { + swiperOptionsLoading.value = true; homeCarouselListApi({ page: 1, pageSize: 6 }).then((res) => { - carousel.value = res.items + carousel.value = res.items; + swiperOptionsLoading.value = false }) } @@ -155,7 +133,12 @@ const breakpoints = {
-
+ +
+
+ 加载中... +
+
+ + +
+ +
+ + + + 管理员没有设置轮播图 +
+
+
-
+
+
+ 加载中... +
+
+
+ +
+ + + + 暂时没有精选项目 +
+
{ + loading.value = true // 开始加载 projectListApi({ + title: searchQuery.value, page: currentPage.value, pageSize: pageSize.value, }).then((res) => { @@ -62,6 +67,9 @@ const getList = () => { pageSize.value = res.size; totalItems.value = res.total; pageCount.value = res.page_count; + loading.value = false // 加载结束 + }).catch(() => { + loading.value = false // 加载出错 }) } // 筛选排序逻辑 @@ -144,8 +152,12 @@ const changePage = (page) => { currentPage.value = page getList(); } - +const reset = () => { + searchQuery.value = ''; + getList(); +} +