123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <template>
- <view class="container club clearfix">
- <view class="club-main">
- <view v-if="isEmpty" class="empty-container">
- <image class="club-empty-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png" mode="aspectFit"></image>
- <view class="txt">暂无公告~</view>
- </view>
- <view v-else class="club-list">
- <scroll-view scroll-y="true">
- <view class="list" v-for="(list, index) in newsList" :key="index" @tap='detail(list.id)'>
- <view class="list-left">
- <text class="iconfont icon-xiaochengxu"></text>
- <text class="txt">{{ list.title }}</text>
- </view>
- <view class="list-right">{{ list.creationtime }}</view>
- </view>
- <!--加载loadding-->
- <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
- <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text='nomoreText'></tui-nomore>
- <!--加载loadding-->
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import authorize from '@/common/config/authorize.js'
- import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
- import tuiNomore from '@/components/tui-components/nomore/nomore'
- export default {
- components:{
- tuiLoadmore,
- tuiNomore,
- },
- data() {
- return {
- serviceProviderId:'',
- isShowClose:false,
- searchInputVal:'',
- isEmpty:false,
- listQuery:{
- pageNum:1,
- pageSize:20,
- },
- nomoreText: '上拉显示更多',
- hasNextPage:false,
- loadding: false,
- pullUpOn: true,
- pullFlag: true,
- allowDataStatus:true,
- wrapperHeight:'100%',
- scrollHeight:'',
- deleteAddressId:'',
- currPage:'',//当前页面
- prevPage:'',//上一个页面
- tabCurrentIndex:0,
- listStatus:1,
- newsList:[],
- isIphoneX:this.$store.state.isIphoneX,
- show_index:0,//控制显示那个组件
- }
- },
- onLoad(){
- this.setScrollHeight()
- this.GetNewsList()
- },
- methods: {
- setScrollHeight() {
- // 窗口高度 - 底部距离
- setTimeout(()=> {
- const query = wx.createSelectorQuery().in(this)
- query.selectAll('.add-btn').boundingClientRect()
- query.exec(res => {
- if(res[0][0]){
- let winHeight = this.$api.getWindowHeight(),
- eleTop = res[0][0].top - 1
- this.scrollHeight = eleTop
- }
- })
- }, 500)
- },
- GetNewsList(){
- this.CommonService.GetNewsList(this.listQuery).then(response =>{
- let data = response.data
- if(data.results && data.results.length > 0){
- this.isEmpty = false
- this.hasNextPage = data.hasNextPage
- this.newsList =data.results
- this.pullFlag = false
- setTimeout(()=>{this.pullFlag = true},500)
- if(this.hasNextPage){
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- }else{
- this.pullUpOn = true
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }else{
- this.isEmpty = true
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- getOnReachBottomData(){
- this.listQuery.pageNum+=1
- this.CommonService.GetNewsList(this.listQuery).then(response =>{
- let data = response.data
- if(data.results && data.results.length > 0){
- this.hasNextPage = data.hasNextPage
- this.newsList = this.newsList.concat(data.results)
- this.pullFlag = false// 防上拉暴滑
- setTimeout(()=>{this.pullFlag = true},500)
- if(this.hasNextPage){
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- }else{
- this.pullUpOn = false
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- detail(id){// 跳转公告详情
- this.$api.navigateTo(`/pages/service/news-detailes?id=${id}`)
- },
- },
- onReachBottom() {
- if(this.hasNextPage){
- this.loadding = true
- this.pullUpOn = true
- this.getOnReachBottomData()
- }
- },
- onPullDownRefresh() {
- setTimeout(() => {
- this.listQuery.pageNum = 1
- this.GetNewsList()
- uni.stopPullDownRefresh()
- }, 200)
- },
- onShow() {
-
- }
- }
- </script>
- <style lang='scss'>
- page {
- height: auto;
- }
- page,.container{
- /* padding-bottom: 120upx; */
- background: #FFFFFF;
- }
- .container{
- position: relative;
- }
- .club-main{
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 24rpx;
- .list{
- display: flex;
- align-items: center;
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- background: #FFFFFF;
- position: relative;
- border-bottom: 1px solid #EBEBEB;
- .list-left{
- display: flex;
- flex: 8;
- .icon-xiaochengxu{
- font-size: $font-size-22;
- color: #999999;
- margin-right: 10rpx;
- }
- .txt{
- display: flex;
- flex: 1;
- font-size: $font-size-26;
- color: $text-color;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- }
- .list-right{
- font-size: $font-size-24;
- color: #999999;
- text-align: right;
- }
- }
- }
- </style>
|