intelligentGroup/pageTwo/news/list.vue

154 lines
3.1 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" @handleSearchId="handleSearchId"></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
console.log("options", options)
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)
},
// onShareAppMessage() {
// let that = this
// return {
// title: "智照团线上展厅",
// path: '/pageTwo/news/list?type=' + that.type,
// imageUrl: '',
// success: function(res) {
// console.log("分享到朋友成功")
// },
// fail: function(res) {
// console.log("分享到朋友失败")
// },
// }
// },
// onShareTimeline() {
// let that = this
// return {
// title: "智照团线上展厅",
// query: 'type=' + that.type,
// imageUrl: '',
// success: function(res) {
// console.log("分享到朋友成功")
// },
// fail: function(res) {
// console.log("分享到朋友失败")
// },
// }
// },
methods: {
handleInfoList(page) {
let that = this
let account = {
pageNo: page,
pageSize: 10,
searchValue: "",
}
// 1资讯4公益7党建
let https = this.type == 1 ? that.$model.getinfolist(account) : this.type == 4 ? that.$model.getGongyiList(account) : that.$model.getPartyList(account)
return https.then((res) => {
if (res.code != 0) return
that.newsList = this.newsList.concat(res.data.rows)
that.lastPage = res.data.totalpage
})
},
handleSearchId(id, cnt) {
let that = this
console.log("返回", id, cnt)
that.newsList.forEach(ite => {
if (ite.id == id) {
ite.browsecnt = cnt
}
})
}
}
}
</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>