代码重构(我的页面): 清理导航与组件冗余代码

- 移除三个我的子页面的自定义导航配置,改用默认原生导航栏
- 将列表项和操作按钮的button标签替换为view标签,调整对应布局样式
- 移除未使用的TopHeader组件导入,同时删除成员组件中的已登录状态徽章
- 清理冗余的导入语句
This commit is contained in:
duanshuwen
2026-08-27 14:48:47 +08:00
parent 0803c9ed5b
commit 72d0976da4
5 changed files with 66 additions and 86 deletions

View File

@@ -28,22 +28,19 @@
{
"path": "pages/mine/vehicle-demands/index",
"style": {
"navigationBarTitleText": "用车提交记录",
"navigationStyle": "custom"
"navigationBarTitleText": "用车提交记录"
}
},
{
"path": "pages/mine/browse-history/index",
"style": {
"navigationBarTitleText": "历史浏览记录",
"navigationStyle": "custom"
"navigationBarTitleText": "历史浏览记录"
}
},
{
"path": "pages/mine/vehicle-demand-detail",
"style": {
"navigationBarTitleText": "用车提交详情",
"navigationStyle": "custom"
"navigationBarTitleText": "用车提交详情"
}
},
{

View File

@@ -1,8 +1,6 @@
<template>
<z-paging v-if="isReady" ref="paging" v-model="records" class="bg-[#f5f2ed]" @query="queryList">
<template #top>
<TopHeader title="历史浏览记录" @back="goBack()" />
</template>
<view class="px-5 pb-10 pt-5">
<view class="mb-5 flex items-end justify-between">
@@ -13,19 +11,17 @@
<text class="text-[11px] text-[#6d8377]">{{ total }} </text>
</view>
<view v-if="usingLocalFallback" class="mb-4 flex items-center gap-2 rounded-[10px] bg-[#fff8ed] px-3 py-2 text-[11px] leading-5 text-[#a67842]">
<view v-if="usingLocalFallback"
class="mb-4 flex items-center gap-2 rounded-[10px] bg-[#fff8ed] px-3 py-2 text-[11px] leading-5 text-[#a67842]">
<uni-icons type="info" :size="15" color="#a67842" />
<text>网络暂不可用当前展示本地缓存</text>
</view>
<view class="overflow-hidden rounded-[16px] border border-[#e2d9d0] bg-white shadow-[0_8px_20px_rgba(80,58,45,0.05)]">
<button
v-for="(item, index) in records"
:key="`${item.itemType}-${item.itemId}`"
<view
class="overflow-hidden rounded-[16px] border border-[#e2d9d0] bg-white shadow-[0_8px_20px_rgba(80,58,45,0.05)]">
<view v-for="(item, index) in records" :key="`${item.itemType}-${item.itemId}`"
class="m-0 flex w-full items-center gap-3 px-4 py-3 text-left"
:class="index < records.length - 1 ? 'border-b border-[#eee7e0]' : ''"
@click="openHistory(item)"
>
:class="index < records.length - 1 ? 'border-b border-[#eee7e0]' : ''" @click="openHistory(item)">
<view class="h-14 w-16 shrink-0 overflow-hidden rounded-[10px] bg-[#f1ece6]">
<image v-if="item.image" class="h-full w-full" :src="item.image" mode="aspectFill" />
<view v-else class="flex h-full w-full items-center justify-center">
@@ -35,12 +31,13 @@
<view class="min-w-0 flex-1">
<text class="block truncate text-[14px] font-medium text-[#2b2724]">{{ item.title }}</text>
<view class="mt-1 flex items-center gap-2">
<text class="rounded-full bg-[#edf1ec] px-2 py-0.5 text-[10px] text-[#6d8377]">{{ browseHistoryTypeLabel(item.itemType) }}</text>
<text class="rounded-full bg-[#edf1ec] px-2 py-0.5 text-[10px] text-[#6d8377]">{{
browseHistoryTypeLabel(item.itemType) }}</text>
<text class="truncate text-[10px] leading-4 text-[#a19890]">{{ formatDateTime(item.visitedAt) }}</text>
</view>
</view>
<uni-icons class="shrink-0" type="right" :size="15" color="#b3a79e" />
</button>
</view>
</view>
</view>
@@ -55,20 +52,16 @@
<text class="mt-2 block text-[12px] leading-5 text-[#978d85]">
{{ isLoadFailed ? errorMessage : "去玩法页看看,找到适合你的下一段旅程。" }}
</text>
<button
v-if="isLoadFailed"
class="m-0 mt-5 h-10 rounded-full border border-[#bfd0c3] bg-white px-6 text-[12px] font-medium text-[#5f7a69]"
@click="retry"
>
<view v-if="isLoadFailed"
class="m-0 mt-5 h-10 rounded-full border border-[#bfd0c3] bg-white px-6 text-[12px] flex items-center justify-center font-medium text-[#5f7a69]"
@click="retry">
重试
</button>
<button
v-else
class="m-0 mt-5 h-10 rounded-full bg-[#6d8377] px-6 text-[12px] font-medium text-white"
@click="goPlay()"
>
</view>
<view v-else
class="m-0 mt-5 h-10 rounded-full bg-[#6d8377] px-6 text-[12px] flex items-center justify-center font-medium text-white"
@click="goPlay()">
去看看玩法
</button>
</view>
</view>
</template>
</z-paging>
@@ -77,12 +70,10 @@
<script setup lang="ts">
import { ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import TopHeader from "@/components/TopHeader.vue";
import { ApiRequestError, fetchCustomerBrowseHistory } from "@/lib/api";
import { clearAuthSession, getAuthSession, redirectToLogin } from "@/lib/auth";
import { browseHistoryTypeLabel, formatDateTime, localBrowseHistoryPage } from "@/lib/customerRecords";
import {
goBack,
goPlay,
goTeamBuildingDetail,
goWanfaRouteDetail,

View File

@@ -29,10 +29,8 @@
<view class="min-w-0 flex-1">
<view class="flex items-center justify-between gap-2">
<text class="truncate text-[17px] font-semibold tracking-[0.02em] text-[#24211f]">{{ customerName
}}</text>
<view class="shrink-0 rounded-full bg-[#edf5ef] px-2 py-1">
<text class="text-[10px] font-medium tracking-[0.06em] text-[#3f7b57]">已登录</text>
</view>
}}</text>
</view>
<text class="mt-2 block truncate text-[12px] leading-5 text-[#857d75]">{{ customerLine }}</text>
</view>

View File

@@ -1,7 +1,6 @@
<template>
<view class="wq-page min-h-screen bg-[#f5f2ed]">
<view class="wq-phone min-h-screen">
<TopHeader title="用车提交详情" @back="goBack()" />
<scroll-view scroll-y class="h-[calc(100vh-60px)]" :show-scrollbar="false">
<view v-if="loading" class="flex min-h-[520px] items-center justify-center px-8 text-center">
@@ -19,8 +18,7 @@
<text class="mt-2 block text-[12px] leading-5 text-[#978d85]">{{ errorMessage || "没有找到这条用车提交记录。" }}</text>
<button
class="m-0 mt-5 h-10 rounded-full border border-[#d9c5b8] bg-white px-6 text-[12px] font-medium text-[#a45a3d]"
@click="loadDetail"
>
@click="loadDetail">
重试
</button>
</view>
@@ -30,8 +28,10 @@
<view class="flex items-start justify-between gap-3">
<view class="min-w-0 flex-1">
<text class="block text-[11px] font-semibold tracking-[0.18em] text-[#a45a3d]">VEHICLE SERVICE</text>
<text class="mt-2 block truncate text-[23px] font-semibold text-[#24211f]">{{ vehicleDestination(record) }}</text>
<text class="mt-2 block text-[11px] leading-5 text-[#a19890]">提交于 {{ formatDateTime(record.createdAt) }}</text>
<text class="mt-2 block truncate text-[23px] font-semibold text-[#24211f]">{{ vehicleDestination(record)
}}</text>
<text class="mt-2 block text-[11px] leading-5 text-[#a19890]">提交于 {{ formatDateTime(record.createdAt)
}}</text>
</view>
<text class="shrink-0 rounded-full px-2.5 py-1.5 text-[10px]" :class="statusClass(record.status)">
{{ vehicleStatusLabel(record.status) }}
@@ -39,12 +39,14 @@
</view>
</view>
<view class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<view
class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<text class="block text-[15px] font-semibold text-[#2b2724]">出行信息</text>
<view class="mt-4 grid grid-cols-2 gap-4">
<view>
<text class="block text-[10px] text-[#a19890]">出行日期</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{ formatTravelDate(vehicleTravelDate(record)) }}</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{ formatTravelDate(vehicleTravelDate(record))
}}</text>
</view>
<view>
<text class="block text-[10px] text-[#a19890]">出行人数</text>
@@ -52,23 +54,27 @@
</view>
<view>
<text class="block text-[10px] text-[#a19890]">服务类型</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{ serviceTypeLabel(record.vehicleDemand?.serviceType) }}</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{
serviceTypeLabel(record.vehicleDemand?.serviceType) }}</text>
</view>
<view>
<text class="block text-[10px] text-[#a19890]">包车时长</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{ durationLabel(record.vehicleDemand?.charterDuration) }}</text>
<text class="mt-1 block text-[13px] text-[#3b342f]">{{
durationLabel(record.vehicleDemand?.charterDuration) }}</text>
</view>
</view>
</view>
<view class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<view
class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<text class="block text-[15px] font-semibold text-[#2b2724]">行程安排</text>
<view class="mt-4 space-y-3">
<view class="flex items-start gap-3">
<view class="mt-1 h-2.5 w-2.5 shrink-0 rounded-full bg-[#a45a3d]" />
<view class="min-w-0 flex-1">
<text class="block text-[10px] text-[#a19890]">上车地点</text>
<text class="mt-1 block text-[13px] leading-5 text-[#3b342f]">{{ record.vehicleDemand?.pickupLocation || "待确认" }}</text>
<text class="mt-1 block text-[13px] leading-5 text-[#3b342f]">{{ record.vehicleDemand?.pickupLocation
|| "待确认" }}</text>
</view>
</view>
<view class="ml-1 border-l border-dashed border-[#d8cec5] py-1" />
@@ -76,13 +82,15 @@
<view class="mt-1 h-2.5 w-2.5 shrink-0 rounded-full bg-[#6d8377]" />
<view class="min-w-0 flex-1">
<text class="block text-[10px] text-[#a19890]">目的地 / 下车地点</text>
<text class="mt-1 block text-[13px] leading-5 text-[#3b342f]">{{ record.vehicleDemand?.dropoffLocation || record.destination || "待确认" }}</text>
<text class="mt-1 block text-[13px] leading-5 text-[#3b342f]">{{ record.vehicleDemand?.dropoffLocation
|| record.destination || "待确认" }}</text>
</view>
</view>
</view>
</view>
<view class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<view
class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<text class="block text-[15px] font-semibold text-[#2b2724]">联系人信息</text>
<view class="mt-4 flex items-center justify-between border-b border-[#eee7e0] pb-3">
<text class="text-[11px] text-[#a19890]">联系人</text>
@@ -94,13 +102,16 @@
</view>
</view>
<view v-if="record.vehicleDemand?.vehicleOptionTitle || record.vehicleDemand?.specialRequirements || record.note" class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<view
v-if="record.vehicleDemand?.vehicleOptionTitle || record.vehicleDemand?.specialRequirements || record.note"
class="mt-4 rounded-[16px] border border-[#e2d9d0] bg-white p-4 shadow-[0_8px_20px_rgba(80,58,45,0.04)]">
<text class="block text-[15px] font-semibold text-[#2b2724]">其他需求</text>
<view v-if="record.vehicleDemand?.vehicleOptionTitle" class="mt-3 flex items-center justify-between">
<text class="text-[11px] text-[#a19890]">意向车型</text>
<text class="text-[13px] text-[#3b342f]">{{ record.vehicleDemand.vehicleOptionTitle }}</text>
</view>
<text v-if="record.vehicleDemand?.specialRequirements || record.note" class="mt-3 block text-[13px] leading-6 text-[#5f5852]">
<text v-if="record.vehicleDemand?.specialRequirements || record.note"
class="mt-3 block text-[13px] leading-6 text-[#5f5852]">
{{ record.vehicleDemand.specialRequirements || record.note }}
</text>
</view>

View File

@@ -1,8 +1,6 @@
<template>
<z-paging v-if="isReady" ref="paging" v-model="records" class="bg-[#f5f2ed]" @query="queryList">
<template #top>
<TopHeader title="用车提交记录" @back="goBack()" />
</template>
<view class="px-5 pb-10 pt-5">
<view class="mb-5 flex items-end justify-between">
@@ -13,22 +11,11 @@
<text class="text-[11px] text-[#a45a3d]">{{ total }} </text>
</view>
<button
class="m-0 mb-4 flex h-11 w-full items-center justify-center rounded-full bg-[#a45a3d] text-[13px] font-semibold text-white shadow-[0_8px_16px_rgba(164,90,61,0.16)]"
@click="goVehicleDemand()"
>
<uni-icons type="plus" :size="16" color="#ffffff" />
<text class="ml-1">提交新的用车需求</text>
</button>
<view class="overflow-hidden rounded-[16px] border border-[#e2d9d0] bg-white shadow-[0_8px_20px_rgba(80,58,45,0.05)]">
<button
v-for="(record, index) in records"
:key="record.id"
<view
class="overflow-hidden rounded-[16px] border border-[#e2d9d0] bg-white shadow-[0_8px_20px_rgba(80,58,45,0.05)]">
<view v-for="(record, index) in records" :key="record.id"
class="m-0 flex w-full items-start gap-3 px-4 py-4 text-left"
:class="index < records.length - 1 ? 'border-b border-[#eee7e0]' : ''"
@click="openRecord(record.id)"
>
:class="index < records.length - 1 ? 'border-b border-[#eee7e0]' : ''" @click="openRecord(record.id)">
<view class="flex h-11 w-11 shrink-0 items-center justify-center rounded-[12px] bg-[#f4e5dc]">
<uni-icons type="car" :size="21" color="#a45a3d" />
</view>
@@ -43,10 +30,11 @@
<text>{{ formatTravelDate(vehicleTravelDate(record)) }}</text>
<text>{{ vehiclePeopleCount(record) ?? "待确认" }} </text>
</view>
<text class="mt-2 block text-[10px] leading-4 text-[#aaa098]">{{ formatDateTime(record.createdAt) }} 提交</text>
<text class="mt-2 block text-[10px] leading-4 text-[#aaa098]">{{ formatDateTime(record.createdAt) }}
提交</text>
</view>
<uni-icons class="mt-2 shrink-0" type="right" :size="15" color="#b3a79e" />
</button>
</view>
</view>
</view>
@@ -61,20 +49,16 @@
<text class="mt-2 block text-[12px] leading-5 text-[#978d85]">
{{ isLoadFailed ? errorMessage : "提交一份出行需求,让管家为你安排旅程。" }}
</text>
<button
v-if="isLoadFailed"
class="m-0 mt-5 h-10 rounded-full border border-[#d9c5b8] bg-white px-6 text-[12px] font-medium text-[#a45a3d]"
@click="retry"
>
<view v-if="isLoadFailed"
class="m-0 mt-5 h-10 rounded-full border border-[#d9c5b8] bg-white px-6 text-[12px] flex items-center justify-center font-medium text-[#a45a3d]"
@click="retry">
重试
</button>
<button
v-else
class="m-0 mt-5 h-10 rounded-full bg-[#a45a3d] px-6 text-[12px] font-medium text-white"
@click="goVehicleDemand()"
>
</view>
<view v-else
class="m-0 mt-5 h-10 rounded-full bg-[#a45a3d] px-6 text-[12px] flex items-center justify-center font-medium text-white"
@click="goVehicleDemand()">
提交新的用车需求
</button>
</view>
</view>
</template>
</z-paging>
@@ -83,7 +67,6 @@
<script setup lang="ts">
import { ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import TopHeader from "@/components/TopHeader.vue";
import { ApiRequestError, fetchCustomerVehicleDemands } from "@/lib/api";
import { clearAuthSession, getAuthSession, redirectToLogin } from "@/lib/auth";
import {
@@ -94,7 +77,7 @@ import {
vehicleStatusLabel,
vehicleTravelDate,
} from "@/lib/customerRecords";
import { goBack, goVehicleDemand, goCustomerVehicleDemandDetail } from "@/lib/navigation";
import { goVehicleDemand, goCustomerVehicleDemandDetail } from "@/lib/navigation";
import type { CustomerVehicleDemandRecord } from "@/lib/types";
type PagingInstance = {