Files
qncV4uni-app/src/pages/index.vue

585 lines
13 KiB
Vue
Raw Normal View History

2026-05-16 15:47:07 +08:00
<script setup lang="ts">
import { computed, ref } from 'vue'
import { getInquireCategoryConfig, getInquiryItemIconUrl } from '@/config/inquireCategories'
2026-05-21 12:00:38 +08:00
import { getToolboxItem } from '@/config/toolboxRegistry'
2026-05-16 15:47:07 +08:00
definePage({
style: {
navigationBarTitleText: '全能查',
navigationStyle: 'default',
navigationBarBackgroundColor: '#ffffff',
navigationBarTextStyle: 'black',
},
})
interface CaseItem {
id: string
tag: string
vin: string
model: string
}
interface ReviewItem {
id: string
name: string
content: string
}
const caseList = ref<CaseItem[]>([
2026-05-21 12:00:38 +08:00
{ id: '1', tag: '新能源电池查询', vin: 'LBV8********0981', model: '某品牌新能源车型' },
{ id: '2', tag: '里程异常检测', vin: 'LSGN********3389', model: '凯迪拉克 XT5' },
2026-05-16 15:47:07 +08:00
])
const vehicleItems = computed(() => getInquireCategoryConfig('vehicle')?.items ?? [])
2026-05-21 12:00:38 +08:00
/** 首页热门工具 2×3 网格 */
const hotTools = computed(() =>
['tianqishiju', 'jieqi', 'blood', 'zodiac', 'saylove', 'nethot']
.map(key => getToolboxItem(key))
.filter(Boolean),
)
2026-05-16 15:47:07 +08:00
2026-05-21 12:00:38 +08:00
/** 每日推荐候选池 */
const dailyPool = [
'jixiong', 'naowan', 'joke', 'dujitang', 'dream', 'oilprice',
'caihongpi', 'riddle', 'decide', 'caipu', 'godreply', 'tiangou',
'story', 'targa', 'hsjz', 'zimi',
]
2026-05-18 13:54:57 +08:00
2026-05-21 12:00:38 +08:00
/** 随机从候选池中抽取 n 个 */
function pickRandom(pool: string[], n: number): string[] {
const shuffled = [...pool].sort(() => Math.random() - 0.5)
return shuffled.slice(0, n)
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
const dailyKeys = ref<string[]>(pickRandom(dailyPool, 8))
const dailyPicks = computed(() =>
dailyKeys.value.map(key => getToolboxItem(key)).filter(Boolean),
)
function refreshDaily() {
dailyKeys.value = pickRandom(dailyPool, 8)
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
const reviewList = ref<ReviewItem[]>([
{ id: '1', name: '陈先生', content: '查完车况再成交,心里更踏实,避免了重大事故车。' },
{ id: '2', name: '周女士', content: '报告内容很详细,维保、出险一目了然,值得推荐。' },
])
function reviewInitial(name: string) {
return name.slice(0, 1) || '?'
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
function goInquireFeature(feature: string) {
uni.navigateTo({ url: `/pages/inquire/index?feature=${encodeURIComponent(feature)}` })
2026-05-16 15:47:07 +08:00
}
function goToolboxItem(key: string) {
2026-05-21 12:00:38 +08:00
uni.navigateTo({ url: `/pages/toolbox/query?key=${encodeURIComponent(key)}` })
2026-05-16 15:47:07 +08:00
}
function goCategory(categoryKey: string) {
2026-05-21 12:00:38 +08:00
uni.navigateTo({ url: `/pages/toolbox/category?category=${encodeURIComponent(categoryKey)}` })
}
function goVehicleList() {
uni.navigateTo({ url: '/pages/inquire/list' })
2026-05-16 15:47:07 +08:00
}
</script>
<template>
2026-05-21 12:00:38 +08:00
<view class="page-container">
<scroll-view scroll-y class="scroll-view">
<!-- 1. Banner 头部 -->
<view class="banner-box">
<image class="banner" src="/static/home/images/Banner.png" mode="widthFix" />
</view>
2026-05-16 15:47:07 +08:00
2026-05-21 12:00:38 +08:00
<!-- 2. 车辆查询服务 -->
<view class="section">
<view class="section-header">
<text class="title">车辆查询服务</text>
<text class="sub">专业车况核验</text>
2026-05-16 15:47:07 +08:00
</view>
2026-05-21 12:00:38 +08:00
<view class="vehicle-grid">
2026-05-18 13:54:57 +08:00
<view
2026-05-22 16:28:50 +08:00
v-for="item in vehicleItems.slice(0, 7)"
2026-05-21 12:00:38 +08:00
:key="item.feature"
class="vehicle-cell"
@tap="goInquireFeature(item.feature)"
2026-05-18 13:54:57 +08:00
>
2026-05-21 12:00:38 +08:00
<view class="vehicle-icon-wrap">
<image class="vehicle-icon" :src="getInquiryItemIconUrl(item)" mode="aspectFit" />
2026-05-22 16:28:50 +08:00
<text class="vehicle-name">{{ item.name }}</text>
2026-05-18 13:54:57 +08:00
</view>
2026-05-21 12:00:38 +08:00
</view>
<!-- 更多服务入口 -->
<view class="vehicle-cell vehicle-cell--more" @tap="goVehicleList">
<view class="vehicle-icon-wrap vehicle-icon-wrap--more">
<view class="i-carbon-overflow-menu-horizontal vehicle-more-icon" />
2026-05-22 16:28:50 +08:00
<text class="vehicle-name">更多服务</text>
2026-05-16 15:47:07 +08:00
</view>
</view>
2026-05-21 12:00:38 +08:00
</view>
</view>
<!-- 4. 热门工具 -->
<view class="section">
<view class="section-header">
<text class="title">万能工具免费查询</text>
<view class="more-link" @tap="goCategory('all')">
<text class="more-text">查看全部</text>
<text class="more-arrow"></text>
2026-05-16 15:47:07 +08:00
</view>
2026-05-21 12:00:38 +08:00
</view>
<view class="hot-tools-grid">
2026-05-16 15:47:07 +08:00
<view
2026-05-21 12:00:38 +08:00
v-for="(item, idx) in hotTools"
:key="item.key"
class="hot-tool-card"
:class="['hot-tool-card--c' + (idx % 4)]"
@tap="goToolboxItem(item.key)"
2026-05-16 15:47:07 +08:00
>
2026-05-21 12:00:38 +08:00
<view class="hot-tool-icon-wrap">
<view :class="item.icon" class="hot-tool-icon" />
2026-05-22 16:28:50 +08:00
<text class="hot-tool-name">{{ item.name }}</text>
2026-05-16 15:47:07 +08:00
</view>
</view>
</view>
2026-05-21 12:00:38 +08:00
</view>
2026-05-16 15:47:07 +08:00
2026-05-21 12:00:38 +08:00
<!-- 5. 每日推荐 -->
<view class="section">
<view class="section-header">
<view class="daily-title-group">
<text class="title">每日推荐</text>
<text class="daily-badge">精选</text>
</view>
<view class="refresh-btn" @tap="refreshDaily">
<view class="i-carbon-renew refresh-icon" :class="{ 'refresh-icon--spin': false }" />
<text class="refresh-text">换一批</text>
2026-05-16 15:47:07 +08:00
</view>
2026-05-21 12:00:38 +08:00
</view>
<view class="daily-grid">
2026-05-16 15:47:07 +08:00
<view
2026-05-21 12:00:38 +08:00
v-for="(item, idx) in dailyPicks"
:key="item.key"
class="daily-card"
:class="['daily-card--c' + (idx % 4)]"
@tap="goToolboxItem(item.key)"
2026-05-16 15:47:07 +08:00
>
2026-05-21 12:00:38 +08:00
<view class="daily-icon-wrap">
<view :class="item.icon" class="daily-icon" />
2026-05-22 16:28:50 +08:00
<text class="daily-name">{{ item.name }}</text>
2026-05-16 15:47:07 +08:00
</view>
2026-05-21 12:00:38 +08:00
</view>
</view>
</view>
<!-- 6. 真实案例 -->
<view class="section">
<view class="section-header">
<text class="title">真实查询案例</text>
<text class="sub">已服务 29+ 车主</text>
</view>
<view class="case-list">
<view v-for="item in caseList" :key="item.id" class="case-item">
<view class="case-tag">{{ item.tag }}</view>
<view class="case-vin">{{ item.vin }}</view>
<view class="case-model">{{ item.model }}</view>
</view>
</view>
</view>
<!-- 6. 用户评价 -->
<view class="section">
<view class="section-header">
<text class="title">用户真实评价</text>
</view>
<view class="review-list">
<view v-for="item in reviewList" :key="item.id" class="review-item">
<view class="avatar">{{ reviewInitial(item.name) }}</view>
2026-05-16 15:47:07 +08:00
<view class="review-content">
2026-05-21 12:00:38 +08:00
<view class="username">{{ item.name }}</view>
<view class="content">{{ item.content }}</view>
2026-05-16 15:47:07 +08:00
</view>
</view>
</view>
</view>
2026-05-21 12:00:38 +08:00
<view style="height: 40rpx"></view>
2026-05-16 15:47:07 +08:00
</scroll-view>
</view>
</template>
<style scoped lang="scss">
2026-05-21 12:00:38 +08:00
page {
background: #f5f7fa;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.page-container {
min-height: 100vh;
padding: 20rpx;
2026-05-16 15:47:07 +08:00
box-sizing: border-box;
}
2026-05-21 12:00:38 +08:00
.scroll-view {
height: 100%;
}
2026-05-16 15:47:07 +08:00
2026-05-21 12:00:38 +08:00
/* Banner */
.banner-box {
2026-05-16 15:47:07 +08:00
border-radius: 24rpx;
overflow: hidden;
2026-05-21 12:00:38 +08:00
margin-bottom: 24rpx;
box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.05);
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.banner {
2026-05-16 15:47:07 +08:00
width: 100%;
display: block;
}
2026-05-21 12:00:38 +08:00
/* 区块通用 */
.section {
background: #fff;
2026-05-16 15:47:07 +08:00
border-radius: 24rpx;
2026-05-21 12:00:38 +08:00
padding: 32rpx;
2026-05-16 15:47:07 +08:00
margin-bottom: 24rpx;
2026-05-21 12:00:38 +08:00
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03);
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.section-header {
2026-05-16 15:47:07 +08:00
display: flex;
justify-content: space-between;
align-items: center;
2026-05-21 12:00:38 +08:00
margin-bottom: 24rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.title {
font-size: 30rpx;
font-weight: 700;
color: #1d2129;
}
.sub {
font-size: 24rpx;
color: #86909c;
}
.more-link {
2026-05-16 15:47:07 +08:00
display: flex;
align-items: center;
2026-05-21 12:00:38 +08:00
gap: 4rpx;
}
.more-text {
font-size: 24rpx;
color: #86909c;
}
.more-arrow {
font-size: 28rpx;
color: #86909c;
2026-05-16 15:47:07 +08:00
}
2026-05-22 16:28:50 +08:00
/* 车辆查询 2×4 网格 */
2026-05-21 12:00:38 +08:00
.vehicle-grid {
display: grid;
2026-05-22 16:28:50 +08:00
grid-template-columns: repeat(4, 1fr);
gap: 12rpx;
2026-05-21 12:00:38 +08:00
}
.vehicle-cell {
2026-05-22 16:28:50 +08:00
position: relative;
border-radius: 16rpx;
2026-05-21 12:00:38 +08:00
background: #f7f8fa;
2026-05-22 16:28:50 +08:00
height: 160rpx;
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.vehicle-cell:active {
background: #eef1f5;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.vehicle-icon-wrap {
2026-05-22 16:28:50 +08:00
position: relative;
width: 100%;
height: 100%;
border-radius: 16rpx;
2026-05-21 12:00:38 +08:00
display: flex;
2026-05-22 16:28:50 +08:00
flex-direction: column;
2026-05-21 12:00:38 +08:00
align-items: center;
justify-content: center;
2026-05-22 16:28:50 +08:00
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.vehicle-icon-wrap--more {
2026-05-22 16:28:50 +08:00
background: #f7f8fa;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.vehicle-icon {
2026-05-22 16:28:50 +08:00
width: 90rpx;
height: 90rpx;
opacity: 1;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
object-fit: contain;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.vehicle-more-icon {
2026-05-22 16:28:50 +08:00
font-size: 80rpx;
opacity: 1;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
2026-05-21 12:00:38 +08:00
color: #fa8c16;
}
.vehicle-name {
2026-05-22 16:28:50 +08:00
flex: 0 0 auto;
font-size: 20rpx;
2026-05-21 12:00:38 +08:00
color: #333;
text-align: center;
2026-05-22 16:28:50 +08:00
line-height: 1.5;
2026-05-21 12:00:38 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
2026-05-22 16:28:50 +08:00
padding: 0 4rpx 6rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
/* 热门工具 2×3 网格 */
.hot-tools-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16rpx;
}
.hot-tool-card {
2026-05-22 16:28:50 +08:00
position: relative;
padding: 0;
2026-05-21 12:00:38 +08:00
border-radius: 20rpx;
background: #f7f8fa;
transition: background 0.2s;
2026-05-22 16:28:50 +08:00
height: 200rpx;
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card:active {
background: #eef1f5;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-icon-wrap {
2026-05-22 16:28:50 +08:00
position: relative;
width: 100%;
height: 100%;
border-radius: 20rpx;
2026-05-16 15:47:07 +08:00
display: flex;
2026-05-22 16:28:50 +08:00
flex-direction: column;
2026-05-16 15:47:07 +08:00
align-items: center;
2026-05-21 12:00:38 +08:00
justify-content: center;
2026-05-22 16:28:50 +08:00
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c0 .hot-tool-icon-wrap {
background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c1 .hot-tool-icon-wrap {
background: linear-gradient(135deg, #e3f2fd, #bbdefb);
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c2 .hot-tool-icon-wrap {
background: linear-gradient(135deg, #fce4ec, #f8bbd0);
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c3 .hot-tool-icon-wrap {
background: linear-gradient(135deg, #f3e5f5, #e1bee7);
2026-05-16 15:47:07 +08:00
}
2026-05-22 16:28:50 +08:00
.hot-tool-icon {
font-size: 100rpx;
opacity: 0.15;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c0 .hot-tool-icon {
color: #43a047;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c1 .hot-tool-icon {
color: #1e88e5;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.hot-tool-card--c2 .hot-tool-icon {
color: #e53935;
}
.hot-tool-card--c3 .hot-tool-icon {
color: #8e24aa;
}
.hot-tool-name {
2026-05-22 16:28:50 +08:00
flex: 0 0 auto;
2026-05-16 15:47:07 +08:00
font-size: 22rpx;
2026-05-21 12:00:38 +08:00
color: #333;
2026-05-16 15:47:07 +08:00
text-align: center;
2026-05-22 16:28:50 +08:00
line-height: 1.5;
display: flex;
align-items: center;
justify-content: center;
padding: 0 4rpx 8rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
/* 每日推荐 */
.daily-title-group {
2026-05-16 15:47:07 +08:00
display: flex;
2026-05-21 12:00:38 +08:00
align-items: center;
gap: 12rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.daily-badge {
font-size: 20rpx;
color: #fff;
background: linear-gradient(135deg, #ff6b6b, #ee5a24);
padding: 4rpx 14rpx;
border-radius: 16rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.refresh-btn {
display: flex;
align-items: center;
gap: 6rpx;
padding: 8rpx 18rpx;
border-radius: 24rpx;
background: #f2f3f5;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.refresh-btn:active {
background: #e5e6eb;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.refresh-icon {
font-size: 26rpx;
color: #86909c;
}
.refresh-text {
font-size: 22rpx;
color: #86909c;
}
.daily-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 14rpx;
}
.daily-card {
2026-05-22 16:28:50 +08:00
position: relative;
padding: 0;
2026-05-21 12:00:38 +08:00
border-radius: 16rpx;
background: #f7f8fa;
2026-05-22 16:28:50 +08:00
height: 180rpx;
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.daily-card:active {
background: #eef1f5;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.daily-icon-wrap {
2026-05-22 16:28:50 +08:00
position: relative;
width: 100%;
height: 100%;
border-radius: 16rpx;
2026-05-21 12:00:38 +08:00
display: flex;
2026-05-22 16:28:50 +08:00
flex-direction: column;
2026-05-21 12:00:38 +08:00
align-items: center;
justify-content: center;
2026-05-22 16:28:50 +08:00
overflow: hidden;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.daily-card--c0 .daily-icon-wrap {
background: linear-gradient(135deg, #fff3e0, #ffe0b2);
}
.daily-card--c1 .daily-icon-wrap {
background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
}
.daily-card--c2 .daily-icon-wrap {
background: linear-gradient(135deg, #fce4ec, #f8bbd0);
}
.daily-card--c3 .daily-icon-wrap {
background: linear-gradient(135deg, #f3e5f5, #e1bee7);
}
.daily-icon {
2026-05-22 16:28:50 +08:00
font-size: 90rpx;
opacity: 0.15;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
2026-05-21 12:00:38 +08:00
}
.daily-card--c0 .daily-icon {
color: #ef6c00;
}
.daily-card--c1 .daily-icon {
color: #00838f;
}
.daily-card--c2 .daily-icon {
color: #c62828;
}
.daily-card--c3 .daily-icon {
color: #7b1fa2;
}
.daily-name {
2026-05-22 16:28:50 +08:00
flex: 0 0 auto;
2026-05-21 12:00:38 +08:00
font-size: 20rpx;
color: #333;
text-align: center;
2026-05-22 16:28:50 +08:00
line-height: 1.5;
2026-05-21 12:00:38 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
2026-05-22 16:28:50 +08:00
display: flex;
align-items: center;
justify-content: center;
padding: 0 4rpx 8rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
/* 案例 */
.case-list {
gap: 16rpx;
display: flex;
flex-direction: column;
}
.case-item {
padding: 20rpx;
background: #f9fafb;
border-radius: 16rpx;
display: flex;
align-items: center;
2026-05-16 15:47:07 +08:00
font-size: 22rpx;
}
.case-tag {
color: #1768ff;
2026-05-21 12:00:38 +08:00
font-weight: 600;
margin-right: 12rpx;
2026-05-16 15:47:07 +08:00
}
.case-vin {
2026-05-21 12:00:38 +08:00
color: #333;
margin-right: 12rpx;
}
.case-model {
color: #86909c;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
/* 评价 */
.review-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
2026-05-16 15:47:07 +08:00
.review-item {
display: flex;
2026-05-21 12:00:38 +08:00
align-items: flex-start;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.avatar {
width: 60rpx;
height: 60rpx;
2026-05-16 15:47:07 +08:00
border-radius: 50%;
2026-05-21 12:00:38 +08:00
background: #eef4ff;
color: #1768ff;
2026-05-16 15:47:07 +08:00
display: flex;
align-items: center;
justify-content: center;
2026-05-21 12:00:38 +08:00
font-weight: 700;
margin-right: 16rpx;
2026-05-16 15:47:07 +08:00
flex-shrink: 0;
}
.review-content {
flex: 1;
}
2026-05-21 12:00:38 +08:00
.username {
2026-05-16 15:47:07 +08:00
font-size: 24rpx;
color: #1d2129;
2026-05-21 12:00:38 +08:00
margin-bottom: 6rpx;
2026-05-16 15:47:07 +08:00
}
2026-05-21 12:00:38 +08:00
.content {
2026-05-16 15:47:07 +08:00
font-size: 22rpx;
color: #4e5969;
line-height: 1.6;
}
2026-05-21 12:00:38 +08:00
</style>