fix: record page
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
zzc
2026-02-09 01:43:01 +08:00
parent 23b0ae35af
commit 43f38207bf
6 changed files with 403 additions and 18 deletions

View File

@@ -53,3 +53,11 @@ export function toggleEnable(id, isEnabled) {
data: { isEnabled },
})
}
export function getCreateList(data) {
return request({
url: '/management/api/spring/avatar/create/list',
method: 'get',
params: data,
})
}

View File

@@ -8,6 +8,14 @@ export function getList(data) {
})
}
export function getDrawList(data) {
return request({
url: 'management/api/spring/fortune/card/draw/list',
method: 'get',
params: data,
})
}
export function doAdd(data) {
return request({
url: '/management/api/spring/fortune/card',

View File

@@ -169,6 +169,12 @@ export const asyncRoutes = [
component: () => import('@/views/spring/avatar/avatarDecor/index'),
meta: { title: '头像挂饰' },
},
{
path: 'record',
name: 'AvatarRecord',
component: () => import('@/views/spring/avatar/record/index'),
meta: { title: '头像记录' },
},
],
},
{
@@ -189,6 +195,12 @@ export const asyncRoutes = [
component: () => import('@/views/spring/fortune/card/index'),
meta: { title: '抽签卡片' },
},
{
path: 'drawRecord',
name: 'DrawRecord',
component: () => import('@/views/spring/fortune/drawRecord/index'),
meta: { title: '抽签记录' },
},
],
},
{

View File

@@ -0,0 +1,182 @@
<template>
<div class="avatar-record-container">
<vab-query-form>
<vab-query-form-left-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-left-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" label="生成结果" width="100">
<template slot-scope="scope">
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
</el-tooltip>
</template>
</el-table-column>
<el-table-column align="left" label="信息" show-overflow-tooltip>
<template #default="{ row }">
<div>
<div>
<strong>设备</strong>
<template v-if="row.deviceId">
<el-link type="primary" :underline="false" @click="goToDevice(row.deviceId)">{{ row.deviceModel || row.deviceId }}</el-link>
</template>
<template v-else>--</template>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="left" label="作者信息" show-overflow-tooltip>
<template #default="{ row }">
<div class="author-cell">
<img alt="avatar" class="author-avatar" :src="row?.fromUser?.avatar" />
<div class="author-meta">
<div>
<strong>id</strong>
{{ row?.fromUser?.id || '--' }}
</div>
<div>
<strong>昵称</strong>
{{ row?.fromUser?.nickname || '--' }}
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
<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 { getCreateList } from '@/api/spring/avatar'
import { formatTime } from '@/utils'
export default {
name: 'AvatarRecord',
data() {
return {
host: 'https://file.lihailezzc.com/',
list: null,
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: '',
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
keyword: '',
},
timeOutID: null,
}
},
created() {
const { id } = this.$route.query || {}
if (id) {
this.queryForm.keyword = id
this.queryForm.pageNo = 1
}
this.fetchData()
},
beforeDestroy() {
clearTimeout(this.timeOutID)
},
methods: {
formatTime,
setSelectRows(val) {
this.selectRows = val
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
},
async fetchData() {
this.listLoading = true
const { data } = await getCreateList(this.queryForm)
this.list = data.list
this.total = data.totalCount
this.timeOutID = setTimeout(() => {
this.listLoading = false
}, 300)
},
},
}
</script>
<style scoped>
.author-option {
display: flex;
align-items: center;
}
.author-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
margin-right: 8px;
}
.author-name {
font-size: 14px;
}
.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;
}
.image-grid {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.grid-image {
width: 80px;
height: 80px;
object-fit: cover;
border-radius: 8px;
}
</style>

View File

@@ -64,24 +64,6 @@
</div>
</template>
</el-table-column>
<el-table-column align="left" label="交互信息" show-overflow-tooltip>
<template #default="{ row }">
<div>
<div>
<strong>查看数</strong>
{{ row.viewCount }}
</div>
<div>
<strong>分享数</strong>
{{ row.shareCount }}
</div>
<div>
<strong>保存数</strong>
{{ row.saveCount }}
</div>
</div>
</template>
</el-table-column>
<el-table-column align="left" label="作者信息" show-overflow-tooltip>
<template #default="{ row }">
<div class="author-cell">

View File

@@ -0,0 +1,193 @@
<template>
<div class="draw-record-container">
<vab-query-form>
<vab-query-form-left-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-left-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column align="center" label="抽签结果" width="100">
<template slot-scope="scope">
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
<el-image fit="cover" :preview-src-list="[scope.row.imageUrl]" :src="scope.row.imageUrl" style="width: 50px; height: 50px" />
</el-tooltip>
</template>
</el-table-column>
<!-- <el-table-column align="left" label="信息" show-overflow-tooltip>
<template #default="{ row }">
<div>
<div>
<strong>设备</strong>
<template v-if="row.deviceId">
<el-link type="primary" :underline="false" @click="goToDevice(row.deviceId)">{{ row.deviceModel || row.deviceId }}</el-link>
</template>
<template v-else>--</template>
</div>
<div>
<strong>卡片id</strong>
<template v-if="row.cardId">
<el-link type="primary" :underline="false" @click="goToCard(row.cardId)">{{ row.cardId }}</el-link>
</template>
<template v-else>--</template>
</div>
</div>
</template>
</el-table-column> -->
<el-table-column align="left" label="抽签人" show-overflow-tooltip>
<template #default="{ row }">
<div class="author-cell">
<img alt="avatar" class="author-avatar" :src="row?.fromUser?.avatar" />
<div class="author-meta">
<div>
<strong>id</strong>
{{ row?.fromUser?.id || '--' }}
</div>
<div>
<strong>昵称</strong>
{{ row?.fromUser?.nickname || '--' }}
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
<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 { getDrawList } from '@/api/spring/fortune/card'
import { formatTime } from '@/utils'
export default {
name: 'DrawRecord',
data() {
return {
host: 'https://file.lihailezzc.com/',
list: null,
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: '',
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
keyword: '',
},
timeOutID: null,
}
},
created() {
const { id } = this.$route.query || {}
if (id) {
this.queryForm.keyword = id
this.queryForm.pageNo = 1
}
this.fetchData()
},
beforeDestroy() {
clearTimeout(this.timeOutID)
},
methods: {
formatTime,
setSelectRows(val) {
this.selectRows = val
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
goToDevice(deviceId) {
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
},
goToCard(cardId) {
// Assuming there is a card detail or list page, but for now just placeholder or link to card list
this.$router.push({ path: '/spring/fortune/card', query: { id: cardId } })
},
async fetchData() {
this.listLoading = true
const { data } = await getDrawList(this.queryForm)
this.list = data.list
this.total = data.totalCount
this.timeOutID = setTimeout(() => {
this.listLoading = false
}, 300)
},
},
}
</script>
<style scoped>
.author-option {
display: flex;
align-items: center;
}
.author-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
margin-right: 8px;
}
.author-name {
font-size: 14px;
}
.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;
}
.image-grid {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.grid-image {
width: 80px;
height: 80px;
object-fit: cover;
border-radius: 8px;
}
</style>