🐛 鉴权问题修复

This commit is contained in:
ronger 2021-04-27 21:39:56 +08:00
parent 6a3e6b3351
commit 6d840142ff
2 changed files with 113 additions and 77 deletions

View File

@ -35,13 +35,22 @@
</el-col>
</el-col>
<el-col>
<el-divider><i class="el-icon-loading"></i></el-divider>
<el-divider></el-divider>
</el-col>
<el-col>
<portfolio-manager-list :idPortfolio="portfolio.idPortfolio"></portfolio-manager-list>
</el-col>
</el-col>
</el-col>
<el-col v-else class="text-center">
<el-alert
title="用户无权限"
type="warning"
center
show-icon
:closable="false">
</el-alert>
</el-col>
</el-row>
</template>

View File

@ -1,5 +1,6 @@
<template>
<el-row class="wrapper">
<el-col v-if="isAuthor">
<el-col v-if="isEdit" style="margin-bottom: 1rem;">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/portfolio/manager/' + idPortfolio }">{{ portfolio.portfolioTitle }}
@ -80,6 +81,16 @@
</el-form-item>
</el-form>
</el-col>
</el-col>
<el-col v-else class="text-center">
<el-alert
title="用户无权限"
type="warning"
center
show-icon
:closable="false">
</el-alert>
</el-col>
</el-row>
</template>
@ -112,6 +123,19 @@ export default {
portfolioDetail: state => state.portfolio.detail.data,
uploadHeaders: state => {
return {'X-Upload-Token': state.uploadHeaders}
},
isAuthor() {
let account = this.$store.state.userInfo?.nickname;
if (account) {
if (this.$route.params.portfolio_id) {
if (account === this.portfolioDetail.portfolioAuthorName) {
return true;
}
} else {
return true;
}
}
return false;
}
}),
idPortfolio() {
@ -366,6 +390,9 @@ export default {
window.onbeforeunload = null;
},
mounted() {
if (!this.isAuthor) {
return
}
window.addEventListener('beforeunload', e => {
e = e || window.event;