|
@@ -13,9 +13,34 @@
|
|
|
var wx_state = getUrlParam('state');
|
|
|
$.get(spiServer+'/user/authorizationLogin?code='+wx_code+'&state='+wx_state, function(r){
|
|
|
if(r.code===0){
|
|
|
- window.location.href = sessionStorage.getItem("urlForCurrent");
|
|
|
+ console.log(r.data);
|
|
|
+ var userData = {
|
|
|
+ account: r.data.account,
|
|
|
+ email: r.data.email,
|
|
|
+ phone: r.data.bindMobile,
|
|
|
+ name: r.data.name,
|
|
|
+ userName: r.data.userName,
|
|
|
+ userId: r.data.userID,
|
|
|
+ spId: r.data.serviceProviderID,
|
|
|
+ clubId: r.data.clubID,
|
|
|
+ shopId: r.data.shopID,
|
|
|
+ userIdentity: r.data.userIdentity,
|
|
|
+ permission: r.data.userPermission,
|
|
|
+ token: r.data.token
|
|
|
+ };
|
|
|
+ localStorage.setItem('userInfo',JSON.stringify(userData));
|
|
|
+ var loginBeforePath = sessionStorage.getItem("loginBeforePath");
|
|
|
+ if (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";
|
|
|
+ }
|
|
|
}else{
|
|
|
- alert(r.msg);
|
|
|
+ CAIMEI.Alert(r.msg,'确定',false);
|
|
|
}
|
|
|
});
|
|
|
</script>
|