|
@@ -23,7 +23,7 @@
|
|
|
</div>
|
|
|
</el-header>
|
|
|
<el-main>
|
|
|
- <router-view v-on:status-change="changeStatus"></router-view>
|
|
|
+ <router-view v-if="ok" v-on:status-change="changeStatus" v-on:redirect-page="redirectPage" :hasConcole="hasConcole"></router-view>
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
</el-container>
|
|
@@ -41,7 +41,7 @@
|
|
|
components: {
|
|
|
'lt-badge': LtBadge,
|
|
|
'lt-menu': LtMenu,
|
|
|
- 'console': Console
|
|
|
+ 'console': Console
|
|
|
},
|
|
|
data: function () {
|
|
|
return {
|
|
@@ -49,7 +49,9 @@
|
|
|
organization: null,
|
|
|
userLoginDTO: null,
|
|
|
authStatus: null,
|
|
|
- authStatusName:''
|
|
|
+ authStatusName:'',
|
|
|
+ ok:false, //是否已获取到菜单
|
|
|
+ hasConcole:true //是否有控制台权限,登录后跳转用
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -57,22 +59,32 @@
|
|
|
return this.userLoginDTO && this.userLoginDTO.type == '0' ? 'user' : 'admin';
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
//获取菜单
|
|
|
api.getAccessdMenu().then((res) => {
|
|
|
if (res.data.code == '0') {
|
|
|
const data = res.data.data;
|
|
|
- this.menuWrappers = data.menuWrappers;
|
|
|
- this.organization = data.organization;
|
|
|
- this.userLoginDTO = data.userLoginDTO;
|
|
|
- data.userLoginDTO && data.userLoginDTO.type == '0' && this.getAuthStatus();
|
|
|
+ next(vm=>{
|
|
|
+ vm.ok = true;
|
|
|
+ const hasConcole=data.menuWrappers.findIndex((it)=>{
|
|
|
+ return it.code == 'LT-KZT'
|
|
|
+ });
|
|
|
+ vm.hasConcole = hasConcole!=-1;
|
|
|
+ vm.menuWrappers = data.menuWrappers;
|
|
|
+ vm.organization = data.organization;
|
|
|
+ vm.userLoginDTO = data.userLoginDTO;
|
|
|
+ data.userLoginDTO && data.userLoginDTO.type == '0' && vm.getAuthStatus();
|
|
|
+ })
|
|
|
}
|
|
|
}).catch((error) => {
|
|
|
console.log(error);
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
+ redirectPage(){
|
|
|
+ const url = this.getRole=='user'?'/user':'/admin';
|
|
|
+ this.$router.push({path:url});
|
|
|
+ },
|
|
|
changeStatus(text){ //账号信息中提交认证后修改状态
|
|
|
this.authStatus = 2;
|
|
|
this.authStatusName = text;
|