<template>
|
<view class="advisory-big">
|
<!-- 顶部下拉刷新 -->
|
<view v-show="isFlash">
|
<uni-load-more :status="loadStatus" ></uni-load-more>
|
</view>
|
<view v-for="i in data" class="advisory-model" @click="goDetail(i)">
|
<view class="advisory-left">
|
<view class="advisory-title-top">
|
<view class="advisory-title">{{i.title}}</view>
|
</view>
|
<view class="advisory-title-down">
|
<view class="advisory-title-name">{{i.sourceName}}</view>
|
<view class="advisory-title-time">{{i.createTime}}</view>
|
</view>
|
</view>
|
<view class="advisory-right">
|
<image :src="i.url"></image>
|
</view>
|
|
</view>
|
<!-- loading加载提示处 -->
|
<view v-show="isLoadMore">
|
<uni-load-more :status="loadStatus" ></uni-load-more>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default{
|
data(){
|
return {
|
// pathUrl:"http://localhost:89/",
|
pathUrl:"http://s16s652780.51mypc.cn/api/blade-jfpts",
|
page:1,
|
pagesize:10,
|
loadStatus:'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
|
isLoadMore:false, //是否加载中
|
isFlash:false,//是否刷新
|
data:[]
|
}
|
},
|
mounted(){
|
// this.getArtcilePageList();
|
},
|
//上拉加载更多
|
onReachBottom(){ //上拉触底函数
|
if(!this.isLoadMore){ //此处判断,上锁,防止重复请求
|
this.isLoadMore=true
|
this.page+=1
|
this.getArtcilePageList()
|
}
|
},
|
//下拉刷新
|
onPullDownRefresh() {
|
// console.log("上拉了!....");
|
if(!this.isFlash){ //此处判断,上锁,防止重复请求
|
this.isFlash=true;
|
this.page =1;
|
this.getArtcilePageList();
|
}
|
},
|
onLoad() {
|
this.getArtcilePageList();
|
},
|
methods:{
|
//去跳转详情页面
|
goDetail(e){
|
|
//内容传值容易报错,所以直传id,然后调用接口去查询
|
// let detail = {
|
// title: e.title,
|
// content: e.content,
|
// id: e.id,
|
// createTime: e.createTime,
|
// sourceName: e.sourceName,
|
// imgUrl: e.url,
|
// videoUrl:e.videoUrl
|
// };
|
|
let detail = {
|
id: e.id
|
};
|
//去跳转
|
uni.navigateTo({
|
url: './article_detail?detailData=' + JSON.stringify(detail)
|
});
|
},
|
|
//获取资讯信息
|
getArtcilePageList(){
|
var that = this;
|
uni.request({
|
url: that.pathUrl+'/article/article/page',
|
method:'GET',
|
data:{
|
current:this.page,
|
size: this.pagesize
|
},
|
success: (res) => {
|
if(res.data.code==200){
|
if(res.data.data.records){
|
//如果总数小于pageSize,不做其他操作
|
if(res.data.data.total<this.pagesize){
|
that.data = res.data.data.records;
|
}else{
|
if(res.data.data.records.length<this.pagesize){
|
//如果数量小于分页数量,则为最后一页
|
this.isLoadMore=true;
|
this.loadStatus='nomore';
|
}else{
|
this.isLoadMore=false
|
}
|
res.data.data.records.forEach((item)=>{
|
that.data.push(item);
|
})
|
}
|
}else{
|
this.isLoadMore=true;
|
this.loadStatus='nomore';
|
}
|
}
|
}
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.advisory-big{
|
width: 100%;
|
height: 70%;
|
position: absolute;
|
top: 2%;
|
// background-color: #0078A8;
|
|
.advisory-model{
|
width: 100%;
|
height: 20%;
|
// background-color: #00FF00;
|
|
|
.advisory-left{
|
width: 61%;
|
height: 80%;
|
float: left;
|
position: relative;
|
// background-color: #00FFFF;
|
position: relative;
|
left: 4%;
|
top: 10%;
|
|
|
.advisory-title-top{
|
// background-color: #2692FD;
|
width: 100%;
|
height: 75%;
|
|
.advisory-title{
|
width: 92%;
|
font-size: 15px;
|
font-weight: 550;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 2;
|
-webkit-box-orient: vertical;
|
}
|
|
|
}
|
|
.advisory-title-down{
|
// background-color: #0078A8;
|
width: 100%;
|
height: 25%;
|
font-size: 12px;
|
font-weight: 550;
|
color: #808080;
|
|
.advisory-title-name{
|
width: 130rpx;
|
float: left;
|
letter-spacing: 1px;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 1;
|
-webkit-box-orient: vertical;
|
// background-color:#0078A8;
|
}
|
|
.advisory-title-time{
|
position: relative;
|
left: 15rpx;
|
}
|
}
|
|
}
|
|
.advisory-right{
|
// background-color: #222222;
|
width: 32%;
|
height: 80%;
|
left: 63%;
|
position: relative;
|
top: 10%;
|
|
image{
|
position: relative;
|
left: 0px;
|
top: -100%;
|
width: 100%;
|
height: 100%;
|
border-radius: 5px;
|
}
|
}
|
}
|
}
|
|
|
|
|
</style>
|