ListDetailsApe.js 4.4 KB
//*
// 列表详情模块
// */

import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";

let loger = Loger.getLoger('PC-ListDetailsApe');
class ListDetailsApe extends Ape {
    constructor() {
        super();
        this.addEvent();
        this.init();
    }

    init() {
        $('#themeBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));
        $('#collectYes ').on('click',this._collectYesHandler.bind(this));
        $('#collectNo ').on('click',this._collectNoHandler.bind(this));
    }

    addEvent() {

    }
    _curriculumListHandler(evt){
        $('#slideshow').hide();
        let _id = evt.currentTarget.id;
        this.detailPage(_id);
    }
    _collectYesHandler(){
        $('#collectYes ').hide();
        $('#collectNo ').show();
    }
    _collectNoHandler(){
        $('#collectYes ').show();
        $('#collectNo ').hide();
    }
    detailPage(_id){
        let that = this;
        let signInfo = {
            id: _id,
            siteId:'markettest'
        }
        let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
        $.ajax({
            type: "post",
            url: _url,
            timeout:5000,
            headers: {
                siteId:'markettest',
                'token':'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IlhXQnJlRU00T0swYTVqUUIyUTFicGtObHlxOUFWbXZkIiwibmFtZSI6ImFkbWluIiwiY29kZSI6MSwiaWF0IjoxNTAzNDUxODU0LCJleHAiOjIyODEwNTE4NTR9.3kTVzKd_jbP7l69nxOpNaFeSjVnnjZkagYMzRB8fjNo'
                },
            data:signInfo,
            success:function(_data){
                //获取课堂数据
                if(_data || _data.code == 200){
                    that._gainClassData(_data);
                }
            },
            error:function(error){
                console.log(error,'失败')
            }
        })
    }
    _gainClassData(_data){
        //切换列表内容
        this._classDateContent(_data.returnData.data);
    }
    _classDateContent(_data){
        let _dataList = _data.meetingInfo[0];
        if(_dataList.meetingType == 1){
            loger.log('互动课堂')
            this._lanclassRender(_dataList);
        }else if(_dataList.meetingType == 2){
            loger.log('直播课堂')
            this._liveRender(_dataList);
        }else{
            this._lanclassRender(_dataList);
        }
        $('#classifyListBox').hide();
    }
    //互动课堂
    _lanclassRender(_dataList){
        $('#defaultBox').hide();
        $('.curriculumBox').hide();
        $('#teacherDetailBox').show();

        $('#teacherDetailInfoImg').attr('src','images/u293.png');//老师授课标题图片
        $('#teacherDetailInfoDetailName').text(_dataList.userName);//老师名字
        $('#teacherDetailInfoDetailSex').text();//老师性别
        $('#teacherDetailInfoDetailPoint').text();//老师专长
        $('#teacherDetailInfoDetailAge').text(_dataList.capacity+'年');//老师教龄
        $('#teacherDetailInfoDetailGrade').text();//老师评分
        $('#teacherDetailReferralContent').text();//老师授课内容
        $('#teacherDetailPost').text();//老师职称
        $('#teacherDetailEducation').text();//老师学历
        $('#teacherDetailAcademy').text();//老师院校
        $('#teacherDetailWay').text();//老师授课方式
        $('#teacherDetailArea').text();//老师授课地区
        $('#teacherDetailSynopsis').text();//老师授课简介

    }
    //直播课堂
    _liveRender(_dataList){
        $('#defaultBox').hide();
        $('.curriculumBox').hide();
        $('#lanclassBox').show();

        $('#lanclassContentCover').attr('src','images/u373.png');//老师授课标题图片
        $('#lanclassContentTitle').text();//老师授课标题
        $('#lanclassContentInfoPortrait').text();//老师授课老师头像
        $('#lanclassContentInfoName').text();//老师授课老师名字
        $('#lanclassContentInfoTimeStart').text(_dataList.createTime);//老师授课开始时间
        $('#lanclassContentInfoTimeEnd').text(_dataList.endTime);//老师授课结束时间
        $('#collectYes');//老师授课是否收藏
        $('#collectNo');//老师授课是否收藏
        $('#lanclassIntroduceDescription').text();//老师授课课程介绍
        $('#teacherInfoSchool').text();//老师学院
        $('#teacherInfoContent').text();//老师专业等级信息
    }
}
export default ListDetailsApe;