1
This commit is contained in:
parent
01ca2c7e01
commit
b75b710702
@ -33,7 +33,8 @@
|
|||||||
:class="{'is-reply': comment.toUserName}">
|
:class="{'is-reply': comment.toUserName}">
|
||||||
<view class="comment-header">
|
<view class="comment-header">
|
||||||
<image class="avatar"
|
<image class="avatar"
|
||||||
:src="comment.pusherPortrait === '/static/imgs/index/nav.png' ? comment.pusherPortrait : `${IMAGE_BASE_URL}${comment.pusherPortrait}`" mode="aspectFill"></image>
|
:src="getAvatarSrc(comment.pusherPortrait)"
|
||||||
|
mode="aspectFill"></image>
|
||||||
<view class="comment-user-info">
|
<view class="comment-user-info">
|
||||||
<text class="username">{{ comment.pusherName }}</text>
|
<text class="username">{{ comment.pusherName }}</text>
|
||||||
<view class="meta-info">
|
<view class="meta-info">
|
||||||
@ -114,8 +115,27 @@
|
|||||||
this.error = '缺少内容ID';
|
this.error = '缺少内容ID';
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAvatarSrc(portrait) {
|
||||||
|
const defaultAvatar = '/static/imgs/index/nav.png';
|
||||||
|
|
||||||
|
if (!portrait) {
|
||||||
|
return defaultAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultUrls = ['/static/imgs/index/nav.png', 'https://jinshan.nantong.info'];
|
||||||
|
|
||||||
|
if (defaultUrls.includes(portrait) || portrait.startsWith('http')) {
|
||||||
|
return portrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${this.IMAGE_BASE_URL}${portrait}`;
|
||||||
|
},
|
||||||
|
|
||||||
// 扁平化评论结构(核心修改)
|
// 扁平化评论结构(核心修改)
|
||||||
updateFlatComments() {
|
updateFlatComments() {
|
||||||
const flattenComments = (comments, parentUser = '') => {
|
const flattenComments = (comments, parentUser = '') => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user