5 changed files with 274 additions and 3 deletions
@ -0,0 +1,125 @@ |
|||
<template> |
|||
<view class="bg"> |
|||
|
|||
<swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000" circular indicator-dots indicator-color="rgba(255,255,255,.5)" |
|||
indicator-active-color="#fff" v-if="detail.images"> |
|||
<swiper-item v-for="(item, index) in detail.images.split(',')" :key="item.id"> |
|||
<view class="swiper-item"> |
|||
<image class="item-img" :src="showImg(item)" mode="aspectFill"></image> |
|||
</view> |
|||
</swiper-item> |
|||
</swiper> |
|||
|
|||
<view class="topBox"> |
|||
<view class="title text-overflowRows">{{detail.title}}</view> |
|||
<view class="flex-between"> |
|||
<view class="name"> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/noveltyUser.png" mode=""></image> |
|||
{{detail.author}} |
|||
</view> |
|||
<view class="other-info"> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/eye.png" mode=""></image> |
|||
<text style="padding-right: 36rpx;">{{detail.view}}</text> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/eye.png" mode=""></image> |
|||
{{detail.view}} |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="content" v-html="formateRichText(detail.content)"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
detail: {} |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
this.Post({id: option.id},'/api/article/getArticleById').then(res => { |
|||
if (res.data.flag == 0) { |
|||
uni.showToast({title: '文章不存在或已下架',icon: 'none'}) |
|||
setTimeout(() => {this.goBack()}, 2000) |
|||
} |
|||
this.detail = res.data; |
|||
}); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.bg { |
|||
width: 750rpx; |
|||
min-height: 100vh; |
|||
background: #FFFFFF; |
|||
padding-bottom: 100rpx; |
|||
} |
|||
|
|||
.swiper { |
|||
height: 408rpx; |
|||
|
|||
.swiper-item { |
|||
width: 100%; |
|||
height: 408rpx; |
|||
|
|||
.item-img { |
|||
width: 750rpx; |
|||
height: 408rpx; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.topBox { |
|||
width: 100%; |
|||
padding: 28rpx 32rpx; |
|||
|
|||
.title { |
|||
font-weight: 500; |
|||
font-size: 32rpx; |
|||
color: #000000; |
|||
} |
|||
.flex-between{ |
|||
padding: 28rpx 0; |
|||
border-bottom: 2rpx solid #F7F7F7; |
|||
} |
|||
|
|||
.name { |
|||
font-weight: 400; |
|||
font-size: 24rpx; |
|||
color: #000000; |
|||
display: flex; |
|||
align-items: center; |
|||
|
|||
|
|||
image { |
|||
width: 48rpx; |
|||
height: 48rpx; |
|||
border-radius: 50%; |
|||
margin-right: 12rpx; |
|||
} |
|||
} |
|||
|
|||
.other-info{ |
|||
display: flex; |
|||
align-items: center; |
|||
font-weight: 400; |
|||
font-size: 24rpx; |
|||
color: #848484; |
|||
|
|||
image{ |
|||
width: 32rpx; |
|||
height: 32rpx; |
|||
margin-right: 8rpx; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.content { |
|||
width: 100%; |
|||
background: #FFFFFF; |
|||
padding:0 28rpx; |
|||
} |
|||
</style> |
@ -0,0 +1,134 @@ |
|||
<template> |
|||
<view class="bg"> |
|||
<img :src="showImg(headImg)" class="topImg" /> |
|||
|
|||
<div class="article-container"> |
|||
<navigator :url="'/subPackages/letter/detail?id='+item.id" v-for="(item,index) in list" :key="index" class="item"> |
|||
<image class="img" :src="showImg(item.image)" mode="aspectFill"></image> |
|||
<view class="content flex-column"> |
|||
<view class="title text-overflowRows">{{item.title}}</view> |
|||
<view class="text-overflow" style="font-size: 24rpx;color: #848484;">{{item.title}}</view> |
|||
<view class="subtitle flex-between"> |
|||
<view style="color: #000000;"> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/user.png" mode=""></image> |
|||
{{item.author}} |
|||
</view> |
|||
<view> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/eye.png" mode=""></image> |
|||
<text style="padding-right: 36rpx;">{{item.view}}</text> |
|||
<image src="https://static.ticket.sz-trip.com/tongli/images/index/eye.png" mode=""></image> |
|||
{{item.view}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</navigator> |
|||
</div> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
list: [], |
|||
finished: false, |
|||
headImg: '' |
|||
} |
|||
}, |
|||
onReady() { |
|||
this.getHeadImg('shuhui').then(res => {this.headImg = res}) |
|||
this.getArticleByType() |
|||
}, |
|||
methods: { |
|||
// 游记攻略 |
|||
getArticleByType() { |
|||
this.Post({ |
|||
type_id: 46, |
|||
offset: this.list.length, |
|||
limit: 10 |
|||
},'/api/Article/getArticleByType').then(res => { |
|||
if (res.data.length < 10) { |
|||
this.finished = true |
|||
} |
|||
this.list = [...this.list, ...res.data] |
|||
}) |
|||
}, |
|||
handleNum (num) { |
|||
if (num>=1000) { |
|||
return (num/1000).toFixed(1)+'k' |
|||
} |
|||
}, |
|||
}, |
|||
//下拉触底事件 |
|||
onReachBottom() { |
|||
setTimeout(() => { |
|||
if (!this.finished) this.getArticleByType(); |
|||
}, 1000); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.bg { |
|||
width: 750rpx; |
|||
min-height: 100vh; |
|||
background: #FFFFFF; |
|||
padding-bottom: 50rpx; |
|||
} |
|||
|
|||
.topImg { |
|||
width: 100%; |
|||
height: 380rpx; |
|||
} |
|||
|
|||
.article-container{ |
|||
margin-top: -15rpx; |
|||
width: 100%; |
|||
background: #FFFFFF; |
|||
border-radius: 24rpx ; |
|||
position: relative; |
|||
padding: 32rpx; |
|||
} |
|||
|
|||
.item { |
|||
width: 100%; |
|||
height: 198rpx; |
|||
margin-bottom:30rpx; |
|||
display: flex; |
|||
|
|||
.img { |
|||
width: 208rpx; |
|||
height: 198rpx; |
|||
border-radius: 24rpx; |
|||
flex-shrink: 0; |
|||
} |
|||
|
|||
.content { |
|||
width: 370rpx; |
|||
flex: 1; |
|||
height: 198rpx; |
|||
padding: 12rpx 0 0 24rpx; |
|||
justify-content: space-between; |
|||
|
|||
.title { |
|||
font-weight: 400; |
|||
font-size: 28rpx; |
|||
color: #000000; |
|||
} |
|||
|
|||
.subtitle { |
|||
font-weight: 500; |
|||
font-size: 27rpx; |
|||
color: #848484; |
|||
|
|||
image { |
|||
width: 26rpx; |
|||
height: 26rpx; |
|||
margin-right: 6rpx; |
|||
vertical-align: text-bottom; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue