intelligentGroup/pageTwo/news/list.vue

116 lines
2.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content bgfff">
<!-- 列表 -->
<view class="box">
<list :isAddress="type" :list="newsList" v-if="newsList.length"></list>
<view class="nolist" style="margin-top: 15px;" v-if="!newsList.length">
<image src="@/static/none.png"></image>
<text>暂无数据</text>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
import list from "@/components/newsList.vue"
export default {
data() {
return {
type: 1, //1资讯列表4活动列表,6党建专栏
page: 1,
lastPage: 1,
newsList: [],
}
},
computed: {
...mapState(["InfoList"]),
},
components: {
list,
},
onLoad(options) {
let that = this
that.page = 1
this.type = options.type
this.handleInfoList(that.page)
},
onReachBottom() {
let that = this
console.log("this.lastPage", this.lastPage)
if (!this.lastPage || this.page >= this.lastPage) {
uni.showToast({
title: '没有更多数据!',
icon: 'none'
})
return
}
this.page++
this.handleInfoList(that.page)
},
methods: {
handleInfoList(page) {
let that = this
let account = {
pageNo: page,
pageSize: 10,
}
let https = this.type == 1 ? that.$model.getinfolist(account) : this.type == 4 ? that.$model
.getCampaignList(account) : that.$model.getPartyList(account)
return https.then((res) => {
// console.log("资讯列表", res)
if (res.code != 0) return
that.newsList = this.newsList.concat(res.data.rows)
that.lastPage = res.data.totalpage
})
}
}
}
</script>
<style scoped lang="scss">
.box {
width: 100%;
}
.marginTop {
margin-top: 85px;
}
.tabbar {
width: 100%;
margin-top: 75px;
display: flex;
justify-content: space-around;
align-items: center;
position: relative;
background-color: #fff;
view {
font-size: 16px;
height: 40px;
line-height: 40px;
padding: 0 25px;
text-align: center;
}
.active {
color: $blue;
font-weight: bold;
border-bottom: 2px solid $blue;
}
}
.tabbar::before {
content: "";
position: absolute;
left: 50%;
height: 40px;
width: 1px;
background-color: #dfdfdf;
}
</style>