personalCenter.js
5.5 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
$(document).ready(function() {
//获取个人信息(传一个token)
$.ajax({
type: 'GET',
url: 'http://192.168.1.241:9004/login/userInfo',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
console.log(res);
// $("#Pnumber").html(res.data.phoneNumber)
// $('#surname').html(res.data.surname)
// $('#userName').html(res.data.userName)
// $('#specialty').html(res.data.specialty)
// $('#school').html(res.data.school)
// $('#phone').html(res.data.phone)
// $('#emailAddress').html(res.data.emailAddress)
//缺一个img
//input用val,a用html
$('#phone').val(res.data.phone)
$('#surname').val(res.data.surname)
$('#userName').val(res.data.userName)
$('#specialty').val(res.data.specialty)
$('#school').val(res.data.school)
$('#emailAddress').val(res.data.emailAddress)
$('#WXname').html(res.data.wname)
$('#Pnumber').html(res.data.phoneNumber)
}
})
//修改个人信息
$(".btnSave button").click(function() {
//姓
var inputSurname = $("#surname").val();
console.log(inputSurname);
//名
var inputUserName = $("#userName").val();
console.log(inputUserName);
//专业(null)
var inputSpecialty = $("#specialty").val();
console.log(inputSpecialty);
//学校
var inputSchool = $("#school").val();
console.log(inputSchool);
//手机号
var inputPhone = $("#phone").val();
console.log(inputPhone);
//邮箱
var inputEmailAddress = $("#emailAddress").val();
console.log(inputEmailAddress);
$.ajax({
type: "PUT",
url: "http://192.168.1.241:9004/login/updateSysUser",
headers: {
"Content-Type": "application/json"
},
//图片为空!!!!!!!!!!!!!!!!!!!!
data: JSON.stringify({
emailAddress: inputEmailAddress,
id: localStorage.getItem("userId"),
img: null,
phone: inputPhone,
specialty: inputSpecialty,
school: inputSchool,
surname: inputSurname,
userName: inputUserName
}),
success: function(msg) {
alert('保存成功!')
location.reload();
},
error: function(res) {
alert('保存失败!')
}
});
})
//删除微信(传token)
$("#WXunbind").click(function() {
$.ajax({
type: "DELETE",
url: "http://192.168.1.241:9004/login/deleteWeXin",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
alert("解绑成功!")
location.reload();
},
error: function(res) {
alert('解绑失败!')
}
});
})
//删除手机号(传token)
$("#Punbind").click(function() {
$.ajax({
type: "DELETE",
url: "http://192.168.1.241:9004/login/deletePhone",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"token": localStorage.getItem('token'),
},
success: function(res) {
alert("解绑成功!")
location.reload();
},
error: function(res) {
alert('解绑失败!')
}
});
})
});
// function name(params) {
// }
$('#meau_nav>div').click(function() {
// var index = $(this).index();
$(this).addClass('active-click').siblings().removeClass('active-click');
})
var actualFee = ''
var memberMonth = ''
var memberName = ''
var paymentType = ''
function clickVIPone() {
actualFee = 99
memberMonth = 1
memberName = '基础会员'
}
function clickVIPtwo() {
actualFee = 399
memberMonth = 6
memberName = '标准会员'
}
function clickVIPthree() {
actualFee = 699
memberMonth = 12
memberName = '超级会员'
}
function checkRadio() {
paymentType = $("input[name='zhifu']:checked").val()
}
//提交订单
function payment() {
console.log(paymentType);
console.log(actualFee);
console.log(memberMonth);
console.log(memberName);
$.ajax({
type: "POST",
url: "http://192.168.1.241:9004/orderLog/orderAdd",
headers: {
"Content-Type": "application/json",
"token": localStorage.getItem('token'),
},
data: JSON.stringify({
actualFee: actualFee,
memberMonth: memberMonth,
memberName: memberName,
paymentType: paymentType
}),
success: function(res) {
//res.data:订单号
console.log(res.data);
$(".hide_box").fadeToggle();
$(".shang_box").fadeToggle();
},
error: function(res) {
console.log(res);
}
});
}