董佳音

更改进入详情页详细,个人中心个人信息分类

... ... @@ -1255,7 +1255,6 @@ body{
position: absolute;
left: 50%;
right: 50%;
margin-left:-210px;
background: #fff;
}
.userLogin{
... ... @@ -1298,6 +1297,8 @@ body{
border:none;
background: none;
outline: none;
border-radius: 2px;
}
.userVerifyLiInputBtn{
height:32px;
... ... @@ -1368,9 +1369,6 @@ body{
.loginBtn{
color:#d95136;
}
.usersignNameLi{
position: relative;
}
.requiredMsg{
position: absolute;
right:-15px;
... ... @@ -1468,7 +1466,6 @@ body{
position: absolute;
left: 50%;
top: 0;
margin-left:-150px;
z-index: 1;
background: #fffdfd;
cursor: default;
... ... @@ -1895,7 +1892,6 @@ body{
position: absolute;
left: 50%;
top: 50%;
margin-left:-205px;
}
.updateInputContent{
padding: 55px 35px;
... ... @@ -2023,4 +2019,9 @@ body{
text-align: center;
line-height: 305px;
}
.dataCenterErrorTitle{
font-size: 14px;
color: #999999;
padding-left: 15px;
}
... ...
... ... @@ -90,7 +90,6 @@
</div>
<!--课堂分类列表-->
<!--最新直播课程-->
<div class="classifyListBox" id="liveContentAllBox">
<div class="classifyListTitle">最新直播课程</div>
<div class="classifyListContent" id="liveContent">
... ... @@ -1699,11 +1698,11 @@
<ul>
<li class="usersignTit">登录</li>
<li class="usersignNameLi usersignLi">
<input id="loginName" class="usersignInput" type="text" placeholder="手机/用户名/邮箱" maxlength="20"
<input id="loginName" class="usersignInput classThemeInfo" type="text" placeholder="手机/用户名/邮箱" value="" maxlength="20"
onkeyup="this.value=this.value.replace(/^ +| +$/g,'')">
</li>
<li class="userPassWordLi usersignLi">
<input id="loginPassWord" class="userPassWordInput usersignInput" type="password" placeholder="密码" maxlength="20"
<input id="loginPassWord" class="usersignInput classThemeInfo" type="password" placeholder="密码" value="" maxlength="20"
onkeyup="this.value=this.value.replace(/^ +| +$/g,'')">
</li>
<p class="forgetPasswordBtn" id="forgetPasswordBtn">
... ...
... ... @@ -29,5 +29,6 @@ MessageTypes.ORDER_FINISH= "order_finish"; //预约成功
//个人中心
MessageTypes.LOGIN_MYCENTER= "login_mycenter"; //预约成功
MessageTypes.ROLE_MESSAGE= "role_message"; //我的信息
export default MessageTypes;
... ...
... ... @@ -7,7 +7,6 @@ import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import dateUI from 'libs/laydate';
import ErrorApe from "./ErrorApe";
let loger = Loger.getLoger('PC-AboutClassApe');
const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" id="t_box" class="t_box">
... ... @@ -161,7 +160,7 @@ class AboutClassApe extends Ape {
that._gainUserClassData(_data.returnData.data);
}else{
//显示老师界面
that._gainUserClassData1(_data.returnData.data);
// that._gainUserClassData1(_data.returnData.data);
}
}
},
... ...
... ... @@ -33,7 +33,7 @@ class AdministratorApe extends Ape {
//设置当前时间 给输入框默认值
this._setNewTime();
//设置弹框位置
this._setMarginTop();
// this._setMarginTop();
}
_switchover(evt){
$(evt.currentTarget).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
... ... @@ -88,15 +88,18 @@ class AdministratorApe extends Ape {
this._setMarginTopHandler($('#usersign'));//注册
this._setMarginTopHandler($('#warnHintBox'));//错误提示
this._setMarginTopHandler($('#removeHandler'));//删除
this._setMarginTopHandler($('#updateInputBox'));//修改信息输入框
this._setMarginTopHandler($('.updateInputBox'));//修改信息输入框
this._setMarginTopHandler($('#teacherDetailReminders'));//预约成功弹框
this._setMarginTopHandler($('#createUser'));//注册老师账号
this._setMarginTopHandler($('#createClass'));//创建课堂
}
//设置弹框位置 方法
_setMarginTopHandler(_data){
let clienth = document.documentElement.clientHeight || document.body.clientHeight
_data.css('margin-top',Math.abs((clienth - parseInt(_data.height()))/2))
let top = ($(window).height() - _data.height())/2;
let left = ($(window).width() - _data.width())/2;
let scrollTop = $(document).scrollTop();
let scrollLeft = $(document).scrollLeft();
_data.css( { position : 'absolute', 'top' : top + scrollTop, left : left + scrollLeft } );
}
}
export default AdministratorApe;
\ No newline at end of file
... ...
... ... @@ -52,8 +52,6 @@ class CreateClassApe extends Ape {
isLocalStorage(){
//设置当前时间 给输入框默认值
this._setNewTime();
//设置弹框位置
this._setMarginTop();
}
_showPresentTime(){
let newDate = new Date();
... ... @@ -318,26 +316,6 @@ class CreateClassApe extends Ape {
$('#liveInfoCenterLiveEnd').html(time);
$('#createUserAbortTime').html(time);
}
//设置弹框位置
_setMarginTop(){
this._setMarginTopHandler($('#createUserAccount'));//创建用户选择身份
this._setMarginTopHandler($('#userLogin'));//登录
this._setMarginTopHandler($('#usersign'));//注册
this._setMarginTopHandler($('#warnHintBox'));//错误提示
this._setMarginTopHandler($('#removeHandler'));//删除
this._setMarginTopHandler($('#updateInputBox'));//修改信息输入框
this._setMarginTopHandler($('#teacherDetailReminders'));//预约成功弹框
this._setMarginTopHandler($('#createUser'));//注册老师账号
this._setMarginTopHandler($('#createClass'));//创建课堂
this._setMarginTopHandler($('#createGrade'));//创建班级
this._setMarginTopHandler($('#manageClass'));//管理班级
}
//设置弹框位置 方法
_setMarginTopHandler(_data){
let clienth = document.documentElement.clientHeight || document.body.clientHeight
_data.css('margin-top',(clienth - parseInt(_data.height()))/2)
}
_dateUI(){
//执行一个laydate实例
dateUI.render({
... ...
... ... @@ -21,8 +21,8 @@ class ListDetailsApe extends Ape {
$('#liveContentAllBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));//直播详情页
$('#liveListBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));//首页 进入 直播详情页
$('#lanclassAllBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));//互动详情页
$('#lanclassList ').on('click','.classifyList',this._curriculumListHandler.bind(this));//首页 进入 互动详情页
$('#lanclassAllBox ').on('click','.classifyList',this._liveListHandler.bind(this));//互动详情页
$('#lanclassList ').on('click','.classifyList',this._liveListHandler.bind(this));//首页 进入 互动详情页
$('#teacherIntroAllBox ').on('click','.classifyList',this._teacherInfoHandler.bind(this));//老师详情页
$('#teacherIntro ').on('click','.classifyList',this._teacherInfoHandler.bind(this));//首页 进入 老师详情页
... ... @@ -33,17 +33,21 @@ class ListDetailsApe extends Ape {
}
_curriculumListHandler(evt){
let buttonIsCheck = $('#orderBtn').attr('value','1');
/* let buttonIsCheck = $('#orderBtn').attr('value','1');
if($('#orderBtn').attr('value') == '1'){
$('#orderBtn').attr('disabled',true)
$('#orderBtn').css('background','#3498db')
}
this.commonalityClass();
}*/
let _id = $(evt.currentTarget).attr('data');
this._id = _id;
this.classInfoDetail(_id);
this.commonalityClass();
}
_liveListHandler(evt){
let _id = $(evt.currentTarget).attr('data');
this._id = _id;
this.liveInfoDetail(_id);
this.commonalityClass();
}
commonalityClass(){
$('#slideshow').hide();
... ... @@ -63,6 +67,21 @@ class ListDetailsApe extends Ape {
let that = this;
let data = {
id: _id,
meetingStatus:2,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
this.detailPage(_url,data,function(_data){
if(_data){
that._gainClassData(_data.returnData.data);
}
})
}
liveInfoDetail(_id){
let that = this;
let data = {
id: _id,
meetingStatus:1,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
... ... @@ -86,60 +105,22 @@ class ListDetailsApe extends Ape {
}
})
}
detailPage(url,data,callback){
$.ajax({
type: "POST",
url: url,
timeout:5000,
data : data,
headers: {siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
_gainClassData(_data){
let _dataList = _data.meetingInfo;
if(_dataList){
for(let i = 0;i<_dataList.length;i++){
let item = _dataList[i];
if(item.id == this._id ){
this._liveRender(item);
loger.log('课堂信息桑心',item)
}
}
}
if(_data){
let _dataList = _data.meetingInfo;
if(_dataList){
this._liveRender(_dataList[0]);
loger.log('课堂信息信息',_dataList)
}
}
}
_classDateContent(_data){
let teacherList = _data.users;
if(teacherList){
for(let i = 0;i<teacherList.length;i++){
let item = teacherList[i];
if(item.id == this._id){
this._lanclassRender(item);
}
if(_data){
let teacherList = _data.users;
if(teacherList){
this._lanclassRender(teacherList[0]);
loger.log('课堂信息信息',teacherList)
}
}
}
//老师
... ... @@ -182,5 +163,34 @@ class ListDetailsApe extends Ape {
$('#teacherInfoSchool').text();//老师学院
$('#teacherInfoContent').text();//老师专业等级信息
}
detailPage(url,data,callback){
$.ajax({
type: "POST",
url: url,
timeout:5000,
data : data,
headers: {siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
}
export default ListDetailsApe;
\ No newline at end of file
... ...
... ... @@ -63,17 +63,20 @@ class LoginOrRegister extends Ape {
}
//注册跳转登录界面
_skipLoginBtnHandler(){
ClassDataProxy.getMarginTopHandler($('#userLogin'));
$('#userSignBox').hide();
$('#userLoginBox').show();
}
//新用户注册
_nowUserSignHandler(){
ClassDataProxy.getMarginTopHandler($('#usersign'));
$('#userLoginBox').hide();
$('#userSignBox').show();
}
//首页用户登录
_homeUserLoginBtnHandler(){
if(!window.localStorage.getItem('status')){
ClassDataProxy.getMarginTopHandler($('#userLogin'));
$('#userLoginBox').show();
}
}
... ... @@ -223,9 +226,11 @@ class LoginOrRegister extends Ape {
if(_data && _data.code == 200){
// alert('注册成功')
console.log(_data,'成功')
ClassDataProxy.getMarginTopHandler($('#warnHintBox'));
ErrorApe.showWarnError('注册成功');
that._successSign(_data);
}else{
ClassDataProxy.getMarginTopHandler($('#warnHintBox'));
ErrorApe.showWarnError(_data.returnData.data.msg);
// alert(_data.returnData.data.msg)
}
... ... @@ -281,6 +286,7 @@ class LoginOrRegister extends Ape {
loger.log('登录返回数据',_data)
if(_data && _data.code == 200){
// alert('登录成功')
ClassDataProxy.getMarginTopHandler($('#warnHintBox'));
ErrorApe.showWarnError('登录成功');
ClassDataProxy.userType= _data.returnData.data.userType;
ClassDataProxy.loginName =_name.value;
... ... @@ -311,6 +317,7 @@ class LoginOrRegister extends Ape {
that.updateChangeUser(_data);
}else{
ClassDataProxy.getMarginTopHandler($('#warnHintBox'));
ErrorApe.showWarnError(_data.returnData.data.msg);
// alert(_data.returnData.data.msg)
}
... ...
... ... @@ -72,7 +72,7 @@ class ManagementHomePageApe extends Ape {
$('#classHandlerEndPage0').on('click',this._endPageHandler.bind(this));//尾页
$('#classHandlerSpecificPage0').on('click',this._assignPageHandler.bind(this));//指定页
$('#courseContent0').on('click','.deleteClass',this._deleteClass.bind(this));//删除课堂
// $('#courseContent0').on('click','.deleteClass',this._deleteClass.bind(this));//删除课堂
$('#courseContent0').on('click','.joinClass',this._joinClass.bind(this));//加入课堂
}
... ...
//*
// 个人中心 我的预约
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import ErrorApe from "./ErrorApe";
import MessageTypes from "../MessageTypes";
const classifyList = `<div class="courseMinuteListTimeTit" style="display: {_isShowTitle}">
<span class="courseMinuteListTime">{_liveTimer}</span>
<span class="courseMinuteListWire"></span>
</div>
<div class="classifyListMyCenter {_classifyListR}">
<div class="myCenterContentMask accessLearningBtn">
<button class="myCenterContentMaskBtn btnHover" data="{_meetingNumber}">进入学习</button>
</div>
<div class="myCenterContentMask cancelReservation">
<button class="myCenterContentMaskBtn btnHover" data="{_studentMeetingId}">取消预约</button>
</div>
<img class="myCenterContentListImg" src="{_msgImg}" alt="">
<p class="myCenterContentListTit">{_meetingName}</p>
<p class="myCenterContentListTit1">主讲人:{_create_user}</p>
<p class="myCenterContentMin">45min</p>
<span class="myCenterContentTimer">{_liveTimer}</span>
</div>`;
const curriculumList = `<li class="teacherTodayCourseList">
<span class="courseDetailInfo">{_infoTit}</span>
<span class="courseDetailInfo1">距开始还有:<i class="teacherStartContent">{_countDown}</i></span>
<button class="teacherEnterClass btnHover" data="{_meetingNumber}" style="display: {_isShow}">立即进入</button>
</li>`;
const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" class="t_box">
<tbody>
<tr align="center" height="44" class="tr_center" bgcolor="#fff" bordercolor="#e6e6e6">
<th width="7%" class="tr_center">
课堂主题
</th>
<th width="7%" class="tr_center">
课堂号
</th>
<th width="7%" class="tr_center">
老师
</th>
<th width="7%" class="tr_center">
课堂状态
</th>
<th width="15%" class="tr_center">
课堂时间
</th>
<th width="7%" class="tr_center">
在线人数
</th>
<th width="10%" class="tr_center">
操作
</th>
</tr>
`;
//管理首页
const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor="#e6e6e6">
<td width="7%" class="tr_main tr_mainLeft">{_meetingName}</td>
<td width="7%" class="tr_main">{_meetingNumber}</td>
<td width="7%" class="tr_main">{_create_user}</td>
<td width="7%" class="tr_main">{_state}</td>
<td width="15%" class="tr_main">{_timer}</td>
<td width="7%" class="tr_main">{_num}</td>
<td width="10%" class="tr_main tr_mainRight" align="center">
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="###">文档</a>
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="###">多媒体</a>
<a class="classHandlePort resolveBtn" href="###" data="{_aboutMsg}">伴音</a>
</td>
</tr>
`;
const adminListEnd = `</tbody></table>`;
//学生端显示老师信息
const teacherInfoLeft = `<div class="teacherCorrelatedInfoBox">
<div class="teacherCorrelatedInfoLeft">
<img class="teacherCorrelatedInfoImg" id="teacherCorrelatedInfoImg" src="images/u293.png" alt="">
<div class="teacherCorrelatedInfo">
<b class="teacherCorrelatedInfoName" id="teacherCorrelatedInfoName">{_teacherName}</b>
<b class="teacherCorrelatedInfoMajor">北京市|少儿英语</b>
<b class="teacherCorrelatedInfoCourse">课程:50</b>
<span class="teacherCorrelatedInfoMajorMsg">毕业于外国语学院,专业8</span>
<p class="cancelReservationBtn"">取消预约</p>
</div>
</div>
<div class="teacherCorrelatedInfoCenter">`;
const teacherInfoCenter= `<img class="teachercourseImg" data="{_id}" src="{_imgSrc}" alt="">`;
const teacherInfoRight = `</div> <div class="teacherCorrelatedInfoBtn" data="{_teacherName}">更多课程</div>
</div></div>`;
const teacherDetail = `<span class="teacherDetailCurriculumList">《{_detailList}》</span>`
let loger = Loger.getLoger('PC-MyBookingsApe');
class MyBookingsApe extends Ape {
constructor() {
super();
this.dataList = {};
this.teacherList = {};
this.presentInd = 1;//点击翻页默认为第一页
this._judgeListPlace();
this.addEvent();
this.init();
}
init() {
$('#personageInfo').on('click',this._myCenterBoxHandler.bind(this));//个人中心
$('#teacherUI li').on('click',this._recordLiHandler.bind(this));//课堂分类
$('#teacherInfoList li').on('click',this._teacherInfoListHandler.bind(this));//首页 老师 直播分类 正在直播 未开始 已结束
$('#studentInfoList li').on('click',this._studentInfoListHandler.bind(this));//首页 学生 待学习 已学完 收藏
$('#courseInfoList li').on('click',this._courseInfoListHandler.bind(this));//我的课程 学生 待学习 已学完 收藏
$('#teacherLiveList li').on('click',this._teacherLiveListHandler.bind(this));//我的课程 老师 正在直播 未开始 已结束
$('#subscribeList .liveInfoLeftLi').on('click',this._subscribeListHandler.bind(this));//课程 老师
$('#studentMyCenterContentList').on('mouseenter','.classifyListMyCenter',this._mouseenter.bind(this));//个人中心移入进入课堂
$('#studentMyCenterContentList').on('mouseleave','.classifyListMyCenter',this._mouseleave.bind(this));//个人中心移出进入课堂
$('#courseMinuteList').on('mouseenter','.classifyListMyCenter',this._mouseenter.bind(this));//课程移入进入课堂
$('#courseMinuteList').on('mouseleave','.classifyListMyCenter',this._mouseleave.bind(this));//课程移出进入课堂
$('#teacherCorrelatedInfo').on('mouseenter','.classifyListMyCenter',this._cancelMouseenter.bind(this));//我的预约 课程移入显示取消预约
$('#teacherCorrelatedInfo').on('mouseleave','.classifyListMyCenter',this._cancelMouseleave.bind(this));//我的预约 课程移出隐藏取消预约
$('#studentMyCenterContentList').on('click','.accessLearningBtn',this._enterClassRoomHandler.bind(this));//我的预约进入课堂
$('#courseMinuteList').on('click','.accessLearningBtn',this._enterClassRoomHandler.bind(this));//我的预约进入课堂
$('#myCurriculumInfo').on('click','.teacherEnterClass',this._enterClassRoomHandler.bind(this));//我的课程进入课堂
$('#teacherCorrelatedInfo').on('click','.teacherCorrelatedInfoBtn',this._teacherSubscribeMoveHandler.bind(this));//点击预约查看当前点击的更多信息
$('#teacherCorrelatedInfo').on('click','.cancelReservation',this._cancelSubscribeHandler.bind(this));//取消预约
$('#teacherCorrelatedInfo').on('click','.teachercourseImg',this._teacherClassDetails.bind(this));//点击进入老师课堂详情页
$('#teacherMyCerterHomePage').on('click',this._homePageHandler.bind(this));//首页
$('#teacherMyCerterUpPage').on('click',this._upPageHandler.bind(this));//上页
$('#teacherMyCerterDownPage').on('click',this._downPageHandler.bind(this));//下页
$('#teacherMyCerterEndPage').on('click',this._endPageHandler.bind(this));//尾页
$('#teacherMyCerterSpecificPage').on('click',this._assignPageHandler.bind(this));//指定页
}
addEvent() {
}
//首页
_createClassHomePage(){
this._teacherLiveModule(1);
}
//首页
_homePageHandler(){
this.presentInd = 1;
this._teacherLiveModule(this.presentInd);
}
//上页
_upPageHandler(){
if(this.presentInd > 1){
this.presentInd--;
this._teacherLiveModule(this.presentInd);
}
}
//下页
_downPageHandler(){
loger.log('点击下一页')
if(this.presentInd < this.pageNo){
this.presentInd++;
this._teacherLiveModule(this.presentInd);
}
}
//尾页
_endPageHandler(){
this.presentInd = this.pageNo;
this._teacherLiveModule(this.presentInd);
}
//指定页
_assignPageHandler(){
let inputVal = $('#teacherMyCerterPageInfoInput').val();
if(parseInt(inputVal) <= this.pageNo || parseInt(inputVal) >= 1 ){
this._teacherLiveModule(parseInt(inputVal));
}
}
loadMeeting(meeting){
let status = meeting["meetingStatus"];
if(status != ''){
if (status == "1" || status == "2") {
return '已开始';
}else{
if (status == "2") {
// alert("会议已经开始!");
return '已开始';
} else if (status == "3") {
return '未开始';
// alert("未到开始时间!");
} else if (status == "4") {
// alert("会议已经结束!");
return '已结束';
}
}
}
}
//老师端数据请求
_teacherCurriculumInfo(data,num,ind,callback){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
let that = this;
$.ajax({
type: "POST",
url: _url,
timeout:5000,
data : data,
headers: {siteId:ClassDataProxy.siteId,pageno:num, page:ind,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
_studentCurriculumInfo(num,callback){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/getStudentMeetingByStudentId/'+ClassDataProxy.id;
let that = this;
$.ajax({
type: "GET",
url: _url,
timeout:5000,
headers: {siteId:ClassDataProxy.siteId,pageno:num,id:ClassDataProxy.id,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
//老师端首页默认数据
detailPageTeacher(){
//首页课程
this._teacherCourseModule();
//首页直播信息
this._teacherLiveModule(1);
}
detailPageStudent(){
this._studentCourseModule();
//首页课程
let ind = $('#studentInfoList .liveInfoLeftLiCheck').attr('data');
let studentMyCenterContentList = $('#studentMyCenterContentList');
switch (parseInt(ind)){
case 0:
//待学习
this._studentStudyModule(studentMyCenterContentList);
break;
case 1:
//已学完
this._studentStudyOverModule(studentMyCenterContentList);
break;
case 2:
//收藏
this._studenTcollectModule(studentMyCenterContentList);
break;
default:
return;
}
}
_showStatus(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
$('#teacherMyCenterStatus').text('老师');
$('#teacherMyCerter').show();
$('#studentMyCerter').hide();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#teacherMyCenterStatus').text('同学');
$('#teacherMyCerter').hide();
$('#studentMyCerter').show();
}
}
_recordLiHandler(evt){
let ind = $(evt.currentTarget).attr('data');
$(evt.currentTarget).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
$('.myCenterContentBox').eq(ind).show().siblings().hide();
switch (parseInt(ind)){
case 0:
//首页
this.detailpage();
break;
case 1:
//我的课程
this.myCoursesMessage();
break;
case 2:
//我的预约
this.myBookingsMessage();
break;
case 3:
//个人信息
this._emit(MessageTypes.ROLE_MESSAGE);
break;
default:
return;
}
}
detailpage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
this.detailPageTeacher();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.detailPageStudent();
}
}
/*-------------------老师-------------------*/
//老师端首页课程显示
_teacherCourseModule(){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName};
let that = this;
this._teacherCurriculumInfo(data,3,1,function(_data){
//首页今日课程渲染
if(_data){
that._teacherCourseCourse(_data.returnData.data.meetingInfo);
}
})
}
//老师端首页课程数据渲染
_teacherCourseCourse(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
let that = this;
if(_data) {
for (let i = 0; i < _data.length; i++) {
let item = _data[i];
if (item) {
let curInfo = this._format(curriculumList, {
_infoTit: item.meetingName,
_meetingNumber: item.meetingNumber,
_countDown: that.loadMeeting(item),
_isShow: (that.loadMeeting(item) == '已开始') ? 'block' : 'none'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
}
}
//老师端首页直播数据
_teacherLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:1};
let that = this;
this._teacherCurriculumInfo(data,4,ind,function(_data){
//首页直播信息渲染
if(_data){
that._teacherLiveCourse(_data.returnData.data);
}
})
}
_teacherLiveCourse(_data){
let teacherMyCenterContentList = $('#teacherMyCenterContentList');
teacherMyCenterContentList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
// loger.log('老师端信息想显示',_data)
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
teacherMyCenterContentList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
teacherMyCenterContentList.append(_adminList)
}
teacherMyCenterContentList.append(adminListEnd)
}
_teacherCourse(_data){
let courseMinuteList = $('#courseMinuteList');
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
courseMinuteList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
courseMinuteList.append(_adminList)
}
courseMinuteList.append(adminListEnd)
}
/*---------------------------学生-----------------------*/
//学生端首页課程显示
_studentCourseModule(){
let that = this;
this._studentCurriculumInfo(3,function(_data){
that.studentCourseList(_data.returnData.data);
})
}
studentCourseList(_data){
if(_data){
// loger.log('学生端首页课程信息',_data)
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
let that = this;
if(_data) {
for (let i = 0; i < _data.length; i++) {
let item = _data[i];
let timer = ClassDataProxy.getTimeCountDown(item.meetingBeginTime,item.meetingEndTime)
loger.log('newTimenewTimenewTimenewTime',timer)
if (item) {
let curInfo = this._format(curriculumList, {
_infoTit: item.meeting_name,
_meetingNumber: item.meetingNumber,
_countDown:timer ,
_isShow: (timer == '已结束') ? 'none' : 'block'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
}
}
}
//学生端首页学习数据
_studentStudyModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
if(_data){
that.studentStudyList(studentMyCenterContentList,_data.returnData.data);
}
})
}
studentStudyList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}else{
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
studentMyCenterContentList.append(_classifyList)
}
}
//已学完
_studentStudyOverModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
that.studentStudyOverList(studentMyCenterContentList,_data.returnData.data);
})
}
studentStudyOverList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}
}else{
console.error('_gainClassData没数据')
}
}
}
_studenTcollectModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
that.studentTcollectList(studentMyCenterContentList,_data.returnData.data);
})
}
studentTcollectList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
/* for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}
}else{
console.error('_gainClassData没数据')
}
}*/
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
}
//我的预约
myBookingsMessage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.studentBookings();
}
}
studentBookings(){
let that = this;
let data = $('#subscribeList').find('.liveInfoLeftLiCheck').attr('data');
this._studentCurriculumInfo(12,function(_data){
if(_data){
if(data == '1'){
that._studentSubscribeTeacher(_data.returnData.data)
}else{
that._studentSubscribe(_data.returnData.data)
}
}
});
}
_studentSubscribe(_data){
let teacherCorrelatedInfo = $('#teacherCorrelatedInfo');
teacherCorrelatedInfo.empty();
for(let i = 0;i<_data.length;i++){
if(_data[i]){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0],
_studentMeetingId : _data[i].studentMeetingId
})
teacherCorrelatedInfo.append(_classifyList)
}else{
console.error('_gainClassData没数据')
}
}
}
_studentSubscribeTeacher(_data){
let teacherCorrelatedInfo = $('#teacherCorrelatedInfo');
teacherCorrelatedInfo.empty();
if(_data){
this.teacherList={};
for(let i = 0;i<_data.length;i++){
let item=_data[i];
if(item){
let temp = item.teacherName;
if(!this.teacherList[temp]) {
this.teacherList[temp] = [];
}
this.teacherList[temp].push(item)
}
}
for( let key in this.teacherList){
let teacherInfo = ''
let arrList = this.teacherList[key];
teacherInfo = this._format(teacherInfoLeft,{
_teacherName : key,
// meetingNumber
})
for(let n = 0;n<arrList.length;n++){
teacherInfo += this._format(teacherInfoCenter,{
_imgSrc : 'images/u374.png',
_id : arrList[n].teacherName
})
}
teacherInfo += this._format(teacherInfoRight,{
_teacherName : key
})
teacherCorrelatedInfo.append(teacherInfo)
}
}
}
//我的课程
myCoursesMessage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
this.teacherCourses();
$('#courseInfoList').hide();
$('#teacherLiveList').show();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.studentCourses();
$('#courseInfoList').show();
$('#teacherLiveList').hide();
}
}
teacherCourses(){
let _index = $('#teacherLiveList .liveInfoLeftLiCheck').attr('data');
let courseMinuteList = $('#courseMinuteList');
switch (parseInt(_index)){
case 0:
//正在直播
loger.log('直播首页信息')
this.teacherNowLiveModule(1);
break;
case 1:
//未开始
this.teacherNoneLiveModule(1);
loger.log('直播首页信息1')
break;
case 2:
//已结束
break;
default:
return;
}
}
teacherNowLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:1};
let that = this;
this._teacherCurriculumInfo(data,12,ind,function(_data){
//首页直播信息渲染
if(_data){
// loger.log('首页直播信息渲染',_data)
that._teacherCourse(_data.returnData.data);
}
})
}
teacherNoneLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName};
let that = this;
this._teacherCurriculumInfo(data,12,ind,function(_data){
//首页直播信息渲染
if(_data){
that._teacherCourse(_data.returnData.data);
}
})
}
//老师端课程数据
_teacherCourseRender(_data){
let courseMinuteList = $('#courseMinuteList');
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.beginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
let j = (key%4)==3;
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meetingName,
_create_user : arrList[n].create_user,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
}
//学生端 我的课程 切换
studentCourses(){
let ind = $('#courseInfoList .liveInfoLeftLiCheck').attr('data');
let courseMinuteList = $('#courseMinuteList');
switch (parseInt(ind)){
case 0:
//待学习
this.studentFutureModule(courseMinuteList);
break;
case 1:
//已学完
this.studentFormerlyModule(courseMinuteList);
break;
case 2:
//收藏
this.studentCollectModule(courseMinuteList);
break;
default:
return;
}
}
//学生端 我的课程 待学习
studentFutureModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentCourseRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 待学习
_studentCourseRender(courseMinuteList,_data){
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
let recordData = 0;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
//if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
if(ClassDataProxy.getTimeDay(key)){
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meeting_name,
_create_user : arrList[n].teacherName,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}else {
recordData = 1;
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
courseMinuteList.append(_classifyList)
}
}
//学生端 我的课程 已学完
studentFormerlyModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentFormerlyRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 已学完
_studentFormerlyRender(courseMinuteList,_data){
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
if(!ClassDataProxy.getTimeDay(key)){
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meeting_name,
_create_user : arrList[n].teacherName,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
}
}
//学生端 我的课程 收藏
studentCollectModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentCollectRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 收藏
_studentCollectRender(courseMinuteList,_data){
loger.log('收藏',_data)
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
// let arrList = this.dataList[key];
if(_dataList){
for(let n = 0;n<_dataList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _dataList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _dataList[n].meeting_name,
_create_user : _dataList[n].teacherName,
// _liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
//老师端首页显示课程
_teacherHomeCourse(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
if(_data){
for(let i = 0;i < 3;i++){
let item = _data[i];
if(item){
let curInfo = this._format(curriculumList,{
_infoTit : item.meetingName,
_meetingNumber : item.meetingNumber,
_countDown : that.loadMeeting(item),
_isShow : (that.loadMeeting(item)=='已开始')?'block':'none'
})
myCurriculumInfo.append(curInfo);
}else{
console.error('_gainClassData没数据')
}
}
}
}
//老师端首页直播信息
_liveClassData(_data){
let teacherMyCenterContentList = $('#teacherMyCenterContentList');
teacherMyCenterContentList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
teacherMyCenterContentList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
teacherMyCenterContentList.append(_adminList)
}
teacherMyCenterContentList.append(adminListEnd)
}
_myCenterBoxHandler(){
this._showStatus();
this.detailpage();
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){
return;
}
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').hide();
$('#lanclassBox').hide();
$('#liveContentAllBox').hide();
$('#lanclassAllBox').hide();
$('#teacherIntroAllBox').hide();
$('#teacherDetailBox').hide();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
}
$('#myCenterBox').show();
}
updateEmail(userEmail){
return userEmail.replace(/(\d{2})\d{2}(\d{1})/, '$1****$2')
}
updateMobile(userMobile){
return userMobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
_enterClassRoomHandler(evt){
let ind = $(evt.target).attr('data');
window.open('http://networkshool.xuedianyun.com/3m/attend.do?meetingNumber=' + ind);
}
_mouseenter(evt){
$(evt.currentTarget).find('.accessLearningBtn').show();
}
_mouseleave(evt){
$(evt.currentTarget).find('.accessLearningBtn').hide();
}
_cancelMouseenter(evt){
$(evt.currentTarget).find('.cancelReservation').show();
}
_cancelMouseleave(evt){
$(evt.currentTarget).find('.cancelReservation').hide();
}
_teacherSubscribeMoveHandler(evt){
$('#teacherDetailBox').show();
$('#myCenterBox').hide();
let buttonIsCheck = $('#orderBtn').attr('value','0');
if($('#orderBtn').attr('value') == '0'){
$('#orderBtn').attr('disabled',false)
$('#orderBtn').css('background','#ccc')
}
let teacherDetailCurriculum = $('#teacherDetailCurriculum');
teacherDetailCurriculum.empty();
let _data = $(evt.target).attr('data');
if(_data){
let _dataList = this.teacherList[_data];
$('#teacherDetailInfoDetailName').html(_dataList[0].teacherName);
for(let i = 0;i<_dataList.length;i++){
let _teacherDetail = this._format(teacherDetail,{
_detailList : _dataList[i].meeting_name
})
teacherDetailCurriculum.append(_teacherDetail)
}
}
}
//取消预约
_cancelSubscribeHandler(evt){
let _id = $(evt.target).attr('data');
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/updateStudentMeetingBySite/'+_id;
let that = this;
$.ajax({
type: "PUT",
url: _url,
timeout:5000,
headers: {
siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token
},
data:{status:'5'},
success:function(_data){
//获取课堂数据
if(_data && _data.code == 200){
that.studentBookings();
}
},
error:function(error){
console.log(error,'失败')
}
})
}
_teacherClassDetails(evt){
let name = $(evt.target).attr('data');
let ind = $(evt.target).index();
let _data = this.teacherList[name][ind]
$('#lanclassBox').show();
$('#myCenterBox').hide();
$('#lanclassContentTitle').html(_data.meeting_name);
$('#lanclassContentInfoName').html(_data.teacherName);
$('#lanclassContentInfoTimeStart').html('开始时间:'+_data.meetingBeginTime);
$('#lanclassContentInfoTimeEnd').html('结束时间:'+_data.meetingEndTime);
}
_judgeListPlace(){
let i;
let curriculumList = document.getElementsByClassName('classifyListMyCenter');
for(i=0;i<curriculumList.length;i++){
if((i%4) == 3){
$(curriculumList[i]).addClass('classifyListR');
}
}
}
//切换类的公用样式
commonality(evt){
$(evt.currentTarget).addClass('liveInfoLeftLiCheck').siblings().removeClass('liveInfoLeftLiCheck');
}
_teacherInfoListHandler(evt){
this.commonality(evt);
}
//学生端 首页
_studentInfoListHandler(evt){
this.commonality(evt);
this.detailPageStudent();
}
//学生端 我的课程
_courseInfoListHandler(evt){
this.commonality(evt);
this.studentCourses();
}
//老师端 我的课程
_teacherLiveListHandler(evt){
this.commonality(evt);
this.teacherCourses();
}
_subscribeListHandler(evt){
this.commonality(evt);
this.studentBookings();
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
return obj[group];
});
};
}
export default MyBookingsApe;
\ No newline at end of file
... ...
... ... @@ -76,19 +76,18 @@ const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor=
const adminListEnd = `</tbody></table>`;
//学生端显示老师信息
const teacherInfoLeft = `
<div class="teacherCorrelatedInfoBox">
<div class="teacherCorrelatedInfoLeft">
<img class="teacherCorrelatedInfoImg" id="teacherCorrelatedInfoImg" src="images/u293.png" alt="">
<div class="teacherCorrelatedInfo">
<b class="teacherCorrelatedInfoName" id="teacherCorrelatedInfoName">{_teacherName}</b>
<b class="teacherCorrelatedInfoMajor">北京市|少儿英语</b>
<b class="teacherCorrelatedInfoCourse">课程:50</b>
<span class="teacherCorrelatedInfoMajorMsg">毕业于外国语学院,专业8</span>
<p class="cancelReservationBtn"">取消预约</p>
const teacherInfoLeft = `<div class="teacherCorrelatedInfoBox">
<div class="teacherCorrelatedInfoLeft">
<img class="teacherCorrelatedInfoImg" id="teacherCorrelatedInfoImg" src="images/u293.png" alt="">
<div class="teacherCorrelatedInfo">
<b class="teacherCorrelatedInfoName" id="teacherCorrelatedInfoName">{_teacherName}</b>
<b class="teacherCorrelatedInfoMajor">北京市|少儿英语</b>
<b class="teacherCorrelatedInfoCourse">课程:50</b>
<span class="teacherCorrelatedInfoMajorMsg">毕业于外国语学院,专业8</span>
<p class="cancelReservationBtn"">取消预约</p>
</div>
</div>
</div>
<div class="teacherCorrelatedInfoCenter">`;
<div class="teacherCorrelatedInfoCenter">`;
const teacherInfoCenter= `<img class="teachercourseImg" data="{_id}" src="{_imgSrc}" alt="">`;
const teacherInfoRight = `</div> <div class="teacherCorrelatedInfoBtn" data="{_teacherName}">更多课程</div>
</div></div>`;
... ... @@ -121,17 +120,6 @@ class MyCenterApe extends Ape {
$('#subscribeList .liveInfoLeftLi').on('click',this._subscribeListHandler.bind(this));//课程 老师
$('#updateInputYes').on('click',this._updateInputYesHandler.bind(this));//确定时把输入的信息存入数据中
$('#accountInfoSaveBtn').on('click',this._accountInfoSaveBtnHandler.bind(this));//更新用户信息按钮
$('#updateInputBoxA').on('click',this._hideInputBox.bind(this));//关闭弹框
$('#updateInputNo').on('click',this._hideInputBox.bind(this));//关闭弹框
//修改账户信息
$('#accountPassWordBtn').on('click',this._accountPassWordBtnHandler.bind(this));//密码
$('#accountEmailBtn').on('click',this._accountEmailBtnHandler.bind(this));//邮箱
$('#accountMobilelBtn').on('click',this._accountMobilelBtnHandler.bind(this));//手机号
$('#studentMyCenterContentList').on('mouseenter','.classifyListMyCenter',this._mouseenter.bind(this));//个人中心移入进入课堂
$('#studentMyCenterContentList').on('mouseleave','.classifyListMyCenter',this._mouseleave.bind(this));//个人中心移出进入课堂
... ... @@ -389,7 +377,7 @@ class MyCenterApe extends Ape {
break;
case 3:
//个人信息
this._updatMessage();
this._emit(MessageTypes.ROLE_MESSAGE);
break;
default:
return;
... ... @@ -516,7 +504,7 @@ class MyCenterApe extends Ape {
}
studentCourseList(_data){
if(_data){
loger.log('学生端首页课程信息',_data)
// loger.log('学生端首页课程信息',_data)
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
let that = this;
... ... @@ -553,25 +541,34 @@ class MyCenterApe extends Ape {
studentStudyList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}else{
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}else{
console.error('_gainClassData没数据')
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
studentMyCenterContentList.append(_classifyList)
}
}
//已学完
... ... @@ -635,73 +632,6 @@ class MyCenterApe extends Ape {
}*/
}
//提交用户信息修改
_accountInfoSaveBtnHandler(){
let id = ClassDataProxy.id;//id
let loginName = ClassDataProxy.loginName;//登录名
let userMobile = ClassDataProxy.userMobile;//手机号
let userEmail = ClassDataProxy.userEmail;//邮箱
let monicker = ClassDataProxy.monicker;//用户名
let passWord = ClassDataProxy.password;//密码
let oneselfInfoLoginName = $('#oneselfInfoLoginName').val();//登录名
let oneselfInfoUserName = $('#oneselfInfoUserName').val();//用户名
let oneselfInfoMan = $('#oneselfInfoMan');//性别
let setPassWord = $('#setPassWord').attr('data');//密码
let setMail = $('#setMail').attr('data');//邮箱
let setPhone = $('#setPhone').attr('data');//手机号
let signInfo = {};
if(oneselfInfoLoginName != loginName){
signInfo.loginName = oneselfInfoLoginName;
}
if(oneselfInfoUserName != monicker){
signInfo.userName = oneselfInfoUserName;
}
if(!setPassWord){
// signInfo.loginName = oneselfInfoLoginName;
}
if(setMail != userEmail){
signInfo.userEmail = setMail;
}
if(setPhone != userMobile){
signInfo.userMobile = setPhone;
}
let that = this;
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/users/updateUserByUserId/' + id;
$.ajax({
type: "PUT",
url: _url,
timeout:5000,
headers: {siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token},
data:signInfo,
success:function(_data){
//获取个人信息数据
if(_data && _data.code == 200){
loger.log('修改信息成功',_data)
ErrorApe.showWarnError('修改信息成功');
ClassDataProxy.loginName =_data.returnData.data.loginName;
ClassDataProxy.monicker = _data.returnData.data.userName;
ClassDataProxy.userEmail = _data.returnData.data.userEmail;
ClassDataProxy.userMobile = _data.returnData.data.userMobile;
window.localStorage.setItem('loginName', ClassDataProxy.loginName);
window.localStorage.setItem('monicker', ClassDataProxy.monicker);
window.localStorage.setItem('userEmail', ClassDataProxy.userEmail);
window.localStorage.setItem('userMobile', ClassDataProxy.userMobile);
$('#teacherMyCenterName').html(ClassDataProxy.loginName);
}else if(_data.code == 400){
ErrorApe.showWarnError('账号未修改');
}else{
ErrorApe.showWarnError(_data.returnData.data.msg);
}
},
error:function(error){
loger.log(error,'修改信息失败')
}
})
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
... ... @@ -711,11 +641,6 @@ class MyCenterApe extends Ape {
ClassDataProxy.status = false;
}
//个人信息
_updatMessage(){
$('#oneselfInfoLoginName').val( ClassDataProxy.loginName);//登录名
$('#oneselfInfoUserName').val(ClassDataProxy.monicker);//用户名
}
//我的预约
myBookingsMessage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
... ... @@ -940,6 +865,7 @@ class MyCenterApe extends Ape {
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
let recordData = 0;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
... ... @@ -976,8 +902,13 @@ class MyCenterApe extends Ape {
courseMinuteList.append(_classifyList)
}
}
}else {
recordData = 1;
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
courseMinuteList.append(_classifyList)
}
}
//学生端 我的课程 已学完
... ... @@ -1042,13 +973,13 @@ class MyCenterApe extends Ape {
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
loger.log('显示收藏数据',_data)
that._studentCollectRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 收藏
_studentCollectRender(courseMinuteList,_data){
loger.log('收藏',_data)
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
... ... @@ -1073,27 +1004,27 @@ class MyCenterApe extends Ape {
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
if(!ClassDataProxy.getTimeDay(key)){
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
// let arrList = this.dataList[key];
if(_dataList){
for(let n = 0;n<_dataList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_isShowTitle : 'none',
_meetingNumber : _dataList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meeting_name,
_create_user : arrList[n].teacherName,
_liveTimer : key
_meetingName : _dataList[n].meeting_name,
_create_user : _dataList[n].teacherName,
// _liveTimer : key
})
// courseMinuteList.append(_classifyList)
courseMinuteList.append(_classifyList)
}
}
}
}
}
//老师端首页显示课程
_teacherHomeCourse(_data){
... ... @@ -1146,23 +1077,6 @@ class MyCenterApe extends Ape {
}
teacherMyCenterContentList.append(adminListEnd)
}
//修改密码
_accountPassWordBtnHandler(){
this.data = 0;
this._showInputBox(this.data);
}
//修改邮箱
_accountEmailBtnHandler(){
this.data = 1;
this._showInputBox(this.data);
}
//修改手机号
_accountMobilelBtnHandler(){
this.data = 2;
this._showInputBox(this.data);
}
_myCenterBoxHandler(){
this._showStatus();
this.detailpage();
... ... @@ -1184,57 +1098,6 @@ class MyCenterApe extends Ape {
$('#myCenterBox').show();
}
_updateInputYesHandler(evt){
let updateInput = $('#updateInput').val();
switch (parseInt(this.data)){
case 0:
//密码
let reg = /^[0-9a-zA-Z]{8,12}$/;
if(!updateInput || !(reg.test(updateInput))){
ErrorApe.showWarnError('密码格式不正确,请重新输入');
return;
}
$('#setPassWord').attr('data',updateInput);
this._hideInputBox();
break;
case 1:
//邮箱
let filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!updateInput || !(filter.test(updateInput))){
ErrorApe.showWarnError('邮箱格式不正确,请重新输入');
return;
}
$('#setMail').attr('data',updateInput);
$('#setMail').html(this.updateEmail(updateInput))
this._hideInputBox();
break;
case 2:
//手机号
let reg1 = /^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$/;
let regPhone = "^1[3|4|5|8][0-9]\\d{8}$";
let re = new RegExp(regPhone);
if(!updateInput || !(re.test(updateInput))){
ErrorApe.showWarnError('手机格式不正确,请重新输入');
return;
}
$('#setPhone').attr('data',updateInput);
$('#setPhone').html(this.updateMobile(updateInput))
this._hideInputBox();
break;
default:
return;
}
}
_hideInputBox(){
$('#updateInput').val('');
$('#updateInputShade').hide();
}
_showInputBox(ind){
let arr = ['请输入新密码 :','请输入新邮箱 :','请输入新手机号 :']
$('#updateInputShade').show();
$('#updateInputText').text(arr[ind])
}
updateEmail(userEmail){
return userEmail.replace(/(\d{2})\d{2}(\d{1})/, '$1****$2')
}
... ...
... ... @@ -1107,11 +1107,11 @@ class MyCenterStudentApe extends Ape {
$('#teacherDetailBox').show();
$('#myCenterBox').hide();
let buttonIsCheck = $('#orderBtn').attr('value','0');
/* let buttonIsCheck = $('#orderBtn').attr('value','0');
if($('#orderBtn').attr('value') == '0'){
$('#orderBtn').attr('disabled',false)
$('#orderBtn').css('background','#ccc')
}
}*/
let teacherDetailCurriculum = $('#teacherDetailCurriculum');
teacherDetailCurriculum.empty();
... ...
... ... @@ -1226,11 +1226,11 @@ class MyCenterTeacherApe extends Ape {
$('#teacherDetailBox').show();
$('#myCenterBox').hide();
let buttonIsCheck = $('#orderBtn').attr('value','0');
/*let buttonIsCheck = $('#orderBtn').attr('value','0');
if($('#orderBtn').attr('value') == '0'){
$('#orderBtn').attr('disabled',false)
$('#orderBtn').css('background','#ccc')
}
}*/
let teacherDetailCurriculum = $('#teacherDetailCurriculum');
teacherDetailCurriculum.empty();
... ...
//*
// 首页模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import ErrorApe from "./ErrorApe";
let loger = Loger.getLoger('PC-MyChangeInfoApe');
class MyChangeInfoApe extends Ape {
constructor() {
super();
this.addEvent();
this.init();
}
init() {
$('#updateInputYes').on('click',this._updateInputYesHandler.bind(this));//确定时把输入的信息存入数据中
$('#accountInfoSaveBtn').on('click',this._accountInfoSaveBtnHandler.bind(this));//更新用户信息按钮
$('#updateInputBoxA').on('click',this._hideInputBox.bind(this));//关闭弹框
$('#updateInputNo').on('click',this._hideInputBox.bind(this));//关闭弹框
//修改账户信息
$('#accountPassWordBtn').on('click',this._accountPassWordBtnHandler.bind(this));//密码
$('#accountEmailBtn').on('click',this._accountEmailBtnHandler.bind(this));//邮箱
$('#accountMobilelBtn').on('click',this._accountMobilelBtnHandler.bind(this));//手机号
}
addEvent() {
}
//修改密码
_accountPassWordBtnHandler(){
this.data = 0;
this._showInputBox(this.data);
}
//修改邮箱
_accountEmailBtnHandler(){
this.data = 1;
this._showInputBox(this.data);
}
//修改手机号
_accountMobilelBtnHandler(){
this.data = 2;
this._showInputBox(this.data);
}
_updateInputYesHandler(evt){
let updateInput = $('#updateInput').val();
switch (parseInt(this.data)){
case 0:
//密码
let reg = /^[0-9a-zA-Z]{8,12}$/;
if(!updateInput || !(reg.test(updateInput))){
ErrorApe.showWarnError('密码格式不正确,请重新输入');
return;
}
$('#setPassWord').attr('data',updateInput);
this._hideInputBox();
break;
case 1:
//邮箱
let filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!updateInput || !(filter.test(updateInput))){
ErrorApe.showWarnError('邮箱格式不正确,请重新输入');
return;
}
$('#setMail').attr('data',updateInput);
$('#setMail').html(this.updateEmail(updateInput))
this._hideInputBox();
break;
case 2:
//手机号
let reg1 = /^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$/;
let regPhone = "^1[3|4|5|8][0-9]\\d{8}$";
let re = new RegExp(regPhone);
if(!updateInput || !(re.test(updateInput))){
ErrorApe.showWarnError('手机格式不正确,请重新输入');
return;
}
$('#setPhone').attr('data',updateInput);
$('#setPhone').html(this.updateMobile(updateInput))
this._hideInputBox();
break;
default:
return;
}
}
_hideInputBox(){
$('#updateInput').val('');
$('#updateInputShade').hide();
}
_showInputBox(ind){
let arr = ['请输入新密码 :','请输入新邮箱 :','请输入新手机号 :']
ClassDataProxy.getMarginTopHandler($('.updateInputBox'));
$('#updateInputShade').show();
$('#updateInputText').text(arr[ind])
}
updateEmail(userEmail){
return userEmail.replace(/(\d{2})\d{2}(\d{1})/, '$1****$2')
}
updateMobile(userMobile){
return userMobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
//提交用户信息修改
_accountInfoSaveBtnHandler(){
let id = ClassDataProxy.id;//id
let loginName = ClassDataProxy.loginName;//登录名
let userMobile = ClassDataProxy.userMobile;//手机号
let userEmail = ClassDataProxy.userEmail;//邮箱
let monicker = ClassDataProxy.monicker;//用户名
let passWord = ClassDataProxy.password;//密码
let oneselfInfoLoginName = $('#oneselfInfoLoginName').val();//登录名
let oneselfInfoUserName = $('#oneselfInfoUserName').val();//用户名
let oneselfInfoMan = $('#oneselfInfoMan');//性别
let setPassWord = $('#setPassWord').attr('data');//密码
let setMail = $('#setMail').attr('data');//邮箱
let setPhone = $('#setPhone').attr('data');//手机号
let signInfo = {};
if(oneselfInfoLoginName != loginName){
signInfo.loginName = oneselfInfoLoginName;
}
if(oneselfInfoUserName != monicker){
signInfo.userName = oneselfInfoUserName;
}
if(!setPassWord){
// signInfo.loginName = oneselfInfoLoginName;
}
if(setMail != userEmail){
signInfo.userEmail = setMail;
}
if(setPhone != userMobile){
signInfo.userMobile = setPhone;
}
let that = this;
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/users/updateUserByUserId/' + id;
$.ajax({
type: "PUT",
url: _url,
timeout:5000,
headers: {siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token},
data:signInfo,
success:function(_data){
//获取个人信息数据
if(_data && _data.code == 200){
loger.log('修改信息成功',_data)
ErrorApe.showWarnError('修改信息成功');
ClassDataProxy.loginName =_data.returnData.data.loginName;
ClassDataProxy.monicker = _data.returnData.data.userName;
ClassDataProxy.userEmail = _data.returnData.data.userEmail;
ClassDataProxy.userMobile = _data.returnData.data.userMobile;
window.localStorage.setItem('loginName', ClassDataProxy.loginName);
window.localStorage.setItem('monicker', ClassDataProxy.monicker);
window.localStorage.setItem('userEmail', ClassDataProxy.userEmail);
window.localStorage.setItem('userMobile', ClassDataProxy.userMobile);
$('#teacherMyCenterName').html(ClassDataProxy.loginName);
}else if(_data.code == 400){
ErrorApe.showWarnError('账号未修改');
}else{
ErrorApe.showWarnError(_data.returnData.data.msg);
}
},
error:function(error){
loger.log(error,'修改信息失败')
}
})
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
}
//个人信息
_updatMessage(){
$('#oneselfInfoLoginName').val( ClassDataProxy.loginName);//登录名
$('#oneselfInfoUserName').val(ClassDataProxy.monicker);//用户名
}
}
export default MyChangeInfoApe;
\ No newline at end of file
... ...
//*
// 个人中心 我的课程
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import ErrorApe from "./ErrorApe";
import MessageTypes from "../MessageTypes";
const classifyList = `<div class="courseMinuteListTimeTit" style="display: {_isShowTitle}">
<span class="courseMinuteListTime">{_liveTimer}</span>
<span class="courseMinuteListWire"></span>
</div>
<div class="classifyListMyCenter {_classifyListR}">
<div class="myCenterContentMask accessLearningBtn">
<button class="myCenterContentMaskBtn btnHover" data="{_meetingNumber}">进入学习</button>
</div>
<div class="myCenterContentMask cancelReservation">
<button class="myCenterContentMaskBtn btnHover" data="{_studentMeetingId}">取消预约</button>
</div>
<img class="myCenterContentListImg" src="{_msgImg}" alt="">
<p class="myCenterContentListTit">{_meetingName}</p>
<p class="myCenterContentListTit1">主讲人:{_create_user}</p>
<p class="myCenterContentMin">45min</p>
<span class="myCenterContentTimer">{_liveTimer}</span>
</div>`;
const curriculumList = `<li class="teacherTodayCourseList">
<span class="courseDetailInfo">{_infoTit}</span>
<span class="courseDetailInfo1">距开始还有:<i class="teacherStartContent">{_countDown}</i></span>
<button class="teacherEnterClass btnHover" data="{_meetingNumber}" style="display: {_isShow}">立即进入</button>
</li>`;
const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" class="t_box">
<tbody>
<tr align="center" height="44" class="tr_center" bgcolor="#fff" bordercolor="#e6e6e6">
<th width="7%" class="tr_center">
课堂主题
</th>
<th width="7%" class="tr_center">
课堂号
</th>
<th width="7%" class="tr_center">
老师
</th>
<th width="7%" class="tr_center">
课堂状态
</th>
<th width="15%" class="tr_center">
课堂时间
</th>
<th width="7%" class="tr_center">
在线人数
</th>
<th width="10%" class="tr_center">
操作
</th>
</tr>
`;
//管理首页
const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor="#e6e6e6">
<td width="7%" class="tr_main tr_mainLeft">{_meetingName}</td>
<td width="7%" class="tr_main">{_meetingNumber}</td>
<td width="7%" class="tr_main">{_create_user}</td>
<td width="7%" class="tr_main">{_state}</td>
<td width="15%" class="tr_main">{_timer}</td>
<td width="7%" class="tr_main">{_num}</td>
<td width="10%" class="tr_main tr_mainRight" align="center">
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="###">文档</a>
<a class="classHandlePort deleteClass" data="{_aboutMsg}" href="###">多媒体</a>
<a class="classHandlePort resolveBtn" href="###" data="{_aboutMsg}">伴音</a>
</td>
</tr>
`;
const adminListEnd = `</tbody></table>`;
//学生端显示老师信息
const teacherInfoLeft = `<div class="teacherCorrelatedInfoBox">
<div class="teacherCorrelatedInfoLeft">
<img class="teacherCorrelatedInfoImg" id="teacherCorrelatedInfoImg" src="images/u293.png" alt="">
<div class="teacherCorrelatedInfo">
<b class="teacherCorrelatedInfoName" id="teacherCorrelatedInfoName">{_teacherName}</b>
<b class="teacherCorrelatedInfoMajor">北京市|少儿英语</b>
<b class="teacherCorrelatedInfoCourse">课程:50</b>
<span class="teacherCorrelatedInfoMajorMsg">毕业于外国语学院,专业8</span>
<p class="cancelReservationBtn"">取消预约</p>
</div>
</div>
<div class="teacherCorrelatedInfoCenter">`;
const teacherInfoCenter= `<img class="teachercourseImg" data="{_id}" src="{_imgSrc}" alt="">`;
const teacherInfoRight = `</div> <div class="teacherCorrelatedInfoBtn" data="{_teacherName}">更多课程</div>
</div></div>`;
const teacherDetail = `<span class="teacherDetailCurriculumList">《{_detailList}》</span>`
let loger = Loger.getLoger('PC-MyCoursesApe');
class MyCoursesApe extends Ape {
constructor() {
super();
this.isLocalStorage();
this.data = 0;
this.dataList = {};
this.teacherList = {};
this.messageDetails = [];
this.presentInd = 1;//点击翻页默认为第一页
this._judgeListPlace();
this.addEvent();
this.init();
}
init() {
$('#personageInfo').on('click',this._myCenterBoxHandler.bind(this));//个人中心
$('#teacherUI li').on('click',this._recordLiHandler.bind(this));//课堂分类
$('#teacherInfoList li').on('click',this._teacherInfoListHandler.bind(this));//首页 老师 直播分类 正在直播 未开始 已结束
$('#studentInfoList li').on('click',this._studentInfoListHandler.bind(this));//首页 学生 待学习 已学完 收藏
$('#courseInfoList li').on('click',this._courseInfoListHandler.bind(this));//我的课程 学生 待学习 已学完 收藏
$('#teacherLiveList li').on('click',this._teacherLiveListHandler.bind(this));//我的课程 老师 正在直播 未开始 已结束
$('#subscribeList .liveInfoLeftLi').on('click',this._subscribeListHandler.bind(this));//课程 老师
$('#studentMyCenterContentList').on('mouseenter','.classifyListMyCenter',this._mouseenter.bind(this));//个人中心移入进入课堂
$('#studentMyCenterContentList').on('mouseleave','.classifyListMyCenter',this._mouseleave.bind(this));//个人中心移出进入课堂
$('#courseMinuteList').on('mouseenter','.classifyListMyCenter',this._mouseenter.bind(this));//课程移入进入课堂
$('#courseMinuteList').on('mouseleave','.classifyListMyCenter',this._mouseleave.bind(this));//课程移出进入课堂
$('#teacherCorrelatedInfo').on('mouseenter','.classifyListMyCenter',this._cancelMouseenter.bind(this));//我的预约 课程移入显示取消预约
$('#teacherCorrelatedInfo').on('mouseleave','.classifyListMyCenter',this._cancelMouseleave.bind(this));//我的预约 课程移出隐藏取消预约
$('#studentMyCenterContentList').on('click','.accessLearningBtn',this._enterClassRoomHandler.bind(this));//我的预约进入课堂
$('#courseMinuteList').on('click','.accessLearningBtn',this._enterClassRoomHandler.bind(this));//我的预约进入课堂
$('#myCurriculumInfo').on('click','.teacherEnterClass',this._enterClassRoomHandler.bind(this));//我的课程进入课堂
$('#teacherCorrelatedInfo').on('click','.teacherCorrelatedInfoBtn',this._teacherSubscribeMoveHandler.bind(this));//点击预约查看当前点击的更多信息
$('#teacherCorrelatedInfo').on('click','.cancelReservation',this._cancelSubscribeHandler.bind(this));//取消预约
$('#teacherCorrelatedInfo').on('click','.teachercourseImg',this._teacherClassDetails.bind(this));//点击进入老师课堂详情页
$('#teacherMyCerterHomePage').on('click',this._homePageHandler.bind(this));//首页
$('#teacherMyCerterUpPage').on('click',this._upPageHandler.bind(this));//上页
$('#teacherMyCerterDownPage').on('click',this._downPageHandler.bind(this));//下页
$('#teacherMyCerterEndPage').on('click',this._endPageHandler.bind(this));//尾页
$('#teacherMyCerterSpecificPage').on('click',this._assignPageHandler.bind(this));//指定页
}
addEvent() {
}
//首页
_createClassHomePage(){
this._teacherLiveModule(1);
}
//首页
_homePageHandler(){
this.presentInd = 1;
this._teacherLiveModule(this.presentInd);
}
//上页
_upPageHandler(){
if(this.presentInd > 1){
this.presentInd--;
this._teacherLiveModule(this.presentInd);
}
}
//下页
_downPageHandler(){
loger.log('点击下一页')
if(this.presentInd < this.pageNo){
this.presentInd++;
this._teacherLiveModule(this.presentInd);
}
}
//尾页
_endPageHandler(){
this.presentInd = this.pageNo;
this._teacherLiveModule(this.presentInd);
}
//指定页
_assignPageHandler(){
let inputVal = $('#teacherMyCerterPageInfoInput').val();
if(parseInt(inputVal) <= this.pageNo || parseInt(inputVal) >= 1 ){
this._teacherLiveModule(parseInt(inputVal));
}
}
loadMeeting(meeting){
let status = meeting["meetingStatus"];
if(status != ''){
if (status == "1" || status == "2") {
return '已开始';
}else{
if (status == "2") {
// alert("会议已经开始!");
return '已开始';
} else if (status == "3") {
return '未开始';
// alert("未到开始时间!");
} else if (status == "4") {
// alert("会议已经结束!");
return '已结束';
}
}
}
}
//老师端数据请求
_teacherCurriculumInfo(data,num,ind,callback){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
let that = this;
$.ajax({
type: "POST",
url: _url,
timeout:5000,
data : data,
headers: {siteId:ClassDataProxy.siteId,pageno:num, page:ind,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
_studentCurriculumInfo(num,callback){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/getStudentMeetingByStudentId/'+ClassDataProxy.id;
let that = this;
$.ajax({
type: "GET",
url: _url,
timeout:5000,
headers: {siteId:ClassDataProxy.siteId,pageno:num,id:ClassDataProxy.id,
'token':ClassDataProxy.token},
success:function(_data){
//获取我的课程数据
if(_data && _data.code == 200){
if(callback){
callback(_data);
}
}else{
if(callback){
callback(null);
}
}
},
error:function(error){
//alert('直播数据获取失败')
if(callback){
callback(null);
}
loger.log(error,'直播数据获取失败')
}
})
}
//老师端首页默认数据
detailPageTeacher(){
//首页课程
this._teacherCourseModule();
//首页直播信息
this._teacherLiveModule(1);
}
detailPageStudent(){
this._studentCourseModule();
//首页课程
let ind = $('#studentInfoList .liveInfoLeftLiCheck').attr('data');
let studentMyCenterContentList = $('#studentMyCenterContentList');
switch (parseInt(ind)){
case 0:
//待学习
this._studentStudyModule(studentMyCenterContentList);
break;
case 1:
//已学完
this._studentStudyOverModule(studentMyCenterContentList);
break;
case 2:
//收藏
this._studenTcollectModule(studentMyCenterContentList);
break;
default:
return;
}
}
_showStatus(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
$('#teacherMyCenterStatus').text('老师');
$('#teacherMyCerter').show();
$('#studentMyCerter').hide();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#teacherMyCenterStatus').text('同学');
$('#teacherMyCerter').hide();
$('#studentMyCerter').show();
}
}
isLocalStorage(){
let newDate = new Date();
let newHours = newDate.getHours();
let text = newHours>12?'下午好,':'上午好,'
$('#teacherMyCenterTime').text(text);
this._showStatus();
this.detailpage();
loger.log('登录老师首页',ClassDataProxy.userType , ClassDataProxy.USER_TYPE_1)
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
//首页默认数据
// this.detailPageTeacher();
$('#teacherMyCenterName').text(ClassDataProxy.loginName);
$('#teacherMyCenterStatus').text('老师');
$('#teacherUI .recordLi').eq(2).hide();
$('#teacherMyCerter').show();
$('#studentMyCerter').hide();
$('#myCenterBox').show();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
//首页默认数据
// this.detailPageStudent();
$('#myCenterBox').show();
$('#teacherMyCenterName').text(ClassDataProxy.loginName);
$('#teacherMyCenterStatus').text('同学');
$('#teacherMyCerter').hide();
$('#studentMyCerter').show();
$('#teacherUI .recordLi').eq(2).show();
}
$('#lanclassBox').hide();
$('#oneselfInfoLoginName').val( ClassDataProxy.loginName);//登录名
$('#oneselfInfoUserName').val(ClassDataProxy.monicker);//用户名
let setMail = $('#setMail');//邮箱
let setPhone = $('#setPhone');//手机号
let userEmail = this.updateEmail(ClassDataProxy.userEmail);
let userMobile = this.updateMobile(ClassDataProxy.userMobile);
setMail.attr('data',ClassDataProxy.userEmail);
setPhone.attr('data',ClassDataProxy.userMobile);
setMail.html(userEmail)
setPhone.html(userMobile)
}
_recordLiHandler(evt){
let ind = $(evt.currentTarget).attr('data');
$(evt.currentTarget).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
$('.myCenterContentBox').eq(ind).show().siblings().hide();
switch (parseInt(ind)){
case 0:
//首页
this.detailpage();
break;
case 1:
//我的课程
this.myCoursesMessage();
break;
case 2:
//我的预约
this.myBookingsMessage();
break;
case 3:
//个人信息
this._emit(MessageTypes.ROLE_MESSAGE);
break;
default:
return;
}
}
detailpage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
this.detailPageTeacher();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.detailPageStudent();
}
}
/*-------------------老师-------------------*/
//老师端首页课程显示
_teacherCourseModule(){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName};
let that = this;
this._teacherCurriculumInfo(data,3,1,function(_data){
//首页今日课程渲染
if(_data){
that._teacherCourseCourse(_data.returnData.data.meetingInfo);
}
})
}
//老师端首页课程数据渲染
_teacherCourseCourse(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
let that = this;
if(_data) {
for (let i = 0; i < _data.length; i++) {
let item = _data[i];
if (item) {
let curInfo = this._format(curriculumList, {
_infoTit: item.meetingName,
_meetingNumber: item.meetingNumber,
_countDown: that.loadMeeting(item),
_isShow: (that.loadMeeting(item) == '已开始') ? 'block' : 'none'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
}
}
//老师端首页直播数据
_teacherLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:1};
let that = this;
this._teacherCurriculumInfo(data,4,ind,function(_data){
//首页直播信息渲染
if(_data){
that._teacherLiveCourse(_data.returnData.data);
}
})
}
_teacherLiveCourse(_data){
let teacherMyCenterContentList = $('#teacherMyCenterContentList');
teacherMyCenterContentList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
// loger.log('老师端信息想显示',_data)
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
teacherMyCenterContentList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
teacherMyCenterContentList.append(_adminList)
}
teacherMyCenterContentList.append(adminListEnd)
}
_teacherCourse(_data){
let courseMinuteList = $('#courseMinuteList');
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
courseMinuteList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
courseMinuteList.append(_adminList)
}
courseMinuteList.append(adminListEnd)
}
/*---------------------------学生-----------------------*/
//学生端首页課程显示
_studentCourseModule(){
let that = this;
this._studentCurriculumInfo(3,function(_data){
that.studentCourseList(_data.returnData.data);
})
}
studentCourseList(_data){
if(_data){
// loger.log('学生端首页课程信息',_data)
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
let that = this;
if(_data) {
for (let i = 0; i < _data.length; i++) {
let item = _data[i];
let timer = ClassDataProxy.getTimeCountDown(item.meetingBeginTime,item.meetingEndTime)
loger.log('newTimenewTimenewTimenewTime',timer)
if (item) {
let curInfo = this._format(curriculumList, {
_infoTit: item.meeting_name,
_meetingNumber: item.meetingNumber,
_countDown:timer ,
_isShow: (timer == '已结束') ? 'none' : 'block'
})
myCurriculumInfo.append(curInfo);
} else {
console.error('_gainClassData没数据')
}
}
}
}
}
//学生端首页学习数据
_studentStudyModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
if(_data){
that.studentStudyList(studentMyCenterContentList,_data.returnData.data);
}
})
}
studentStudyList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
let recordData = 0;
if(_data){
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}else{
recordData = 1;
}
}else{
console.error('_gainClassData没数据')
}
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
studentMyCenterContentList.append(_classifyList)
}
}
//已学完
_studentStudyOverModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
that.studentStudyOverList(studentMyCenterContentList,_data.returnData.data);
})
}
studentStudyOverList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}
}else{
console.error('_gainClassData没数据')
}
}
}
_studenTcollectModule(studentMyCenterContentList){
let that = this;
this._studentCurriculumInfo(4,function(_data){
that.studentTcollectList(studentMyCenterContentList,_data.returnData.data);
})
}
studentTcollectList(studentMyCenterContentList,_data){
studentMyCenterContentList.empty();
$('#courseMinutePageBox').hide();
/* for(let i = 0;i<_data.length;i++){
if(_data[i]){
if(!ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0]
})
studentMyCenterContentList.append(_classifyList)
}
}else{
console.error('_gainClassData没数据')
}
}*/
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
}
//我的预约
myBookingsMessage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.studentBookings();
}
}
studentBookings(){
let that = this;
let data = $('#subscribeList').find('.liveInfoLeftLiCheck').attr('data');
this._studentCurriculumInfo(12,function(_data){
if(_data){
if(data == '1'){
that._studentSubscribeTeacher(_data.returnData.data)
}else{
that._studentSubscribe(_data.returnData.data)
}
}
});
}
_studentSubscribe(_data){
let teacherCorrelatedInfo = $('#teacherCorrelatedInfo');
teacherCorrelatedInfo.empty();
for(let i = 0;i<_data.length;i++){
if(_data[i]){
let j = (i%4)==3;
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _data[i].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _data[i].meeting_name,
_create_user : _data[i].teacherName,
_liveTimer : _data[i].meetingBeginTime.split(' ')[0],
_studentMeetingId : _data[i].studentMeetingId
})
teacherCorrelatedInfo.append(_classifyList)
}else{
console.error('_gainClassData没数据')
}
}
}
_studentSubscribeTeacher(_data){
let teacherCorrelatedInfo = $('#teacherCorrelatedInfo');
teacherCorrelatedInfo.empty();
if(_data){
this.teacherList={};
for(let i = 0;i<_data.length;i++){
let item=_data[i];
if(item){
let temp = item.teacherName;
if(!this.teacherList[temp]) {
this.teacherList[temp] = [];
}
this.teacherList[temp].push(item)
}
}
for( let key in this.teacherList){
let teacherInfo = ''
let arrList = this.teacherList[key];
teacherInfo = this._format(teacherInfoLeft,{
_teacherName : key,
// meetingNumber
})
for(let n = 0;n<arrList.length;n++){
teacherInfo += this._format(teacherInfoCenter,{
_imgSrc : 'images/u374.png',
_id : arrList[n].teacherName
})
}
teacherInfo += this._format(teacherInfoRight,{
_teacherName : key
})
teacherCorrelatedInfo.append(teacherInfo)
}
}
}
//我的课程
myCoursesMessage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
this.teacherCourses();
$('#courseInfoList').hide();
$('#teacherLiveList').show();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.studentCourses();
$('#courseInfoList').show();
$('#teacherLiveList').hide();
}
}
teacherCourses(){
let _index = $('#teacherLiveList .liveInfoLeftLiCheck').attr('data');
let courseMinuteList = $('#courseMinuteList');
switch (parseInt(_index)){
case 0:
//正在直播
loger.log('直播首页信息')
this.teacherNowLiveModule(1);
break;
case 1:
//未开始
this.teacherNoneLiveModule(1);
loger.log('直播首页信息1')
break;
case 2:
//已结束
break;
default:
return;
}
}
teacherNowLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName,meetingStatus:1};
let that = this;
this._teacherCurriculumInfo(data,12,ind,function(_data){
//首页直播信息渲染
if(_data){
// loger.log('首页直播信息渲染',_data)
that._teacherCourse(_data.returnData.data);
}
})
}
teacherNoneLiveModule(ind){
let data = {siteId:ClassDataProxy.siteId,create_user : ClassDataProxy.loginName};
let that = this;
this._teacherCurriculumInfo(data,12,ind,function(_data){
//首页直播信息渲染
if(_data){
that._teacherCourse(_data.returnData.data);
}
})
}
//老师端课程数据
_teacherCourseRender(_data){
let courseMinuteList = $('#courseMinuteList');
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.beginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
let j = (key%4)==3;
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meetingName,
_create_user : arrList[n].create_user,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
}
//学生端 我的课程 切换
studentCourses(){
let ind = $('#courseInfoList .liveInfoLeftLiCheck').attr('data');
let courseMinuteList = $('#courseMinuteList');
switch (parseInt(ind)){
case 0:
//待学习
this.studentFutureModule(courseMinuteList);
break;
case 1:
//已学完
this.studentFormerlyModule(courseMinuteList);
break;
case 2:
//收藏
this.studentCollectModule(courseMinuteList);
break;
default:
return;
}
}
//学生端 我的课程 待学习
studentFutureModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentCourseRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 待学习
_studentCourseRender(courseMinuteList,_data){
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
let recordData = 0;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
//if(ClassDataProxy.getTimeDay(_data[i].meetingBeginTime)){
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
if(ClassDataProxy.getTimeDay(key)){
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meeting_name,
_create_user : arrList[n].teacherName,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}else {
recordData = 1;
}
}
if(recordData == 1){
let _classifyList = '<div class="dataCenterErrorTitle">暂无数据~</div>'
courseMinuteList.append(_classifyList)
}
}
//学生端 我的课程 已学完
studentFormerlyModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentFormerlyRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 已学完
_studentFormerlyRender(courseMinuteList,_data){
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
for(let key in this.dataList){
if(!ClassDataProxy.getTimeDay(key)){
let arrList = this.dataList[key];
if(arrList){
for(let n = 0;n<arrList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : n == 0 ?'block':'none',
_meetingNumber : arrList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : arrList[n].meeting_name,
_create_user : arrList[n].teacherName,
_liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
}
}
//学生端 我的课程 收藏
studentCollectModule(courseMinuteList){
let that = this;
this._studentCurriculumInfo(12,function(_data){
if(_data){
that._studentCollectRender(courseMinuteList,_data.returnData.data)
}
});
}
//学生端课程数据 收藏
_studentCollectRender(courseMinuteList,_data){
loger.log('收藏',_data)
courseMinuteList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data;
this.pageNo = pagenum;
$('#courseMinutePageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
if(count <= 12){
$('#courseMinutePageBox').hide();
}
//存储数据按日期分类
this.dataList={};
for(let i = 0;i<_dataList.length;i++){
let item=_dataList[i];
if(item){
let temp = item.meetingBeginTime.split(' ')[0]
if(!this.dataList[temp]) {
this.dataList[temp] = [];
}
this.dataList[temp].push(item)
}
}
// let arrList = this.dataList[key];
if(_dataList){
for(let n = 0;n<_dataList.length;n++){
let j = (n%4) == 3;
let _classifyList = this._format(classifyList,{
_classifyListR : j ?'classifyListR':'',
_isShowTitle : 'none',
_meetingNumber : _dataList[n].meetingNumber,
_msgImg : '../images/u373.png',
_meetingName : _dataList[n].meeting_name,
_create_user : _dataList[n].teacherName,
// _liveTimer : key
})
courseMinuteList.append(_classifyList)
}
}
}
//老师端首页显示课程
_teacherHomeCourse(_data){
let myCurriculumInfo = $('#myCurriculumInfo');
myCurriculumInfo.empty();
if(_data){
for(let i = 0;i < 3;i++){
let item = _data[i];
if(item){
let curInfo = this._format(curriculumList,{
_infoTit : item.meetingName,
_meetingNumber : item.meetingNumber,
_countDown : that.loadMeeting(item),
_isShow : (that.loadMeeting(item)=='已开始')?'block':'none'
})
myCurriculumInfo.append(curInfo);
}else{
console.error('_gainClassData没数据')
}
}
}
}
//老师端首页直播信息
_liveClassData(_data){
let teacherMyCenterContentList = $('#teacherMyCenterContentList');
teacherMyCenterContentList.empty();
let count = _data.count;
let page = _data.page;
let pageno = _data.pageno;
let pagenum = Math.ceil(count / pageno);
let _dataList = _data.meetingInfo;
this.pageNo = pagenum;
$('#teacherMyCerterPageMsg').html('第'+page+'页/共'+pagenum+'页,有'+count+'个记录');
teacherMyCenterContentList.append(adminListTit)
for(let i = 0;i<_dataList.length;i++){
if(count <= 8){
$('#teacherMyCerterPageBox').hide();
}
let _adminList = this._format(adminList,{
_meetingName : _dataList[i].meetingName,
_meetingNumber : _dataList[i].meetingNumber,
_create_user : _dataList[i].create_user,
_state : ClassDataProxy.getTimeEnd(_dataList[i].beginTime,_dataList[i].endTime),
_timer : _dataList[i].beginTime + '-' + _dataList[i].endTime,
_num : '0'
})
teacherMyCenterContentList.append(_adminList)
}
teacherMyCenterContentList.append(adminListEnd)
}
_myCenterBoxHandler(){
this._showStatus();
this.detailpage();
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){
return;
}
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').hide();
$('#lanclassBox').hide();
$('#liveContentAllBox').hide();
$('#lanclassAllBox').hide();
$('#teacherIntroAllBox').hide();
$('#teacherDetailBox').hide();
}else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){
}
$('#myCenterBox').show();
}
updateEmail(userEmail){
return userEmail.replace(/(\d{2})\d{2}(\d{1})/, '$1****$2')
}
updateMobile(userMobile){
return userMobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
_enterClassRoomHandler(evt){
let ind = $(evt.target).attr('data');
window.open('http://networkshool.xuedianyun.com/3m/attend.do?meetingNumber=' + ind);
}
_mouseenter(evt){
$(evt.currentTarget).find('.accessLearningBtn').show();
}
_mouseleave(evt){
$(evt.currentTarget).find('.accessLearningBtn').hide();
}
_cancelMouseenter(evt){
$(evt.currentTarget).find('.cancelReservation').show();
}
_cancelMouseleave(evt){
$(evt.currentTarget).find('.cancelReservation').hide();
}
_teacherSubscribeMoveHandler(evt){
$('#teacherDetailBox').show();
$('#myCenterBox').hide();
let buttonIsCheck = $('#orderBtn').attr('value','0');
if($('#orderBtn').attr('value') == '0'){
$('#orderBtn').attr('disabled',false)
$('#orderBtn').css('background','#ccc')
}
let teacherDetailCurriculum = $('#teacherDetailCurriculum');
teacherDetailCurriculum.empty();
let _data = $(evt.target).attr('data');
if(_data){
let _dataList = this.teacherList[_data];
$('#teacherDetailInfoDetailName').html(_dataList[0].teacherName);
for(let i = 0;i<_dataList.length;i++){
let _teacherDetail = this._format(teacherDetail,{
_detailList : _dataList[i].meeting_name
})
teacherDetailCurriculum.append(_teacherDetail)
}
}
}
//取消预约
_cancelSubscribeHandler(evt){
let _id = $(evt.target).attr('data');
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/updateStudentMeetingBySite/'+_id;
let that = this;
$.ajax({
type: "PUT",
url: _url,
timeout:5000,
headers: {
siteId:ClassDataProxy.siteId,
'token':ClassDataProxy.token
},
data:{status:'5'},
success:function(_data){
//获取课堂数据
if(_data && _data.code == 200){
that.studentBookings();
}
},
error:function(error){
console.log(error,'失败')
}
})
}
_teacherClassDetails(evt){
let name = $(evt.target).attr('data');
let ind = $(evt.target).index();
let _data = this.teacherList[name][ind]
$('#lanclassBox').show();
$('#myCenterBox').hide();
$('#lanclassContentTitle').html(_data.meeting_name);
$('#lanclassContentInfoName').html(_data.teacherName);
$('#lanclassContentInfoTimeStart').html('开始时间:'+_data.meetingBeginTime);
$('#lanclassContentInfoTimeEnd').html('结束时间:'+_data.meetingEndTime);
}
_judgeListPlace(){
let i;
let curriculumList = document.getElementsByClassName('classifyListMyCenter');
for(i=0;i<curriculumList.length;i++){
if((i%4) == 3){
$(curriculumList[i]).addClass('classifyListR');
}
}
}
//切换类的公用样式
commonality(evt){
$(evt.currentTarget).addClass('liveInfoLeftLiCheck').siblings().removeClass('liveInfoLeftLiCheck');
}
_teacherInfoListHandler(evt){
this.commonality(evt);
}
//学生端 首页
_studentInfoListHandler(evt){
this.commonality(evt);
this.detailPageStudent();
}
//学生端 我的课程
_courseInfoListHandler(evt){
this.commonality(evt);
this.studentCourses();
}
//老师端 我的课程
_teacherLiveListHandler(evt){
this.commonality(evt);
this.teacherCourses();
}
_subscribeListHandler(evt){
this.commonality(evt);
this.studentBookings();
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
return obj[group];
});
};
}
export default MyCoursesApe;
\ No newline at end of file
... ...
... ... @@ -143,12 +143,12 @@ class PlayRecordApe extends Ape {
url: _url,
data:{siteId : ClassDataProxy.siteId},
headers: {siteId:ClassDataProxy.siteId,
pageno:7,
pageno:8,
page:ind,
'token':ClassDataProxy.token},
success:function(_data){
if(_data && _data.code == 200){
loger.log(_data,'录制回放数据信息')
// loger.log(_data,'录制回放数据信息')
that._gainUserClassData(_data.returnData.data);
}
},
... ...
... ... @@ -47,9 +47,11 @@ class SubscribeApe extends Ape {
//获取课堂数据
if(_data && _data.code == 200){
loger.log(_data,'预约信息')
ClassDataProxy.getMarginTopHandler($('#teacherDetailReminders'));//显示预约成功弹框
$('#teacherDetailRemindersBox').show();
that._emit(MessageTypes.ORDER_FINISH);
}else if(_data.returnData.data.msg == '您已预约这堂课' && ClassDataProxy.loginName){
ClassDataProxy.getMarginTopHandler($('#warnHintBox'));//修改信息输入框
ErrorApe.showWarnError('您已预约这堂课');
}else{
that.toLogin();
... ... @@ -62,6 +64,7 @@ class SubscribeApe extends Ape {
})
}
toLogin(){
ClassDataProxy.getMarginTopHandler($('#userLogin'));
$('#userLoginBox').show();
}
//工具类
... ...
... ... @@ -27,7 +27,11 @@ import PlayRecordApe from 'ape/PlayRecordApe';//录制管理
import MyCenterApe from 'ape/MyCenterApe';//个人中心
import MyCenterStudentApe from 'ape/MyCenterStudentApe';//个人中心老师
import MyCenterTeacherApe from 'ape/MyCenterTeacherApe';//个人中心学生
import MyCoursesApe from 'ape/MyCoursesApe';//个人中心 我的课程
import MyBookingsApe from 'ape/MyBookingsApe';//个人中心 我的预约
import MyChangeInfoApe from 'ape/MyChangeInfoApe';//个人中心 信息修改
import SubscribeApe from 'ape/SubscribeApe';//预约
import CollectApe from 'ape/CollectApe';//预约
... ... @@ -54,8 +58,13 @@ let _listDetailsApe;
let _administratorApe;
let _playRecordApe;
let _myCenterApe;
let _myCenterStudentApe;
let _myCenterTeacherApe;
let _myCoursesApe;//我的课程
let _myBookingsApe;//我的预约
let _myChangeInfoApe;//个人信息修改
let _subscribeApe;
let _collectApe;
... ... @@ -182,7 +191,7 @@ class Main {
//个人中心
_myCenterApe = new MyCenterApe();
_myCenterApe.on(MessageTypes.ROLE_MESSAGE,this.roleMessage.bind(this));
//预约管理
_subscribeApe = new SubscribeApe();
... ... @@ -191,7 +200,6 @@ class Main {
_collectApe = new CollectApe();
}
//
loginOut(_data){
//
... ... @@ -240,6 +248,11 @@ class Main {
_myCenterStudentApe = new MyCenterStudentApe();
}
}
//myCenter 我的个人信息
roleMessage(){
_myChangeInfoApe = new MyChangeInfoApe();
}
//管理员左侧列表
switchClass(_data){
let ind = parseInt(_data);
... ... @@ -280,9 +293,9 @@ class Main {
break;
}
}
//切换头部列表
switchHeader(_data){
let ind = parseInt(_data);
switch (ind){
case 0:
_homeApe.studentClick();
... ... @@ -321,6 +334,8 @@ class Main {
let status = window.localStorage.getItem('status')|| '';
let token = window.localStorage.getItem('token')|| '';
let password = window.localStorage.getItem('password')|| '';
ClassDataProxy.userType = parseInt(userType);
ClassDataProxy.loginName = loginName;
ClassDataProxy.id = id;
... ... @@ -331,6 +346,7 @@ class Main {
ClassDataProxy.monicker = monicker;
ClassDataProxy.status = status;
ClassDataProxy.token = token;
ClassDataProxy.password = password
loger.log('进入课堂时显示的type值',ClassDataProxy.userType)
switch (parseInt(userType)){
... ...
import $ from "jquery";
class ClassDataProxy {
constructor() {
}
... ... @@ -289,6 +290,15 @@ class ClassDataProxy {
}
}
//设置弹框位置 方法
static getMarginTopHandler(_data){
let top = ($(window).height() - _data.height())/2;
let left = ($(window).width() - _data.width())/2;
let scrollTop = $(document).scrollTop();
let scrollLeft = $(document).scrollLeft();
_data.css( { position : 'absolute', 'top' : top + scrollTop, left : left + scrollLeft } ).show();
}
}
//Class
... ...