code review:签到记录

This commit is contained in:
YunaiV 2023-08-20 19:34:39 +08:00
parent 82628ce780
commit be485cc4ab
3 changed files with 10 additions and 37 deletions

View File

@ -11,8 +11,3 @@ export interface SignInRecordVO {
export const getSignInRecordPage = async (params) => { export const getSignInRecordPage = async (params) => {
return await request.get({ url: `/member/point/sign-in-record/page`, params }) return await request.get({ url: `/member/point/sign-in-record/page`, params })
} }
// 导出用户签到积分 Excel
export const exportSignInRecord = async (params) => {
return await request.download({ url: `/member/point/sign-in-record/export-excel`, params })
}

View File

@ -77,7 +77,7 @@
width="180" width="180"
/> />
<el-table-column label="用户" align="center" prop="nickname" width="200" /> <el-table-column label="用户" align="center" prop="nickname" width="200" />
<el-table-column label="变动积分" align="center" prop="point" width="100"> <el-table-column label="获得积分" align="center" prop="point" width="100">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.point > 0" class="ml-2" type="success" effect="dark"> <el-tag v-if="scope.row.point > 0" class="ml-2" type="success" effect="dark">
+{{ scope.row.point }} +{{ scope.row.point }}

View File

@ -40,15 +40,6 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['point:sign-in-record:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -57,7 +48,6 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<!-- TODO @xiaqing展示用户昵称 -->
<el-table-column label="签到用户" align="center" prop="nickname" /> <el-table-column label="签到用户" align="center" prop="nickname" />
<el-table-column <el-table-column
label="签到天数" label="签到天数"
@ -65,7 +55,14 @@
prop="day" prop="day"
:formatter="(_, __, cellValue) => ['第', cellValue, '天'].join(' ')" :formatter="(_, __, cellValue) => ['第', cellValue, '天'].join(' ')"
/> />
<el-table-column label="获得积分" align="center" prop="point" /> <el-table-column label="获得积分" align="center" prop="point" width="100">
<template #default="scope">
<el-tag v-if="scope.row.point > 0" class="ml-2" type="success" effect="dark">
+{{ scope.row.point }}
</el-tag>
<el-tag v-else class="ml-2" type="danger" effect="dark"> {{ scope.row.point }} </el-tag>
</template>
</el-table-column>
<el-table-column <el-table-column
label="签到时间" label="签到时间"
align="center" align="center"
@ -81,15 +78,11 @@
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 -->
<SignInRecordForm ref="formRef" @success="getList" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import * as SignInRecordApi from '@/api/member/signin/record'
import * as SignInRecordApi from '@/api/point/signInRecord'
defineOptions({ name: 'SignInRecord' }) defineOptions({ name: 'SignInRecord' })
@ -132,21 +125,6 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await SignInRecordApi.exportSignInRecord(queryParams)
download.excel(data, '用户签到积分.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()