intelligentGroup/pageTwo/news/list.vue

154 lines
3.1 KiB
Vue
Raw Permalink Normal View History

2023-09-08 14:52:40 +08:00
<template>
<view class="content bgfff">
<!-- 列表 -->
<view class="box">
2024-05-02 15:31:12 +08:00
<list :isAddress="type" :list="newsList" v-if="newsList.length" @handleSearchId="handleSearchId"></list>
2023-09-08 14:52:40 +08:00
<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
2024-04-19 10:52:03 +08:00
that.page = 1
2023-09-08 14:52:40 +08:00
this.type = options.type
2024-05-02 15:31:12 +08:00
console.log("options", options)
2023-09-08 14:52:40 +08:00
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("分享到朋友失败")
// },
// }
// },
2023-09-08 14:52:40 +08:00
methods: {
2024-04-19 10:52:03 +08:00
handleInfoList(page) {
2023-09-08 14:52:40 +08:00
let that = this
let account = {
pageNo: page,
pageSize: 10,
2024-05-02 15:31:12 +08:00
searchValue: "",
2023-09-08 14:52:40 +08:00
}
// 1资讯4公益7党建
let https = this.type == 1 ? that.$model.getinfolist(account) : this.type == 4 ? that.$model.getGongyiList(account) : that.$model.getPartyList(account)
2023-09-08 14:52:40 +08:00
return https.then((res) => {
if (res.code != 0) return
that.newsList = this.newsList.concat(res.data.rows)
that.lastPage = res.data.totalpage
})
2024-05-02 15:31:12 +08:00
},
handleSearchId(id, cnt) {
let that = this
console.log("返回", id, cnt)
that.newsList.forEach(ite => {
if (ite.id == id) {
ite.browsecnt = cnt
}
})
2023-09-08 14:52:40 +08:00
}
}
}
</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>