...
|
...
|
@@ -4,11 +4,11 @@ |
|
|
import _ from 'lodash';
|
|
|
import axios from 'axios';
|
|
|
import UserService from 'services/user/user-service';
|
|
|
import Rsa from 'rsa';
|
|
|
import crypto from 'util/crypto';
|
|
|
|
|
|
export default {
|
|
|
updateUser(Vue, user, purviews) {
|
|
|
Vue.$store.set(Vue.$config.storeKeys.user, Rsa.encrypt(user));
|
|
|
Vue.$store.set(Vue.$config.storeKeys.user, crypto.aesEncrypt(user));
|
|
|
Vue.prop('user', user);
|
|
|
Vue.prop('isLogin', true);
|
|
|
Vue.prop('purviews', purviews.deep);
|
...
|
...
|
@@ -39,12 +39,16 @@ export default { |
|
|
let isLogin = Vue.$cookie.get('_isLogin');
|
|
|
|
|
|
if (isLogin && user) {
|
|
|
user = Rsa.decrypt(user, Object);
|
|
|
return this.initPurview(Vue, user).then(() => {
|
|
|
next();
|
|
|
}, () => {
|
|
|
next();
|
|
|
});
|
|
|
try {
|
|
|
user = crypto.aesDecrypt(user, Object);
|
|
|
return this.initPurview(Vue, user).then(() => {
|
|
|
next();
|
|
|
}, () => {
|
|
|
next();
|
|
|
});
|
|
|
} catch (e) {
|
|
|
Vue.logout();
|
|
|
}
|
|
|
}
|
|
|
next();
|
|
|
});
|
...
|
...
|
@@ -87,7 +91,7 @@ export default { |
|
|
}
|
|
|
};
|
|
|
Vue.switchShop = shopsId => {
|
|
|
Vue.$store.set(Vue.$config.storeKeys.user, Rsa.encrypt(Vue.$user));
|
|
|
Vue.$store.set(Vue.$config.storeKeys.user, crypto.aesEncrypt(Vue.$user));
|
|
|
Vue.$cookie.set('_sign', shopsId, {
|
|
|
path: '/'
|
|
|
});
|
...
|
...
|
|