fix: ad watch
This commit is contained in:
@@ -15,3 +15,11 @@ export function getTrackingLogsList(data) {
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
export function getAdWatchTicketList(data) {
|
||||
return request({
|
||||
url: 'management/api/system/ad-watch-ticket/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -277,6 +277,12 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/spring/user/order/index'),
|
||||
meta: { title: '订单' },
|
||||
},
|
||||
{
|
||||
path: 'adWatchRecord',
|
||||
name: 'AdWatchRecord',
|
||||
component: () => import('@/views/spring/user/adWatch/index'),
|
||||
meta: { title: '广告观看记录' },
|
||||
},
|
||||
{
|
||||
path: 'userChat',
|
||||
name: 'UserChat',
|
||||
|
||||
@@ -52,6 +52,7 @@ export function parseTime(time, cFormat) {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (!time) return
|
||||
if (typeof time === 'string' && !isNaN(Date.parse(time))) {
|
||||
// 处理 ISO 8601 格式的时间
|
||||
time = new Date(time)
|
||||
|
||||
141
src/views/spring/user/adWatch/index.vue
Normal file
141
src/views/spring/user/adWatch/index.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="adWatch-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="center" label="ID" prop="id" show-overflow-tooltip width="220" />
|
||||
|
||||
<el-table-column align="left" label="用户信息" min-width="200" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.user && row.user.id" class="author-cell">
|
||||
<el-image class="author-avatar" :preview-src-list="[getThumbUrl(row.user.avatar)]" :src="getThumbUrl(row.user.avatar)" />
|
||||
<div class="author-meta">
|
||||
<div>
|
||||
<strong>昵称:</strong>
|
||||
{{ row.user.nickname || '--' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>ID:</strong>
|
||||
{{ row.user.id }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div>User ID: {{ row.userId }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="广告位ID" prop="adPlacementId" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="是否看完" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.consumed" type="success">是</el-tag>
|
||||
<el-tag v-else type="danger">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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.consumedAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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 { getAdWatchTicketList } from '@/api/system/index'
|
||||
import { formatTime } from '@/utils'
|
||||
import { getThumbUrl } from '@/utils/blessing'
|
||||
|
||||
export default {
|
||||
name: 'AdWatchRecord',
|
||||
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 getAdWatchTicketList(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>
|
||||
Reference in New Issue
Block a user