查看附件
This commit is contained in:
@@ -1,276 +0,0 @@
|
||||
<template>
|
||||
<div class="news">
|
||||
<div class="fixed-top">
|
||||
<div class="header-search">
|
||||
<div class="search-input-content">
|
||||
<img src="https://cdn.cunwuyun.cn/img/search-blue.svg" alt="" class="search-icon">
|
||||
<input type="text" placeholder="请输入标题" class="search-input" placeholder-style="color:#E2E8F1;" v-model="title" @confirm="onConfirm" confirm-type="search" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-tab">
|
||||
<div class="tab-item" v-for="(item, index) in tabList" :key="index" @click="changeTab(index)">{{item}}<span class="active-line" v-if="currIndex == index"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news-list">
|
||||
<div class="item" hover-class="bg-hover" v-for="(item, index) in newsList" :key="index" @click="toDetail(item.id)">
|
||||
<div class="item-wrapper solid" :style="{display: type === '1' ? 'block' : 'flex'}">
|
||||
<div class="item-left flex1">
|
||||
<h2 :style="{marginBottom: item.type === '1' ? '16rpx' : '30rpx'}">{{ item.title }}</h2>
|
||||
<div class="item-video" v-if="item.type === '1'">
|
||||
<image class="play-btn" src="https://cdn.cunwuyun.cn/img/bf@2x.png" />
|
||||
<div class="mask"></div>
|
||||
<image class="cover" :src="item.coverFile.url" mode="aspectFill" />
|
||||
</div>
|
||||
<div class="item-left__bottom item-active" :class="[item.photo ? 'item-active' : '']">
|
||||
<span class="top-text">置顶</span>
|
||||
<span>浏览{{ item.viewCount }}</span>
|
||||
<span>点赞{{ item.upCount }}</span>
|
||||
<span>{{ item.createTime ? item.createTime.split(' ')[0] : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<image v-if="item.type === '0'" :src="item.coverFile.url" mode="aspectFill" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="noMore" v-if="isMore && current !== 0">没有更多了噢!</div>
|
||||
<div class="no-more" v-if="!newsList.length && isShowEmpty">
|
||||
<image src="https://cdn.cunwuyun.cn/img/Empty.png" />
|
||||
<p>暂无相关信息</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'newsList',
|
||||
|
||||
data () {
|
||||
return {
|
||||
currIndex: 0,
|
||||
title: '',
|
||||
isLoading: false,
|
||||
newsList: [],
|
||||
isShowEmpty: false,
|
||||
isMore: false,
|
||||
current: 0,
|
||||
areaId: '',
|
||||
tabList: ['全部', '视频', '文章']
|
||||
}
|
||||
},
|
||||
|
||||
onLoad (params) {
|
||||
this.areaId = params.areaId
|
||||
this.$loading()
|
||||
this.getNewsList(params.areaId)
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeTab(index) {
|
||||
this.currIndex = index
|
||||
this.isMore = false
|
||||
this.current = 0
|
||||
this.$loading()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.getNewsList(this.areaId)
|
||||
})
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
this.isMore = false
|
||||
this.current = 0
|
||||
this.$loading()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.getNewsList(this.areaId)
|
||||
})
|
||||
},
|
||||
|
||||
getNewsList(areaId) {
|
||||
if (this.isMore || this.isLoading) return
|
||||
let type = ''
|
||||
|
||||
if (this.currIndex === 1) {
|
||||
type = 1
|
||||
} else if (this.currIndex === 2) {
|
||||
type = 0
|
||||
}
|
||||
|
||||
this.isLoading = true
|
||||
this.$instance.post(`/app/appnewscenterinfo/listForWx?current=${this.current + 1}&type=${type}&size=10&areaId=&title=${this.title}`, null, {
|
||||
withoutToken: 1
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.isShowEmpty = true
|
||||
this.$hideLoading()
|
||||
|
||||
if (this.current === 0) {
|
||||
this.newsList = []
|
||||
}
|
||||
if (!res.data.records.length) {
|
||||
this.isMore = true
|
||||
this.isLoading = false
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.pageShow = true
|
||||
})
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
const data = res.data.records
|
||||
this.newsList.push(...data)
|
||||
this.current = this.current + 1
|
||||
this.isLoading = false
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.pageShow = true
|
||||
})
|
||||
} else {
|
||||
this.$hideLoading()
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$hideLoading()
|
||||
this.isShowEmpty = true
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
toDetail (id) {
|
||||
this.$linkTo(`/subPages/live/newsDetail?id=${id}&areaId=${this.areaId}`)
|
||||
}
|
||||
},
|
||||
|
||||
onReachBottom () {
|
||||
this.getNewsList(this.areaId)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news-list{
|
||||
padding-top: 120rpx;
|
||||
}
|
||||
.news {
|
||||
min-height: 100vh;
|
||||
padding-top: 96rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.item-video {
|
||||
position: relative;
|
||||
height: 388rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.mask {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 11;
|
||||
background: rgba(0, 0, 0, 0.16);
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 121;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin: 0;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.cover {
|
||||
display: block;
|
||||
width: 100%!important;
|
||||
height: 388rpx!important;
|
||||
margin-left: 0!important;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.noMore {
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.news {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 0 30rpx;
|
||||
|
||||
&:first-child {
|
||||
.item-wrapper {
|
||||
padding-top: 0!important;
|
||||
}
|
||||
}
|
||||
|
||||
.item-wrapper {
|
||||
padding: 30rpx 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-left {
|
||||
flex: 1;
|
||||
|
||||
h2 {
|
||||
margin-bottom: 32rpx;
|
||||
color: #333333;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.item-left__bottom {
|
||||
display: flex;
|
||||
|
||||
span {
|
||||
margin-right: 10rpx;
|
||||
color: #999999;
|
||||
font-size: 22rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.top-text{
|
||||
font-size: 22rpx;
|
||||
color: #EF4645;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
flex-shrink: 0;
|
||||
width: 224rpx;
|
||||
height: 140rpx;
|
||||
margin-left: 46rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.no-more {
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
|
||||
image {
|
||||
width: 400rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user