From a5220394a1c671b6f6cdd8ffb7c0f55feebb159b Mon Sep 17 00:00:00 2001 From: sjeam <359824901@qq.com> Date: Thu, 4 Sep 2025 12:10:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 8 + src/pages/about/detail.vue | 180 ++++++++++++++++++++ src/pages/about/index.vue | 5 +- src/pages/index/index.vue | 341 +++++++++++++------------------------ src/style/index.scss | 12 +- 5 files changed, 323 insertions(+), 223 deletions(-) create mode 100644 src/pages/about/detail.vue diff --git a/src/pages.json b/src/pages.json index 0b7ee4a..02588d7 100644 --- a/src/pages.json +++ b/src/pages.json @@ -60,6 +60,14 @@ "navigationBarTitleText": "首页" } }, + { + "path": "pages/about/detail", + "type": "page", + "layout": "default", + "style": { + "navigationBarTitleText": "详情" + } + }, { "path": "pages/about/index", "type": "page", diff --git a/src/pages/about/detail.vue b/src/pages/about/detail.vue new file mode 100644 index 0000000..de0e6ed --- /dev/null +++ b/src/pages/about/detail.vue @@ -0,0 +1,180 @@ + + +{ + layout: 'default', + style: { + // 'custom' 表示开启自定义导航栏,默认 'default' + navigationBarTitleText: '详情', + }, +} + + + + + + + diff --git a/src/pages/about/index.vue b/src/pages/about/index.vue index cd5629b..4460d29 100644 --- a/src/pages/about/index.vue +++ b/src/pages/about/index.vue @@ -60,7 +60,7 @@ - + {{ item.author }} {{ item.description }} @@ -140,6 +140,9 @@ export default defineComponent({ // 使用正确的 map 方法返回新数组 this.detail = res.data }, + goPage(item) { + getUrl('/pages/about/detail?id=' + item.id) + }, more(item) { console.log(item) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 47c5b18..8131962 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -42,7 +42,7 @@ > {{ city }} - + {{ title }} @@ -121,27 +121,29 @@ " v-for="item in product_30" > - - - - - {{ item.store_name }} - {{ item.store_info }} - - - - - + + + + - - + {{ item.store_name }} + {{ item.store_info }} + + + + + + + + + @@ -177,20 +179,13 @@ > - + - 三江区街道 - - 因举办古韵悠然的传统民俗文化节热度飙升,在这里,你能感受到乡村文化的深厚底蕴和无穷魅力。 - + {{ current_item.title }} + {{ current_item.description }} @@ -200,39 +195,13 @@ - {{ item.name }} + {{ item.title }} @@ -256,39 +225,7 @@ - + - - - - - xxx蔬菜基地 - 我们这里的食物很新鲜 - - - - - + + + + - - + {{ item.store_name }} + {{ item.store_info }} + + + + + + + + + @@ -348,36 +282,26 @@ - - - - - - - - 零失败!手把手教你种出又大又圆的土豆 - - 2025-8-23 - 建党知识 + + + + + + + + + {{ item.title }} + {{ item.description }} + + 2025-8-23 + + {{ item.category_name }} + + - - + + @@ -399,75 +323,31 @@ - - - - - - - xxx蔬菜基地 - 我们这里的食物很新鲜 - - - - - + + + + + + - - + {{ item.author }} + {{ item.description }} + + + + + @@ -482,7 +362,11 @@ import { getProductAPI, getBannerAPI } from '@/service/crmeb/product.ts' import { useUserStore } from '@/store' import { getUrl, getWebUrl } from '@/utils' - +import { + getArticleCategoryAPI, + getArticleIndexAPI, + getArticleDetailAPI, +} from '@/service/crmeb/product.ts' const userStore = useUserStore() const hasLogin = computed(() => userStore.userInfo?.id) import { defineComponent } from 'vue' @@ -493,7 +377,11 @@ export default defineComponent({ show: false, product_30: {}, swiperList: {}, - + index_eat: {}, + index_live: {}, + index_play: {}, + index_purchase: {}, + current_item: {}, currentTab: 1, city: '', title: '', @@ -502,6 +390,7 @@ export default defineComponent({ async onLoad(option) { this.getBanner() this.getProduct(30) + this.getArticle() }, methods: { async getBanner() { @@ -532,11 +421,23 @@ export default defineComponent({ console.log(e) // this.currentTab = e.id }, - // async submitGroup() { - // const res = await setGroupAPI(this.addressinfo) - // this.show = false - // }, + async getArticle() { + this.index_eat = await this.getIndex(1) + this.current_item = this.index_eat[0] || {} + this.index_live = await this.getIndex(2) + + this.index_play = await this.getIndex(3) + this.index_purchase = await this.getIndex(4) + }, + async getIndex(category_id) { + const res = await getArticleIndexAPI({ category_id: category_id }) + // 使用正确的 map 方法返回新数组 + return res.data + }, + goPage(item) { + getUrl('/pages/about/detail?id=' + item.id) + }, moreVillage() { console.log('查看乡村') uni.navigateTo({ diff --git a/src/style/index.scss b/src/style/index.scss index 6d77a35..53e5523 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -44,6 +44,14 @@ page { background: linear-gradient(to bottom, #87d76b, #f1f1f1); /* 垂直渐变 */ } +.color-black { + color: #333333 !important; +} + +.default-color { + color: #87d76b; +} + //渐变背景 .background_home_card { background: linear-gradient(to bottom, #f1f1f1, #87d76b); /* 垂直渐变 */ @@ -145,7 +153,7 @@ $padding-width: 20rpx; } .ellipsis-2 { display: -webkit-box; - font-weight: 500; + // font-weight: 500; font-size: 40rpx; line-height: 40rpx; -webkit-box-orient: vertical; @@ -159,7 +167,7 @@ $padding-width: 20rpx; .ellipsis-5 { display: -webkit-box; - font-weight: 500; + // font-weight: 500; font-size: 40rpx; line-height: 40rpx; -webkit-box-orient: vertical;