double_choose.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
define(['jquery', 'bootstrap', 'frontend', 'form', 'template', 'swiper', 'layer'], function($, undefined, Frontend,
Form, Template, Swiper, Layer) {
var Controller = {
index: function() {
// console.log(true)
var first_swiper = new Swiper ('#first_swiper', {
loop: true, // 循环模式选项
// 如果需要分页器
autoplay:true,
pagination: {
el: '.swiper-pagination',
}
});
$(document).on("click","ul.type li",function(){
location.href = '?type='+ $(this).data("type");
})
$("#create").click(function(){
layer.open({
type: 1,
title:['请选择分类','font-size:1rem;'],
area:['50rem','20rem'],
scrollbar:false,
content: $('#modal1'), //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
success:function(){
$.ajax({
type:'post',
url: 'student_login/getLoginStatus',
dataType:'json',
success:function(res){
console.log(res);
if(res.code ==0){
Layer.alert(res.msg,{time:3000},function(index){
Layer.close(index);
if(res.url != ''){
location.href = res.url;
}
});
}
}
});
}
});
});
$(".apply").click(function(){
var double_id = $(this).data("id");
layer.open({
type: 1,
title:['申请加入','font-size:1rem;'],
area:['80%','60%'],
scrollbar:false,
content: $('#modal2'), //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
success:function(){
$("#modal2").find("#c-double_id").val(double_id);
$(document).on('submit',"form[name='applyteacher']",function(){
var data = $(this).serialize();
$.ajax({
type:'post',
url: $(this).attr('action'),
data:data,
dataType:'json',
success:function(res){
console.log(res);
if(res.code ==0){
Layer.alert(res.msg,{time:3000},function(index){
Layer.close(index);
if(res.url != ''){
location.href = res.url;
}
});
}else{
Layer.alert(res.msg,{time:3000},function(index){
Layer.close(index);
if(res.url != ''){
location.href = res.url;
}
});
}
}
});
});
}
});
});
},
}
return Controller;
});