Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cube-index-list 上拉加载更多的时候,滚动无法到底部,底部有几个会卡顿 #684

Closed
CodingZJ opened this issue Mar 15, 2020 · 1 comment

Comments

@CodingZJ
Copy link

排行榜

时间:{{period}}

  • {{item.text}}
时间:2020.3.18-2020.6.30

名次

(总人数:{{totalPerson}}人)

个数

  • {{index+1}}

    {{item.nickName}}

    {{item.streetName}}

    {{item.skipNumber}}

  • {{index+1}}

    {{item.nickName}}

    {{item.streetName}}

    {{item.skipNumber}}

  • {{index+1}}

    {{item.nickName}}

    {{item.streetName}}

    {{item.skipNumber}}

  • <script> import ajax from '@/api/coolMatch'; import browser from '@/utils/browser'; import moment from 'moment'; import {skipPage, remindNativeRefreshJSMethod, Common } from '@/utils/common'; // 和客户端交互 export default { data(){ return { typeList:[ {text:'周'}, {text:'月'}, {text:'总排行'} ], activeIndex:2, image:'', nickName:'', period:'', rank:'-', totalPerson:'-', skipNumber:'-', totalParam:{ pageIndex:1, pageSize:10 }, totalRankVos:[], totalNum:0, monthParam:{ recordMonth:'', pageIndex:1, pageSize:10 }, totalMonth:0, monthRankVos:[], weekParam:{ recordNo:'', pageIndex:1, pageSize:10 }, weekRankVos:[], totalWeek:0, chooseVos:[], options:{ observeDOM:true, probeType: 1, pullUpLoad: { threshold: 50, txt: { noMore: '没有更多数据了' } }, pullDownRefresh: { threshold: 50, txt:'刷新成功' }
            }
        }
    },
    methods:{
        selectChange(index){
            if(index===1){
                if (!this.timePicker) {
                    this.timePicker = this.$createDatePicker({
                        min: new Date(2020, 2),
                        max: new Date(2030, 12),
                        columnCount: 2,
                        onSelect: this.monthRank,
                        onCancel: this.monthRank,
                        format: {
                            year: 'YYYY',
                            month: 'M'
                        }
                    })
                }
                this.timePicker.show()
            }
            if(index===0){
              this.chooseVos = JSON.parse(sessionStorage.getItem('chooseVos') || []);
              if (!this.picker && this.chooseVos.length!==0) {
                let temArr = [];
                this.chooseVos.forEach(item=>{
                    temArr.push({
                        text: item.key+(item.key.length===4?'':'\xa0\xa0\xa0')+'\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0时间:'+item.value,
                        value:item.recordNo
                    })
                });
                this.picker = this.$createPicker({
                    data: [temArr],
                    onSelect: this.weekRank,
                    onCancel: this.weekRank
                })
                  this.picker.show()
              }
              if(this.chooseVos.length===0){
                  this.weekRank();
              }
            }
            if(index===2){
                this.totalRank();
            }
            this.activeIndex = index
        },
        getUserInfo(){
            ajax.userInfo().then(res=>{
                if(res.code==='0'){
                    this.image = res.data.image;
                    this.nickName = res.data.nickName;
                    this.period = res.data.period;
                }
            })
        },
        totalRank(){
            ajax.totalList(this.totalParam).then(res=>{
                if(res.code==='0'){
                    this.rank = res.data.rank;
                    this.totalPerson = res.data.totalPerson;
                    this.skipNumber = res.data.skipNumber;
                    this.totalNum = res.data.total;
                    if(this.totalParam.pageIndex===1){
                        this.totalRankVos = res.data.weekRankVos;
                    } else {
                        this.totalRankVos = this.totalRankVos.concat(res.data.weekRankVos);
                    }
                    if(this.$refs.totalList){
                        this.$refs.totalList.forceUpdate(true);
                    }
                }
            })
        },
        monthRank(recordMonth){
           if(recordMonth){
                this.monthParam = {
                    recordMonth:moment(recordMonth).format('YYYY-MM'),
                    pageIndex:1,
                    pageSize:10
                }
                this.monthRankVos=[];
            } else {
                this.monthParam.recordMonth = ''
            }
            ajax.monthList(this.monthParam).then(res=>{
                if(res.code==='0'){
                    this.rank = res.data.rank;
                    this.totalPerson = res.data.totalPerson;
                    this.skipNumber = res.data.skipNumber;
                    this.totalMonth = res.data.total;
                    if(this.monthParam.pageIndex===1){
                        this.monthRankVos = res.data.weekRankVos;
                    } else {
                        this.monthRankVos = this.monthRankVos.concat(res.data.weekRankVos);
                    }
                    if( this.$refs.monthList){
                        this.$refs.monthList.forceUpdate(true);
                    }
                }
            })
        },
        weekRank(recordNo){
            this.picker='';
            if(recordNo){
                this.weekParam = {
                    recordNo:recordNo[0],
                    pageIndex:1,
                    pageSize:10
                }
                this.weekRankVos=[];
            } else {
                if(!this.weekParam.recordNo){
                    this.weekParam.recordNo = ''
                }
            }
            ajax.weekList(this.weekParam).then(res=>{
               if(res.code==='0'){
                    this.rank = res.data.rank;
                    this.totalPerson = res.data.totalPerson;
                    this.skipNumber = res.data.skipNumber;
                    this.totalWeek = res.data.total;
                     if(this.weekParam.pageIndex===1){
                        this.weekRankVos = res.data.weekRankVos;
                    } else {
                        this.weekRankVos = this.weekRankVos.concat(res.data.weekRankVos);
                    }
                    if(this.$refs.weekList){
                        this.$refs.weekList.forceUpdate(true);
                    }
                } 
            })
        },
        chooseWeek(){
            ajax.weekUserChoose().then(res=>{
                if(res.code==='0'){
                   this.chooseVos = res.data.chooseVos;
                   sessionStorage.setItem('chooseVos',JSON.stringify(res.data.chooseVos));
                }
            })
        },
        onPullingUp(){
             if(this.activeIndex==0){
               if(this.weekRankVos.length<this.totalWeek){
                   this.weekParam.pageIndex++;
                   this.weekRank();
               } else {
                    this.$refs.weekList.forceUpdate();
               }
            } else if(this.activeIndex==1){
               if(this.monthRankVos.length<this.totalMonth){
                   this.monthParam.pageIndex++;
                   this.monthRank();
               } else {
                    this.$refs.monthList.forceUpdate();
               }
            } else if(this.activeIndex==2){
               if(this.totalRankVos.length<this.totalNum){
                   this.totalParam.pageIndex++;
                   this.totalRank();
               } else {
                    this.$refs.totalList.forceUpdate();
               }
            }
        },
        onPullingDown(){
            if(this.activeIndex==0){
              this.weekParam.pageIndex=1;
              this.weekRank();
            } else if(this.activeIndex==1){
              this.monthParam.pageIndex=1;
              this.monthRank();
            } else if(this.activeIndex==2){
              this.totalParam.pageIndex=1;
              this.totalRank();
            }
        },
        closeWebView(){
            skipPage(202,2)
        }
    },
    created(){
        skipPage(205,2);// 全屏风格
        let accessToken  = localStorage.getItem('accessToken')
        console.log('accessToken',accessToken)
        if(accessToken){
            this.getUserInfo();
            this.totalRank();
            this.chooseWeek();
        } else {
            remindNativeRefreshJSMethod('300');
            dsBridge.register('getPlatformToken',data => {
                let useMsg = JSON.parse(decodeURIComponent(data));
                if(!useMsg.accessToken) {//用户第一次未登录
                    skipPage(100);
                } else {
                    localStorage.setItem('accessToken', useMsg.accessToken);
                    localStorage.setItem('platformType', 'h5-'+ useMsg.platformType);
                    this.getUserInfo();
                    this.totalRank();
                    this.chooseWeek();
                }
                return 'suceess';
            })
        }
    }
    

    }
    </script>

    <style lang="scss"> .rank-list-wrap{ display: flex; flex-direction: column; align-items: center; width: 100%; height: 100%; .rank-card{ display: flex; flex-direction: column; width: 100%; height:4.8rem; padding-top: .8rem; background:linear-gradient(180deg,rgba(86,195,248,1) 0%,rgba(43,144,238,1) 100%); box-sizing: border-box; .title-wrap{ display: flex; height: .88rem; align-items: center; .back{ width: .22rem; height: .44rem; padding-left: .32rem; } .web-title{ font-size:.36rem; padding-left: 1.92rem; font-weight:500; color:rgba(255,255,255,1); } } .user-wrap{ display: flex; height: 1.8rem; line-height: 1.8rem; padding-top: .4rem; padding-left: .3rem; box-sizing: border-box; img{ border-radius: 50%; width: 1.4rem; height: 1.4rem; } div{ display: flex; flex-direction: column; justify-content: center; padding-left: .2rem; align-items: flex-start; p:first-of-type{ height:.36rem; font-size:.36rem; font-weight:500; color:rgba(255,255,255,1); line-height:.36rem; } p:last-of-type{ height:.4rem; font-size:.28rem; font-weight:400; color:rgba(255,255,255,1); line-height:.4rem; } } } .select-wrap{ display: flex; flex-direction: row; height: 1.32rem; width: 100%; li{ display: flex; flex: 1; font-size:.32rem; font-weight:400; justify-content: center; box-sizing: border-box; padding-top: .48rem; span{ color:rgba(255,255,255,1); font-size:.32rem; font-weight:400; line-height:.44rem; padding-top: 0.08rem; box-sizing: border-box; } .active-li{ display: flex; width: 1.6rem!important; height: .84rem; color: #3096EF; background-image:url('../../assets/images/coolMatch/current_active.png') ; background-repeat: no-repeat; background-size: cover; justify-content: center; } } } } .time-card{ display: flex; width:6.54rem; height:.8rem; background:rgba(43,144,238,1); border-radius:.4rem; opacity:0.5; font-size:.28rem; font-weight:500; color:rgba(255,255,255,1); line-height:.8rem; justify-content: center; margin-top: .2rem; } .desc-wrap{ display: flex; height: 2.34rem; width: 100%; padding:.3rem 0; box-sizing: border-box; div{ display: flex; flex: 1; flex-direction: column; align-items: center; p:first-of-type{ height:.94rem; font-size:.8rem; font-weight:bold; color:rgba(51,51,51,1); line-height:.94rem; } p:nth-of-type(2){ height:.44rem; font-size:.32rem; font-weight:400; color:rgba(51,51,51,1); line-height:.44rem; } .people-num{ width:1.94rem; height:.34rem; font-size:.24rem; font-weight:400; color:rgba(153,153,153,1); line-height:.34rem; } } } .rank-ul-wrap{ display: flex; flex-direction: column; width: 100%; padding-bottom: .84rem; // height: calc(100% - 7.74rem); flex: 1; position: relative; .rank-li{ position: relative; flex-direction: row; display: flex; height: 1.2rem; align-items: center; padding: 0 .30rem; &::after{ position: absolute; content: ''; bottom: 0; left: .3rem; right: 0; height:.02rem; background-color: #EFEFEF; } .rank-good{ width: .48rem; height: .48rem; } .rank-li-num{ display: flex; width: .48rem; justify-content: center; font-size:.24rem; font-weight:500; color:rgba(102,102,102,1); } .ranking-head-img{ width: .72rem; height: .72rem; border-radius: 50%; margin: 0 .2rem; } .ranking-content{ display: flex; flex: 1; flex-direction: column; align-items: flex-start; font-size:.24rem; font-weight:600; line-height: .34rem; .rank-li-name{ color:#222; } .rank-li-street{ color:#666; } } .step-wrap{ display: flex; flex-direction: column; align-items: flex-end; span:first-of-type{ height:.44rem; font-size:.32rem; font-weight:600; color:rgba(43,144,238,1); line-height:.44rem; } span:last-of-type{ height:.34rem; font-size:.24rem; font-weight:400; color:rgba(153,153,153,1); line-height:.34rem; } } } } } .cube-picker-confirm { color: #2B90EE!important; } .cube-picker-wheel-wrapper > div{ font-size:.32rem!important; } </style>[](url)
    @CodingZJ CodingZJ changed the title cube-index-list下拉刷新的时候加载更多的时候,滚动无法到底部,底部有几个会卡顿 cube-index-list 上拉加载更多的时候,滚动无法到底部,底部有几个会卡顿 Mar 15, 2020
    @dolymood
    Copy link
    Contributor

    虽然没看明白 但是猜测 数据load后初始化
    以及保障外层高度确定 即 height 100% 有效

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants