SubscribeApe.js
2.7 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
//*
// 收藏预约模块
// */
import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import MessageTypes from "../MessageTypes";
import ErrorApe from "./ErrorApe";
let loger = Loger.getLoger('PC-SubscribeApe');
class SubscribeApe extends Ape {
constructor() {
super();
this.id = '';
this.addEvent();
this.init();
}
init() {
$('#lanclassContentApply').on('click',this._lanclassContentApplyHandler.bind(this));//我要报名
$('#orderBtn').on('click',this._lanclassContentApplyHandler.bind(this));//我要预约
$('#collectYes').on('click',this._lanclassContentApplyHandler.bind(this));//取消收藏
$('#collectNo').on('click',this._lanclassContentApplyHandler.bind(this));//收藏
}
addEvent() {
}
_lanclassContentApplyHandler(evt){
let that = this;
let _url = ClassDataProxy.locationProtocol + ClassDataProxy.locationProt + '/studentMeeting/addStudentMeeting';
let status = $(evt.currentTarget).attr('data');
let id = $('#lanclassBox').attr('data');
this.id = id;
$.ajax({
type: "POST",
url: _url,
data:{siteId:ClassDataProxy.siteId,
"studentId":ClassDataProxy.id,
"status":parseInt(status),
"meetingId":id
},
headers: {siteId:ClassDataProxy.siteId,
'token':'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IlhXQnJlRU00T0swYTVqUUIyUTFicGtObHlxOUFWbXZkIiwibmFtZSI6ImFkbWluIiwiY29kZSI6MSwiaWF0IjoxNTAzNDUxODU0LCJleHAiOjIyODEwNTE4NTR9.3kTVzKd_jbP7l69nxOpNaFeSjVnnjZkagYMzRB8fjNo'},
success:function(_data){
let arr = ['收藏成功!','预约成功!','报名成功!']
//获取课堂数据
if(_data && _data.code == 200){
loger.log(_data,'预约信息')
$('#teacherDetailRemindersBox').show();
}else if(_data.returnData.data.msg == '您已预约这堂课' && ClassDataProxy.loginName){
ErrorApe.showWarnError('您已预约这堂课');
}else{
that.toLogin();
}
},
error:function(error){
//alert('首页数据获取失败')
console.log(error,'首页数据获取失败')
}
})
}
toLogin(){
$('#userLoginBox').show();
}
//工具类
_format(str, obj) {
return str.replace(/\{(\w+)\}/g, function (match, group, index) {
return obj[group];
});
};
}
export default SubscribeApe;