zhaojs
2023-06-28 ba41c12799f35267d5a28d20a87b003c0c015b0a
public/html/fengqiangbang.html
@@ -241,7 +241,7 @@
            font-weight: 500;color: #fff;line-height: .65rem;text-align: center;
        }
        .list-container .card-block{
            padding-top: 15px;
        }
        .sys{
            width: 100%;
@@ -278,6 +278,11 @@
            font-size: .35rem;
            color: #333;
        }
        .contscore
        {
            overflow:scroll;
            height: 80vh;
        }
    </style>
</head>
@@ -310,7 +315,7 @@
        <div class="swiper-container card-block">
            <div class="swiper-wrapper">
                <div class="swiper-slide swiper-no-swiping">
                <div class="swiper-slide swiper-no-swiping contscore">
                        <div class="topThree">
                                <div v-for="(item,index) in goodsList" :key = "index" v-if="index==1"  @click="handleCdetailFavorite(item)">
                                    <a>
@@ -455,9 +460,16 @@
                }
            ],
            platid:'tb',
            scrollTop: 0,
         canScroll: false,
            nowPage:1,
            loadData:false
        },
        onload(options){
            console.log(options);
        },
        onReachBottom(){
            console.log("到底了111");
        },
        methods:{
            getItemDetail:function(items)
@@ -477,6 +489,29 @@
                    }).done(function(res){
                       _config.jumpGoodsUrl(res.data,_this.platid);
                    })
            },
            scrollLoad: function() {
            //
            var _this = this;
            var range = 800; //距下边界长度/单位px
            var totalheight = 0;
            $('.contscore').scroll(function() {
               var scroll = document.getElementsByClassName('contscore')
               var srollPos = $('.contscore').scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)
               totalheight = parseFloat($('.contscore').height()) + parseFloat(srollPos);
               _this.scrollTop = srollPos
               var scrollH = scroll[0].scrollHeight
               // debugger
               // console.log('scrollH - range',scrollH - range,'srollPos',srollPos)
               if (scrollH - range <= srollPos) {
                  if (_this.canScroll&&_this.platid!='tb') {
                            _this.canScroll = false;
                     _this.loadData = true;
                     _this.nowPage++;
                     _this.getGoodsList(_this.cid);
                  }
               }
            });
            },
            handleCdetailFavorite: function (items) {
                if(_config.jumpGoodsUrl){
@@ -552,7 +587,9 @@
                })
            },
            chooseCate:function(index,cid,type){//选择分类
                mySwiper.slideTo(index-2, 1000, false)
                mySwiper.slideTo(index-2, 1000, false);
                this.nowPage=1;
                this.goodsList=[];
                this.actIndex = index;
                this.getGoodsList(cid,type)
                this.cid = cid;
@@ -561,11 +598,13 @@
            choosePlat:function(index,id)
            {//选择平台
                this.platid = id;
                this.goodsList=[];
                this.getCateList();
            },
            getCateList:function(){//获取分类列表
                var _this = this;
                //_this.loading=true;
                this.nowPage=1;
                if(this.platid=='tb')
                {
                    $.ajax({
@@ -684,11 +723,20 @@
                        cid:cid,
                        type:type,
                        app_key: _config.appKey,
                        mainid:_this.nowPage
                    }
                }).done(function(res){
                    _this.loading=false;
                    if(res.code == 0){
                        _this.goodsList =_this.platid=='tb'? res.data.data.data:res.data;
                        var resdata=_this.platid=='tb'? res.data.data.data:res.data;
                        _this.goodsList=_this.goodsList.concat(resdata);
                        if(resdata&&resdata.length>0)
                        {
                            _this.canScroll=true;
                        }
                        else{
                            _this.canScroll=false;
                        }
                      //  _this.sys = (res.data.data && res.data.data.sys) ? res.data.data.sys : null;
                    }
                    else {
@@ -769,6 +817,7 @@
        mounted:function(){
            this.getCateList();
            this.cateRender();
            this.scrollLoad();
            // this.getDateNow();
            //this.getGoodsList();
           // this.getNowTime();