...
|
...
|
@@ -31,6 +31,12 @@ export default { |
|
|
this.updateUser(Vue, user, purviews);
|
|
|
});
|
|
|
},
|
|
|
initConfig(Vue) {
|
|
|
return this.userService.config().then((data) => {
|
|
|
Object.assign(Vue.$config, data);
|
|
|
Vue.prop('config', Vue.$config);
|
|
|
});
|
|
|
},
|
|
|
install(Vue) {
|
|
|
this.userService = new UserService();
|
|
|
|
...
|
...
|
@@ -41,7 +47,10 @@ export default { |
|
|
if (isLogin && user) {
|
|
|
try {
|
|
|
user = crypto.aesDecrypt(user, Object);
|
|
|
return this.initPurview(Vue, user).then(() => {
|
|
|
return Promise.all([
|
|
|
this.initPurview(Vue, user),
|
|
|
this.initConfig(Vue)
|
|
|
]).then(() => {
|
|
|
next();
|
|
|
}, () => {
|
|
|
next();
|
...
|
...
|
@@ -82,7 +91,10 @@ export default { |
|
|
local: (username, password) => {
|
|
|
return this.userService.login(username, password).then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
return this.initPurview(Vue, res.data).then(() => {
|
|
|
return Promise.all([
|
|
|
this.initPurview(Vue, res.data),
|
|
|
this.initConfig(Vue)
|
|
|
]).then(() => {
|
|
|
return res.data;
|
|
|
});
|
|
|
}
|
...
|
...
|
|