...
|
...
|
@@ -7,14 +7,46 @@ $(document).ready(function() { |
|
|
// }
|
|
|
|
|
|
//判断并接收code值
|
|
|
// var url = window.location.search;
|
|
|
var url = window.location.href;
|
|
|
console.log(url);
|
|
|
var url = window.location.search;
|
|
|
if (url.indexOf('?') != -1) {
|
|
|
newId = url.substr(6)
|
|
|
console.log(newId);
|
|
|
newCode = url.substr(6)
|
|
|
newCodes = newCode.split("&");
|
|
|
var ncode = newCodes[0]
|
|
|
// console.log(ncode);
|
|
|
var url1 = '/login/loginCheck'
|
|
|
var header1 = {
|
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
|
}
|
|
|
var params = { code: ncode }
|
|
|
//传回code值
|
|
|
ajax(url1, "POST", header1, params, function(res) {
|
|
|
console.log(res);
|
|
|
// alert("登录成功!")
|
|
|
localStorage.setItem("token", res.data.token);
|
|
|
localStorage.setItem("userId", res.data.id);
|
|
|
if (res.data.status === 1) {
|
|
|
window.location.href = 'save.html'
|
|
|
} else if (res.data.Status1 === 2) {
|
|
|
window.location.href = 'participated.html'
|
|
|
} else {
|
|
|
window.location.href = 'index.html'
|
|
|
}
|
|
|
//绑定账号的用户授权
|
|
|
var url3 = '/login/loginCheck1'
|
|
|
var header2 = {
|
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
|
"token": res.data.token
|
|
|
}
|
|
|
ajax(url3, "PUT", header2, params, function(res) {
|
|
|
console.log(res);
|
|
|
}, function(res) {
|
|
|
console.log(res);
|
|
|
})
|
|
|
}, function(res) { console.log(res); })
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -43,7 +75,16 @@ $(document).ready(function() { |
|
|
code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效
|
|
|
}
|
|
|
}, 1000);
|
|
|
var url2 = '/login/codeLogin'
|
|
|
var header1 = {
|
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
|
}
|
|
|
var params1 = { phoneNumber: phone }
|
|
|
|
|
|
//获取验证码接口
|
|
|
ajax(url2, "GET", header1, params1, function(res) {
|
|
|
console.log(res);
|
|
|
}, function(res) {})
|
|
|
});
|
|
|
$(".btnLogin button").click(function() {
|
|
|
var inputNumber = $("#phone").val();
|
...
|
...
|
@@ -65,12 +106,11 @@ $(document).ready(function() { |
|
|
var header = {
|
|
|
"Content-Type": "application/json"
|
|
|
}
|
|
|
var params = JSON.stringify({
|
|
|
code: inputCode,
|
|
|
phoneNumber: inputNumber
|
|
|
})
|
|
|
// 调用公共ajax
|
|
|
ajax(url, "POST", header, params, function(res) {
|
|
|
var params2 = JSON.stringify({
|
|
|
code: inputCode,
|
|
|
phoneNumber: inputNumber
|
|
|
})
|
|
|
ajax(url, "POST", header, params2, function(res) {
|
|
|
console.log(res);
|
|
|
localStorage.setItem("token", res.data.token);
|
|
|
localStorage.setItem("userId", res.data.user);
|
...
|
...
|
@@ -92,6 +132,7 @@ $(document).ready(function() { |
|
|
}
|
|
|
}, function(res) {
|
|
|
console.log(res);
|
|
|
alert(res.responseJSON.msg)
|
|
|
})
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -126,14 +167,13 @@ function setEWM() { |
|
|
var header = {
|
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
|
}
|
|
|
ajax(url, "GET", header, function(res) {
|
|
|
}, function(res) {
|
|
|
console.log(res);
|
|
|
console.log(res.data);
|
|
|
window.location.href = res.data
|
|
|
})
|
|
|
// $('#phone-login').hide()
|
|
|
// $('#EWM-login').show()
|
|
|
ajax(url, "GET", header, function(res) {}, function(res) {
|
|
|
console.log(res);
|
|
|
console.log(res.data);
|
|
|
window.location.href = res.data
|
|
|
})
|
|
|
// $('#phone-login').hide()
|
|
|
// $('#EWM-login').show()
|
|
|
}
|
|
|
//跳转手机号登录
|
|
|
function setPhone() {
|
...
|
...
|
|