景徳镇旅游微信小程序
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.
 
 
 

202 lines
3.8 KiB

<template>
<!-- 申遗新闻 -->
<view class="apply">
<navbar title="申遗新闻" leftClick @leftClick="$utils.navigateBack" />
<view class="top-img">
<uv-swiper
:list="banner.course"
indicator
height="420rpx"
keyName="imageContent"></uv-swiper>
</view>
<!-- <view class="middle-box">
<view class="middle-img">
<view
:key="index"
:class="{act : item.id == articleType}"
v-for="(item, index) in category">
<image src="../static/applyRelic/2.png" mode="aspectFill" />
</view>
</view>
<view class="middle-font">
<view @click="selectMiddle(item.id)"
:key="index"
v-for="(item, index) in category">
{{ item.name }}
</view>
</view>
</view> -->
<view class="apply-list">
<uv-list @scrolltolower="scrolltolower">
<uv-list-item
:title="item.newsTitle"
:note="$dayjs(item.createTime).format('YYYY-MM-DD')"
:border="true"
v-for="(item,index) in list"
:key="index"
:clickable="true"
@click="toUrl(item)"
>
<template #footer>
<uv-image :src="item.newsImage &&
item.newsImage.split(',')[0]" radius="10rpx" width="240rpx"
height="160rpx" />
</template>
</uv-list-item>
</uv-list>
</view>
<uv-empty
v-if="total == 0"
text="没有找到你需要的哦!"
textSize="30rpx"
iconSize="200rpx"
icon="list"></uv-empty>
<tabber />
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
queryParams: {
pageNo: 1,
pageSize: 10,
},
total : 0,
list : [],
articleType : -1,
keyword : '',
category : [],
}
},
computed : {
...mapState(['banner']),
},
onShow() {
this.queryArticleListByType()
},
onReachBottom() {
this.loadMoreData()
},
onPullDownRefresh(){
this.queryArticleListByType()
},
onLoad(args) {
this.keyword = args.keyword
this.queryArticleListByType()
},
methods: {
queryArticleListByType(){
let query = {
...this.queryParams,
// categoryId : this.articleType
}
// if(this.articleType == -1){
// return
// }
if(this.keyword){
query.articleTitle = this.keyword
}
this.$api('queryNewsByType', query, res => {
uni.stopPullDownRefresh()
if(res.code == 200){
this.list = res.result.records
this.total = res.result.total
}
})
},
queryNewsTypeList(){
this.$api('queryNewsTypeList', {
pageNo : 1,
pageSize : 9999999,
}, res => {
if(res.code == 200){
this.category = res.result.records
this.selectMiddle(this.category[0].id)
}
})
},
loadMoreData(){
if(this.queryParams.pageSize < this.total){
this.queryParams.pageSize += 10
this.queryArticleListByType()
}
},
toUrl(item){
console.log(item);
this.$utils.navigateTo(`/pages_order/service/newsDetail?id=${item.id}`)
},
selectMiddle(id){
this.articleType = id
this.queryArticleListByType()
},
}
}
</script>
<style scoped lang="scss">
.apply {
.top-img {
}
.middle-box {
display: flex;
position: relative;
height: 220rpx;
align-items: center;
justify-content: space-around;
background-color: #fff;
.middle-img {
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
view {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
image {
width: 100%;
height: 100%;
}
}
}
.act{
box-shadow: 0 0 18rpx 14rpx #ff000042;
}
.middle-font {
position: absolute;
display: flex;
width: 100%;
justify-content: space-around;
view {
width: 60rpx;
color: #FFFDF6;
font-weight: 600;
}
}
}
.apply-list {
width: 94%;
margin-left: 3%;
/deep/ .uv-list-item{
background-color: #FFFDF6 !important;
}
}
}
</style>