feat: add result change log entities

This commit is contained in:
Tim
2025-09-08 13:54:35 +08:00
parent 567452f570
commit 5ae0f9311c
9 changed files with 80 additions and 4 deletions

View File

@@ -1,7 +1,13 @@
<template>
<div :id="`change-log-${log.id}`" class="change-log-container">
<div class="change-log-text">
<span class="change-log-user">{{ log.username }}</span>
<BaseImage
v-if="log.userAvatar"
class="change-log-avatar"
:src="log.userAvatar"
alt="avatar"
/>
<span v-if="log.username" class="change-log-user">{{ log.username }}</span>
<span v-if="log.type === 'CONTENT'">变更了文章内容</span>
<span v-else-if="log.type === 'TITLE'">变更了文章标题</span>
<span v-else-if="log.type === 'CATEGORY'">变更了文章分类</span>
@@ -18,6 +24,8 @@
<template v-if="log.newFeatured">将文章设为精选</template>
<template v-else>取消精选文章</template>
</span>
<span v-else-if="log.type === 'VOTE_RESULT'">投票已出结果</span>
<span v-else-if="log.type === 'LOTTERY_RESULT'">抽奖已开奖</span>
</div>
<div class="change-log-time">{{ log.time }}</div>
<div
@@ -34,6 +42,7 @@ import { html } from 'diff2html'
import { createTwoFilesPatch } from 'diff'
import { useIsMobile } from '~/utils/screen'
import 'diff2html/bundles/css/diff2html.min.css'
import BaseImage from '~/components/BaseImage.vue'
const props = defineProps({
log: Object,
title: String,
@@ -76,10 +85,20 @@ const diffHtml = computed(() => {
opacity: 0.7;
font-size: 14px;
}
.change-log-text {
display: flex;
align-items: center;
}
.change-log-user {
font-weight: bold;
margin-right: 4px;
}
.change-log-avatar {
width: 20px;
height: 20px;
border-radius: 50%;
margin-right: 4px;
}
.change-log-time {
font-size: 12px;
opacity: 0.6;