The problem of getting the value of the closure forEach is urgent.

require(["../../common/common-d10c9dda2d.js"],function(common){
    require(["utils","specialBanner","SpecialCourseSeries","SpecialConference","SpecialArticleModel","Pullload","specialList"],function(utils,specialBanner,SpecialCourseSeries,SpecialConference,SpecialArticleModel,Pullload,specialList) {

        var videoList = {
            containerId:"college-channel-content1",
            // subjectId:utils.optUrlParams("subjectId")||"",
            subjectId:"850192620763222016",
            subjectCategoryId:"848649468520697856",
            startIndex:0,
            pageSize:20,
            init:function(){
                var _this = this;
                var banner = new specialBanner("banner-container");
                banner.init();
                this.getBanner(function(data){
                    banner.update(data);
                })
                var mPullload = new Pullload("video-list-page","",_this.dataApi.bind(_this),_this.pageSize,_this.dataInit.bind(_this),window);
                mPullload.init();
                // utils.pullRefresh($(".main-content")[0],mPullload.init.bind(mPullload));
                this.getApi(function(data){
                    $(".special-tab-container").html(_.template($("-sharpspecial-tab-container").html())({ data: data }))
                    // slide function
                })
            },
            dataApi:function(callback){
                this.getApi(function(data){
                    data.subjectCategorys.forEach(function(el){
                        this.subjectCategoryId = el.subjectCategoryId;
                        this.startIndex = 0;
                        this.pageSize = 20;
                        this.subjectId = el.subjectId;
                        var params = {startIndex:this.startIndex,pageSize:this.pageSize,subjectId:this.subjectId,subjectCategoryId:this.subjectCategoryId}
                        huiguPost(function(data){
                            if(data.code == 0){
                                callback&&callback(data.data);
                            }else{
                                utils.Errordata();
                            }
                        },"http://develop.huiguqx.com/thirdpartyapi/subject/querySubjectArticles", params)
                    })
                })
            },
            dataInit:function(data){
                var _this = this;
                data&&data.forEach(function(el){
                    if(!el) return;
                    var index = 0;
                    var id = _this.containerId;
                    var element = null;
                    console.log(el);
                    switch(el.sourceType){
                        case 1: el.sourceType = 1;element = new SpecialArticleModel(id,el);break;
                        case 2: el.sourceType = 2;element = new SpecialCourseSeries(id,el);break;
                        case 3: el.sourceType = 3;element = new SpecialCourseSeries(id,el,_this.swiperIndexPP);break;
                        case 4: el.sourceType = 4;element = new SpecialConference(id,el);break;
                    }
                    element&&element.init();
                    indexPP;
                })
            },
            getBanner:function(callback){
                var params = {subjectId:this.subjectId};
                huiguPost(function(data){
                    if(!data.data || data.data.length <= 0){
                        $("-sharpvideo-list-page -sharpbanner-container").hide();
                    }else{
                        $("-sharpvideo-list-page -sharpbanner-container").show();
                        callback&&callback(data);
                    }
                },"http://develop.huiguqx.com/thirdpartyapi/subject/getSubjectDetail",params)
            },
            getApi:function(callback){
                var params = {subjectId:this.subjectId};
                huiguPost(function(data){
                    if(data.code == 0){
                        callback&&callback(data.data);
                    }else{
                        utils.Errordata();
                    }
                },"http://develop.huiguqx.com/thirdpartyapi/subject/getSubjectDetail", params)
            }
        }
        videoList.init();
    })
})
The

code is shown above, where there are two api requests. The id of the first api request needs to be bound to the id of the second api request. Now it"s subjectCategoryId
subjectCategoryId. There are four kinds of
that want to have this effect

.

clipboard.png

now there are no restrictions on all subjectCategoryId, and all the content runs on the tab of category 4. If you want each subjectCategoryId to be displayed in only one tab, how do you modify the code?

Apr.02,2021

Brother, a question like yours will make the viewer walk away with a ctrl+w backhand. It is suggested to find a more specific problem

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eacedd-211a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eacedd-211a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?