lanan-repair/pages-home/home/home.vue
2024-09-28 00:17:38 +08:00

395 lines
9.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container">
<VNavigationBar style="position: relative;z-index: 99;" leftTitle="true" backgroundColor="rgba(0,0,0,0)" title-color="#fff" title="车辆检测维修"></VNavigationBar>
<template v-if="bannerList && bannerList.length > 0" >
<view class="bannerBg1"></view>
<view class="bannerBg" :style="{backgroundImage: `url(${bannerList[bannerIndex].url})`}"></view>
<view class="bannerBottom"></view>
</template>
<view class="body">
<view class="body-top-banner">
<!-- <image class="banner" src="@/static/images/banner.jpg" mode="aspectFit" />-->
<!-- <image class="banner" v-for="banner in bannerList" :key="banner.id" :src="banner.url" @click="toContent(banner.id)" mode="scaleToFill" />-->
<swiper style="height: 400rpx;" class="swiper" circular indicator-dots="true" autoplay="true" interval="2000" duration="500"
@change="swiperChangeFun">
<swiper-item v-for="banner in bannerList" :key="banner.id" @click="toContent(banner.id)">
<image class="banner" :src="banner.url" mode="aspectFill" />
</swiper-item>
</swiper>
</view>
<view class="menus">
<view @click="gotoPage(menu)" v-for="(menu, index) in menus" :key="index" class="menu-item">
<image class="menu-icon" :src="menu.icon" mode="aspectFit"></image>
<text class="menu-title">{{menu.title}}</text>
</view>
</view>
<view class="info">
<image class="info-icon" src="@/static/icons/homeInfo.png" mode="aspectFit"></image>
<view class="infoList">
<view v-for="(item, index) in infoList" :key="item.id" class="infoItem">
<view class="infoIndex"></view>
<view class="infoText">{{item.title}}</view>
</view>
</view>
<image class="more-icon" src="../../static/icons/homeInfoMore.png" mode="aspectFit"></image>
</view>
<view class="repairShop">
<view class="title">推荐修理厂</view>
<view class="shopList">
<view v-for="(item, index) in shopList" :key="index" class="shopItem" @click="gotoShopDetail(item)">
<image class="shopImg" :src="item.image" mode="aspectFill"></image>
<view class="shopInfo">
<view class="shopTitle">{{item.corpName}}</view>
<view class="shopDetail">
<view class="shopAddress">{{item.address}}</view>
<view class="line"></view>
<view class="shopDistance">{{item.distance}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<tabBarVue msg="1"></tabBarVue>
</view>
</template>
<script>
import tabBarVue from '@/components/tabBar/tabBar.vue'
import VNavigationBar from '@/components/VNavigationBar.vue'
import request from "../../utils/request";
import config from "@/config";
export default {
components: {
tabBarVue,
VNavigationBar
},
data() {
return {
bannerIndex: 0,
menus: [{
title: '预约记录',
icon: require('@/static/icons/homeMenuIcon/menu1.png'),
path: '/pages/myReservation/myReservation'
},
{
title: '我的车辆',
icon: require('@/static/icons/homeMenuIcon/menu2.png'),
path: '/pages/myCar/myCar'
},
{
title: '活动礼包',
icon: require('@/static/icons/homeMenuIcon/menu3.png'),
path: '/pages-home/home/active'
},
{
title: '操作指南',
icon: require('@/static/icons/homeMenuIcon/menu4.png'),
path: '/pages/guideList/guideList'
},
],
infoList: [{
id: 1,
title: '暖心!深夜汽车高速路上爆胎 彝良交警化身“修理工”帮忙换胎'
},
{
id: 2,
title: '车辆机件“焕新上岗”,武汉公交修旧创效出实招'
},
],
// shopList: [{
// id: 1,
// title: '顺捷汽车维修搭电救援补胎中心',
// address: '济南市历下区福瑞达历下护理院东南门旁',
// distance: '1.9km',
// image: ''
// },
// {
// id: 2,
// title: '顺捷汽车维修搭电救援补胎中心',
// address: '济南市历下区福瑞达历下护理院东南门旁',
// distance: '1.9km',
// image: ''
// },
// {
// id: 3,
// title: '顺捷汽车维修搭电救援补胎中心',
// address: '济南市历下区福瑞达历下护理院东南门旁',
// distance: '1.9km',
// image: ''
// },
// ]
shopList: [],
bannerList: [],
richTextHtml: null
}
},
onShow() {
this.getCompanyPage()
this.getBannerList()
},
methods: {
swiperChangeFun(e) {
console.log('e', e)
this.bannerIndex = e.detail.current
},
toContent(id) {
uni.navigateTo({
url: "/pages-home/home/content?id=" + id,
})
},
async getBannerList() {
const res = await request({
url: '/userClient/banner/list?type=weixiu',
method: "get",
})
this.bannerList = res.data
this.bannerList.forEach(item => {
item.url = config.baseImageUrl + item.url
})
},
gotoShopDetail(row) {
// 直接把那一行的数据转发过去
uni.navigateTo({
url: '/pages-shop/shopDetail/shopDetail?info=' + encodeURIComponent(JSON.stringify(row))
})
},
gotoPage(menu) {
uni.navigateTo({
url: menu.path
})
},
// 附近修理厂
async getCompanyPage() {
const res = await request({
url: "/userClient/base/company/page",
method: "get",
params: {
serviceCodes: "weixiu"
}
})
this.shopList = res.data.records
this.shopList.forEach(item => {
item['image'] = require("../static/outImage.jpg")
})
}
}
}
</script>
<style scoped lang="less">
.container {
height: 100%;
background-color: #fff;
//background: linear-gradient(180deg, #0174F6 0%, rgba(1, 116, 246, 0) 100%);
color: #333333;
display: flex;
flex-direction: column;
position: relative;
.bannerBg1 {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 800rpx;
background-color: #999;
filter: blur(20rpx);
z-index: 1;
}
.bannerBg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 800rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
/* 应用背景模糊滤镜 */
-webkit-backdrop-filter: blur(10px);
/* 兼容Webkit内核浏览器如ChromeSafari */
// backdrop-filter: blur(10px);
filter: blur(20rpx);
/* 设置透明度 */
opacity: 0.5;
// -webkit-filter: brightness(150%);
// filter: brightness(150%);
transition: all 0.5s;
z-index: 2;
}
.bannerBottom {
z-index: 3;
position: absolute;
left: 0;
top: 600rpx;
width: 100%;
height: 300rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 1) 100%);
}
.body {
position: relative;
z-index: 10;
flex: 1;
height: 0;
overflow: auto;
padding-bottom: 30rpx;
}
.body-top-banner {
text-align: center;
}
.banner {
margin: 24rpx 0 0;
width: 686rpx;
height: 100%;
border-radius: 12rpx 12rpx 12rpx 12rpx;
background-color: #0174F6;
}
.menus {
margin: 30rpx auto 0;
box-sizing: border-box;
width: 686rpx;
padding: 40rpx 38rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(10, 54, 104, 0.1);
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.menu-item {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
row-gap: 22rpx;
font-size: 24rpx;
.menu-icon {
width: 48rpx;
height: 48rpx;
}
}
.info {
width: 686rpx;
margin: 38rpx auto 0;
display: flex;
align-items: center;
column-gap: 20rpx;
.info-icon {
width: 80rpx;
height: 80rpx;
}
.infoList {
flex: 1;
width: 0;
.infoItem {
display: flex;
align-items: center;
justify-content: space-between;
column-gap: 10rpx;
}
.infoIndex {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background-color: #333;
}
.infoText {
flex: 1;
width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 24rpx;
}
}
.more-icon {
width: 24rpx;
height: 24rpx;
}
}
.repairShop {
width: 686rpx;
margin: 38rpx auto 0;
.title {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.shopList {
.shopItem {
padding: 30rpx 0;
border-bottom: 1rpx solid #DDDDDD;
display: flex;
align-items: center;
column-gap: 20rpx;
}
.shopImg {
width: 160rpx;
height: 100rpx;
border-radius: 8rpx 8rpx 8rpx 8rpx;
background-color: #999;
}
.shopInfo {
flex: 1;
width: 0;
}
.shopTitle {
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-bottom: 20rpx;
}
.shopDetail {
display: flex;
align-items: center;
font-size: 24rpx;
color: #666666;
column-gap: 10rpx;
}
.shopAddress {
flex: 1;
width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.line {
width: 2rpx;
height: 24rpx;
background-color: #858BA0;
}
.shopDistance {
flex-shrink: 0;
}
}
}
}
</style>