From cef5331379ca50e6bda8ab513ceb6ee9c14d954f Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Thu, 19 Jun 2025 09:15:32 +0800 Subject: [PATCH] 1 --- mixins/myMixins.js | 10 +- pages.json | 13 ++- pages/index/index.vue | 196 ++++++++++++++++++++++++----------- pages/stratIndex.vue | 47 +++++++++ subPackages/letter/index.vue | 15 ++- 5 files changed, 209 insertions(+), 72 deletions(-) create mode 100644 pages/stratIndex.vue diff --git a/mixins/myMixins.js b/mixins/myMixins.js index 2f412e9..bff0923 100644 --- a/mixins/myMixins.js +++ b/mixins/myMixins.js @@ -15,10 +15,10 @@ export const myMixins ={ // 分享到朋友圈 onShareTimeline() { return { - title: '智游常熟', + title: 'CGC-ICH', type: 0, summary: "edewdewdewf", - imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg" + imageUrl: "https://static.ticket.sz-trip.com/uploads/20250612/e022a1b7c8df621cb15082d0b0f5bba3.jpg" } }, onShareAppMessage() { @@ -33,10 +33,10 @@ export const myMixins ={ console.log(111,url,`${view.route}?url=${url}`) return { - title: '智游常熟', // 分享的名称 + title: 'CGC-ICH', // 分享的名称 path: `${view.route}?url=${url}`, // 将 url 作为参数传递 - imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg", - mpId: 'wxb8f15afe2765976d' // 此处配置微信小程序的 AppId + imageUrl: "https://static.ticket.sz-trip.com/uploads/20250612/e022a1b7c8df621cb15082d0b0f5bba3.jpg", + mpId: 'wx9d68934300b1fe90' // 此处配置微信小程序的 AppId }; } } \ No newline at end of file diff --git a/pages.json b/pages.json index 0e4428d..43b6a6d 100644 --- a/pages.json +++ b/pages.json @@ -1,9 +1,16 @@ { "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/stratIndex", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/index/index", "style": { - "navigationBarTitleText": "大美非遗" + // "navigationStyle": "custom", + "navigationBarTitleText": "CGC-ICH" } }, { @@ -16,7 +23,7 @@ { "path": "pages/login/login", "style": { - "navigationBarTitleText": "大美非遗" + "navigationBarTitleText": "CGC-ICH" } } ], @@ -26,7 +33,7 @@ { "path": "index", "style": { - "navigationBarTitleText": "uni-app" + "navigationBarTitleText": "CGC-ICH" } }, { diff --git a/pages/index/index.vue b/pages/index/index.vue index 344dddc..4ba0c7f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,5 +1,10 @@ @@ -88,26 +96,36 @@ export default { data() { return { + // 导航栏参数 + height: 0, + statusBarHeight: 0, + topBanner: [], smallBanner: [], menuList: [ { - path: '/subPackages/techan/index?idIndex=0' + path: '/subPackages/techan/index?idIndex=0', + image: '', }, { - path: '/subPackages/techan/index?idIndex=1' + path: '/subPackages/techan/index?idIndex=1', + image: '', }, { - path: '/subPackages/techan/index?idIndex=2' + path: '/subPackages/techan/index?idIndex=2', + image: '', }, { - path: '/subPackages/techan/index?idIndex=3' + path: '/subPackages/techan/index?idIndex=3', + image: '', }, { - path: '/subPackages/techan/index?idIndex=4' + path: '/subPackages/techan/index?idIndex=4', + image: '', }, { - path: '/subPackages/techan/index?idIndex=5' + path: '/subPackages/techan/index?idIndex=5', + image: '', } ], handwrittenList: [], @@ -118,24 +136,25 @@ id: '41' }, { - title: '猜你喜欢', + title: '苏州非遗', id: '41' } ], hotIndex: 0, hotList: [], isLoading: false, - limit: 4 + limit: 4, } }, onLoad() { - + }, onReady() { // 获取经纬度 if(!uni.getStorageSync('location')) { this.getLocation() } + this.initRectInfo() this.getList() this.changeType(0) @@ -146,6 +165,23 @@ }, 1000); }, methods: { + 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 + }) + }, + initRectInfo () { + const sysInfo = uni.getSystemInfoSync() + this.statusBarHeight = sysInfo.statusBarHeight + // 默认高度 + this.height = sysInfo.statusBarHeight + 40 + }, getList() { // 大轮播 this.Post({ @@ -164,6 +200,7 @@ }, '/api/adv/getAdv').then(res => { if(res.data) { this.smallBanner = res.data; + this.screenPng = res.data[0] } }); @@ -171,7 +208,7 @@ this.Post({ type_id: 1, offset: 0, - limit: 4 + limit: 1 }, '/api/article/getArticleByType').then(res => { if(res.data) { this.handwrittenList = res.data @@ -229,13 +266,14 @@ getColumnItems(columnIndex) { const columnItems = []; this.hotList.forEach((item, index) => { - switch (this.hotIndex) { - case 1: - item.src = this.showImg(item.image); - break; - default: - item.src = this.showImg(item.goods.image); - } + // switch (this.hotIndex) { + // case 1: + // item.src = this.showImg(item.image); + // break; + // default: + // item.src = this.showImg(item.goods.image); + // } + item.src = this.showImg(item.goods.image); if (index % 2 === columnIndex) { columnItems.push(item); @@ -252,15 +290,23 @@ }, getHotList() { if(this.hotIndex == 1) { + // this.Post({ + // type_id: 3, + // offset: this.hotList.length, + // limit: this.limit + // },'/api/Article/getArticleByType').then(res => { + // if(res) { + // if(res.data.length < this.limit) this.isLoading = true + // this.hotList = this.hotList.concat(res.data) + // } + // }) this.Post({ - type_id: 3, + tag_id: 52, offset: this.hotList.length, - limit: this.limit - },'/api/Article/getArticleByType').then(res => { - if(res) { - if(res.data.length < this.limit) this.isLoading = true - this.hotList = this.hotList.concat(res.data) - } + limit: this.limit, + },'/api/tag/getGoodsByTagId').then(res => { + if(res.data.length < this.limit) this.isLoading = true + this.hotList = this.hotList.concat(res.data) }) }else { this.Post({ @@ -279,29 +325,50 @@ }) }, gotoHotDetail(item) { - if(this.hotIndex == 1) { - - if(item.genre == 'video') { - // 视频 - this.gotoVideo(item) - }else { - // 文章 - uni.navigateTo({ - url: '/subPackages/letter/detail?id=' + item.id - }) - } - - }else { uni.navigateTo({ url: '/subPackages/techan/detail?id=' + item.goods_id }) - } + // if(this.hotIndex == 1) { + + // if(item.genre == 'video') { + // // 视频 + // this.gotoVideo(item) + // }else { + // // 文章 + // uni.navigateTo({ + // url: '/subPackages/letter/detail?id=' + item.id + // }) + // } + + // }else { + // uni.navigateTo({ + // url: '/subPackages/techan/detail?id=' + item.goods_id + // }) + // } } } } \ No newline at end of file diff --git a/subPackages/letter/index.vue b/subPackages/letter/index.vue index 2832376..626f26d 100644 --- a/subPackages/letter/index.vue +++ b/subPackages/letter/index.vue @@ -3,7 +3,7 @@
- + {{item.title}} @@ -22,7 +22,7 @@ - +
@@ -57,6 +57,17 @@ }, likeAricle (item) { + }, + 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 + }) }, handleNum (num) { if (num<=0) { return 0 }