董佳音

整理登录退出身份判断

@@ -155,6 +155,7 @@ body{ @@ -155,6 +155,7 @@ body{
155 .DownloadLoginBox{ 155 .DownloadLoginBox{
156 float: right; 156 float: right;
157 font-size: 16px; 157 font-size: 16px;
  158 + cursor: pointer;
158 } 159 }
159 .DownloadLoginBox li{ 160 .DownloadLoginBox li{
160 float: left; 161 float: left;
@@ -182,11 +183,40 @@ body{ @@ -182,11 +183,40 @@ body{
182 margin-left:20px; 183 margin-left:20px;
183 } 184 }
184 .userLoginBtn{ 185 .userLoginBtn{
185 - width:30px;  
186 - height:30px;  
187 - border-radius: 50%;  
188 - margin:15px 0 0 15px; 186 + margin-left:15px;
189 cursor: pointer; 187 cursor: pointer;
  188 + position: relative;
  189 +}
  190 +.userLoginText{
  191 + height: 70px;
  192 + line-height: 70px;
  193 +}
  194 +.userLoginText:hover{
  195 + color:#3498db;
  196 +}
  197 +.exitBox{
  198 + position: absolute;
  199 + left:-48px;
  200 + top:55px;
  201 + width:130px;
  202 + height:78px;
  203 + padding-top:20px;
  204 + background: #fff;
  205 + box-shadow: 0px 1px 2px #adadad;
  206 + display: none;
  207 + z-index: 1;
  208 +}
  209 +.exitList{
  210 + width:100%;
  211 + height: 28px;
  212 + line-height: 28px;
  213 + font-size: 14px;
  214 + color:#333;
  215 + text-align: center;
  216 +}
  217 +.exitList:hover{
  218 + background: #3498db;
  219 + color:#fff;
190 } 220 }
191 .userLoginBtnImg{ 221 .userLoginBtnImg{
192 width:100%; 222 width:100%;
@@ -1337,4 +1367,35 @@ body{ @@ -1337,4 +1367,35 @@ body{
1337 } 1367 }
1338 .removeCancel{ 1368 .removeCancel{
1339 background: #e6e6e6; 1369 background: #e6e6e6;
  1370 +}
  1371 +/*个人中心*/
  1372 +.myCenterBox{
  1373 + width:100%;
  1374 + float: left;
  1375 + margin:40px 15px 0 40px;
  1376 + display: none;
  1377 +}
  1378 +.myCenterLeftBox{
  1379 + width:200px;
  1380 + height:270px;
  1381 + background: #fff;
  1382 +}
  1383 +.recordLi2{
  1384 + width: 60%;
  1385 + padding-left:30%;
  1386 + text-align: left;
  1387 +}
  1388 +.myCenterContentBox{
  1389 + float: left;
  1390 + width: 1005px;
  1391 +}
  1392 +.myCenterTopLeftBox{
  1393 + width:330px;
  1394 + height:180px;
  1395 + background: #fff;
  1396 +}
  1397 +.myCenterTopRightBox{
  1398 + width:640px;
  1399 + height:180px;
  1400 + background: #fff;
1340 } 1401 }
@@ -29,7 +29,12 @@ @@ -29,7 +29,12 @@
29 </li> 29 </li>
30 <li class="userNews iconfont">&#xe6a5;</li> 30 <li class="userNews iconfont">&#xe6a5;</li>
31 <li class="userLoginBtn"> 31 <li class="userLoginBtn">
32 - <img class="userLoginBtnImg" id="homeUserLoginBtn" src="images/u293.png" alt=""> 32 + <span class="userLoginText" id="homeUserLoginBtn">登录</span>
  33 + <!--<img class="userLoginBtnImg" id="homeUserLoginBtn" src="images/u293.png" alt="">-->
  34 + <ul class="exitBox" id="exitBox">
  35 + <li class="exitList" id="personageInfo">个人中心</li>
  36 + <li class="exitList" id="exitBtn">退出</li>
  37 + </ul>
33 </li> 38 </li>
34 </ul> 39 </ul>
35 </div> 40 </div>
@@ -113,7 +118,7 @@ @@ -113,7 +118,7 @@
113 <span class="lanclassContentInfoTimeStart" id="lanclassContentInfoTimeStart">开始时间:2017-08-01 13:00:00</span> 118 <span class="lanclassContentInfoTimeStart" id="lanclassContentInfoTimeStart">开始时间:2017-08-01 13:00:00</span>
114 <span class="lanclassContentInfoTimeEnd" id="lanclassContentInfoTimeEnd">结束时间:2017-08-01 13:00:00</span> 119 <span class="lanclassContentInfoTimeEnd" id="lanclassContentInfoTimeEnd">结束时间:2017-08-01 13:00:00</span>
115 </div> 120 </div>
116 - <div class="lanclassContentApply" id="lanclassContentApply">我要报名</div> 121 + <div class="lanclassContentApply btnHover" id="lanclassContentApply">我要报名</div>
117 </div> 122 </div>
118 <div class="lanclassContentRight"> 123 <div class="lanclassContentRight">
119 <div class="thirdPartyIconBox"> 124 <div class="thirdPartyIconBox">
@@ -165,7 +170,7 @@ @@ -165,7 +170,7 @@
165 <img class="teacherDetailInfoImg" id="teacherDetailInfoImg" src="" alt=""> 170 <img class="teacherDetailInfoImg" id="teacherDetailInfoImg" src="" alt="">
166 <ul class="teacherDetailInfoDetailBox"> 171 <ul class="teacherDetailInfoDetailBox">
167 <li class="teacherDetailInfoDetailTit"> 172 <li class="teacherDetailInfoDetailTit">
168 - <span class="teacherDetailInfoDetailName" id="teacherDetailInfoDetailName">媛媛</span> 173 + <span class="teacherDetailInfoDetailName" id="teacherDetailInfoDetailName">3333</span>
169 <span class="teacherDetailInfoDetailSex" id="teacherDetailInfoDetailSex"></span> 174 <span class="teacherDetailInfoDetailSex" id="teacherDetailInfoDetailSex"></span>
170 </li> 175 </li>
171 <li class="teacherDetailInfoDetailSpeciality"> 176 <li class="teacherDetailInfoDetailSpeciality">
@@ -323,34 +328,6 @@ @@ -323,34 +328,6 @@
323 操作 328 操作
324 </th> 329 </th>
325 </tr> 330 </tr>
326 - <tr align="center" bgcolor="#FFFFFF" height="44">  
327 - <td class="tr_main">  
328 - 少儿英语  
329 - </td>  
330 - <td class="tr_main">  
331 - 101545534  
332 - </td>  
333 - <td class="tr_main">  
334 - markettest  
335 - </td>  
336 - <td class="tr_main">  
337 - 准备  
338 - </td>  
339 - <td class="tr_main" style="width:40px;">  
340 - 2017-08-29 18:00:00 - 2017-08-29 23:00:00  
341 - </td>  
342 - <td class="tr_main">  
343 - 0  
344 - </td>  
345 - <td class="tr_main tr_mainRight" align="center" >  
346 - <a class="classHandlePort" href="#">文档</a>  
347 - <a class="classHandlePort" href="">多媒体</a>  
348 - <a class="classHandlePort" href="">伴音</a>  
349 - <a class="classHandlePort" href="">修改</a>  
350 - <a class="classHandlePort" href="">删除</a>  
351 - <a class="classHandlePort" href="">加入课堂</a>  
352 - </td>  
353 - </tr>  
354 </tbody> 331 </tbody>
355 </table> 332 </table>
356 333
@@ -970,6 +947,43 @@ @@ -970,6 +947,43 @@
970 </div> 947 </div>
971 </div> 948 </div>
972 </div> 949 </div>
  950 + <!--个人中心-->
  951 + <div id="myCenterBox" class="myCenterBox">
  952 + <div class="myCenterLeftBox">
  953 + <ul class="recordUl" id="teacherUI">
  954 + <li class="recordLi recordLi2 recordLiCheck">
  955 + <label for="courseManagement" class="iconfont">&#xe699;</label>
  956 + <span class="recordLiText" id="teacherHomeBtn">首页</span>
  957 + </li>
  958 + <li class="recordLi recordLi2">
  959 + <label for="createClassBtn" class="iconfont">&#xe69a;</label>
  960 + <span class="recordLiText" id="teacherCoursesBtn">我的课程</span>
  961 + </li>
  962 + <li class="recordLi recordLi2">
  963 + <label for="classManagement" class="iconfont">&#xe6a4;</label>
  964 + <span class="recordLiText" id="teacherOrderBtn">我的预约</span>
  965 + </li>
  966 + <li class="recordLi recordLi2">
  967 + <label for="personManagement" class="iconfont">&#xe6a1;</label>
  968 + <span class="recordLiText" id="teacherSetBtn">个人设置</span>
  969 + </li>
  970 + </ul>
  971 + </div>
  972 + <div class="myCenterContentBox">
  973 + <div class="myCenterTopLeftBox"></div>
  974 + <div class="myCenterTopRightBox"></div>
  975 + <div class="myCenterContentTitle">
  976 + <div class="liveInfoLeft" id="teacherInfoList">
  977 + <div class="liveInfoLeftLi liveInfoLeftLiCheck">正在直播</div>
  978 + <div class="liveInfoLeftLi">未开始</div>
  979 + <div class="liveInfoLeftLi">已结束</div>
  980 + </div>
  981 + </div>
  982 + <div class="myCenterContent">
  983 +
  984 + </div>
  985 + </div>
  986 + </div>
973 </div> 987 </div>
974 <div class="footerBg"> 988 <div class="footerBg">
975 <div class="footer"> 989 <div class="footer">
  1 +/**
  2 + *事件消息ID和错误码 定义
  3 + */
  4 +
  5 +function MessageTypes() {}
  6 +
  7 +//--------------------事件相关的定义--------------------------------------
  8 +//登陆相关
  9 +MessageTypes.LOGIN_OUT= "login_out"; //更新用户退出
  10 +MessageTypes.LOGIN_IN= "login_in"; //更新用户退出
  11 +
  12 +
  13 +//header按钮
  14 +MessageTypes.HOME_SKIP= "home_skip"; //首页跳转
  15 +MessageTypes.TEACHER_SKIP= "teacher_skip"; //老师跳转
  16 +
  17 +
  18 +
  19 +//
  20 +export default MessageTypes;
  21 +
@@ -32,7 +32,7 @@ const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspa @@ -32,7 +32,7 @@ const adminListTit = `<table width="100%" align="center" cellpadding="0" cellspa
32 <th width="6%" class="tr_center"> 32 <th width="6%" class="tr_center">
33 在线人数 33 在线人数
34 </th> 34 </th>
35 - <th width="22%" class="tr_center"> 35 + <th width="20%" class="tr_center">
36 操作 36 操作
37 </th> 37 </th>
38 </tr> 38 </tr>
@@ -45,7 +45,7 @@ const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor= @@ -45,7 +45,7 @@ const adminList = `<tr align="center" bgcolor="#FFFFFF" height="44" bordercolor=
45 <td width="6%" class="tr_main">{_stateInfo}</td> 45 <td width="6%" class="tr_main">{_stateInfo}</td>
46 <td width="18%" class="tr_main">{_time}</td> 46 <td width="18%" class="tr_main">{_time}</td>
47 <td width="4%" class="tr_main">{_onlineLen}</td> 47 <td width="4%" class="tr_main">{_onlineLen}</td>
48 - <td width="22%" class="tr_main tr_mainRight" align="center" > 48 + <td width="20%" class="tr_main tr_mainRight" align="center" >
49 <a id="{_DocInd}" class="classHandlePort" href="#">文档</a> 49 <a id="{_DocInd}" class="classHandlePort" href="#">文档</a>
50 <a id="{_mediaInd}" class="classHandlePort" href="">多媒体</a> 50 <a id="{_mediaInd}" class="classHandlePort" href="">多媒体</a>
51 <a id="{_musicInd}" class="classHandlePort" href="">伴音</a> 51 <a id="{_musicInd}" class="classHandlePort" href="">伴音</a>
@@ -62,6 +62,7 @@ class AdministratorApe extends Ape { @@ -62,6 +62,7 @@ class AdministratorApe extends Ape {
62 this.classDateList = {};//课堂的所有数据 62 this.classDateList = {};//课堂的所有数据
63 this.pageNo = 0; 63 this.pageNo = 0;
64 this.presentInd = 0; 64 this.presentInd = 0;
  65 + this.isLocalStorage();
65 this.addEvent(); 66 this.addEvent();
66 this.init(); 67 this.init();
67 } 68 }
@@ -80,6 +81,12 @@ class AdministratorApe extends Ape { @@ -80,6 +81,12 @@ class AdministratorApe extends Ape {
80 addEvent() { 81 addEvent() {
81 82
82 } 83 }
  84 + isLocalStorage(){
  85 + if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){
  86 + this.detailPage();
  87 + console.log('管理员',111111111)
  88 + }
  89 + }
83 //首页 90 //首页
84 _homePageHandler(){ 91 _homePageHandler(){
85 this.presentInd = 1; 92 this.presentInd = 1;
@@ -27,18 +27,26 @@ class HomeApe extends Ape { @@ -27,18 +27,26 @@ class HomeApe extends Ape {
27 this.classDateList = {};//课堂的所有数据 27 this.classDateList = {};//课堂的所有数据
28 //判断列表在右侧时取消边距 28 //判断列表在右侧时取消边距
29 this._judgeListPlace(); 29 this._judgeListPlace();
  30 + this.isLocalStorage();
30 this.addEvent(); 31 this.addEvent();
31 this.init(); 32 this.init();
32 } 33 }
33 34
34 init() { 35 init() {
35 - this.detailPage(); 36 + // this.subscribe();
36 $('#defaultBtn').on('click',this._lanclassBtnHandler.bind(this)); 37 $('#defaultBtn').on('click',this._lanclassBtnHandler.bind(this));
  38 +
37 } 39 }
38 40
39 addEvent() { 41 addEvent() {
40 42
41 } 43 }
  44 + isLocalStorage(){
  45 + if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_0 || ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){
  46 + this.detailPage();
  47 + console.log('学生',111111111)
  48 + }
  49 + }
42 _judgeListPlace(){ 50 _judgeListPlace(){
43 let i; 51 let i;
44 let curriculumList = document.getElementsByClassName('curriculumList'); 52 let curriculumList = document.getElementsByClassName('curriculumList');
@@ -50,11 +58,13 @@ class HomeApe extends Ape { @@ -50,11 +58,13 @@ class HomeApe extends Ape {
50 } 58 }
51 _lanclassBtnHandler(evt){ 59 _lanclassBtnHandler(evt){
52 $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); 60 $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
53 - $('#slideshow').show();  
54 - $('#defaultBox').show();  
55 - $('#classifyListBox').hide();  
56 - $('#teacherDetailBox').hide();  
57 - $('#lanclassBox').hide(); 61 + let userType = window.localStorage.getItem("userType");
  62 + if( userType== ClassDataProxy.USER_TYPE_8 || userType== ClassDataProxy.USER_TYPE_0){
  63 + this.studentClick();
  64 + }else if(userType== ClassDataProxy.USER_TYPE_1){
  65 + let userType = ClassDataProxy.userType;
  66 + this._emit(MessageTypes.HOME_SKIP,{userType:userType});
  67 + }
58 } 68 }
59 detailPage(){ 69 detailPage(){
60 let that = this; 70 let that = this;
@@ -77,6 +87,40 @@ class HomeApe extends Ape { @@ -77,6 +87,40 @@ class HomeApe extends Ape {
77 } 87 }
78 }) 88 })
79 } 89 }
  90 + subscribe(){
  91 + let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
  92 + $.ajax({
  93 + type: "GET",
  94 + url: _url,
  95 + data:{siteId:'markettest'},
  96 + headers: {siteId:'markettest',
  97 + 'token':'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IlhXQnJlRU00T0swYTVqUUIyUTFicGtObHlxOUFWbXZkIiwibmFtZSI6ImFkbWluIiwiY29kZSI6MSwiaWF0IjoxNTAzNDUxODU0LCJleHAiOjIyODEwNTE4NTR9.3kTVzKd_jbP7l69nxOpNaFeSjVnnjZkagYMzRB8fjNo'},
  98 + success:function(_data){
  99 + // loger.log(_data,'成功')
  100 + //获取课堂数据
  101 + if(_data || _data.code == 200){
  102 + that._gainClassData(_data.returnData.data);
  103 + }
  104 + },
  105 + error:function(error){
  106 + console.log(error,'失败')
  107 + }
  108 + })
  109 + }
  110 + studentClick(){
  111 + $('#slideshow').show();
  112 + $('#defaultBox').show();
  113 + $('#classifyListBox').hide();
  114 + $('#teacherDetailBox').hide();
  115 + $('#lanclassBox').hide();
  116 + }
  117 + teacher(){
  118 + $('#slideshow').hide();
  119 + $('#defaultBox').hide();
  120 + $('#classifyListBox').show();
  121 + $('#teacherDetailBox').hide();
  122 + $('#lanclassBox').hide();
  123 + }
80 _gainClassData(_data){ 124 _gainClassData(_data){
81 let liveList = $('#liveList'); 125 let liveList = $('#liveList');
82 let lanclassList = $('#lanclassList'); 126 let lanclassList = $('#lanclassList');
@@ -89,7 +133,7 @@ class HomeApe extends Ape { @@ -89,7 +133,7 @@ class HomeApe extends Ape {
89 for(let i = 0;i<_dataList.length;i++){ 133 for(let i = 0;i<_dataList.length;i++){
90 if(i<8){ 134 if(i<8){
91 let j = (i%4)==3; 135 let j = (i%4)==3;
92 - let _getTime = this.getTime(_dataList[i].beginTime,_dataList[i].endTime) 136 + let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
93 let _classifyList = this._format(classifyList,{ 137 let _classifyList = this._format(classifyList,{
94 _classifyListR : j?'classifyListR':'', 138 _classifyListR : j?'classifyListR':'',
95 _id : _dataList[i].id, 139 _id : _dataList[i].id,
@@ -106,26 +150,6 @@ class HomeApe extends Ape { @@ -106,26 +150,6 @@ class HomeApe extends Ape {
106 } 150 }
107 151
108 } 152 }
109 - getTime(start,end){  
110 -  
111 - let newStart = new Date(start)  
112 - let newEnd = new Date(end)  
113 -  
114 - let day =1000*3600*24;  
115 -  
116 - let timer = parseInt((newEnd.getTime() - newStart.getTime()) / parseInt(day));  
117 - let newEndHours = newEnd.getHours()<10?'0'+newEnd.getHours():newEnd.getHours();  
118 - let newStartHours = newStart.getHours()<10?'0'+newStart.getHours():newStart.getHours();  
119 -  
120 - let newStartDate = newStart.getDate()<10?'0'+newStart.getDate():newStart.getDate();  
121 - let newStartDay = newStart.getDay()<10?'0'+newStart.getDay():newStart.getDay();  
122 - if(timer == 0){  
123 - return '今天 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';  
124 - }else{  
125 - return newStartDate+1 + '月' + newStartDay +'日 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';  
126 - }  
127 -  
128 - }  
129 //工具类 153 //工具类
130 _format(str, obj) { 154 _format(str, obj) {
131 return str.replace(/\{(\w+)\}/g, function (match, group, index) { 155 return str.replace(/\{(\w+)\}/g, function (match, group, index) {
@@ -133,12 +133,13 @@ class LanclassApe extends Ape { @@ -133,12 +133,13 @@ class LanclassApe extends Ape {
133 if(_dataList){ 133 if(_dataList){
134 for(let i = 0;i<_dataList.length;i++){ 134 for(let i = 0;i<_dataList.length;i++){
135 let j = (i%4)==3; 135 let j = (i%4)==3;
  136 + let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
136 let _classifyList = this._format(classifyList,{ 137 let _classifyList = this._format(classifyList,{
137 _classifyListR : j?'classifyListR':'', 138 _classifyListR : j?'classifyListR':'',
138 _id : _dataList[i].id, 139 _id : _dataList[i].id,
139 _msgImg :'../images/u373.png', 140 _msgImg :'../images/u373.png',
140 _classroomTitle : _dataList[i].meetingName, 141 _classroomTitle : _dataList[i].meetingName,
141 - _schoolTime : '11', 142 + _schoolTime : _getTime,
142 _subscribeNum : _dataList[i].reservationNumber+'人已预约' 143 _subscribeNum : _dataList[i].reservationNumber+'人已预约'
143 }) 144 })
144 classifyListContent.append(_classifyList); 145 classifyListContent.append(_classifyList);
@@ -20,6 +20,8 @@ class ListDetailsApe extends Ape { @@ -20,6 +20,8 @@ class ListDetailsApe extends Ape {
20 20
21 init() { 21 init() {
22 $('#themeBox ').on('click','.classifyList',this._curriculumListHandler.bind(this)); 22 $('#themeBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));
  23 + $('#collectYes ').on('click',this._collectYesHandler.bind(this));
  24 + $('#collectNo ').on('click',this._collectNoHandler.bind(this));
23 } 25 }
24 26
25 addEvent() { 27 addEvent() {
@@ -30,6 +32,14 @@ class ListDetailsApe extends Ape { @@ -30,6 +32,14 @@ class ListDetailsApe extends Ape {
30 let _id = evt.currentTarget.id; 32 let _id = evt.currentTarget.id;
31 this.detailPage(_id); 33 this.detailPage(_id);
32 } 34 }
  35 + _collectYesHandler(){
  36 + $('#collectYes ').hide();
  37 + $('#collectNo ').show();
  38 + }
  39 + _collectNoHandler(){
  40 + $('#collectYes ').show();
  41 + $('#collectNo ').hide();
  42 + }
33 detailPage(_id){ 43 detailPage(_id){
34 let that = this; 44 let that = this;
35 let signInfo = { 45 let signInfo = {
@@ -133,12 +133,13 @@ class LanclassApe extends Ape { @@ -133,12 +133,13 @@ class LanclassApe extends Ape {
133 if(_dataList){ 133 if(_dataList){
134 for(let i = 0;i<_dataList.length;i++){ 134 for(let i = 0;i<_dataList.length;i++){
135 let j = (i%4)==3; 135 let j = (i%4)==3;
  136 + let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
136 let _classifyList = this._format(classifyList,{ 137 let _classifyList = this._format(classifyList,{
137 _classifyListR : j?'classifyListR':'', 138 _classifyListR : j?'classifyListR':'',
138 _id : _dataList[i].id, 139 _id : _dataList[i].id,
139 _msgImg :'../images/u373.png', 140 _msgImg :'../images/u373.png',
140 _classroomTitle : _dataList[i].meetingName, 141 _classroomTitle : _dataList[i].meetingName,
141 - _schoolTime : '11', 142 + _schoolTime : _getTime,
142 _subscribeNum : _dataList[i].reservationNumber+'人已预约' 143 _subscribeNum : _dataList[i].reservationNumber+'人已预约'
143 }) 144 })
144 classifyListContent.append(_classifyList); 145 classifyListContent.append(_classifyList);
@@ -9,12 +9,13 @@ import DrawTool from "./DrawTool"; @@ -9,12 +9,13 @@ import DrawTool from "./DrawTool";
9 import LaserPen from "./LaserPen"; 9 import LaserPen from "./LaserPen";
10 import $ from "jquery"; 10 import $ from "jquery";
11 import ClassDataProxy from "proxy/ClassDataProxy"; 11 import ClassDataProxy from "proxy/ClassDataProxy";
  12 +import MessageTypes from "../MessageTypes";
12 13
13 let loger = Loger.getLoger('PC-LoginOrRegister'); 14 let loger = Loger.getLoger('PC-LoginOrRegister');
14 class LoginOrRegister extends Ape { 15 class LoginOrRegister extends Ape {
15 constructor() { 16 constructor() {
16 super(); 17 super();
17 - this.localStorage = window.localStorage; 18 +
18 this.isLocalStorage(); 19 this.isLocalStorage();
19 this.addEvent(); 20 this.addEvent();
20 this.init(); 21 this.init();
@@ -36,15 +37,37 @@ class LoginOrRegister extends Ape { @@ -36,15 +37,37 @@ class LoginOrRegister extends Ape {
36 $('#userLoginBtn').on('click',this._loginBtnHandler.bind(this));//登录信息提交 37 $('#userLoginBtn').on('click',this._loginBtnHandler.bind(this));//登录信息提交
37 38
38 $('#homeUserLoginBtn').on('click',this._homeUserLoginBtnHandler.bind(this));//首页用户登录 39 $('#homeUserLoginBtn').on('click',this._homeUserLoginBtnHandler.bind(this));//首页用户登录
  40 + $('#homeUserLoginBtn').on('mouseenter',this._mouseenterHandler.bind(this));//首页用户登录
  41 + $('#exitBox').on('mouseleave',this._mouseleaveHandler.bind(this));//首页用户登录
39 42
  43 + $('#exitBtn').on('click',this._exitBtnHandler.bind(this));//退出登录
40 44
  45 + $('body').on('click',function(evt){
  46 + if(!$(evt.target).is('#exitBox')){
  47 + $('#exitBox').hide();
  48 + }
  49 + });
41 } 50 }
  51 +
42 isLocalStorage(){ 52 isLocalStorage(){
43 - if(window.localStorage.getItem('loginName') && window.localStorage.getItem('password')){  
44 - this._showAdministratorInfo();  
45 - }  
46 - } 53 + let that = this;
  54 + $(window).on('load',function(){
  55 + if(!window.localStorage.getItem('status')){
  56 + $('#homeUserLoginBtn').text('登录');
  57 + }else{
  58 +
  59 + }
  60 + if(window.localStorage.getItem('status') == 'true'){
  61 + let userType = window.localStorage.getItem('userType')
  62 + $('#homeUserLoginBtn').text(window.localStorage.getItem('loginName'));
  63 +
  64 + // that._showAdministratorInfo();
47 65
  66 +
  67 + }
  68 +
  69 + })
  70 + }
48 addEvent() { 71 addEvent() {
49 72
50 } 73 }
@@ -68,8 +91,46 @@ class LoginOrRegister extends Ape { @@ -68,8 +91,46 @@ class LoginOrRegister extends Ape {
68 } 91 }
69 //首页用户登录 92 //首页用户登录
70 _homeUserLoginBtnHandler(){ 93 _homeUserLoginBtnHandler(){
71 - $('#userLoginBox').show(); 94 + if(!window.localStorage.getItem('status')){
  95 + $('#userLoginBox').show();
  96 + }
  97 + }
  98 + _mouseenterHandler(){
  99 + if(window.localStorage.getItem('status') == 'true'){
  100 + $('#exitBox').show();
  101 + }
72 } 102 }
  103 + _mouseleaveHandler(){
  104 + $('#exitBox').hide();
  105 + }
  106 + _exitBtnHandler(){
  107 + this.clearLocalStorage();
  108 + this.updateInterfaceState();
  109 + this._emit(MessageTypes.LOGIN_OUT);
  110 + }
  111 + clearLocalStorage(){
  112 + window.localStorage.clear();
  113 + ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
  114 + ClassDataProxy.loginName ="";
  115 + ClassDataProxy.password =""
  116 + ClassDataProxy.token ="";
  117 + ClassDataProxy.status = false;
  118 +
  119 + }
  120 + updateInterfaceState(){
  121 + $('#homeUserLoginBtn').text('登录');
  122 + $('#loginName').val('');
  123 + $('#loginPassWord').val('');
  124 + $('#slideshow').show();
  125 + $('#defaultBox').show();
  126 + $('#header_list').show();
  127 + $('#header_seek').show();
  128 + $('#androidDownload').show();
  129 + $('#exitBox').hide();
  130 + $('#classManagementBox').hide();
  131 + $('#defaultBtn').addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
  132 + }
  133 +
73 _signFocusHandler(evt){ 134 _signFocusHandler(evt){
74 let _ele = $(evt.target); 135 let _ele = $(evt.target);
75 if(_ele.css('color') != 'rgb(0, 0, 0)'){ 136 if(_ele.css('color') != 'rgb(0, 0, 0)'){
@@ -211,7 +272,6 @@ class LoginOrRegister extends Ape { @@ -211,7 +272,6 @@ class LoginOrRegister extends Ape {
211 } 272 }
212 //登录信息提交 273 //登录信息提交
213 _loginBtnHandler(){ 274 _loginBtnHandler(){
214 - loger.log('登录信息提交')  
215 let _name = document.getElementById("loginName");//用户名 275 let _name = document.getElementById("loginName");//用户名
216 let _passWord = document.getElementById("loginPassWord");//手机号 276 let _passWord = document.getElementById("loginPassWord");//手机号
217 if(_name.value && _passWord.value){ 277 if(_name.value && _passWord.value){
@@ -227,13 +287,22 @@ class LoginOrRegister extends Ape { @@ -227,13 +287,22 @@ class LoginOrRegister extends Ape {
227 url: _url, 287 url: _url,
228 data: signInfo, 288 data: signInfo,
229 success:function(_data){ 289 success:function(_data){
230 - loger.log('登录信息返回信息',_data)  
231 if(_data || _data.code == 200){ 290 if(_data || _data.code == 200){
232 - that.successLogin(_data);  
233 - window.localStorage.setItem("loginName",_name.value);  
234 - window.localStorage.setItem("password", _passWord.value);  
235 - window.localStorage.setItem("userType", _data.returnData.data.userType);  
236 - window.localStorage.setItem("token",_data.returnData.data.token); 291 + ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1;
  292 + //ClassDataProxy.userType= _data.returnData.data.userType;
  293 + ClassDataProxy.loginName =_name.value;
  294 + ClassDataProxy.password = _passWord.value;
  295 + ClassDataProxy.token =_data.returnData.data.token
  296 + ClassDataProxy.status = true;
  297 +
  298 +
  299 + window.localStorage.setItem("loginName",ClassDataProxy.loginName);
  300 + window.localStorage.setItem("password", ClassDataProxy.password );
  301 + window.localStorage.setItem("userType", ClassDataProxy.userType);
  302 + window.localStorage.setItem("token", ClassDataProxy.token );
  303 + window.localStorage.setItem('status', ClassDataProxy.status);
  304 +
  305 + that.successLogin();
237 } 306 }
238 }, 307 },
239 error:function(error){ 308 error:function(error){
@@ -248,26 +317,21 @@ class LoginOrRegister extends Ape { @@ -248,26 +317,21 @@ class LoginOrRegister extends Ape {
248 } 317 }
249 //用户成功登录 318 //用户成功登录
250 successLogin(_data){ 319 successLogin(_data){
251 - if(_data.code == 200){ 320 +
  321 + //登录成功后显示用户名字
  322 + $('#homeUserLoginBtn').text( ClassDataProxy.loginName);
  323 + this._userLoginAHandler();
  324 + this._emit(MessageTypes.LOGIN_IN,{userType: ClassDataProxy.userType});
  325 +
  326 + /* if(_data.code == 200){
  327 + window.localStorage.setItem('status',true)
  328 + //登录成功后显示用户名字
  329 + $('#homeUserLoginBtn').text(_data.returnData.data.userName);
252 this._userLoginAHandler(); 330 this._userLoginAHandler();
253 - //判断状态1 是管理员  
254 - this._administratorInfo(_data);  
255 - //状态2 是老师  
256 - //状态8 是学生  
257 - //状态32 是兼课  
258 - }  
259 - }  
260 - _showAdministratorInfo(){  
261 - $('#slideshow').hide();  
262 - $('#defaultBox').hide();  
263 - $('#header_list').hide();  
264 - $('#header_seek').hide();  
265 - $('#androidDownload').hide();  
266 - $('#classManagementBox').show();  
267 - }  
268 - _administratorInfo(_data){  
269 - //显示相应的数据  
270 - this._showAdministratorInfo(); 331 +
  332 + ClassDataProxy.userType= _data.returnData.data.userType;
  333 + this._emit(MessageTypes.LOGIN_IN,{userType: ClassDataProxy.userType});
  334 + }*/
271 } 335 }
272 336
273 } 337 }
  1 +//*
  2 +// 首页模块
  3 +// */
  4 +
  5 +import Loger from "../Loger";
  6 +import Ape from "./Ape";
  7 +import xdysdk from "libs/xdysdk";
  8 +import DrawTool from "./DrawTool";
  9 +import LaserPen from "./LaserPen";
  10 +import $ from "jquery";
  11 +import ClassDataProxy from "proxy/ClassDataProxy";
  12 +
  13 +const classifyList = `<div class="classifyList {_classifyListR}" id="{_id}">
  14 + <img class="curriculumListImg" src="{_msgImg}" alt="">
  15 + <p class="curriculumListTit">{_classroomTitle}</p>
  16 + <p class="curriculumListInfo">
  17 + <span class="curriculumListTime">{_schoolTime}</span>
  18 + <span class="curriculumListNum">{_subscribeNum}</span>
  19 + </p>
  20 + </div>`;
  21 +
  22 +
  23 +let loger = Loger.getLoger('PC-MyCenterApe');
  24 +class MyCenterApe extends Ape {
  25 + constructor() {
  26 + super();
  27 + this.addEvent();
  28 + this.init();
  29 + }
  30 +
  31 + init() {
  32 +
  33 + }
  34 +
  35 + addEvent() {
  36 +
  37 + }
  38 + //工具类
  39 + _format(str, obj) {
  40 + return str.replace(/\{(\w+)\}/g, function (match, group, index) {
  41 + return obj[group];
  42 + });
  43 + };
  44 +}
  45 +export default MyCenterApe;
@@ -79,7 +79,7 @@ class Slideshow extends Ape { @@ -79,7 +79,7 @@ class Slideshow extends Ape {
79 } 79 }
80 slideImg(){ 80 slideImg(){
81 81
82 - let i = 0; 82 + /* let i = 0;
83 let width = $('.slidesMap').width(); 83 let width = $('.slidesMap').width();
84 let clone=$(".slidesMap").first().clone(); 84 let clone=$(".slidesMap").first().clone();
85 $("#motionMapBox").append(clone); 85 $("#motionMapBox").append(clone);
@@ -89,7 +89,7 @@ class Slideshow extends Ape { @@ -89,7 +89,7 @@ class Slideshow extends Ape {
89 } 89 }
90 $("#dots li").first().addClass('active'); 90 $("#dots li").first().addClass('active');
91 91
92 - /* $(".dots li").hover(function(){ 92 + $(".dots li").hover(function(){
93 let index=$(this).index(); 93 let index=$(this).index();
94 i=index; 94 i=index;
95 $(".motionMapBox").stop().animate({left:-index*width},500); 95 $(".motionMapBox").stop().animate({left:-index*width},500);
@@ -27,6 +27,7 @@ class TeacherDetailApe extends Ape { @@ -27,6 +27,7 @@ class TeacherDetailApe extends Ape {
27 constructor() { 27 constructor() {
28 super(); 28 super();
29 this.classDateList = {};//课堂的所有数据 29 this.classDateList = {};//课堂的所有数据
  30 + this.isLocalStorage();
30 this.addEvent(); 31 this.addEvent();
31 this.init(); 32 this.init();
32 } 33 }
@@ -34,28 +35,56 @@ class TeacherDetailApe extends Ape { @@ -34,28 +35,56 @@ class TeacherDetailApe extends Ape {
34 init() { 35 init() {
35 $('#collectYes').hide(); 36 $('#collectYes').hide();
36 37
  38 + $('#defaultBtn').on('click',this._lanclassBtnHandler.bind(this));//老师首页
  39 +
37 $('#teacherBtn').on('click',this._teacherBtnHandler.bind(this));//推荐老师 40 $('#teacherBtn').on('click',this._teacherBtnHandler.bind(this));//推荐老师
38 $('#teacherBtnMove').on('click',this._teacherBtnHandler.bind(this));//推荐老师 41 $('#teacherBtnMove').on('click',this._teacherBtnHandler.bind(this));//推荐老师
39 42
40 $('#classifyListBox').on('click','.pageNumBtn',this._pageNumBtnHandler.bind(this));//点击翻页 43 $('#classifyListBox').on('click','.pageNumBtn',this._pageNumBtnHandler.bind(this));//点击翻页
  44 +
  45 +
41 } 46 }
42 47
43 addEvent() { 48 addEvent() {
44 49
45 } 50 }
  51 + isLocalStorage(){
  52 + let that = this;
  53 + $(window).on('load',function() {
  54 + let userType = window.localStorage.getItem('userType')
  55 + if(window.localStorage.getItem('status') == 'true'){
  56 + if (userType == '1') {
  57 + //老师
  58 + that._teacherHome();
  59 + that.detailPage();
  60 + }
  61 + }
  62 + })
  63 + }
  64 + _lanclassBtnHandler(evt){
  65 + $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
  66 + let userType = window.localStorage.getItem("userType");
  67 + if(userType== '1'){
  68 + //老师首页
  69 + this._teacherHome();
  70 + this.detailPage();
  71 + }
46 72
  73 + }
47 _teacherBtnHandler(evt){ 74 _teacherBtnHandler(evt){
48 let _ele = $(evt.target); 75 let _ele = $(evt.target);
  76 + let userType = window.localStorage.getItem("userType");
49 if(_ele.attr('data')){ 77 if(_ele.attr('data')){
50 $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); 78 $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
51 } 79 }
52 $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); 80 $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck');
53 - $('#slideshow').hide();  
54 - $('#defaultBox').hide();  
55 - $('#classifyListBox').show();  
56 - $('#teacherDetailBox').hide();  
57 - $('#lanclassBox').hide();  
58 - this.detailPage(); 81 + if(userType == '1'){
  82 + this.teacherClickTeacher();//老师点击老师模块
  83 + }else if(userType == '8' || userType == '0'){
  84 + this.studentClickTeacher();//学生点击老师模块
  85 + this.detailPage();
  86 + }
  87 +
59 } 88 }
60 //点击翻页 89 //点击翻页
61 _pageNumBtnHandler(evt){ 90 _pageNumBtnHandler(evt){
@@ -130,12 +159,13 @@ class TeacherDetailApe extends Ape { @@ -130,12 +159,13 @@ class TeacherDetailApe extends Ape {
130 let _dataList = _data.meetingInfo; 159 let _dataList = _data.meetingInfo;
131 for(let i = 0;i<_dataList.length;i++){ 160 for(let i = 0;i<_dataList.length;i++){
132 let j = (i%4)==3; 161 let j = (i%4)==3;
  162 + let _getTime = ClassDataProxy.getTimeDifference(_dataList[i].beginTime,_dataList[i].endTime)
133 let _classifyList = this._format(classifyList,{ 163 let _classifyList = this._format(classifyList,{
134 _classifyListR : j?'classifyListR':'', 164 _classifyListR : j?'classifyListR':'',
135 _id : _dataList[i].id, 165 _id : _dataList[i].id,
136 _msgImg :'../images/u373.png', 166 _msgImg :'../images/u373.png',
137 _classroomTitle : _dataList[i].meetingName, 167 _classroomTitle : _dataList[i].meetingName,
138 - _schoolTime : '11', 168 + _schoolTime : _getTime,
139 _subscribeNum : _dataList[i].reservationNumber+'人已预约' 169 _subscribeNum : _dataList[i].reservationNumber+'人已预约'
140 }) 170 })
141 classifyListContent.append(_classifyList); 171 classifyListContent.append(_classifyList);
@@ -170,6 +200,27 @@ class TeacherDetailApe extends Ape { @@ -170,6 +200,27 @@ class TeacherDetailApe extends Ape {
170 pagingDivInnerHTML += '</div></div>'; 200 pagingDivInnerHTML += '</div></div>';
171 classifyListBox.append(pagingDivInnerHTML); 201 classifyListBox.append(pagingDivInnerHTML);
172 } 202 }
  203 + _teacherHome(){
  204 + $('#slideshow').hide();
  205 + $('#defaultBox').hide();
  206 + $('#header_list').show();
  207 + $('#header_seek').show();
  208 + $('#androidDownload').show();
  209 + $('#classManagementBox').hide();
  210 + $('#classifyListBox').show();
  211 + }
  212 + //学生点击老师模块
  213 + studentClickTeacher(){
  214 + $('#slideshow').hide();
  215 + $('#defaultBox').hide();
  216 + $('#classifyListBox').show();
  217 + $('#teacherDetailBox').hide();
  218 + $('#lanclassBox').hide();
  219 + }
  220 + //老师点击老师模块
  221 + teacherClickTeacher(){
  222 + $('#classifyListBox').hide();
  223 + }
173 //工具类 224 //工具类
174 _format(str, obj) { 225 _format(str, obj) {
175 return str.replace(/\{(\w+)\}/g, function (match, group, index) { 226 return str.replace(/\{(\w+)\}/g, function (match, group, index) {
@@ -23,6 +23,8 @@ import SignApe from "ape/SignApe"; @@ -23,6 +23,8 @@ import SignApe from "ape/SignApe";
23 import localConfig from "local/localConfig"; 23 import localConfig from "local/localConfig";
24 import UIMagnifyApe from "ape/UIMagnifyApe"; 24 import UIMagnifyApe from "ape/UIMagnifyApe";
25 import ErrorApe from 'ape/ErrorApe'; 25 import ErrorApe from 'ape/ErrorApe';
  26 +
  27 +
26 import Slideshow from 'ape/Slideshow';//图片轮播 28 import Slideshow from 'ape/Slideshow';//图片轮播
27 import LoginOrRegister from 'ape/LoginOrRegister';//登录注册 29 import LoginOrRegister from 'ape/LoginOrRegister';//登录注册
28 import LanclassApe from 'ape/LanclassApe';//互动课堂 30 import LanclassApe from 'ape/LanclassApe';//互动课堂
@@ -32,7 +34,8 @@ import TeacherDetailApe from 'ape/TeacherDetailApe';//老师 @@ -32,7 +34,8 @@ import TeacherDetailApe from 'ape/TeacherDetailApe';//老师
32 import CreateClassApe from 'ape/CreateClassApe';//创建课堂 34 import CreateClassApe from 'ape/CreateClassApe';//创建课堂
33 import ListDetailsApe from 'ape/ListDetailsApe';//列表详情 35 import ListDetailsApe from 'ape/ListDetailsApe';//列表详情
34 import AdministratorApe from 'ape/AdministratorApe';//管理员 36 import AdministratorApe from 'ape/AdministratorApe';//管理员
35 - 37 +import MyCenterApe from 'ape/MyCenterApe';//个人中心
  38 +import MessageTypes from "MessageTypes";
36 let loger = Loger.getLoger('PCLive'); 39 let loger = Loger.getLoger('PCLive');
37 40
38 let _classApe; 41 let _classApe;
@@ -56,10 +59,11 @@ let _teacherDetailApe; @@ -56,10 +59,11 @@ let _teacherDetailApe;
56 let _createClassApe; 59 let _createClassApe;
57 let _listDetailsApe; 60 let _listDetailsApe;
58 let _administratorApe; 61 let _administratorApe;
  62 +let _myCenterApe;
59 63
60 class Main { 64 class Main {
61 constructor() { 65 constructor() {
62 - this.clientVersion="v1.2.0.20170901"; 66 + this.clientVersion="v1.4.0.20170903";
63 loger.warn("clientVersion:"+this.clientVersion); 67 loger.warn("clientVersion:"+this.clientVersion);
64 68
65 let locationProtocol= location.protocol; 69 let locationProtocol= location.protocol;
@@ -68,7 +72,9 @@ class Main { @@ -68,7 +72,9 @@ class Main {
68 }else { 72 }else {
69 ClassDataProxy.locationProtocol="http://"; 73 ClassDataProxy.locationProtocol="http://";
70 } 74 }
71 - 75 + this.localStorage = window.localStorage;
  76 + //判断当前用户登录身份状态
  77 + this._localStorageState();
72 //获取国际化语言 78 //获取国际化语言
73 this._localConfig(); 79 this._localConfig();
74 //获取地址栏参数 80 //获取地址栏参数
@@ -132,9 +138,6 @@ class Main { @@ -132,9 +138,6 @@ class Main {
132 init() { 138 init() {
133 loger.log("init"); 139 loger.log("init");
134 140
135 - //xdysdk.api("setDebugInfo",{isDebug:false});//不开启日志输出  
136 - //'xdysdk.api("setOpenSendLogToServer",{isOpen:false});//不上报日志  
137 -  
138 //显示图片大图 141 //显示图片大图
139 UIMagnifyApe.init($('#magnifyBox')); 142 UIMagnifyApe.init($('#magnifyBox'));
140 143
@@ -187,12 +190,16 @@ class Main { @@ -187,12 +190,16 @@ class Main {
187 190
188 //登录注册 191 //登录注册
189 _loginOrRegister = new LoginOrRegister(); 192 _loginOrRegister = new LoginOrRegister();
  193 + _loginOrRegister.on(MessageTypes.LOGIN_OUT,this.loginOut.bind(this));
  194 + _loginOrRegister.on(MessageTypes.LOGIN_IN,this.loginIn.bind(this));
  195 +
190 //互动课堂 196 //互动课堂
191 _lanclassApe = new LanclassApe(); 197 _lanclassApe = new LanclassApe();
192 //互动课堂 198 //互动课堂
193 _liveClassApe = new LiveClassApe(); 199 _liveClassApe = new LiveClassApe();
194 //首页 200 //首页
195 _homeApe = new HomeApe(); 201 _homeApe = new HomeApe();
  202 + _homeApe.on(MessageTypes.HOME_SKIP,this.homeSkip.bind(this));
196 //老师 203 //老师
197 _teacherDetailApe = new TeacherDetailApe(); 204 _teacherDetailApe = new TeacherDetailApe();
198 //创建课堂 205 //创建课堂
@@ -202,9 +209,49 @@ class Main { @@ -202,9 +209,49 @@ class Main {
202 //管理员 209 //管理员
203 _administratorApe = new AdministratorApe(); 210 _administratorApe = new AdministratorApe();
204 211
  212 + //个人中心
  213 + _myCenterApe = new MyCenterApe();
  214 +
205 this._onFlashLoaded(); 215 this._onFlashLoaded();
206 } 216 }
207 217
  218 +
  219 + //
  220 + loginOut(_data){
  221 + //
  222 + if(_homeApe){
  223 + _homeApe.detailPage();
  224 + }
  225 +
  226 +
  227 + }
  228 + loginIn(_data){
  229 + loger.log('进入课堂时显示的type值---登录',_data.userType)
  230 + if(_data && _data.userType){
  231 + if(_data.userType == ClassDataProxy.USER_TYPE_1){
  232 + this._teacherHome();
  233 + _teacherDetailApe.detailPage();
  234 + }else if(_data.userType == ClassDataProxy.USER_TYPE_2){
  235 + this._showAdministratorInfo();
  236 + _administratorApe.detailPage();
  237 + }else if(_data.userType == ClassDataProxy.USER_TYPE_8){
  238 + _homeApe.detailPage();
  239 + }else if(_data.userType == ClassDataProxy.USER_TYPE_32){
  240 +
  241 + }else{
  242 +
  243 + }
  244 + }
  245 + }
  246 + homeSkip(_data){
  247 + if(_data && _data.userType){
  248 + if(_data.userType == ClassDataProxy.USER_TYPE_1){
  249 + _teacherDetailApe.detailPage();
  250 + }
  251 + }
  252 + }
  253 +
  254 +
208 //监听文档、媒体共享、屏幕共享模块的切换 255 //监听文档、媒体共享、屏幕共享模块的切换
209 _onSceneChangeHandler(_sceneName) { 256 _onSceneChangeHandler(_sceneName) {
210 switch (_sceneName) { 257 switch (_sceneName) {
@@ -395,7 +442,62 @@ class Main { @@ -395,7 +442,62 @@ class Main {
395 _musicShareApe.stop(); 442 _musicShareApe.stop();
396 } 443 }
397 } 444 }
398 - 445 + //判断登录用户的状态
  446 + _localStorageState(){
  447 + let userType = window.localStorage.getItem('userType')||0;
  448 + loger.log('进入课堂时显示的type值',parseInt(userType))
  449 +
  450 + switch (parseInt(userType)){
  451 + case ClassDataProxy.USER_TYPE_1:
  452 + console.log('老师')
  453 + //ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1;
  454 + this._teacherHome();
  455 + break;
  456 + case ClassDataProxy.USER_TYPE_2:
  457 + console.log('管理员')
  458 + // ClassDataProxy.userType = ClassDataProxy.USER_TYPE_2;
  459 + this._showAdministratorInfo();
  460 + break;
  461 + case ClassDataProxy.USER_TYPE_8:
  462 + console.log('学生')
  463 + ///ClassDataProxy.userType = ClassDataProxy.USER_TYPE_8;
  464 + this._student();
  465 + break;
  466 + case ClassDataProxy.USER_TYPE_32:
  467 + console.log('兼课')
  468 + //ClassDataProxy.userType = ClassDataProxy.USER_TYPE_32;
  469 + break;
  470 + default:
  471 + console.log('游客')
  472 + // ClassDataProxy.userType = ClassDataProxy.USER_TYPE_0;
  473 + this._student();
  474 + break;
  475 + }
  476 + }
  477 + _showAdministratorInfo(){
  478 + $('#slideshow').hide();
  479 + $('#defaultBox').hide();
  480 + $('#header_list').hide();
  481 + $('#header_seek').hide();
  482 + $('#androidDownload').hide();
  483 + $('#classManagementBox').show();
  484 + }
  485 + _teacherHome(){
  486 + $('#slideshow').hide();
  487 + $('#defaultBox').hide();
  488 + $('#header_list').show();
  489 + $('#header_seek').show();
  490 + $('#androidDownload').show();
  491 + $('#classManagementBox').hide();
  492 + $('#classifyListBox').show();
  493 + }
  494 + _student(){
  495 + $('#slideshow').show();
  496 + $('#defaultBox').show();
  497 + $('#classifyListBox').hide();
  498 + $('#teacherDetailBox').hide();
  499 + $('#lanclassBox').hide();
  500 + }
399 //获取国际化语言 501 //获取国际化语言
400 _localConfig() { 502 _localConfig() {
401 let language = navigator.language || navigator.browserLanguage; 503 let language = navigator.language || navigator.browserLanguage;
@@ -206,6 +206,26 @@ class ClassDataProxy { @@ -206,6 +206,26 @@ class ClassDataProxy {
206 } 206 }
207 return Sys; 207 return Sys;
208 } 208 }
  209 + //计算时间差值显示列表
  210 + static getTimeDifference(start,end){
  211 +
  212 + let newStart = new Date(start)
  213 + let newEnd = new Date(end)
  214 +
  215 + let day =1000*3600*24;
  216 +
  217 + let timer = parseInt((newEnd.getTime() - newStart.getTime()) / parseInt(day));
  218 + let newEndHours = newEnd.getHours()<10?'0'+newEnd.getHours():newEnd.getHours();
  219 + let newStartHours = newStart.getHours()<10?'0'+newStart.getHours():newStart.getHours();
  220 +
  221 + let newStartDate = newStart.getDate()<10?'0'+newStart.getDate():newStart.getDate();
  222 + let newStartDay = newStart.getDay()<10?'0'+newStart.getDay():newStart.getDay();
  223 + if(timer == 0){
  224 + return '今天 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
  225 + }else{
  226 + return newStartDate+1 + '月' + newStartDay +'日 ' + ' '+newStartHours + ':00' + ' - ' + newEndHours+':00';
  227 + }
  228 + }
209 } 229 }
210 230
211 //Class 231 //Class
@@ -232,6 +252,18 @@ ClassDataProxy.password = ""; @@ -232,6 +252,18 @@ ClassDataProxy.password = "";
232 ClassDataProxy.nodeId = 0; 252 ClassDataProxy.nodeId = 0;
233 ClassDataProxy.userRole = "normal"; 253 ClassDataProxy.userRole = "normal";
234 ClassDataProxy.autoLogin = ""; 254 ClassDataProxy.autoLogin = "";
  255 +ClassDataProxy.userType = 0;
  256 +
  257 +ClassDataProxy.loginName ="";
  258 +ClassDataProxy.password =""
  259 +ClassDataProxy.token ="";
  260 +ClassDataProxy.status = false;
  261 +
  262 +ClassDataProxy.USER_TYPE_0 = 0;
  263 +ClassDataProxy.USER_TYPE_1 = 1;
  264 +ClassDataProxy.USER_TYPE_2 = 2;
  265 +ClassDataProxy.USER_TYPE_8 = 8;
  266 +ClassDataProxy.USER_TYPE_32 = 32;
235 267
236 ClassDataProxy.rosterList={};//用户列表数据 268 ClassDataProxy.rosterList={};//用户列表数据
237 ClassDataProxy.rosterListUpdata={};//用户更新的数据 269 ClassDataProxy.rosterListUpdata={};//用户更新的数据
@@ -240,9 +272,11 @@ ClassDataProxy.curUserInfoTeaOrStu; @@ -240,9 +272,11 @@ ClassDataProxy.curUserInfoTeaOrStu;
240 ClassDataProxy.curRosterInvisibleNodeId=0; 272 ClassDataProxy.curRosterInvisibleNodeId=0;
241 273
242 274
243 -ClassDataProxy.USER_HOST = 'host';  
244 -ClassDataProxy.USER_NOTMAL = 'normal';  
245 -ClassDataProxy.USER_INVISIBLE = 'invisible'; 275 +ClassDataProxy.USER_HOST = 'host';//老师
  276 +ClassDataProxy.USER_NOTMAL = 'normal';//学生
  277 +ClassDataProxy.USER_INVISIBLE = 'invisible';//兼课
  278 +ClassDataProxy.USER_ADMIN = 'admin';//管理员
  279 +ClassDataProxy.USER_VISITOR = 'visitor';//游客
246 280
247 ClassDataProxy.docServer = "";//文档服务器地址 281 ClassDataProxy.docServer = "";//文档服务器地址
248 ClassDataProxy.maxAudioChannels = 0;//最大音频路数 282 ClassDataProxy.maxAudioChannels = 0;//最大音频路数