fix: record
This commit is contained in:
255
src/views/spring/user/shareRecord/index.vue
Normal file
255
src/views/spring/user/shareRecord/index.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<div class="share-record-container">
|
||||
<vab-query-form>
|
||||
<!-- <vab-query-form-left-panel :span="12"> -->
|
||||
<!-- <el-button icon="el-icon-plus" type="primary" @click="handleEdit">添加</el-button> -->
|
||||
<!-- <el-button icon="el-icon-delete" type="danger" @click="handleDelete">批量删除</el-button> -->
|
||||
<!-- </vab-query-form-left-panel> -->
|
||||
<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-select v-model="queryForm.type" clearable placeholder="请选择分享类型" @change="queryData">
|
||||
<el-option label="祝福卡片" :value="1" />
|
||||
<el-option label="抽签" :value="2" />
|
||||
<el-option label="壁纸" :value="3" />
|
||||
<el-option label="头像" :value="4" />
|
||||
</el-select>
|
||||
</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="center" label="分享类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.type === 1 ? '祝福卡片' : row.type === 2 ? '抽签' : row.type === 3 ? '壁纸' : '头像' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="信息" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<div>
|
||||
<strong>分享Token:</strong>
|
||||
{{ row.shareToken }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>分享渠道:</strong>
|
||||
{{ row.shareChannel || '--' }}
|
||||
</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="goToContent(row)">{{ 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-column label="操作" show-overflow-tooltip width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleDelete(row)">删除</el-button>
|
||||
</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 { getShareList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'GenerateRecord',
|
||||
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,
|
||||
type: '',
|
||||
keyword: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
this.$baseMessage('未选中任何行', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
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 } })
|
||||
},
|
||||
goToContent(row) {
|
||||
if (row.type === 1) {
|
||||
this.$router.push({ path: '/spring/blessing/generateRecord', query: { id: row.cardId } })
|
||||
} else if (row.type === 2) {
|
||||
this.$router.push({ path: '/spring/blessing/viewRecord', query: { id: row.cardId } })
|
||||
} else if (row.type === 3) {
|
||||
this.$router.push({ path: '/spring/blessing/shareRecord', query: { id: row.cardId } })
|
||||
} else {
|
||||
this.$router.push({ path: '/spring/blessing/shareRecord', query: { id: row.cardId } })
|
||||
}
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getShareList(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>
|
||||
265
src/views/spring/user/viewRecord/index.vue
Normal file
265
src/views/spring/user/viewRecord/index.vue
Normal file
@@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<div class="view-record-container">
|
||||
<vab-query-form>
|
||||
<!-- <vab-query-form-left-panel :span="12"> -->
|
||||
<!-- <el-button icon="el-icon-plus" type="primary" @click="handleEdit">添加</el-button> -->
|
||||
<!-- <el-button icon="el-icon-delete" type="danger" @click="handleDelete">批量删除</el-button> -->
|
||||
<!-- </vab-query-form-left-panel> -->
|
||||
<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.permission" 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>
|
||||
{{ row.year }}-{{ row.festival }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>祝福对象:</strong>
|
||||
{{ row.blessingTo || '--' }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>祝福人:</strong>
|
||||
{{ row.blessingFrom || '--' }}
|
||||
</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.templateId">
|
||||
<el-link type="primary" :underline="false" @click="goToTemplate(row.templateId)">{{ row.templateId }}</el-link>
|
||||
</template>
|
||||
<template v-else>--</template>
|
||||
</div>
|
||||
<div>
|
||||
<strong>内容id:</strong>
|
||||
<template v-if="row.blessingId">
|
||||
<el-link type="primary" :underline="false" @click="goToContentTemplate(row.blessingId)">{{ row.blessingId }}</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>
|
||||
<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">
|
||||
<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-column label="操作" show-overflow-tooltip width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleDelete(row)">删除</el-button>
|
||||
</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 { getViewList } from '@/api/spring/user'
|
||||
import { formatTime } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'ViewRecord',
|
||||
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,
|
||||
permission: '',
|
||||
},
|
||||
timeOutID: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timeOutID)
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
setSelectRows(val) {
|
||||
this.selectRows = val
|
||||
},
|
||||
handleEdit(row) {
|
||||
if (row.id) {
|
||||
this.$refs['edit'].showEdit(row)
|
||||
} else {
|
||||
this.$refs['edit'].showEdit()
|
||||
}
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (row.id) {
|
||||
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: [row.id] })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
if (this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map((item) => item.id).join()
|
||||
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
||||
const { msg } = await doDelete({ ids: ids.split(',') })
|
||||
this.$baseMessage(msg, 'success')
|
||||
this.fetchData()
|
||||
})
|
||||
} else {
|
||||
this.$baseMessage('未选中任何行', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
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 } })
|
||||
},
|
||||
goToTemplate(templateId) {
|
||||
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })
|
||||
},
|
||||
goToContentTemplate(templateId) {
|
||||
this.$router.push({ path: '/spring/blessing/contentTemplate', query: { templateId } })
|
||||
},
|
||||
async fetchData() {
|
||||
this.listLoading = true
|
||||
const { data } = await getViewList(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>
|
||||
Reference in New Issue
Block a user