|
@@ -11,9 +11,10 @@
|
|
<template th:replace="components/foot-link"></template>
|
|
<template th:replace="components/foot-link"></template>
|
|
<script charset="utf-8" type="text/javascript">
|
|
<script charset="utf-8" type="text/javascript">
|
|
// 如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&state=STATE
|
|
// 如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&state=STATE
|
|
|
|
+ var wx_mode = Number(getBaseCookie("weChatAutoLogin"))===1 ? 1 : 2;
|
|
var wx_code = getUrlParam('code');
|
|
var wx_code = getUrlParam('code');
|
|
var wx_state = getUrlParam('state');
|
|
var wx_state = getUrlParam('state');
|
|
- $.get(spiServer+'/user/authorizationLogin?code='+wx_code+'&state='+wx_state, function(r){
|
|
|
|
|
|
+ $.get(spiServer+'/user/authorizationLogin?code='+wx_code+'&state='+wx_state+'&mode='+wx_mode, function(r){
|
|
if(r.code===0){
|
|
if(r.code===0){
|
|
console.log(r.data);
|
|
console.log(r.data);
|
|
var userData = {
|
|
var userData = {
|
|
@@ -31,23 +32,31 @@
|
|
token: r.data.token
|
|
token: r.data.token
|
|
};
|
|
};
|
|
localStorage.setItem('userInfo',JSON.stringify(userData));
|
|
localStorage.setItem('userInfo',JSON.stringify(userData));
|
|
- var loginBeforePath = getBaseCookie("loginBeforePath");
|
|
|
|
- if (loginBeforePath && loginBeforePath!='undefined' && loginBeforePath.indexOf('.html')>0) {
|
|
|
|
- delBaseCookie("loginBeforePath");
|
|
|
|
- window.location.href = loginBeforePath;
|
|
|
|
- } else if (userData.userIdentity*1 === 3) {
|
|
|
|
- location.href = '/supplier/dashboard.html';
|
|
|
|
- } else if (userData.userIdentity*1 === 2 || userData.userIdentity*1 === 4) {
|
|
|
|
- location.href = '/user/dashboard.html';
|
|
|
|
- } else {
|
|
|
|
- location.href="/index.html";
|
|
|
|
- }
|
|
|
|
|
|
+ toPage();
|
|
}else{
|
|
}else{
|
|
- CAIMEI.Alert(r.msg,'确定',true, function(){
|
|
|
|
- location.href="/index.html";
|
|
|
|
- });
|
|
|
|
|
|
+ if (wx_mode===2 && r.code===-4){
|
|
|
|
+ //微信绑定页面
|
|
|
|
+ window.location.href = '/bind.html';
|
|
|
|
+ }else{
|
|
|
|
+ CAIMEI.Alert(r.msg,'确定',true, function(){
|
|
|
|
+ toPage();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ function toPage(){
|
|
|
|
+ var loginBeforePath = getBaseCookie("loginBeforePath");
|
|
|
|
+ if (loginBeforePath && loginBeforePath!='undefined' && loginBeforePath.indexOf('.html')>0) {
|
|
|
|
+ delBaseCookie("loginBeforePath");
|
|
|
|
+ window.location.href = loginBeforePath;
|
|
|
|
+ } else if (userData.userIdentity*1 === 3) {
|
|
|
|
+ location.href = '/supplier/dashboard.html';
|
|
|
|
+ } else if (userData.userIdentity*1 === 2 || userData.userIdentity*1 === 4) {
|
|
|
|
+ location.href = '/user/dashboard.html';
|
|
|
|
+ } else {
|
|
|
|
+ location.href="/index.html";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|