lanan-repair/pages-home/home/home.vue

397 lines
9.2 KiB
Vue
Raw Normal View History

2024-09-22 15:07:01 +08:00
<template>
<view class="container">
2024-09-27 23:32:05 +08:00
<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>
2024-09-22 15:07:01 +08:00
<view class="body">
<view class="body-top-banner">
2024-09-27 23:32:05 +08:00
<!-- <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>
2024-09-22 15:07:01 +08:00
</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">
2024-09-27 20:58:56 +08:00
<view class="title">推荐修理厂</view>
2024-09-22 15:07:01 +08:00
<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">
2024-09-24 14:08:50 +08:00
<view class="shopTitle">{{item.corpName}}</view>
2024-09-22 15:07:01 +08:00
<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'
2024-09-27 23:32:05 +08:00
import request from "../../utils/request";
import config from "@/config";
2024-10-14 18:06:55 +08:00
import {setJSONData} from '@/utils/auth'
2024-09-22 15:07:01 +08:00
export default {
components: {
tabBarVue,
VNavigationBar
},
data() {
return {
2024-09-27 23:32:05 +08:00
bannerIndex: 0,
2024-09-22 15:07:01 +08:00
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'
},
{
2024-09-27 17:14:48 +08:00
title: '活动礼包',
2024-09-22 15:07:01 +08:00
icon: require('@/static/icons/homeMenuIcon/menu3.png'),
2024-09-28 00:17:38 +08:00
path: '/pages-home/home/active'
2024-09-22 15:07:01 +08:00
},
{
title: '操作指南',
icon: require('@/static/icons/homeMenuIcon/menu4.png'),
path: '/pages/guideList/guideList'
},
],
infoList: [{
id: 1,
title: '暖心!深夜汽车高速路上爆胎 彝良交警化身“修理工”帮忙换胎'
},
{
id: 2,
title: '车辆机件“焕新上岗”,武汉公交修旧创效出实招'
},
],
2024-09-24 14:08:50 +08:00
// 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: ''
// },
// ]
2024-09-27 23:32:05 +08:00
shopList: [],
bannerList: [],
richTextHtml: null
}
},
onShow() {
this.getCompanyPage()
this.getBannerList()
2024-09-22 15:07:01 +08:00
},
methods: {
2024-09-27 23:32:05 +08:00
swiperChangeFun(e) {
console.log('e', e)
this.bannerIndex = e.detail.current
},
toContent(id) {
uni.navigateTo({
2024-09-28 00:17:38 +08:00
url: "/pages-home/home/content?id=" + id,
2024-09-27 23:32:05 +08:00
})
},
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
})
},
2024-09-24 14:08:50 +08:00
gotoShopDetail(row) {
2024-10-14 18:06:55 +08:00
setJSONData("shopInfo",row)
2024-09-27 23:32:05 +08:00
// 直接把那一行的数据转发过去
2024-09-22 15:07:01 +08:00
uni.navigateTo({
2024-10-14 18:06:55 +08:00
url: '/pages-shop/shopDetail/shopDetail?id='+row.id
2024-09-22 15:07:01 +08:00
})
},
gotoPage(menu) {
uni.navigateTo({
url: menu.path
})
2024-09-24 14:08:50 +08:00
},
2024-09-27 23:32:05 +08:00
// 附近修理厂
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 => {
2024-09-28 00:17:38 +08:00
item['image'] = require("../static/outImage.jpg")
2024-09-27 23:32:05 +08:00
})
}
2024-09-22 15:07:01 +08:00
}
}
</script>
<style scoped lang="less">
.container {
height: 100%;
background-color: #fff;
2024-09-27 23:32:05 +08:00
//background: linear-gradient(180deg, #0174F6 0%, rgba(1, 116, 246, 0) 100%);
2024-09-22 15:07:01 +08:00
color: #333333;
display: flex;
flex-direction: column;
2024-09-27 23:32:05 +08:00
position: relative;
2024-09-28 00:17:38 +08:00
2024-09-27 23:32:05 +08:00
.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内核浏览器如Chrome、Safari */
// backdrop-filter: blur(10px);
filter: blur(20rpx);
/* 设置透明度 */
opacity: 0.5;
2024-09-28 00:17:38 +08:00
2024-09-27 23:32:05 +08:00
// -webkit-filter: brightness(150%);
// filter: brightness(150%);
2024-09-28 00:17:38 +08:00
2024-09-27 23:32:05 +08:00
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%);
}
2024-09-22 15:07:01 +08:00
.body {
2024-09-27 23:32:05 +08:00
position: relative;
z-index: 10;
2024-09-22 15:07:01 +08:00
flex: 1;
height: 0;
overflow: auto;
padding-bottom: 30rpx;
}
.body-top-banner {
text-align: center;
}
.banner {
margin: 24rpx 0 0;
width: 686rpx;
2024-09-27 23:32:05 +08:00
height: 100%;
2024-09-22 15:07:01 +08:00
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;
}
}
}
}
2024-09-28 00:17:38 +08:00
</style>