123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <view class="center">
- <view class="top">
- <view class="vheigh"></view>
- <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
- <view class="top-main flex">
- <view class="search-box flex" @click="clickSearch()">
- <image class="search" src="../../static/img/search.png" mode=""></image>
- <view class="search-font">输入关键词搜索</view>
- </view>
- </view>
- </view>
- <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
- <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
- @click="bannerNavToUrl(item)">
- <image :src="item.pic" />
- </swiper-item>
- </swiper>
- <view class="tongz flex">
- <view>
- <view class="tongz-bg">
- <image src="../../static/img/tongz-bg.png" mode=""></image>
- </view>
- <view class="tongz-left flex">
- <image class="image-left" src="../../static/img/ling.png" mode=""></image>
- <u-notice-bar style="width: 100%;" mode="vertical" type="none" :volume-icon="false"
- :more-icon="false" :list="text"></u-notice-bar>
- </view>
- </view>
- </view>
- <view class="navbar">
- <view class="nav-item" @click="nav('/pages/index/index')">
- <image class="nav-img" src="../../static/img/newbanner.png" mode=""></image>
- </view>
- <view class="nav-item" @click="nav('/pages/navigation/main')">
- <image class="nav-img" src="../../static/img/oldbanner.png" mode=""></image>
- </view>
- </view>
- <!-- #ifdef H5 -->
- <view class="btm">
- <a href="https://beian.miit.gov.cn" class="a-pm">备案编号:浙ICP备2022017146号 </a>
- </view>
- <!-- #endif -->
- </view>
- </template>
- <script>
- import {
- loadIndexs,
- store_list
- } from '@/api/index.js';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- data() {
- return {
- current: 0,
- titleNViewBackground: '',
- swiperCurrent: 0,
- swiperLength: 0,
- carouselList: [], //轮播图列表
- text: ['双模式 双系统 开创第三代新零售'],
- };
- },
- onShow() {
- this.loadData();
- },
- methods: {
- ...mapMutations(['setLat', 'setLon', 'setChoose']),
- loadData() {
- loadIndexs({})
- .then(({
- data
- }) => {
- let goods = data.info;
- this.dataList = goods.bastList; //精品推荐
- this.carouselList = data.banner;
- })
- .catch(e => {});
- },
- nav(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- });
- }
- });
- },
- //轮播图切换修改背景色
- swiperChange(e) {
- const index = e.detail.current;
- this.swiperCurrent = index;
- this.titleNViewBackground = this.carouselList[index].background;
- },
- // 點擊搜索框
- clickSearch() {
- uni.navigateTo({
- url: '/pages/product/search'
- });
- },
- }
- };
- </script>
- <style lang="scss">
- page,
- .center {
- min-height: 100%;
- height: auto;
- background: #ffffff;
- }
- .vheigh {
- height: var(--status-bar-height);
- background-color: $base-color;
- }
- .top {
- position: relative;
- width: 100%;
- height: 360rpx;
- .top-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- width: 100%;
- height: 100%;
- }
- .top-main {
- position: relative;
- z-index: 2;
- padding: 30rpx;
- .search-box {
- justify-content: center;
- width: 698rpx;
- height: 60rpx;
- background: rgba(255, 240, 245, 0.4);
- box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
- border-radius: 30rpx;
- .search {
- width: 34rpx;
- height: 34rpx;
- }
- .search-font {
- margin-left: 14rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ffffff;
- }
- }
- }
- }
- .carousel {
- width: 700rpx;
- height: 276rpx;
- /* #ifndef APP-PLUS */
- margin: -240rpx auto 0;
- /* #endif */
- /* #ifdef APP-PLUS */
- margin: -180rpx auto 0;
- /* #endif */
- border-radius: 40rpx;
- image {
- border-radius: 40rpx;
- width: 700rpx;
- height: 276rpx;
- }
- }
- .tongz {
- width: 690rpx;
- height: 70rpx;
- margin: 32rpx auto 0;
- padding: 18rpx 30rpx 18rpx 24rpx;
- align-items: center;
- position: relative;
- .tongz-bg {
- position: absolute;
- top: 0;
- right: 0;
- left: 0;
- width: 690rpx;
- height: 70rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .tongz-left {
- width: 640rpx;
- .image-left {
- width: 28rpx;
- height: 34rpx;
- }
- .tongz-font {
- margin-left: 22rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #0f253a;
- }
- }
- .tongz-right {
- position: relative;
- z-index: 11;
- width: 12rpx;
- height: 26rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .nav-item {
- width: 698rpx;
- height: 219rpx;
- background: linear-gradient(150deg, #F5BE41 0%, #DF4226 100%);
- border-radius: 14rpx;
- margin: 40rpx auto 0;
- .nav-img {
- width: 100%;
- height: 100%;
- border-radius: 14rpx;
- }
- }
- .btm {
- position: fixed;
- bottom: 0;
- width: 100%;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- .a-pm {
- text-decoration: none;
- width: 100%;
- height: 50rpx;
- line-height: 50rpx;
- color: navigator;
- }
- }
- </style>
|