From f0550360018f67558dfb137f4baffb14273fe96c Mon Sep 17 00:00:00 2001 From: LinCyJang Date: Sat, 13 Dec 2025 14:49:59 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=8D=83=E5=8E=BF=E8=B5=84?= =?UTF-8?q?=E8=AE=AF=E5=88=86=E7=B1=BB&=E8=AF=84=E8=AE=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/qianxian.js | 15 + pages.json | 6 + pkg_common/views/message.vue | 8 +- pkg_product/views/famousQianxianShop.vue | 165 +++- pkg_product/views/newsInfo.vue | 933 +++++++++++++++++++++++ 5 files changed, 1120 insertions(+), 7 deletions(-) create mode 100644 pkg_product/views/newsInfo.vue diff --git a/api/qianxian.js b/api/qianxian.js index 9da7bd1..bb2d4c1 100644 --- a/api/qianxian.js +++ b/api/qianxian.js @@ -267,3 +267,18 @@ export function getShareHousekeeper(id) { export function getJiaLouStewardDetail(id) { return request.get('/travel/steward/' + id, {}, {login: true}) } + +/** + * 获取县城资讯详情 + */ +export function getCityNewsDetail(id) { + return request.get('/countyFamous/news/' + id, {}, {login: true}) +} + + +/** + * 获取县城资讯类别 + */ +export function getCityNewsCategory() { + return request.get('/countyFamous/newsCategory', {}, {login: true}) +} diff --git a/pages.json b/pages.json index b9c2321..05e06d0 100644 --- a/pages.json +++ b/pages.json @@ -612,6 +612,12 @@ "navigationStyle": "custom" } }, + { + "path": "views/newsInfo", + "style": { + "navigationBarTitleText": "资讯详情" + } + }, { "path": "views/famousQianxianTheme", "style": { diff --git a/pkg_common/views/message.vue b/pkg_common/views/message.vue index 366bf97..4f98a0c 100644 --- a/pkg_common/views/message.vue +++ b/pkg_common/views/message.vue @@ -186,7 +186,11 @@ export default { }) return } - this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + comment.contentId) + if(comment.contentType === 'hotelNews') { + this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + comment.contentId) + } else if(comment.contentType === 'countyFamousNews') { + this.$yrouter.push('/pkg_product/views/newsInfo?id=' + comment.contentId) + } }, /** * 格式化时间 @@ -272,7 +276,7 @@ export default { // 评论的目标内容ID,必传 contentId: this.currentComment.contentId, // 评论的目标内容类型,必传(店铺资讯传入值hotelNews) - contentType: 'hotelNews', + contentType: this.currentComment.contentType, // 评论内容,必传 reply: this.content.replace('@' + this.currentComment.senderUserNickname, '').trim(), // @的用户ID diff --git a/pkg_product/views/famousQianxianShop.vue b/pkg_product/views/famousQianxianShop.vue index 4bebcc1..03f12ec 100644 --- a/pkg_product/views/famousQianxianShop.vue +++ b/pkg_product/views/famousQianxianShop.vue @@ -148,6 +148,21 @@ v-if="activeIndex === 3" class="info-section" > + + + + + {{ item.name }} + + + + @@ -222,7 +237,83 @@ :class="item.hasZan ? 'on' : ''" class="seeNum-txt" >{{ item.zan }} + + + + {{ item.replyCount || 0}} + + + + + + + + @@ -772,7 +863,8 @@ import { getCountyFamousCityDetail, getShareImg, getSaleList, - getJiaLouList + getJiaLouList, + getCityNewsCategory } from '@/api/qianxian' import ProductWindow from '@/components/ProductWindow' import goCartMixin from '@/mixins/goCartMixins' @@ -859,6 +951,8 @@ export default { videoPlayers:[], jiaLouList: [], countyId: null, + newsCategoryList: [], + newsCurrent: 0 } }, onShareAppMessage() { @@ -899,8 +993,46 @@ export default { this.getListReq() this.getsaleList() this.queryGuide('countyFamousIndex') + this.getCityNewsCategoryReq() }, methods: { + /** + * 获取县城资讯类别 + */ + getCityNewsCategoryReq() { + getCityNewsCategory().then(res => { + if(res.status === 200) { + this.newsCategoryList = [{name: '全部', id: ''}].concat(res.data || []) + } + }) + }, + changeNewsTab(index) { + if (this.newsCurrent === index) return + this.newsCurrent = index + this.getInfoReq() + }, + formatterTime(time) { + const now = new Date(); + const date = new Date(time); + const diff = now - date; + const diffMin = Math.floor(diff / 1000 / 60); + const diffHour = Math.floor(diff / 1000 / 60 / 60); + const diffDay = Math.floor(diff / 1000 / 60 / 60 / 24); + if (diffMin < 1) { + return "刚刚"; + } else if (diffHour < 1) { + return diffMin + "分钟前"; + } else if (diffDay < 1) { + return diffHour + "小时前"; + } else if (diffDay < 7) { + return diffDay + "天前"; + } else { + return date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日"; + } + }, + infoClick(info) { + this.$yrouter.push('/pkg_product/views/newsInfo?id=' + info.id) + }, showFunctionGuide() { if(this._step == this.functionGuideData.step) return if(this.functionGuideData.step == 1) { @@ -1221,10 +1353,12 @@ export default { _this.isLoadInfoListSuccess = false _this.loading = true _this.infoArray = [] + const categoryId = this.newsCategoryList[this.newsCurrent] ? this.newsCategoryList[this.newsCurrent].id : '' getCountyFamousCityNews({ page: 1, limit: 9999, - countyFamousDataId: _this.id + countyFamousDataId: _this.id, + categoryId: categoryId }).then(res => { const { data } = res _this.loading = false @@ -1385,9 +1519,6 @@ export default { }) }) }, - infoClick(info) { - // this.$yrouter.push('/pagesInn/inn/innInfoDetail?id=' + info.id) - }, coverPlay(){ this.videoPlayers.forEach(player => { const playerCtx = uni.createVideoContext(player, this) @@ -1914,6 +2045,30 @@ export default { padding: 22rpx; } .info-section { + .news-category { + padding-bottom: 20rpx; + .news-category-scroll { + white-space: nowrap; + width: 100%; + } + .news-category-wrapper { + display: flex; + justify-content: space-evenly; + } + .category-item { + display: inline-block; + padding: 10rpx 30rpx; + margin-right: 20rpx; + border-radius: 16rpx; + font-size: 28rpx; + font-weight: bold; + color: #333; + &.active { + color: #fff; + background: #C52733 + } + } + } .info-item + .info-item { margin: 22rpx 0 0 0; } diff --git a/pkg_product/views/newsInfo.vue b/pkg_product/views/newsInfo.vue new file mode 100644 index 0000000..008bb87 --- /dev/null +++ b/pkg_product/views/newsInfo.vue @@ -0,0 +1,933 @@ + + + + +