feat: merge vehicle demand and recent views
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
|
||||
<MineRecentViews
|
||||
:items="props.recentViews"
|
||||
@open-vehicle="emit('open-vehicle')"
|
||||
@select="(item) => emit('select-recent', item)"
|
||||
@explore="emit('open-play')"
|
||||
/>
|
||||
@@ -109,6 +110,7 @@ const emit = defineEmits<{
|
||||
"request-avatar": [];
|
||||
"open-concierge": [];
|
||||
"open-play": [];
|
||||
"open-vehicle": [];
|
||||
"select-recent": [item: RecentlyViewedItem];
|
||||
logout: [];
|
||||
}>();
|
||||
|
||||
@@ -2,46 +2,62 @@
|
||||
<view class="mt-6">
|
||||
<view class="mb-3 flex items-end justify-between">
|
||||
<view>
|
||||
<text class="block text-[18px] font-semibold tracking-[0.02em] text-[#24211f]">继续探索</text>
|
||||
<text class="mt-1 block text-[11px] leading-5 text-[#9a9189]">最近浏览的内容</text>
|
||||
<text class="block text-[18px] font-semibold tracking-[0.02em] text-[#24211f]">我的出行记录</text>
|
||||
<text class="mt-1 block text-[11px] leading-5 text-[#9a9189]">用车需求与最近浏览集中在这里</text>
|
||||
</view>
|
||||
<text v-if="items.length" class="text-[11px] text-[#b18a76]">{{ items.length }} 条记录</text>
|
||||
<text class="text-[11px] text-[#b18a76]">{{ items.length + 1 }} 项</text>
|
||||
</view>
|
||||
|
||||
<view v-if="items.length" class="overflow-hidden rounded-[16px] border border-[#e2d9d0] bg-white shadow-[0_8px_20px_rgba(80,58,45,0.05)]">
|
||||
<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 items"
|
||||
:key="`${item.type}-${item.id}`"
|
||||
class="m-0 flex w-full items-center gap-3 px-3 py-3 text-left"
|
||||
:class="index < items.length - 1 ? 'border-b border-[#eee7e0]' : ''"
|
||||
@click="emit('select', item)"
|
||||
class="m-0 flex w-full items-center gap-3 border-b border-[#eee7e0] px-3 py-3 text-left"
|
||||
@click="emit('open-vehicle')"
|
||||
>
|
||||
<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">
|
||||
<uni-icons type="image" :size="20" color="#b8aaa0" />
|
||||
</view>
|
||||
<view class="flex h-14 w-16 shrink-0 items-center justify-center rounded-[10px] bg-[#f4e5dc]">
|
||||
<uni-icons type="car" :size="24" color="#a45a3d" />
|
||||
</view>
|
||||
<view class="min-w-0 flex-1">
|
||||
<text class="block truncate text-[14px] font-medium text-[#2b2724]">{{ item.title }}</text>
|
||||
<text class="mt-1 block text-[10px] leading-4 text-[#a19890]">{{ typeLabel(item.type) }}</text>
|
||||
<text class="block truncate text-[14px] font-medium text-[#2b2724]">用车需求</text>
|
||||
<text class="mt-1 block text-[10px] leading-4 text-[#a19890]">填写专属出行方案</text>
|
||||
</view>
|
||||
<uni-icons type="right" :size="15" color="#b3a79e" />
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view v-else class="rounded-[16px] border border-dashed border-[#d8cec5] bg-white/70 px-5 py-6 text-center">
|
||||
<view class="mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-[#f4eee8]">
|
||||
<uni-icons type="eye" :size="20" color="#a45a3d" />
|
||||
<template v-if="items.length">
|
||||
<button
|
||||
v-for="(item, index) in items"
|
||||
:key="`${item.type}-${item.id}`"
|
||||
class="m-0 flex w-full items-center gap-3 px-3 py-3 text-left"
|
||||
:class="index < items.length - 1 ? 'border-b border-[#eee7e0]' : ''"
|
||||
@click="emit('select', 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">
|
||||
<uni-icons type="image" :size="20" color="#b8aaa0" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="min-w-0 flex-1">
|
||||
<text class="block truncate text-[14px] font-medium text-[#2b2724]">{{ item.title }}</text>
|
||||
<text class="mt-1 block text-[10px] leading-4 text-[#a19890]">{{ typeLabel(item.type) }}</text>
|
||||
</view>
|
||||
<uni-icons type="right" :size="15" color="#b3a79e" />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<view v-else class="border-t border-dashed border-[#d8cec5] bg-white/70 px-5 py-6 text-center">
|
||||
<view class="mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-[#f4eee8]">
|
||||
<uni-icons type="eye" :size="20" color="#a45a3d" />
|
||||
</view>
|
||||
<text class="mt-3 block text-[14px] font-medium text-[#4a413a]">暂无浏览记录</text>
|
||||
<text class="mt-1 block text-[11px] leading-5 text-[#9a9189]">去看看玩法,收藏下一段旅程</text>
|
||||
<button
|
||||
class="m-0 mx-auto mt-4 flex min-h-[36px] items-center justify-center rounded-full bg-[#a45a3d] px-5 text-[12px] font-medium text-white"
|
||||
@click="emit('explore')"
|
||||
>
|
||||
去看看玩法
|
||||
</button>
|
||||
</view>
|
||||
<text class="mt-3 block text-[14px] font-medium text-[#4a413a]">暂无浏览记录</text>
|
||||
<text class="mt-1 block text-[11px] leading-5 text-[#9a9189]">去看看玩法,收藏下一段旅程</text>
|
||||
<button
|
||||
class="m-0 mx-auto mt-4 flex min-h-[36px] items-center justify-center rounded-full bg-[#a45a3d] px-5 text-[12px] font-medium text-white"
|
||||
@click="emit('explore')"
|
||||
>
|
||||
去看看玩法
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -54,6 +70,7 @@ defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
"open-vehicle": [];
|
||||
select: [item: RecentlyViewedItem];
|
||||
explore: [];
|
||||
}>();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
@request-avatar="loadWechatProfile"
|
||||
@open-concierge="goConcierge"
|
||||
@open-play="goPlay"
|
||||
@open-vehicle="goVehicleDemand"
|
||||
@select-recent="openRecent"
|
||||
@logout="logout" />
|
||||
</scroll-view>
|
||||
@@ -31,6 +32,7 @@ import {
|
||||
import {
|
||||
goConcierge,
|
||||
goPlay,
|
||||
goVehicleDemand,
|
||||
goTeamBuildingDetail,
|
||||
goWanfaRouteDetail,
|
||||
goWildArchiveDetail,
|
||||
|
||||
20
WonderQ-MiniAPP/tests/mine-records.test.ts
Normal file
20
WonderQ-MiniAPP/tests/mine-records.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import mineMemberSource from "@/pages/mine/components/MineMember.vue?raw";
|
||||
import mineRecentViewsSource from "@/pages/mine/components/MineRecentViews.vue?raw";
|
||||
import minePageSource from "@/pages/mine/index.vue?raw";
|
||||
|
||||
describe("mine travel records integration contract", () => {
|
||||
it("keeps vehicle demand and recent views in one list", () => {
|
||||
expect(mineRecentViewsSource).toContain("我的出行记录");
|
||||
expect(mineRecentViewsSource).toContain("用车需求与最近浏览集中在这里");
|
||||
expect(mineRecentViewsSource).toContain("items.length + 1");
|
||||
expect(mineRecentViewsSource).toContain("open-vehicle");
|
||||
expect(mineRecentViewsSource).toContain("暂无浏览记录");
|
||||
});
|
||||
|
||||
it("wires the vehicle demand action through MineMember to the existing page", () => {
|
||||
expect(mineMemberSource).toContain('@open-vehicle="emit(\'open-vehicle\')"');
|
||||
expect(minePageSource).toContain("goVehicleDemand");
|
||||
expect(minePageSource).toContain('@open-vehicle="goVehicleDemand"');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user