fix: user gretting record

This commit is contained in:
zzc
2026-03-13 05:27:24 +08:00
parent 41eaf2e269
commit 25b176baa9
3 changed files with 146 additions and 0 deletions

View File

@@ -39,3 +39,11 @@ export function toggleEnable(id, isEnabled) {
data: { isEnabled }, data: { isEnabled },
}) })
} }
export function getGreetingStreakList(params) {
return request({
url: '/management/api/spring/system/greeting-streak/list',
method: 'get',
params,
})
}

View File

@@ -79,6 +79,12 @@ export const asyncRoutes = [
component: () => import('@/views/spring/daily/greeting/index'), component: () => import('@/views/spring/daily/greeting/index'),
meta: { title: '问候语配置', icon: 'setting' }, meta: { title: '问候语配置', icon: 'setting' },
}, },
{
path: 'greetingStreak',
name: 'GreetingStreak',
component: () => import('@/views/spring/daily/greetingStreak/index'),
meta: { title: '问候记录', icon: 'list' },
},
], ],
}, },
{ {

View File

@@ -0,0 +1,132 @@
<template>
<div class="greetingStreak-container">
<vab-query-form>
<vab-query-form-left-panel :span="12" />
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入查询条件" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
<el-table-column align="left" label="用户信息" min-width="200" show-overflow-tooltip>
<template #default="{ row }">
<div v-if="row.fromUser && row.fromUser.id" class="author-cell">
<el-image
class="author-avatar"
:preview-src-list="[getThumbUrl(row.fromUser.avatar)]"
:src="getThumbUrl(row.fromUser.avatar)"
/>
<div class="author-meta">
<div>
<strong>昵称</strong>
{{ row.fromUser.nickname || '--' }}
</div>
<div>
<strong>ID</strong>
{{ row.fromUser.id }}
</div>
</div>
</div>
<div v-else>
<div>User ID: {{ row.userId }}</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="内容" prop="content" show-overflow-tooltip />
<el-table-column align="center" label="署名" prop="signature" show-overflow-tooltip />
<el-table-column align="center" label="日期" prop="day" show-overflow-tooltip />
<el-table-column align="center" label="创建时间" show-overflow-tooltip width="160">
<template #default="{ row }">
{{ formatTime(row.createdAt) }}
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</template>
<script>
import { getGreetingStreakList } from '@/api/spring/daily/greeting'
import { formatTime } from '@/utils'
import { getThumbUrl } from '@/utils/blessing'
export default {
name: 'GreetingStreak',
data() {
return {
list: null,
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
keyword: '',
},
}
},
created() {
this.fetchData()
},
methods: {
getThumbUrl,
formatTime,
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
const { data } = await getGreetingStreakList(this.queryForm)
this.list = data.list
this.total = data.totalCount
this.listLoading = false
},
},
}
</script>
<style scoped>
.author-cell {
display: flex;
align-items: center;
gap: 12px;
}
.author-avatar {
width: 50px;
height: 50px;
object-fit: cover;
border-radius: 50%;
}
.author-meta {
display: flex;
flex-direction: column;
}
</style>