| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <template>
- <view class="home-page">
- <!-- 搜索栏 -->
- <view class="search-wrapper">
- <view class="location-box" @click="onLocationClick">
- <text class="location-text">昆明市</text>
- <uni-icons type="bottom" size="10" color="#fff"></uni-icons>
- </view>
- <view class="search-bar" @click="onSearchClick">
- <uni-icons type="search" size="16" color="#999"></uni-icons>
- <text class="search-placeholder">搜索宠物名/主人</text>
- </view>
- </view>
- <!-- 轮播图 -->
- <view class="banner-swipe-wrapper">
- <swiper class="my-swipe" :autoplay="true" :interval="3000" :circular="true" indicator-dots
- indicator-active-color="#ffffff" indicator-color="rgba(255,255,255,0.5)">
- <swiper-item v-for="(image, index) in bannerImages" :key="index">
- <image :src="image" class="swipe-img" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- </view>
- <!-- 系统通知栏 -->
- <view class="notice-section">
- <view class="notice-bar">
- <uni-icons type="sound" size="14" color="#ed6a0c"></uni-icons>
- <scroll-view scroll-x class="notice-scroll" :show-scrollbar="false">
- <text class="notice-text">【重要通知】尊敬的用户,由于近期接送需求激增,请各位宠主尽量提前24小时进行服务预约,感谢您的理解与配合!</text>
- </scroll-view>
- </view>
- </view>
- <!-- 服务分类卡片 -->
- <view class="service-grid">
- <!-- 左侧大块:宠物托运 -->
- <view class="grid-item item-transport-large" @click="goToDetail('托运')">
- <view class="text-info">
- <text class="grid-title">宠物托运</text>
- <text class="grid-desc">专车接送 · 全程监护</text>
- </view>
- <image src="/static/images/transport-3d.png" class="large-3d-icon" mode="aspectFit"></image>
- </view>
- <!-- 右侧两个小块 -->
- <view class="grid-right">
- <view class="grid-item item-wash-small" @click="goToDetail('洗护')">
- <view class="text-info">
- <text class="grid-title">宠物洗护</text>
- <text class="sub-text">深度清洁</text>
- </view>
- <image src="/static/images/wash-3d.png" class="small-3d-icon" mode="aspectFit"></image>
- </view>
- <view class="grid-item item-feed-small" @click="goToDetail('喂养')">
- <view class="text-info">
- <text class="grid-title">宠物喂养</text>
- <text class="sub-text">贴心陪伴</text>
- </view>
- <image src="/static/images/feed-3d.png" class="small-3d-icon" mode="aspectFit"></image>
- </view>
- </view>
- </view>
- <!-- 全部服务列表 -->
- <view class="section-header">
- <text class="section-title">全部服务</text>
- <view class="more-link" @click="goToServices">
- <text>查看全部</text>
- <uni-icons type="right" size="12" color="#999"></uni-icons>
- </view>
- </view>
- <view class="recommend-list">
- <view class="recommend-card" v-for="(item, index) in services" :key="index" @click="goToDetail(item.title)">
- <image :src="item.image" class="item-img" mode="aspectFill"></image>
- <view class="item-info">
- <view class="item-header">
- <text class="item-title">{{ item.title }}</text>
- <text class="booked">{{ item.booked }}</text>
- </view>
- <text class="item-desc">{{ item.desc }}</text>
- <view class="item-bottom">
- <text class="tag" v-for="tag in item.tags" :key="tag">{{ tag }}</text>
- </view>
- </view>
- </view>
- </view>
- <custom-tabbar></custom-tabbar>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import customTabbar from '@/components/custom-tabbar/index.vue'
- import mockData from '@/mock/index.json'
- const bannerImages = mockData.bannerImages
- const services = ref(mockData.services)
- const onLocationClick = () => {
- uni.showToast({ title: '城市选择功能即将上线', icon: 'none' })
- }
- const onSearchClick = () => {
- // 跳转搜索页(预留)
- }
- const goToServices = () => {
- uni.reLaunch({ url: '/pages/service/all/index' })
- }
- const goToDetail = (type) => {
- if (type === '托运') {
- uni.reLaunch({ url: '/pages/service/all/index' })
- return
- }
- uni.navigateTo({
- url: `/pages/service/detail/index?service=${type}`
- })
- }
- </script>
- <style lang="scss" scoped>
- .home-page {
- background-image: linear-gradient(to bottom, #f7ca3e 0%, #f7ca3e 440rpx, #f2f2f2 440rpx, #f2f2f2 100%);
- min-height: 100vh;
- padding-bottom: 120rpx;
- }
- .search-wrapper {
- padding: 24rpx 32rpx;
- padding-top: calc(var(--status-bar-height, 44px) + 20rpx);
- display: flex;
- align-items: center;
- gap: 16rpx;
- }
- .location-box {
- display: flex;
- align-items: center;
- gap: 6rpx;
- flex-shrink: 0;
- }
- .location-text {
- font-size: 28rpx;
- color: #fff;
- font-weight: bold;
- }
- .search-bar {
- flex: 1;
- display: flex;
- align-items: center;
- background: rgba(255, 255, 255, 0.85);
- border-radius: 40rpx;
- padding: 16rpx 24rpx;
- gap: 12rpx;
- }
- .search-placeholder {
- font-size: 26rpx;
- color: #999;
- }
- .banner-swipe-wrapper {
- padding: 0 32rpx 24rpx;
- }
- .my-swipe {
- border-radius: 32rpx;
- overflow: hidden;
- height: 320rpx;
- }
- .swipe-img {
- width: 100%;
- height: 320rpx;
- }
- .notice-section {
- padding: 0 32rpx 24rpx;
- }
- .notice-bar {
- display: flex;
- align-items: center;
- background: #fffbe8;
- border-radius: 16rpx;
- padding: 12rpx 20rpx;
- gap: 12rpx;
- height: 64rpx;
- overflow: hidden;
- }
- .notice-scroll {
- flex: 1;
- white-space: nowrap;
- }
- .notice-text {
- font-size: 24rpx;
- color: #ed6a0c;
- }
- .service-grid {
- padding: 0 32rpx;
- display: flex;
- gap: 24rpx;
- margin-bottom: 32rpx;
- }
- .grid-item {
- border-radius: 24rpx;
- padding: 32rpx;
- position: relative;
- overflow: hidden;
- }
- .item-transport-large {
- flex: 1.2;
- background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
- height: 360rpx;
- }
- .grid-right {
- flex: 1;
- display: flex;
- flex-direction: column;
- gap: 24rpx;
- }
- .item-wash-small {
- background: linear-gradient(135deg, #55efc4 0%, #00b894 100%);
- height: 168rpx;
- }
- .item-feed-small {
- background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
- height: 168rpx;
- }
- .grid-title {
- display: block;
- font-size: 32rpx;
- color: #fff;
- font-weight: 800;
- }
- .grid-desc {
- display: block;
- margin-top: 8rpx;
- font-size: 22rpx;
- color: rgba(255, 255, 255, 0.9);
- }
- .sub-text {
- display: block;
- font-size: 20rpx;
- color: rgba(255, 255, 255, 0.8);
- margin-top: 4rpx;
- }
- .large-3d-icon {
- position: absolute;
- right: -10rpx;
- bottom: -10rpx;
- width: 260rpx;
- height: 260rpx;
- }
- .small-3d-icon {
- position: absolute;
- right: -10rpx;
- bottom: -10rpx;
- width: 150rpx;
- height: 150rpx;
- }
- .section-header {
- padding: 50rpx 32rpx 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .section-title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333;
- }
- .more-link {
- display: flex;
- align-items: center;
- gap: 4rpx;
- font-size: 26rpx;
- color: #999;
- }
- .recommend-list {
- padding: 20rpx 32rpx 40rpx;
- }
- .recommend-card {
- background: #fff;
- border-radius: 24rpx;
- padding: 24rpx;
- display: flex;
- gap: 24rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
- }
- .item-img {
- width: 180rpx;
- height: 180rpx;
- border-radius: 16rpx;
- }
- .item-info {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .item-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .item-title {
- font-size: 32rpx;
- color: #333;
- font-weight: bold;
- }
- .booked {
- font-size: 24rpx;
- color: #999;
- }
- .item-desc {
- font-size: 26rpx;
- color: #666;
- margin: 12rpx 0;
- }
- .item-bottom {
- display: flex;
- align-items: center;
- }
- .tag {
- background-color: #e3f2fd;
- color: #2196f3;
- font-size: 22rpx;
- padding: 6rpx 16rpx;
- border-radius: 8rpx;
- }
- </style>
|