Commit b0939304 authored by 张伯涛's avatar 张伯涛

点击首页banner跳转链接

parent d98137e4
...@@ -35,6 +35,15 @@ ...@@ -35,6 +35,15 @@
"path": "pages/topic/detail", "path": "pages/topic/detail",
"style": {} "style": {}
}, },
{
"path" : "pages/webview/webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{ {
"path": "pages/myArticle/index", "path": "pages/myArticle/index",
"style": { "style": {
......
...@@ -9,14 +9,13 @@ ...@@ -9,14 +9,13 @@
<!-- </view>--> <!-- </view>-->
<!-- </u-col>--> <!-- </u-col>-->
<u-col> <u-col>
<view bindtap="navigateToPage">
<u-swiper <u-swiper
:list="topicList" :list="topicList"
indicator indicator
indicatorMode="line" indicatorMode="line"
circular circular
@click="navigateToPage"
></u-swiper> ></u-swiper>
</view>
</u-col> </u-col>
</u-row> </u-row>
<view style="padding-bottom: 30rpx;"> <view style="padding-bottom: 30rpx;">
...@@ -99,6 +98,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue"; ...@@ -99,6 +98,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
components: {USwiper, UCol}, components: {USwiper, UCol},
data() { data() {
return { return {
linkUrl: '',
unitId: '', unitId: '',
pic1, pic1,
pic2, pic2,
...@@ -106,6 +106,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue"; ...@@ -106,6 +106,7 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
activeNav: 0, activeNav: 0,
newList: [], newList: [],
hotList: [], hotList: [],
topicItemList: [],
topicList: [ topicList: [
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png', // 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png', // 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
...@@ -144,13 +145,13 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue"; ...@@ -144,13 +145,13 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
this.queryTopic(); this.queryTopic();
}, },
navigateToPage(e) { navigateToPage(e) {
// 获取点击的u-swiper组件的索引 console.log('1111',e)
const index = e.currentTarget.dataset.index; this.linkUrl = this.topicItemList[e].linkUrl
// 根据索引或其他逻辑确定跳转的页面 this.$u.route({
const link = this.topicList[index].url; url: '/pages/webview/webview',
// 执行页面跳转 params: {
wx.navigateTo({ linkUrl: this.linkUrl
url: link, }
}); });
}, },
sectionChange(index) { sectionChange(index) {
...@@ -223,9 +224,11 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue"; ...@@ -223,9 +224,11 @@ import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
// item.img = baseApi + '/file/getImgStream?idFile=' + item.article.img; // item.img = baseApi + '/file/getImgStream?idFile=' + item.article.img;
// } // }
if(list.records && list.records.length > 0) { if(list.records && list.records.length > 0) {
this.topicItemList = list.records
this.topicList = list.records.map(item => item.url) this.topicList = list.records.map(item => item.url)
} else { } else {
this.topicList = [] this.topicList = []
this.topicItemList = []
} }
}) })
}, },
......
<template>
<web-view :src="webUrl"></web-view>
</template>
<script>
export default {
name: "webview",
data() {
return {
webUrl: ''
};
},
onLoad(option) {
console.log('11111',option)
this.webUrl = option.linkUrl
},
methods: {
}
}
</script>
<style scoped>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment