fix(components): userAccount is not defined

This commit is contained in:
ronger 2023-01-05 15:07:51 +08:00
parent c3d0471e0f
commit 5d6e23d932
2 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@
</el-col> </el-col>
<el-col :xs="9" :sm="11" :xl="11"> <el-col :xs="9" :sm="11" :xl="11">
<div style="margin-left: 1rem;"> <div style="margin-left: 1rem;">
<el-link :href="'/user/' + article.articleAuthor.userAccount" class="text-default"> <el-link :href="'/user/' + article.articleAuthor?.userAccount" class="text-default">
{{ article.articleAuthorName }} {{ article.articleAuthorName }}
</el-link> </el-link>
<small class="d-block text-muted">{{ article.timeAgo }}</small> <small class="d-block text-muted">{{ article.timeAgo }}</small>
@ -199,7 +199,7 @@ export default {
hasPermissions() { hasPermissions() {
let account = this.$store.state.auth.user?.nickname; let account = this.$store.state.auth.user?.nickname;
if (account) { if (account) {
if (account === this.article.articleAuthor.userNickname) { if (account === this.article.articleAuthor?.userNickname) {
return true; return true;
} }
} }

View File

@ -23,7 +23,7 @@
</el-col> </el-col>
<el-col style="font-size: 14px;"> <el-col style="font-size: 14px;">
<span style="padding-right: 1rem;">作者</span> <span style="padding-right: 1rem;">作者</span>
<el-link target="_blank" :href="'/user/' + portfolio.portfolioAuthor.userAccount"> <el-link target="_blank" :href="'/user/' + portfolio.portfolioAuthor?.userAccount">
<el-avatar :src="portfolio.portfolioAuthorAvatarUrl" :size="16"></el-avatar> <el-avatar :src="portfolio.portfolioAuthorAvatarUrl" :size="16"></el-avatar>
{{ portfolio.portfolioAuthorName }} {{ portfolio.portfolioAuthorName }}
</el-link> </el-link>
@ -60,7 +60,7 @@ export default {
validate({params, store}) { validate({params, store}) {
return params.portfolio_id && !isNaN(Number(params.portfolio_id)) return params.portfolio_id && !isNaN(Number(params.portfolio_id))
}, },
fetch() { async fetch() {
let {store, params, query, error} = this.$nuxt.context let {store, params, query, error} = this.$nuxt.context
params.page = query.page || 1 params.page = query.page || 1
return Promise.all([ return Promise.all([
@ -89,7 +89,7 @@ export default {
isAuthor() { isAuthor() {
let account = this.$store.state.auth.user?.nickname; let account = this.$store.state.auth.user?.nickname;
if (account) { if (account) {
if (account === this.portfolio.portfolioAuthor.userNickname) { if (account === this.portfolio.portfolioAuthor?.userNickname) {
return true; return true;
} }
} }