|
@@ -23,7 +23,8 @@ var loginPage = new Vue({
|
|
|
identity: '',
|
|
|
permission: '',
|
|
|
token: ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ isWeChat: false
|
|
|
},
|
|
|
computed: {
|
|
|
|
|
@@ -91,7 +92,7 @@ var loginPage = new Vue({
|
|
|
_self.setStorages( _self.userData);
|
|
|
// 登录成功页面跳转
|
|
|
var loginBeforePath = getBaseCookie("loginBeforePath");
|
|
|
- if (loginBeforePath && loginBeforePath!=='undefined') {
|
|
|
+ if (loginBeforePath && loginBeforePath!='undefined' && loginBeforePath.indexOf('.html')>0) {
|
|
|
delBaseCookie("loginBeforePath");
|
|
|
window.location.href = loginBeforePath;
|
|
|
} else if (_self.userData.userIdentity*1 === 3) {
|
|
@@ -107,6 +108,30 @@ var loginPage = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 微信公众号授权登录
|
|
|
+ weChatLogin: function(){
|
|
|
+ if (this.isWeChat) {
|
|
|
+ // 微信浏览器自动授权登录
|
|
|
+ var urlForWeChat = 'https://www.caimei365.com/we_chat/redirect_uri.html';
|
|
|
+ $.get(spiServer+'/user/authorizationLink?redirectUri='+urlForWeChat, function(r){
|
|
|
+ if(r.code===0 && r.data){
|
|
|
+ window.location.href = r.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ weChatAutoLogin: function(){
|
|
|
+ if (this.isWeChat && Number(getBaseCookie("weChatAutoLogin"))!==1) {
|
|
|
+ // 微信浏览器自动授权登录
|
|
|
+ var urlForWeChat = 'https://www.caimei365.com/we_chat/redirect_uri.html';
|
|
|
+ $.get(spiServer+'/user/authorizationLink?redirectUri='+urlForWeChat, function(r){
|
|
|
+ if(r.code===0 && r.data){
|
|
|
+ setBaseCookie("weChatAutoLogin", 1);
|
|
|
+ window.location.href = r.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
toNormalLogin: function(){
|
|
|
this.qrCodeLogin = false;
|
|
|
},
|
|
@@ -153,7 +178,7 @@ var loginPage = new Vue({
|
|
|
_self.setStorages( _self.userData);
|
|
|
// 登录成功页面跳转
|
|
|
var loginBeforePath = getBaseCookie("loginBeforePath");
|
|
|
- if (loginBeforePath && loginBeforePath!=='undefined') {
|
|
|
+ if (loginBeforePath && loginBeforePath!='undefined' && loginBeforePath.indexOf('.html')>0) {
|
|
|
delBaseCookie("loginBeforePath");
|
|
|
window.location.href = loginBeforePath;
|
|
|
} else if (_self.userData.userIdentity*1 === 3) {
|
|
@@ -174,7 +199,9 @@ var loginPage = new Vue({
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
|
-
|
|
|
+ var userAgent = navigator.userAgent.toLowerCase();
|
|
|
+ this.isWeChat = userAgent.match(/MicroMessenger/i);
|
|
|
+ this.weChatAutoLogin();
|
|
|
},
|
|
|
mounted: function () {
|
|
|
var _self = this;
|