...
|
...
|
@@ -13,31 +13,38 @@ $(document).ready(function() { |
|
|
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) {
|
|
|
//传回code值 微信登录
|
|
|
ajax('/login/loginCheck', "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) {
|
|
|
|
|
|
// alert("登录成功!")
|
|
|
localStorage.setItem("token", res.data.token);
|
|
|
localStorage.setItem("userId", res.data.id);
|
|
|
//查看个人信息
|
|
|
ajax("/login/userInfo", "GET", header2, function(res) {}, function(res) {
|
|
|
console.log(res);
|
|
|
|
|
|
})
|
|
|
|
|
|
// 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'
|
|
|
// }
|
|
|
|
|
|
//绑定账号的用户授权
|
|
|
ajax('/login/loginCheck1', "PUT", header2, params, function(res) {
|
|
|
console.log(res);
|
|
|
}, function(res) {
|
|
|
console.log(res);
|
...
|
...
|
@@ -75,14 +82,13 @@ $(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) {
|
|
|
ajax('/login/codeLogin', "GET", header1, params1, function(res) {
|
|
|
console.log(res);
|
|
|
}, function(res) {})
|
|
|
});
|
...
|
...
|
@@ -102,7 +108,6 @@ $(document).ready(function() { |
|
|
} else if (inputCode.length === 0) {
|
|
|
alert("验证码不能为空!")
|
|
|
} else {
|
|
|
var url = "/login/loginRegistered"; // 接口
|
|
|
var header = {
|
|
|
"Content-Type": "application/json"
|
|
|
}
|
...
|
...
|
@@ -110,7 +115,9 @@ $(document).ready(function() { |
|
|
code: inputCode,
|
|
|
phoneNumber: inputNumber
|
|
|
})
|
|
|
ajax(url, "POST", header, params2, function(res) {
|
|
|
|
|
|
//手机号登录
|
|
|
ajax("/login/loginRegistered", "POST", header, params2, function(res) {
|
|
|
console.log(res);
|
|
|
localStorage.setItem("token", res.data.token);
|
|
|
localStorage.setItem("userId", res.data.user);
|
...
|
...
|
@@ -126,7 +133,6 @@ $(document).ready(function() { |
|
|
window.location.href = 'save.html'
|
|
|
} else if (res.data.Status1 === 2) {
|
|
|
window.location.href = 'participated.html'
|
|
|
// window.location.href = 'browseMore.html'
|
|
|
} else {
|
|
|
window.location.href = 'index.html'
|
|
|
}
|
...
|
...
|
@@ -143,33 +149,15 @@ $(document).ready(function() { |
|
|
|
|
|
//获取用户VIP信息判断是否是VIP
|
|
|
function setPersonal() {
|
|
|
// $.ajax({
|
|
|
// type: 'GET',
|
|
|
// url: 'http://192.168.1.241:9004/login/userInfo',
|
|
|
// headers: {
|
|
|
// "Content-Type": "application/json",
|
|
|
// "token": localStorage.getItem('token'),
|
|
|
// },
|
|
|
// success: function(res) {
|
|
|
// console.log(res);
|
|
|
// if (res.data.status1 == 1) {
|
|
|
// window.location.href = 'personalCenter.html'
|
|
|
// } else {
|
|
|
// window.location.href = 'personalCenter2.html'
|
|
|
// }
|
|
|
// }
|
|
|
// })
|
|
|
alert('请先登录!')
|
|
|
}
|
|
|
//跳转二维码登录
|
|
|
//请求授权地址,跳转二维码登录页
|
|
|
function setEWM() {
|
|
|
var url = '/login/loginInit'
|
|
|
var header = {
|
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
|
}
|
|
|
ajax(url, "GET", header, function(res) {}, function(res) {
|
|
|
ajax("/login/loginInit", "GET", header, function(res) {}, function(res) {
|
|
|
console.log(res);
|
|
|
console.log(res.data);
|
|
|
window.location.href = res.data
|
|
|
})
|
|
|
// $('#phone-login').hide()
|
...
|
...
|
|