refactor layout

This commit is contained in:
Timi
2026-10-17 12:01:28 +08:00
parent fe467e8781
commit 469c595a7c
134 changed files with 11493 additions and 4437 deletions
+129 -120
View File
@@ -1,127 +1,136 @@
<template>
<div v-can="permissionCodes.stat.read" class="event-record-rank">
<div class="filters">
<t-dropdown-menu class="filter-menu">
<t-dropdown-item
v-model="rankType"
:label="rankTypeLabel"
:options="rankTypeOptions"
@change="selectRankType"
/>
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="selectDateFilter"
/>
<t-dropdown-item
v-model="eventFilter"
:label="eventFilterLabel"
options-columns="2"
:options="eventOptions"
multiple
/>
</t-dropdown-menu>
</div>
<t-cell-group v-if="isCustomRange" class="time-range" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
@click="startVisible = true"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
@click="endVisible = true"
/>
</t-cell-group>
<t-pull-down-refresh
class="list-wrapper"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reloadRanks"
@scrolltolower="loadRanks"
>
<t-cell-group
v-if="pageResult.list.length"
class="list"
theme="card"
<div class="page-layout navbar event-record-rank">
<t-navbar
fixed
:z-index="20"
title="登记记录排行"
left-arrow
@left-click="$router.back()"
/>
<main v-can="permissionCodes.stat.read" class="page-content scroll list">
<t-pull-down-refresh
class="list-wrapper pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reloadRanks"
@scrolltolower="loadRanks"
>
<customer-cell
v-entrance-transition="{ step: 30 }"
v-for="(item, index) in pageResult.list"
:key="item.customerId"
class="item"
:class="{ 'in-top3': index < 3}"
arrow
@click="toCustomerDetail(item.customerId || '')"
:customer="item.customer"
>
<template #note>
<div
class="rank"
:class="{
top1: index === 0,
top2: index === 1,
top3: index === 2,
}"
v-text="index + 1"
/>
</template>
<template #description>
<div class="description">
<t-tag
v-if="rankType === 'TOTAL_DAYS'"
size="small"
variant="outline"
:content="`累计天数 ${item.totalEventDays || 0}`"
<div class="filters">
<t-dropdown-menu class="filter-menu">
<t-dropdown-item
v-model="rankType"
:label="rankTypeLabel"
:options="rankTypeOptions"
@change="selectRankType"
/>
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="selectDateFilter"
/>
<t-dropdown-item
v-model="eventFilter"
:label="eventFilterLabel"
options-columns="2"
:options="eventOptions"
multiple
/>
</t-dropdown-menu>
</div>
<t-cell-group v-if="isCustomRange" class="time-range" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
@click="startVisible = true"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
@click="endVisible = true"
/>
</t-cell-group>
<t-cell-group
v-if="pageResult.list.length"
class="list"
theme="card"
>
<customer-cell
v-entrance-transition="{ step: 30 }"
v-for="(item, index) in pageResult.list"
:key="item.customerId"
class="item"
:class="{ 'in-top3': index < 3}"
arrow
@click="toCustomerDetail(item.customerId || '')"
:customer="item.customer"
>
<template #note>
<div
class="rank"
:class="{
top1: index === 0,
top2: index === 1,
top3: index === 2,
}"
v-text="index + 1"
/>
<t-tag
v-else-if="rankType === 'TOTAL_COUNT'"
size="small"
variant="outline"
:content="`累计次数 ${item.totalEventCount || 0}`"
/>
<t-tag
v-else-if="rankType === 'CONTINUOUS_DAYS'"
size="small"
variant="outline"
:content="`连续天数 ${item.recentContinuousEventDays || 0}`"
/>
<t-tag
v-else
size="small"
variant="outline"
:content="`登记数值 ${getTotalNumberValueText(item)}`"
/>
</div>
</template>
</customer-cell>
</t-cell-group>
<div v-else class="center-tips" v-text="emptyStateText" />
<div v-if="pageResult.list.length" class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</template>
<template #description>
<div class="description">
<t-tag
v-if="rankType === 'TOTAL_DAYS'"
size="small"
variant="outline"
:content="`累计天数 ${item.totalEventDays || 0}`"
/>
<t-tag
v-else-if="rankType === 'TOTAL_COUNT'"
size="small"
variant="outline"
:content="`累计次数 ${item.totalEventCount || 0}`"
/>
<t-tag
v-else-if="rankType === 'CONTINUOUS_DAYS'"
size="small"
variant="outline"
:content="`连续天数 ${item.recentContinuousEventDays || 0}`"
/>
<t-tag
v-else
size="small"
variant="outline"
:content="`登记数值 ${getTotalNumberValueText(item)}`"
/>
</div>
</template>
</customer-cell>
</t-cell-group>
<div v-else class="center-tips" v-text="emptyStateText" />
<div v-if="pageResult.list.length" class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</main>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-model="dateRange[0]"
:default-value="dateRange[0]"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
@confirm="startVisible = false"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-model="dateRange[1]"
:default-value="dateRange[1]"
:mode="['date', 'minute']"
format="YYYY-MM-DD HH:mm"
title="结束时间"
@confirm="endVisible = false"
/>
</t-popup>
</div>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-model="dateRange[0]"
:default-value="dateRange[0]"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
@confirm="startVisible = false"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-model="dateRange[1]"
:default-value="dateRange[1]"
:mode="['date', 'minute']"
format="YYYY-MM-DD HH:mm"
title="结束时间"
@confirm="endVisible = false"
/>
</t-popup>
</template>
<script setup lang="ts">