ListDetailsApe.js
9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
//*
// 列表详情模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import MessageTypes from "../MessageTypes";
let loger = Loger.getLoger('PC-ListDetailsApe');
class ListDetailsApe extends Ape {
constructor() {
super();
this.addEvent();
this.isDate = 0;
this._id = '';
this.init();
}
init() {
$('#liveContentAllBox ').on('click','.classifyList',this._curriculumListHandler.bind(this));//直播详情页
$('#liveListBox ').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));//首页 进入 老师详情页
}
addEvent() {
}
_curriculumListHandler(evt){
/* let buttonIsCheck = $('#orderBtn').attr('value','1');
if($('#orderBtn').attr('value') == '1'){
$('#orderBtn').attr('disabled',true)
$('#orderBtn').css('background','#3498db')
}*/
let _id = $(evt.currentTarget).attr('data');
this._id = _id;
this.classInfoDetail(_id);
this.collectInfoDetail(_id);
this.commonalityClass();
//查看当前点击的列表是否收藏
this._emit(MessageTypes.IS_COLLECT,{id : _id});
}
_liveListHandler(evt){
let _id = $(evt.currentTarget).attr('data');
this._id = _id;
this.liveInfoDetail(_id);
this.collectInfoDetail(_id);
this.commonalityClass();
}
commonalityClass(){
$('#slideshow').hide();
$('#defaultBox').hide();
$('#liveContentAllBox').hide();
$('#lanclassAllBox').hide();
$('#teacherIntroAllBox').hide();
}
_teacherInfoHandler(evt){
let _id = $(evt.currentTarget).attr('data');
this._id = _id;
this.teacherInfoDetail(_id);
this.commonalityClass();
}
_slideshowInfo(_id){
let that = this;
let data = {
id: _id,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
this.detailPage(_url,data,function(_data){
if(_data){
// loger.log('detailPage',_data)
that._gainClassData(_data.returnData.data);
}
})
this.commonalityClass();
}
classInfoDetail(_id){
let that = this;
let data = {
id: _id,
meetingType:2,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
this.detailPage(_url,data,function(_data){
if(_data){
// loger.log('detailPage',_data)
that._gainClassData(_data.returnData.data);
}
})
}
liveInfoDetail(_id){
let that = this;
let data = {
id: _id,
meetingType:1,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/meeting/getMeeting';
this.detailPage(_url,data,function(_data){
if(_data){
// loger.log('detailPage',_data)
that._gainClassData(_data.returnData.data);
}
})
}
//收藏
collectInfoDetail(_id){
let that = this;
let data = {
studentId:ClassDataProxy.id,
meetingId:_id,
siteId:ClassDataProxy.siteId
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/isAppointment';
this.detailPage(_url,data,function(_data){
if(_data && _data.code == 200){
let _dataList = _data.returnData.data;
if(_dataList && _dataList.length > 0 ){
that._collectNoClick();
}else{
that._collectYesClick();
}
}
})
}
teacherInfoDetail(_id){
let that = this;
let data = {
id: _id,
siteId:ClassDataProxy.siteId,
userType : 1
}
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/users/getUser';
this.detailPage(_url,data,function(_data){
if(_data){
that._classDateContent(_data.returnData.data);
}
})
}
_gainClassData(_data){
if(_data){
let _dataList = _data.meetingInfo;
if(_dataList){
this._liveRender(_dataList[0]);
}
}
}
_classDateContent(_data){
if(_data){
let teacherList = _data.users;
if(teacherList){
this._lanclassRender(teacherList[0]);
}
}
}
//老师
_lanclassRender(_dataList){
if(_dataList){
$('#defaultBox').hide();
$('.curriculumBox').hide();
$('#teacherDetailBox').show();
$('#teacherDetailBox').attr('data',this._id);
let _img = _dataList.userPhoto;
let defaultImg = 'images/u373.png'
$('#teacherDetailInfoImg').attr('src',_img?_img:defaultImg);//老师授课标题图片
$('#teacherDetailInfoDetailName').text(_dataList.userName);//老师名字
$('#teacherDetailInfoDetailSex').text();//老师性别
$('#teacherDetailInfoDetailPoint').text();//老师专长
$('#teacherDetailInfoDetailAge').text(3+'年');//老师教龄
$('#teacherDetailInfoDetailGrade').text();//老师评分
$('#teacherDetailReferralContent').text();//老师授课内容
$('#teacherDetailPost').text();//老师职称
$('#teacherDetailEducation').text();//老师学历
$('#teacherDetailAcademy').text();//老师院校
$('#teacherDetailWay').text();//老师授课方式
$('#teacherDetailArea').text();//老师授课地区
$('#teacherDetailSynopsis').text();//老师授课简介
}
}
//课堂
_liveRender(_dataList){
if(_dataList){
$('#defaultBox').hide();
$('.curriculumBox').hide();
$('#lanclassBox').show();
$('#lanclassBox').attr('data',this._id);
let _img = _dataList.meetingPhoto;
let classImg;
if(_img){
classImg = _img;
}else {
classImg = null;
}
let defaultImg = 'images/u373.png'
$('#lanclassContentCover').attr('src',_img?_img:defaultImg);//老师授课标题图片
$('#lanclassContentTitle').text(_dataList.meetingName);//老师授课标题
let _teacherImg = _dataList.teacherPhoto;
let teacherDefault = 'images/u293.png';
$('#lanclassContentInfoPortrait').attr('src',_teacherImg?_teacherImg:teacherDefault);//老师授课老师头像
$('#lanclassContentInfoName').text(_dataList.create_user);//老师授课老师名字
$('#teacherInfoName').text(_dataList.create_user);//老师授课老师名字
$('#lanclassContentInfoTimeStart').text(_dataList.beginTime);//老师授课开始时间
$('#lanclassContentInfoTimeEnd').text(_dataList.endTime);//老师授课结束时间
$('#collectYes');//老师授课是否收藏
$('#collectNo');//老师授课是否收藏
$('#lanclassIntroduceDescription').text();//老师授课课程介绍
$('#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,'直播数据获取失败')
}
})
}
_collectYesClick(){
$('#collectYes ').hide();
$('#collectNo ').show();
}
_collectNoClick(){
$('#collectYes ').show();
$('#collectNo ').hide();
}
}
export default ListDetailsApe;