From ab39785eaa393791763bfe23a56530eadb8e30ac Mon Sep 17 00:00:00 2001 From: chenkainan Date: Fri, 27 Jun 2025 13:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 + pages/index/index.vue | 38 ------ pages/index/readingBody.vue | 127 ++++++++++++++------ static/js/CommonFunction.js | 45 +++++++- subPackages/haveFeeling/detailXiang.vue | 27 ++++- subPackages/letter/detail.vue | 147 ++++++++++++++++++++++++ 6 files changed, 305 insertions(+), 85 deletions(-) create mode 100644 subPackages/letter/detail.vue diff --git a/pages.json b/pages.json index 7e8afa7..f8f6033 100644 --- a/pages.json +++ b/pages.json @@ -117,6 +117,12 @@ "navigationBarTitleText" : "有感商店香", "navigationStyle": "custom" } + }, + { + "path": "letter/detail", + "style": { + "navigationBarTitleText": "文章详情" + } } ] }], diff --git a/pages/index/index.vue b/pages/index/index.vue index cef99a0..9e4ab9b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -67,44 +67,6 @@ } }); }, - // 2是各种详情页,3是列表专题页面,4是小程序 - gotoUrlNew(item) { - console.log(item); - let that = this; - let url = ''; - switch (item.jump_type) { - case 0: - break; - case 2: - uni.navigateTo({ - url: item.tdata - }); - break; - case 3: - uni.navigateTo({ - url: '/subPackages/webPage/webPage?url=' + item.tdata - }); - break; - case 4: - uni.navigateToMiniProgram({ - appId: item.tdata.appid, // 此为appid - path: item.tdata.page, // 此为首页路径 - envVersion: 'release', - success: res => { - // 打开成功 - console.log('打开成功', res); - }, - fail: err => { - console.log(err); - } - }); - break; - default: - break; - } - }, - - gotoVideo(item) { uni.navigateTo({ url: '/subPackages/video/video?item=' + encodeURIComponent(JSON.stringify(item)) diff --git a/pages/index/readingBody.vue b/pages/index/readingBody.vue index 9a32b11..31409da 100644 --- a/pages/index/readingBody.vue +++ b/pages/index/readingBody.vue @@ -2,24 +2,33 @@ - + + 底部指示点 - + --> + + + + + + + + - + @@ -29,11 +38,11 @@ - {{item}} + {{item.title}} - + @@ -50,44 +59,81 @@ }, data() { return { - swiperList: [{ - img: 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img.png' - }, - { - img: 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img.png' - }, - { - img: 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img.png' - }, - { - img: 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img.png' - } - ], + swiperList: [], + current: 0, + swiperDotIndex: 0, + mode: 'round', + dotsStyles: { + selectedBackgroundColor: 'rgb(133, 133, 133)', + selectedBorder: 'none', + backgroundColor: 'rgba(150, 150, 150, 0.5)', + border: 'none' + }, currentIndex: 0, - categories: [ - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img1.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img1.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img1.png' - ], - readingList: [ - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png', - 'https://static.ticket.sz-trip.com/epicSoul/readingBody/img2.png' - ], - readingType: ['2025', '2026', '更多'], + categories: [], + readingList: [], + readingType: [{title: '2025', id: 3}, {title: '2026', id: 6}, {title: '全部', id: ''},], readingIndex: 0 } }, + onReady() { + this.sendRequest() + }, methods: { + sendRequest() { + this.Post({ + type_id: 3, + position: 2, + }, '/api/adv/getAdv').then(res => { + if(res.data) { + this.swiperList = res.data; + } + }); + + this.Post({ + type_id: 3, + position: 1, + }, '/api/adv/getAdv').then(res => { + if(res.data) { + this.categories = res.data; + } + }); + + this.getList() + }, + // 全部阅读 文章 + getList() { + this.Post({ + type_id: this.readingType[this.readingIndex].id, + offset: 0, + limit: 1 + }, '/api/article/getArticleByType').then(res => { + if(res.data) { + this.readingList = res.data + } + }) + }, + change(e) { + this.current = e.detail.current + }, onSwiperChange(e) { this.currentIndex = e.detail.current; }, changeType(index) { this.readingIndex = index + this.getList() console.log(index,this.readingIndex) + }, + viewDetail(item) { + if (item.url) { + uni.navigateTo({ + url:"/subPackages/webPage/webPage?url="+encodeURIComponent(item.url) + }) + return + } + uni.navigateTo({ + url:'/subPackages/letter/detail?id='+item.id + }) } } } @@ -98,13 +144,19 @@ padding-bottom: 200rpx; } - .top-box { + .swiper-box, .top-box { margin: 60rpx 40rpx 0; height: 830rpx; box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1); border-radius: 20rpx; - padding-top: 10rpx; - background-color: #fff; + overflow: hidden; + // padding-top: 10rpx; + // background-color: #fff; + + image { + width: 100%; + height: 100%; + } } .carousel-swiper { @@ -156,6 +208,7 @@ height: 260rpx; flex-shrink: 0; margin-right: 20rpx; + border-radius: 20rpx; } } diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index a311e0b..fb7eb4a 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -292,15 +292,52 @@ Vue.prototype.goOtherDetail = (item,type) => { return true } } + // 根据类型判断详情页 Vue.prototype.goDetailByType= function(item){ - let res = this.goOtherDetail(item) - if (res) { - return - } + // let res = this.goOtherDetail(item) + // if (res) { + // return + // } uni.navigateTo({ url: `/subPackages/techan/detail?id=?${item.id}` }) +} +// 轮播图跳转 2是各种详情页,3是列表专题页面,4是小程序 +Vue.prototype.gotoUrlNew = (item) => { + console.log(item); + let that = this; + let url = ''; + switch (item.jump_type) { + case 0: + break; + case 2: + uni.navigateTo({ + url: item.tdata + }); + break; + case 3: + uni.navigateTo({ + url: '/subPackages/webPage/webPage?url=' + item.tdata + }); + break; + case 4: + uni.navigateToMiniProgram({ + appId: item.tdata.appid, // 此为appid + path: item.tdata.page, // 此为首页路径 + envVersion: 'release', + success: res => { + // 打开成功 + console.log('打开成功', res); + }, + fail: err => { + console.log(err); + } + }); + break; + default: + break; + } } \ No newline at end of file diff --git a/subPackages/haveFeeling/detailXiang.vue b/subPackages/haveFeeling/detailXiang.vue index b8188e2..1dd6d43 100644 --- a/subPackages/haveFeeling/detailXiang.vue +++ b/subPackages/haveFeeling/detailXiang.vue @@ -1,10 +1,10 @@ @@ -31,6 +28,7 @@ }, data() { return { + detail: {}, list: [ { img: 'https://static.ticket.sz-trip.com/epicSoul/readingBody/productImg.png', @@ -70,6 +68,23 @@ } ] } + }, + onLoad(option) { + this.Post({ + id: option.id, + }, '/api/goods/goods_type_detail').then(res => { + if(res.data) { + this.detail = res.data + } + }); + + this.Post({ + type_id: option.id, + offset: this.list.length, + limit: 100, + },'/api/tag/getGoodsByTypeId').then(res => { + this.list = res.data; + }) } } diff --git a/subPackages/letter/detail.vue b/subPackages/letter/detail.vue new file mode 100644 index 0000000..ed502a2 --- /dev/null +++ b/subPackages/letter/detail.vue @@ -0,0 +1,147 @@ + + + + + \ No newline at end of file