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.
140 lines
3.1 KiB
140 lines
3.1 KiB
<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.subtitle}}</view>
|
|
<view class="subtitle flex-between">
|
|
<view style="color: #000000;">
|
|
<image style="width: 48rpx;height:48rpx" :src="showImg(item.author_img)" mode=""></image>
|
|
{{item.author}}
|
|
</view>
|
|
<view>
|
|
<image @click="likeAricle(item)" v-if="item.is_like" :src="showImg('/uploads/20250513/00b5680ca4b62479a59b40786979e3e2.png')" mode=""></image>
|
|
<image @click="likeAricle(item)" v-else :src="showImg('/uploads/20250513/99e8d59b9692ae73b3204a6cec79611b.png')" mode=""></image>
|
|
<text style="padding-right: 36rpx;">{{handleNum(item.star)}}</text>
|
|
<image :src="showImg('/uploads/20250513/71acef9a784095e9ba17c88580506705.png')" mode=""></image>
|
|
{{handleNum(item.view)}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</navigator>
|
|
</div>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
list: [],
|
|
finished: false,
|
|
headImg: 'https://cgc.js-dyyj.com/uploads/20250513/b9f5f5b2b90d8df29247c6aa4f452eaa.png'
|
|
}
|
|
},
|
|
onReady() {
|
|
// this.getHeadImg('shuhui').then(res => {this.headImg = res})
|
|
this.getArticleByType()
|
|
},
|
|
methods: {
|
|
// 游记攻略
|
|
getArticleByType() {
|
|
this.Post({
|
|
type_id: 1,
|
|
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]
|
|
})
|
|
},
|
|
likeAricle (item) {
|
|
|
|
},
|
|
handleNum (num) {
|
|
if (num<=0) { return 0 }
|
|
if (num>=1000) {
|
|
return (num/1000).toFixed(1)+'k'
|
|
}
|
|
return num
|
|
},
|
|
},
|
|
//下拉触底事件
|
|
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: -22rpx;
|
|
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: 32rpx;
|
|
height: 32rpx;
|
|
margin-right: 6rpx;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|