行业报告上方三个按钮的列表展示

This commit is contained in:
邓洁
2023-02-03 19:31:50 +08:00
parent ec3c5b8351
commit 4db15d21cf
6 changed files with 126 additions and 19 deletions

View File

@@ -1,22 +1,68 @@
<template>
<view>
<news></news>
<view class="xw_content" v-for="(item,index) in newsList" :key="index" @click="clickNews(item)">
<u--image :src="imgUrl+item.cover" width="192rpx" height="122rpx" :lazy-load="true">
</u--image>
<view class="xw_right">
<view class="xw_title">
{{item.title}}
</view>
<view style="display: flex;">
<text class="xw_time">
{{item.pub_time_str}}
</text>
<text class="xw_time xw_place">
{{item.pub_name}}
</text>
</view>
</view>
</view>
<view v-if="newsShow" class="no-data">已经到底啦</view>
</view>
</template>
<script>
import {
dateFormat
} from '../../utills/date.js'
export default {
data() {
return {
newsShow: true,
imgUrl: '',
newsList: [],
pageNum: 1, // 当前页
pageSize: 4, // 每页条数
}
},
onLoad() {
this.getNews()
this.imgUrl = uni.getStorageSync('img_url')
},
onReachBottom() {
this.pageNum++
this.getNews()
},
methods: {
// this.newsShow = this.list.length === 0 ? true : false
getNews() {
this.$apiServe.getNews({
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// console.log('行业新闻', res.data.data)
let newsData = res.data.data
for (const item of newsData) {
item.pub_time_str = dateFormat(item.pub_time_str)
}
this.newsList = [...this.newsList, ...newsData]
}).finally(_ => {})
},
// 跳转到新闻详情页
clickNews(item) {
uni.navigateTo({
url: '../newsDetail/newsDetail?id=' + item.id
})
},
}
}
</script>