feat: support set gravatar source. (#314)

pull/315/head
Ryan Wang 2021-03-29 00:16:24 +08:00 committed by GitHub
parent 83e5ac911f
commit f2cf544a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 25 deletions

View File

@ -15,12 +15,7 @@
<a-list :loading="postCommentsLoading" :dataSource="converttedPostComments">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
<a-avatar
class="bg-white"
slot="avatar"
:src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'"
size="large"
/>
<a-avatar class="bg-white" slot="avatar" :src="item.avatar" size="large" />
<template slot="title">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a
><span v-html="item.content"></span>
@ -36,12 +31,7 @@
<a-list :loading="sheetCommentsLoading" :dataSource="converttedSheetComments">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
<a-avatar
class="bg-white"
slot="avatar"
:src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'"
size="large"
/>
<a-avatar class="bg-white" slot="avatar" :src="item.avatar" size="large" />
<template slot="title">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a
><span v-html="item.content"></span>

View File

@ -126,7 +126,7 @@
<a v-if="type === 'posts'" :href="item.post.fullPath" target="_blank">{{ item.post.title }}</a>
<a v-if="type === 'sheets'" :href="item.sheet.fullPath" target="_blank">{{ item.sheet.title }}</a>
</template>
<a-avatar slot="avatar" size="large" :src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'" />
<a-avatar slot="avatar" size="large" :src="item.avatar" />
<span
slot="title"
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"

View File

@ -44,7 +44,7 @@
<a-icon type="user" v-if="comment.isAdmin" style="margin-right: 3px;" />
{{ comment.author }}
</a>
<a-avatar size="large" slot="avatar" :src="avatar" :alt="comment.author" />
<a-avatar size="large" slot="avatar" :src="comment.avatar" :alt="comment.author" />
<p slot="content" v-html="content"></p>
<a-tooltip slot="datetime">
<span slot="title">{{ comment.createTime | moment }}</span>
@ -78,9 +78,6 @@ export default {
}
},
computed: {
avatar() {
return `//cn.gravatar.com/avatar/${this.comment.gravatarMd5}/?s=256&d=mp`
},
content() {
return marked(this.comment.content)
}

View File

@ -1,7 +1,7 @@
<template>
<a-list itemLayout="horizontal" :dataSource="formmatedCommentData" :loading="loading">
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
<a-comment :avatar="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '/?s=256&d=mp'">
<a-comment :avatar="item.avatar">
<template slot="author" v-if="type === 'posts'">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a> 发表在 <a
v-if="item.post.status == 'PUBLISHED' || item.post.status == 'INTIMATE'"

View File

@ -24,13 +24,11 @@
<a-form-model-item label="API 评论开关:" help="* 关闭之后将无法进行评论">
<a-switch v-model="options.comment_api_enabled" />
</a-form-model-item>
<a-form-model-item label="评论模块 JS">
<a-input
type="textarea"
:autoSize="{ minRows: 2 }"
v-model="options.comment_internal_plugin_js"
placeholder="该设置仅对内置的评论模块有效"
/>
<a-form-model-item label="评论模块 JS" help="* 该设置需要主题支持">
<a-input type="textarea" :autoSize="{ minRows: 2 }" v-model="options.comment_internal_plugin_js" />
</a-form-model-item>
<a-form-model-item label="Gravatar 镜像源:" help="* 例如://gravatar.com/avatar/">
<a-input v-model="options.gravatar_source" />
</a-form-model-item>
<a-form-model-item label="每页显示条数: ">
<a-input-number v-model="options.comment_page_size" :min="1" style="width:100%" />