You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
3.2 KiB
163 lines
3.2 KiB
<template>
|
|
<view class="bg">
|
|
<image v-if="headImg" :src="showImg(headImg)" class="topImg" mode="widthFix"></image>
|
|
|
|
<view class="article-container">
|
|
<view @click="viewDetail(item)" v-for="(item,index) in list" :key="index" class="item">
|
|
<image class="img" :src="showImg(item.headimg)" mode="aspectFill"></image>
|
|
<view class="content flex-column">
|
|
<view class="title text-overflowRows">{{item.title}}</view>
|
|
<view class="text-overflowRows" style="font-size: 24rpx;color: #848484;" v-if="item.page">
|
|
地址:{{item.page}}
|
|
</view>
|
|
<view class="btn">详情介绍</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
titleObj: {
|
|
"gxnz":"共享农庄",
|
|
"whck":"网红村咖",
|
|
"yxdw":"乡村研学工坊",
|
|
},
|
|
type: null,
|
|
imgId: null,
|
|
list: [],
|
|
finished: false,
|
|
headImg: '',
|
|
page_no: 1,
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
this.type = option.type
|
|
this.imgId = option.imgId
|
|
if (!this.type) {
|
|
uni.showToast({
|
|
title: '分类不存在',
|
|
icon: 'none',
|
|
})
|
|
uni.navigateBack()
|
|
return
|
|
}
|
|
let title = this.titleObj[this.type] || '点位';
|
|
uni.setNavigationBarTitle({
|
|
title: title
|
|
})
|
|
this.getArticleByType()
|
|
if (this.imgId) {
|
|
this.getHeadImg(this.imgId).then(res => {this.headImg = res})
|
|
}
|
|
|
|
},
|
|
methods: {
|
|
// 游记攻略
|
|
getArticleByType() {
|
|
this.Post({
|
|
type_key: this.type,
|
|
offset: this.list.length,
|
|
page_no: this.page_no,
|
|
page_num: 10,
|
|
},'/api/travels/getList').then(res => {
|
|
if (res.data.rows.length >= 10) {
|
|
this.page_no++
|
|
} else {
|
|
this.finished = true
|
|
}
|
|
this.list = [...this.list, ...res.data.rows]
|
|
})
|
|
},
|
|
|
|
viewDetail(item) {
|
|
if (item.url) {
|
|
uni.navigateTo({
|
|
url:"/subPackages/webPage/webPage?url="+encodeURIComponent(item.url)
|
|
})
|
|
return
|
|
}
|
|
if (item.appId) {
|
|
uni.navigateToMiniProgram({
|
|
appId:item.appId,
|
|
path:item.page
|
|
})
|
|
return
|
|
}
|
|
uni.navigateTo({
|
|
url:'/subPackages/letter/detail?id='+item.id
|
|
})
|
|
},
|
|
},
|
|
//下拉触底事件
|
|
onReachBottom() {
|
|
setTimeout(() => {
|
|
if (!this.finished) this.getArticleByType();
|
|
}, 1000);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.bg {
|
|
width: 750rpx;
|
|
min-height: 100vh;
|
|
background: #F9FCF3;
|
|
padding-bottom: 50rpx;
|
|
}
|
|
|
|
.topImg {
|
|
width: 100%;
|
|
}
|
|
|
|
.article-container{
|
|
width: 100%;
|
|
border-radius: 24rpx ;
|
|
position: relative;
|
|
padding: 32rpx;
|
|
}
|
|
|
|
.item {
|
|
width: 100%;
|
|
height: 240rpx;
|
|
margin-bottom:30rpx;
|
|
display: flex;
|
|
|
|
.img {
|
|
width: 240rpx;
|
|
height: 240rpx;
|
|
border-radius: 24rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.content {
|
|
width: 370rpx;
|
|
flex: 1;
|
|
height: 240rpx;
|
|
padding: 12rpx 0 0 24rpx;
|
|
justify-content: space-between;
|
|
|
|
.title {
|
|
font-weight: bold;
|
|
font-size: 31rpx;
|
|
color: #333333;
|
|
}
|
|
.btn{
|
|
width: 160rpx;
|
|
height: 53rpx;
|
|
line-height: 53rpx;
|
|
background: #6A8A27;
|
|
border-radius: 27rpx;
|
|
text-align: center;
|
|
font-weight: 400;
|
|
font-size: 27rpx;
|
|
color: #FFFFFF;
|
|
margin-left: auto;
|
|
}
|
|
}
|
|
}
|
|
</style>
|