support tablet

This commit is contained in:
Timi
2026-11-02 23:12:05 +08:00
parent c48b19bed5
commit d3879c9c77
123 changed files with 4153 additions and 2673 deletions
+97 -70
View File
@@ -1,5 +1,5 @@
<template>
<div class="page-layout navbar point-rule-list">
<div class="tui-page-layout tui-navbar point-rule-list">
<t-navbar
fixed
:z-index="20"
@@ -11,83 +11,102 @@
<navbar-actions :actions="actionList" :visible="canShowActionMenu" />
</template>
</t-navbar>
<main v-can="permissionCodes.pointRule.read" class="page-content scroll column list">
<t-pull-down-refresh
class="list-wrapper pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<div class="filters">
<t-input
v-model.trim="keyword"
class="keyword"
type="search"
borderless
clearable
placeholder="搜索积分规则名称"
/>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="statusFilter"
label="规则状态"
:options="statusOptions"
@change="selectStatus"
/>
</t-dropdown-menu>
</div>
<t-cell-group
v-if="pageResult.list.length"
class="list empty-cell-title-margin"
theme="card"
<master-detail-page
v-can="permissionCodes.pointRule.read"
class="list"
:split="isWide"
:selected="!!selectedId"
:direction="paneDirection"
>
<template #master>
<t-pull-down-refresh
class="list-wrapper pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<t-cell
v-for="item in pageResult.list"
:key="item.id"
class="item"
:arrow="!!item.id"
:hover="!!item.id"
v-entrance-transition="{ step: 30 }"
@click="toDetail(item)"
<div class="filters">
<t-input
v-model.trim="keyword"
class="keyword"
type="search"
borderless
clearable
placeholder="搜索积分规则名称"
/>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="statusFilter"
label="规则状态"
:options="statusOptions"
@change="selectStatus"
/>
</t-dropdown-menu>
</div>
<t-cell-group
v-if="pageResult.list.length"
class="list empty-cell-title-margin"
theme="card"
>
<template #left-icon>
<div class="point" :class="{ 'consume': item.pointValue && item.pointValue < 0 }">
<t-icon name="money" />
<span v-text="getPointText(item)" />
</div>
</template>
<template #title>
<div class="title">
<h4 class="text" v-text="item.name || '未命名规则'" />
<t-tag
:theme="getStatusTheme(item.status)"
variant="light-outline"
:content="getStatusText(item.status)"
/>
</div>
</template>
<template #description>
<div class="description">
<div v-text="`触发来源:${getTriggerSourceText(item)}`"></div>
<div v-text="`触发对象:${getTriggerRefText(item)}`"></div>
</div>
</template>
</t-cell>
</t-cell-group>
<center-tips :content="loadStateText" />
</t-pull-down-refresh>
</main>
<t-cell
v-for="item in pageResult.list"
:key="item.id"
class="item"
:arrow="!!item.id"
:hover="!!item.id"
v-entrance-transition="{ step: 30 }"
@click="toDetail(item)"
>
<template #left-icon>
<div class="point" :class="{ 'consume': item.pointValue && item.pointValue < 0 }">
<t-icon name="money" />
<span v-text="getPointText(item)" />
</div>
</template>
<template #title>
<div class="title">
<h4 class="text" v-text="item.name || '未命名规则'" />
<t-tag
:theme="getStatusTheme(item.status)"
variant="light-outline"
:content="getStatusText(item.status)"
/>
</div>
</template>
<template #description>
<div class="description">
<div v-text="`触发来源:${getTriggerSourceText(item)}`"></div>
<div v-text="`触发对象:${getTriggerRefText(item)}`"></div>
</div>
</template>
</t-cell>
</t-cell-group>
<center-tips :content="loadStateText" />
</t-pull-down-refresh>
</template>
<template #detail>
<point-rule-edit v-if="editing" :key="`edit-${selectedId}`" :rule-id="selectedId" />
<point-rule-detail
v-else
:key="`detail-${selectedId}-${detailVersion}`"
:rule-id="selectedId"
@edit="openEdit"
/>
</template>
</master-detail-page>
</div>
</template>
<script setup lang="ts">
import type { NavbarAction } from "@/types/NavbarAction.ts";
import { type DropdownValue } from "tdesign-mobile-vue";
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
import { Toolkit } from "timi-web";
import EventAPI from "@/api/EventAPI";
import PointAPI from "@/api/PointAPI";
import PointRuleDetail from "@/pages/point/PointRuleDetail.vue";
import PointRuleEdit from "@/pages/point/PointRuleEdit.vue";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import type { PointRule, PointRuleStatus } from "@/types/Point";
import { formatWanInteger } from "@/utils/money";
@@ -102,6 +121,14 @@ defineOptions({
});
const router = useRouter();
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里
const { selectedId, editing, detailVersion, paneDirection, isWide, openDetail, openEdit } =
useMasterDetailPane({
path: "/management/points/rules",
detail: id => `/management/points/rules/${id}`,
edit: id => `/management/points/rules/${id}/edit`
});
const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore();
@@ -324,7 +351,7 @@ async function toDetail(rule: PointRule): Promise<void> {
if (!rule.id) {
return;
}
await router.push(`/management/points/rules/${rule.id}`);
openDetail(rule.id || "");
}
async function preparePage(): Promise<void> {
@@ -354,10 +381,10 @@ onUnmounted(() => {
<style scoped lang="less">
.point-rule-list {
padding: calc(var(--app-nav-height) + 4rem) 0 1rem;
padding: calc(var(--tui-nav-height) + 4rem) 0 1rem;
.filter-menu {
top: var(--app-nav-height);
top: var(--tui-nav-height);
left: 0;
right: 0;
z-index: 10;