董佳音

整理登录退出身份判断

... ... @@ -155,6 +155,7 @@ body{
.DownloadLoginBox{
float: right;
font-size: 16px;
cursor: pointer;
}
.DownloadLoginBox li{
float: left;
... ... @@ -182,11 +183,40 @@ body{
margin-left:20px;
}
.userLoginBtn{
width:30px;
height:30px;
border-radius: 50%;
margin:15px 0 0 15px;
margin-left:15px;
cursor: pointer;
position: relative;
}
.userLoginText{
height: 70px;
line-height: 70px;
}
.userLoginText:hover{
color:#3498db;
}
.exitBox{
position: absolute;
left:-48px;
top:55px;
width:130px;
height:78px;
padding-top:20px;
background: #fff;
box-shadow: 0px 1px 2px #adadad;
display: none;
z-index: 1;
}
.exitList{
width:100%;
height: 28px;
line-height: 28px;
font-size: 14px;
color:#333;
text-align: center;
}
.exitList:hover{
background: #3498db;
color:#fff;
}
.userLoginBtnImg{
width:100%;
... ... @@ -1337,4 +1367,35 @@ body{
}
.removeCancel{
background: #e6e6e6;
}
/*个人中心*/
.myCenterBox{
width:100%;
float: left;
margin:40px 15px 0 40px;
display: none;
}
.myCenterLeftBox{
width:200px;
height:270px;
background: #fff;
}
.recordLi2{
width: 60%;
padding-left:30%;
text-align: left;
}
.myCenterContentBox{
float: left;
width: 1005px;
}
.myCenterTopLeftBox{
width:330px;
height:180px;
background: #fff;
}
.myCenterTopRightBox{
width:640px;
height:180px;
background: #fff;
}
\ No newline at end of file
... ...
... ... @@ -29,7 +29,12 @@
</li>
<li class="userNews iconfont">&#xe6a5;</li>
<li class="userLoginBtn">
<img class="userLoginBtnImg" id="homeUserLoginBtn" src="images/u293.png" alt="">
<span class="userLoginText" id="homeUserLoginBtn">登录</span>
<!--<img class="userLoginBtnImg" id="homeUserLoginBtn" src="images/u293.png" alt="">-->
<ul class="exitBox" id="exitBox">
<li class="exitList" id="personageInfo">个人中心</li>
<li class="exitList" id="exitBtn">退出</li>
</ul>
</li>
</ul>
</div>
... ... @@ -113,7 +118,7 @@
<span class="lanclassContentInfoTimeStart" id="lanclassContentInfoTimeStart">开始时间:2017-08-01 13:00:00</span>
<span class="lanclassContentInfoTimeEnd" id="lanclassContentInfoTimeEnd">结束时间:2017-08-01 13:00:00</span>
</div>
<div class="lanclassContentApply" id="lanclassContentApply">我要报名</div>
<div class="lanclassContentApply btnHover" id="lanclassContentApply">我要报名</div>
</div>
<div class="lanclassContentRight">
<div class="thirdPartyIconBox">
... ... @@ -165,7 +170,7 @@
<img class="teacherDetailInfoImg" id="teacherDetailInfoImg" src="" alt="">
<ul class="teacherDetailInfoDetailBox">
<li class="teacherDetailInfoDetailTit">
<span class="teacherDetailInfoDetailName" id="teacherDetailInfoDetailName">媛媛</span>
<span class="teacherDetailInfoDetailName" id="teacherDetailInfoDetailName">3333</span>
<span class="teacherDetailInfoDetailSex" id="teacherDetailInfoDetailSex"></span>
</li>
<li class="teacherDetailInfoDetailSpeciality">
... ... @@ -323,34 +328,6 @@
操作
</th>
</tr>
<tr align="center" bgcolor="#FFFFFF" height="44">
<td class="tr_main">
少儿英语
</td>
<td class="tr_main">
101545534
</td>
<td class="tr_main">
markettest
</td>
<td class="tr_main">
准备
</td>
<td class="tr_main" style="width:40px;">
2017-08-29 18:00:00 - 2017-08-29 23:00:00
</td>
<td class="tr_main">
0
</td>
<td class="tr_main tr_mainRight" align="center" >
<a class="classHandlePort" href="#">文档</a>
<a class="classHandlePort" href="">多媒体</a>
<a class="classHandlePort" href="">伴音</a>
<a class="classHandlePort" href="">修改</a>
<a class="classHandlePort" href="">删除</a>
<a class="classHandlePort" href="">加入课堂</a>
</td>
</tr>
</tbody>
</table>
... ... @@ -970,6 +947,43 @@
</div>
</div>
</div>
<!--个人中心-->
<div id="myCenterBox" class="myCenterBox">
<div class="myCenterLeftBox">
<ul class="recordUl" id="teacherUI">
<li class="recordLi recordLi2 recordLiCheck">
<label for="courseManagement" class="iconfont">&#xe699;</label>
<span class="recordLiText" id="teacherHomeBtn">首页</span>
</li>
<li class="recordLi recordLi2">
<label for="createClassBtn" class="iconfont">&#xe69a;</label>
<span class="recordLiText" id="teacherCoursesBtn">我的课程</span>
</li>
<li class="recordLi recordLi2">
<label for="classManagement" class="iconfont">&#xe6a4;</label>
<span class="recordLiText" id="teacherOrderBtn">我的预约</span>
</li>
<li class="recordLi recordLi2">
<label for="personManagement" class="iconfont">&#xe6a1;</label>
<span class="recordLiText" id="teacherSetBtn">个人设置</span>
</li>
</ul>
</div>
<div class="myCenterContentBox">
<div class="myCenterTopLeftBox"></div>
<div class="myCenterTopRightBox"></div>
<div class="myCenterContentTitle">
<div class="liveInfoLeft" id="teacherInfoList">
<div class="liveInfoLeftLi liveInfoLeftLiCheck">正在直播</div>
<div class="liveInfoLeftLi">未开始</div>
<div class="liveInfoLeftLi">已结束</div>
</div>
</div>
<div class="myCenterContent">
</div>
</div>
</div>
</div>
<div class="footerBg">
<div class="footer">
... ...
/**
*事件消息ID和错误码 定义
*/
function MessageTypes() {}
//--------------------事件相关的定义--------------------------------------
//登陆相关
MessageTypes.LOGIN_OUT= "login_out"; //更新用户退出
MessageTypes.LOGIN_IN= "login_in"; //更新用户退出
//header按钮
MessageTypes.HOME_SKIP= "home_skip"; //首页跳转
MessageTypes.TEACHER_SKIP= "teacher_skip"; //老师跳转
//
export default MessageTypes;
... ...
... ... @@ -32,7 +32,7 @@ const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspa
<th width="6%" class="tr_center">
在线人数
</th>
<th width="22%" class="tr_center">
<th width="20%" class="tr_center">
操作
</th>
</tr>
... ... @@ -45,7 +45,7 @@ const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor=
<td width="6%" class="tr_main">{_stateInfo}</td>
<td width="18%" class="tr_main">{_time}</td>
<td width="4%" class="tr_main">{_onlineLen}</td>
<td width="22%" class="tr_main tr_mainRight" align="center" >
<td width="20%" class="tr_main tr_mainRight" align="center" >
<a id="{_DocInd}" class="classHandlePort" href="#">文档</a>
<a id="{_mediaInd}" class="classHandlePort" href="">多媒体</a>
<a id="{_musicInd}" class="classHandlePort" href="">伴音</a>
... ... @@ -62,6 +62,7 @@ class AdministratorApe extends Ape {
this.classDateList = {};//课堂的所有数据
this.pageNo = 0;
this.presentInd = 0;
this.isLocalStorage();
this.addEvent();
this.init();
}
... ... @@ -80,6 +81,12 @@ class AdministratorApe extends Ape {
addEvent() {
}
isLocalStorage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){
this.detailPage();
console.log('管理员',111111111)
}
}
//首页
_homePageHandler(){
this.presentInd = 1;
... ...
... ... @@ -27,18 +27,26 @@ class HomeApe extends Ape {
this.classDateList = {};//课堂的所有数据
//判断列表在右侧时取消边距
this._judgeListPlace();
this.isLocalStorage();
this.addEvent();
this.init();
}
init() {
this.detailPage();
// this.subscribe();
$('#defaultBtn').on('click',this._lanclassBtnHandler.bind(this));
}
addEvent() {
}
isLocalStorage(){
if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_0 || ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
this.detailPage();
console.log('学生',111111111)
}
}
_judgeListPlace(){
let i;
let curriculumList = document.getElementsByClassName('curriculumList');
... ... @@ -50,11 +58,13 @@ class HomeApe extends Ape {
}
_lanclassBtnHandler(evt){
$(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
$('#slideshow').show();
$('#defaultBox').show();
$('#classifyListBox').hide();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
let userType = window.localStorage.getItem("userType");
if( userType== ClassDataProxy.USER_TYPE_8 || userType== ClassDataProxy.USER_TYPE_0){
this.studentClick();
}else if(userType== ClassDataProxy.USER_TYPE_1){
let userType = ClassDataProxy.userType;
this._emit(MessageTypes.HOME_SKIP,{userType:userType});
}
}
detailPage(){
let that = this;
... ... @@ -77,6 +87,40 @@ class HomeApe extends Ape {
}
})
}
subscribe(){
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
$.ajax({
type: "GET",
url: _url,
data:{siteId:'markettest'},
headers: {siteId:'markettest',
'token':'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IlhXQnJlRU00T0swYTVqUUIyUTFicGtObHlxOUFWbXZkIiwibmFtZSI6ImFkbWluIiwiY29kZSI6MSwiaWF0IjoxNTAzNDUxODU0LCJleHAiOjIyODEwNTE4NTR9.3kTVzKd_jbP7l69nxOpNaFeSjVnnjZkagYMzRB8fjNo'},
success:function(_data){
// loger.log(_data,'成功')
//获取课堂数据
if(_data || _data.code == 200){
that._gainClassData(_data.returnData.data);
}
},
error:function(error){
console.log(error,'失败')
}
})
}
studentClick(){
$('#slideshow').show();
$('#defaultBox').show();
$('#classifyListBox').hide();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
}
teacher(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').show();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
}
_gainClassData(_data){
let liveList = $('#liveList');
let lanclassList = $('#lanclassList');
... ... @@ -89,7 +133,7 @@ class HomeApe extends Ape {
for(let i = 0;i<_dataList.length;i++){
if(i<8){
let j = (i%4)==3;
let _getTime = this.getTime(_dataList[i].beginTime,_dataList[i].endTime)
let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_id : _dataList[i].id,
... ... @@ -106,26 +150,6 @@ class HomeApe extends Ape {
}
}
getTime(start,end){
let newStart = new Date(start)
let newEnd = new Date(end)
let day =1000*3600*24;
let timer = parseInt((newEnd.getTime() - newStart.getTime()) / parseInt(day));
let newEndHours = newEnd.getHours()<10?'0'+newEnd.getHours():newEnd.getHours();
let newStartHours = newStart.getHours()<10?'0'+newStart.getHours():newStart.getHours();
let newStartDate = newStart.getDate()<10?'0'+newStart.getDate():newStart.getDate();
let newStartDay = newStart.getDay()<10?'0'+newStart.getDay():newStart.getDay();
if(timer == 0){
return '今天 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
}else{
return newStartDate+1 + '月' + newStartDay +'日 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
}
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
... ...
... ... @@ -133,12 +133,13 @@ class LanclassApe extends Ape {
if(_dataList){
for(let i = 0;i<_dataList.length;i++){
let j = (i%4)==3;
let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_id : _dataList[i].id,
_msgImg :'../images/u373.png',
_classroomTitle : _dataList[i].meetingName,
_schoolTime : '11',
_schoolTime : _getTime,
_subscribeNum : _dataList[i].reservationNumber+'人已预约'
})
classifyListContent.append(_classifyList);
... ...
... ... @@ -20,6 +20,8 @@ class ListDetailsApe extends Ape {
init() {
$('#themeBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));
$('#collectYes ').on('click',this._collectYesHandler.bind(this));
$('#collectNo ').on('click',this._collectNoHandler.bind(this));
}
addEvent() {
... ... @@ -30,6 +32,14 @@ class ListDetailsApe extends Ape {
let _id = evt.currentTarget.id;
this.detailPage(_id);
}
_collectYesHandler(){
$('#collectYes ').hide();
$('#collectNo ').show();
}
_collectNoHandler(){
$('#collectYes ').show();
$('#collectNo ').hide();
}
detailPage(_id){
let that = this;
let signInfo = {
... ...
... ... @@ -133,12 +133,13 @@ class LanclassApe extends Ape {
if(_dataList){
for(let i = 0;i<_dataList.length;i++){
let j = (i%4)==3;
let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_id : _dataList[i].id,
_msgImg :'../images/u373.png',
_classroomTitle : _dataList[i].meetingName,
_schoolTime : '11',
_schoolTime : _getTime,
_subscribeNum : _dataList[i].reservationNumber+'人已预约'
})
classifyListContent.append(_classifyList);
... ...
... ... @@ -9,12 +9,13 @@ import DrawTool from "./DrawTool";
import LaserPen from "./LaserPen";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import MessageTypes from "../MessageTypes";
let loger = Loger.getLoger('PC-LoginOrRegister');
class LoginOrRegister extends Ape {
constructor() {
super();
this.localStorage = window.localStorage;
this.isLocalStorage();
this.addEvent();
this.init();
... ... @@ -36,15 +37,37 @@ class LoginOrRegister extends Ape {
$('#userLoginBtn').on('click',this._loginBtnHandler.bind(this));//登录信息提交
$('#homeUserLoginBtn').on('click',this._homeUserLoginBtnHandler.bind(this));//首页用户登录
$('#homeUserLoginBtn').on('mouseenter',this._mouseenterHandler.bind(this));//首页用户登录
$('#exitBox').on('mouseleave',this._mouseleaveHandler.bind(this));//首页用户登录
$('#exitBtn').on('click',this._exitBtnHandler.bind(this));//退出登录
$('body').on('click',function(evt){
if(!$(evt.target).is('#exitBox')){
$('#exitBox').hide();
}
});
}
isLocalStorage(){
if(window.localStorage.getItem('loginName') && window.localStorage.getItem('password')){
this._showAdministratorInfo();
}
}
let that = this;
$(window).on('load',function(){
if(!window.localStorage.getItem('status')){
$('#homeUserLoginBtn').text('登录');
}else{
}
if(window.localStorage.getItem('status') == 'true'){
let userType = window.localStorage.getItem('userType')
$('#homeUserLoginBtn').text(window.localStorage.getItem('loginName'));
// that._showAdministratorInfo();
}
})
}
addEvent() {
}
... ... @@ -68,8 +91,46 @@ class LoginOrRegister extends Ape {
}
//首页用户登录
_homeUserLoginBtnHandler(){
$('#userLoginBox').show();
if(!window.localStorage.getItem('status')){
$('#userLoginBox').show();
}
}
_mouseenterHandler(){
if(window.localStorage.getItem('status') == 'true'){
$('#exitBox').show();
}
}
_mouseleaveHandler(){
$('#exitBox').hide();
}
_exitBtnHandler(){
this.clearLocalStorage();
this.updateInterfaceState();
this._emit(MessageTypes.LOGIN_OUT);
}
clearLocalStorage(){
window.localStorage.clear();
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
}
updateInterfaceState(){
$('#homeUserLoginBtn').text('登录');
$('#loginName').val('');
$('#loginPassWord').val('');
$('#slideshow').show();
$('#defaultBox').show();
$('#header_list').show();
$('#header_seek').show();
$('#androidDownload').show();
$('#exitBox').hide();
$('#classManagementBox').hide();
$('#defaultBtn').addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
}
_signFocusHandler(evt){
let _ele = $(evt.target);
if(_ele.css('color') != 'rgb(0, 0, 0)'){
... ... @@ -211,7 +272,6 @@ class LoginOrRegister extends Ape {
}
//登录信息提交
_loginBtnHandler(){
loger.log('登录信息提交')
let _name = document.getElementById("loginName");//用户名
let _passWord = document.getElementById("loginPassWord");//手机号
if(_name.value && _passWord.value){
... ... @@ -227,13 +287,22 @@ class LoginOrRegister extends Ape {
url: _url,
data: signInfo,
success:function(_data){
loger.log('登录信息返回信息',_data)
if(_data || _data.code == 200){
that.successLogin(_data);
window.localStorage.setItem("loginName",_name.value);
window.localStorage.setItem("password", _passWord.value);
window.localStorage.setItem("userType", _data.returnData.data.userType);
window.localStorage.setItem("token",_data.returnData.data.token);
ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1;
//ClassDataProxy.userType= _data.returnData.data.userType;
ClassDataProxy.loginName =_name.value;
ClassDataProxy.password = _passWord.value;
ClassDataProxy.token =_data.returnData.data.token
ClassDataProxy.status = true;
window.localStorage.setItem("loginName",ClassDataProxy.loginName);
window.localStorage.setItem("password", ClassDataProxy.password );
window.localStorage.setItem("userType", ClassDataProxy.userType);
window.localStorage.setItem("token", ClassDataProxy.token );
window.localStorage.setItem('status', ClassDataProxy.status);
that.successLogin();
}
},
error:function(error){
... ... @@ -248,26 +317,21 @@ class LoginOrRegister extends Ape {
}
//用户成功登录
successLogin(_data){
if(_data.code == 200){
//登录成功后显示用户名字
$('#homeUserLoginBtn').text( ClassDataProxy.loginName);
this._userLoginAHandler();
this._emit(MessageTypes.LOGIN_IN,{userType: ClassDataProxy.userType});
/* if(_data.code == 200){
window.localStorage.setItem('status',true)
//登录成功后显示用户名字
$('#homeUserLoginBtn').text(_data.returnData.data.userName);
this._userLoginAHandler();
//判断状态1 是管理员
this._administratorInfo(_data);
//状态2 是老师
//状态8 是学生
//状态32 是兼课
}
}
_showAdministratorInfo(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#header_list').hide();
$('#header_seek').hide();
$('#androidDownload').hide();
$('#classManagementBox').show();
}
_administratorInfo(_data){
//显示相应的数据
this._showAdministratorInfo();
ClassDataProxy.userType= _data.returnData.data.userType;
this._emit(MessageTypes.LOGIN_IN,{userType: ClassDataProxy.userType});
}*/
}
}
... ...
//*
// 首页模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import xdysdk from "libs/xdysdk";
import DrawTool from "./DrawTool";
import LaserPen from "./LaserPen";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
const classifyList = `<div class="classifyList {_classifyListR}" id="{_id}">
<img class="curriculumListImg" src="{_msgImg}" alt="">
<p class="curriculumListTit">{_classroomTitle}</p>
<p class="curriculumListInfo">
<span class="curriculumListTime">{_schoolTime}</span>
<span class="curriculumListNum">{_subscribeNum}</span>
</p>
</div>`;
let loger = Loger.getLoger('PC-MyCenterApe');
class MyCenterApe extends Ape {
constructor() {
super();
this.addEvent();
this.init();
}
init() {
}
addEvent() {
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
return obj[group];
});
};
}
export default MyCenterApe;
\ No newline at end of file
... ...
... ... @@ -79,7 +79,7 @@ class Slideshow extends Ape {
}
slideImg(){
let i = 0;
/* let i = 0;
let width = $('.slidesMap').width();
let clone=$(".slidesMap").first().clone();
$("#motionMapBox").append(clone);
... ... @@ -89,7 +89,7 @@ class Slideshow extends Ape {
}
$("#dots li").first().addClass('active');
/* $(".dots li").hover(function(){
$(".dots li").hover(function(){
let index=$(this).index();
i=index;
$(".motionMapBox").stop().animate({left:-index*width},500);
... ...
... ... @@ -27,6 +27,7 @@ class TeacherDetailApe extends Ape {
constructor() {
super();
this.classDateList = {};//课堂的所有数据
this.isLocalStorage();
this.addEvent();
this.init();
}
... ... @@ -34,28 +35,56 @@ class TeacherDetailApe extends Ape {
init() {
$('#collectYes').hide();
$('#defaultBtn').on('click',this._lanclassBtnHandler.bind(this));//老师首页
$('#teacherBtn').on('click',this._teacherBtnHandler.bind(this));//推荐老师
$('#teacherBtnMove').on('click',this._teacherBtnHandler.bind(this));//推荐老师
$('#classifyListBox').on('click','.pageNumBtn',this._pageNumBtnHandler.bind(this));//点击翻页
}
addEvent() {
}
isLocalStorage(){
let that = this;
$(window).on('load',function() {
let userType = window.localStorage.getItem('userType')
if(window.localStorage.getItem('status') == 'true'){
if (userType == '1') {
//老师
that._teacherHome();
that.detailPage();
}
}
})
}
_lanclassBtnHandler(evt){
$(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
let userType = window.localStorage.getItem("userType");
if(userType== '1'){
//老师首页
this._teacherHome();
this.detailPage();
}
}
_teacherBtnHandler(evt){
let _ele = $(evt.target);
let userType = window.localStorage.getItem("userType");
if(_ele.attr('data')){
$('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
}
$(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').show();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
this.detailPage();
if(userType == '1'){
this.teacherClickTeacher();//老师点击老师模块
}else if(userType == '8' || userType == '0'){
this.studentClickTeacher();//学生点击老师模块
this.detailPage();
}
}
//点击翻页
_pageNumBtnHandler(evt){
... ... @@ -130,12 +159,13 @@ class TeacherDetailApe extends Ape {
let _dataList = _data.meetingInfo;
for(let i = 0;i<_dataList.length;i++){
let j = (i%4)==3;
let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
let _classifyList = this._format(classifyList,{
_classifyListR : j?'classifyListR':'',
_id : _dataList[i].id,
_msgImg :'../images/u373.png',
_classroomTitle : _dataList[i].meetingName,
_schoolTime : '11',
_schoolTime : _getTime,
_subscribeNum : _dataList[i].reservationNumber+'人已预约'
})
classifyListContent.append(_classifyList);
... ... @@ -170,6 +200,27 @@ class TeacherDetailApe extends Ape {
pagingDivInnerHTML += '</div></div>';
classifyListBox.append(pagingDivInnerHTML);
}
_teacherHome(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#header_list').show();
$('#header_seek').show();
$('#androidDownload').show();
$('#classManagementBox').hide();
$('#classifyListBox').show();
}
//学生点击老师模块
studentClickTeacher(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#classifyListBox').show();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
}
//老师点击老师模块
teacherClickTeacher(){
$('#classifyListBox').hide();
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
... ...
... ... @@ -23,6 +23,8 @@ import SignApe from "ape/SignApe";
import localConfig from "local/localConfig";
import UIMagnifyApe from "ape/UIMagnifyApe";
import ErrorApe from 'ape/ErrorApe';
import Slideshow from 'ape/Slideshow';//图片轮播
import LoginOrRegister from 'ape/LoginOrRegister';//登录注册
import LanclassApe from 'ape/LanclassApe';//互动课堂
... ... @@ -32,7 +34,8 @@ import TeacherDetailApe from 'ape/TeacherDetailApe';//老师
import CreateClassApe from 'ape/CreateClassApe';//创建课堂
import ListDetailsApe from 'ape/ListDetailsApe';//列表详情
import AdministratorApe from 'ape/AdministratorApe';//管理员
import MyCenterApe from 'ape/MyCenterApe';//个人中心
import MessageTypes from "MessageTypes";
let loger = Loger.getLoger('PCLive');
let _classApe;
... ... @@ -56,10 +59,11 @@ let _teacherDetailApe;
let _createClassApe;
let _listDetailsApe;
let _administratorApe;
let _myCenterApe;
class Main {
constructor() {
this.clientVersion="v1.2.0.20170901";
this.clientVersion="v1.4.0.20170903";
loger.warn("clientVersion:"+this.clientVersion);
let locationProtocol= location.protocol;
... ... @@ -68,7 +72,9 @@ class Main {
}else {
ClassDataProxy.locationProtocol="http://";
}
this.localStorage = window.localStorage;
//判断当前用户登录身份状态
this._localStorageState();
//获取国际化语言
this._localConfig();
//获取地址栏参数
... ... @@ -132,9 +138,6 @@ class Main {
init() {
loger.log("init");
//xdysdk.api("setDebugInfo",{isDebug:false});//不开启日志输出
//'xdysdk.api("setOpenSendLogToServer",{isOpen:false});//不上报日志
//显示图片大图
UIMagnifyApe.init($('#magnifyBox'));
... ... @@ -187,12 +190,16 @@ class Main {
//登录注册
_loginOrRegister = new LoginOrRegister();
_loginOrRegister.on(MessageTypes.LOGIN_OUT,this.loginOut.bind(this));
_loginOrRegister.on(MessageTypes.LOGIN_IN,this.loginIn.bind(this));
//互动课堂
_lanclassApe = new LanclassApe();
//互动课堂
_liveClassApe = new LiveClassApe();
//首页
_homeApe = new HomeApe();
_homeApe.on(MessageTypes.HOME_SKIP,this.homeSkip.bind(this));
//老师
_teacherDetailApe = new TeacherDetailApe();
//创建课堂
... ... @@ -202,9 +209,49 @@ class Main {
//管理员
_administratorApe = new AdministratorApe();
//个人中心
_myCenterApe = new MyCenterApe();
this._onFlashLoaded();
}
//
loginOut(_data){
//
if(_homeApe){
_homeApe.detailPage();
}
}
loginIn(_data){
loger.log('进入课堂时显示的type值---登录',_data.userType)
if(_data && _data.userType){
if(_data.userType == ClassDataProxy.USER_TYPE_1){
this._teacherHome();
_teacherDetailApe.detailPage();
}else if(_data.userType == ClassDataProxy.USER_TYPE_2){
this._showAdministratorInfo();
_administratorApe.detailPage();
}else if(_data.userType == ClassDataProxy.USER_TYPE_8){
_homeApe.detailPage();
}else if(_data.userType == ClassDataProxy.USER_TYPE_32){
}else{
}
}
}
homeSkip(_data){
if(_data && _data.userType){
if(_data.userType == ClassDataProxy.USER_TYPE_1){
_teacherDetailApe.detailPage();
}
}
}
//监听文档、媒体共享、屏幕共享模块的切换
_onSceneChangeHandler(_sceneName) {
switch (_sceneName) {
... ... @@ -395,7 +442,62 @@ class Main {
_musicShareApe.stop();
}
}
//判断登录用户的状态
_localStorageState(){
let userType = window.localStorage.getItem('userType')||0;
loger.log('进入课堂时显示的type值',parseInt(userType))
switch (parseInt(userType)){
case ClassDataProxy.USER_TYPE_1:
console.log('老师')
//ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1;
this._teacherHome();
break;
case ClassDataProxy.USER_TYPE_2:
console.log('管理员')
// ClassDataProxy.userType = ClassDataProxy.USER_TYPE_2;
this._showAdministratorInfo();
break;
case ClassDataProxy.USER_TYPE_8:
console.log('学生')
///ClassDataProxy.userType = ClassDataProxy.USER_TYPE_8;
this._student();
break;
case ClassDataProxy.USER_TYPE_32:
console.log('兼课')
//ClassDataProxy.userType = ClassDataProxy.USER_TYPE_32;
break;
default:
console.log('游客')
// ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
this._student();
break;
}
}
_showAdministratorInfo(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#header_list').hide();
$('#header_seek').hide();
$('#androidDownload').hide();
$('#classManagementBox').show();
}
_teacherHome(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#header_list').show();
$('#header_seek').show();
$('#androidDownload').show();
$('#classManagementBox').hide();
$('#classifyListBox').show();
}
_student(){
$('#slideshow').show();
$('#defaultBox').show();
$('#classifyListBox').hide();
$('#teacherDetailBox').hide();
$('#lanclassBox').hide();
}
//获取国际化语言
_localConfig() {
let language = navigator.language || navigator.browserLanguage;
... ...
... ... @@ -206,6 +206,26 @@ class ClassDataProxy {
}
return Sys;
}
//计算时间差值显示列表
static getTimeDifference(start,end){
let newStart = new Date(start)
let newEnd = new Date(end)
let day =1000*3600*24;
let timer = parseInt((newEnd.getTime() - newStart.getTime()) / parseInt(day));
let newEndHours = newEnd.getHours()<10?'0'+newEnd.getHours():newEnd.getHours();
let newStartHours = newStart.getHours()<10?'0'+newStart.getHours():newStart.getHours();
let newStartDate = newStart.getDate()<10?'0'+newStart.getDate():newStart.getDate();
let newStartDay = newStart.getDay()<10?'0'+newStart.getDay():newStart.getDay();
if(timer == 0){
return '今天 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
}else{
return newStartDate+1 + '月' + newStartDay +'日 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
}
}
}
//Class
... ... @@ -232,6 +252,18 @@ ClassDataProxy.password = "";
ClassDataProxy.nodeId = 0;
ClassDataProxy.userRole = "normal";
ClassDataProxy.autoLogin = "";
ClassDataProxy.userType = 0;
ClassDataProxy.loginName ="";
ClassDataProxy.password =""
ClassDataProxy.token ="";
ClassDataProxy.status = false;
ClassDataProxy.USER_TYPE_0 = 0;
ClassDataProxy.USER_TYPE_1 = 1;
ClassDataProxy.USER_TYPE_2 = 2;
ClassDataProxy.USER_TYPE_8 = 8;
ClassDataProxy.USER_TYPE_32 = 32;
ClassDataProxy.rosterList={};//用户列表数据
ClassDataProxy.rosterListUpdata={};//用户更新的数据
... ... @@ -240,9 +272,11 @@ ClassDataProxy.curUserInfoTeaOrStu;
ClassDataProxy.curRosterInvisibleNodeId=0;
ClassDataProxy.USER_HOST = 'host';
ClassDataProxy.USER_NOTMAL = 'normal';
ClassDataProxy.USER_INVISIBLE = 'invisible';
ClassDataProxy.USER_HOST = 'host';//老师
ClassDataProxy.USER_NOTMAL = 'normal';//学生
ClassDataProxy.USER_INVISIBLE = 'invisible';//兼课
ClassDataProxy.USER_ADMIN = 'admin';//管理员
ClassDataProxy.USER_VISITOR = 'visitor';//游客
ClassDataProxy.docServer = "";//文档服务器地址
ClassDataProxy.maxAudioChannels = 0;//最大音频路数
... ...