Files
xdd-uniapp-new/pages/home/index.vue
T

1893 lines
54 KiB
Vue

<template>
<view class="tabbar-page">
<view
:style="{
'padding-top': statusBarHeight + 'px',
'padding-right': rightDistance + 'px'
}"
:class="scrollTop > 40 ? 'blur' : ''"
class="fix-header"
>
<view class="location" @click="reLocateHandle()">
{{ isLocating ? '定位中' : (cityName || '定位失败') }}
<image
:src="webUrl + '/home/icon-location.png'"
class="icon"
/>
</view>
<view class="search-wrap" @click="goGoodSearch">
<view class="icon">
<image
:src="webUrl + '/home/icon-search2.png'"
class="icon"
/>
</view>
<view class="swpier-bar">
<u-notice-bar
duration="4000"
:text="recommendKeyword"
:icon="' '"
color="#333"
fontSize="14"
bgColor="transparent"
@change="changeRecommendKeyword"
direction="column">
</u-notice-bar>
</view>
</view>
</view>
<view class="slider-banner" id="slider-banner-id">
<swiper
v-if="banner.length > 0"
indicatorDots="true"
indicator-color="rgba(255, 255, 255, .3)"
indicator-active-color="#ffffff"
autoplay
circular
style="height: 510rpx;"
>
<block
v-for="(item, bannerIndex) in banner"
:key="bannerIndex"
>
<swiper-item>
<view @click="goRoll(item)" class="swiper-item">
<image :src="item.pic"/>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="home-body" id="step1">
<!-- 导航v9 -->
<view class="menus-wrap">
<view class="menus-bg" />
<scroll-view scroll-x :scroll-into-view="scrollView" class="scroll-view" scroll-with-animation @scroll="onscroll" >
<view class="menus-list">
<view
v-for="(item, index) in menus"
:key="index"
class="item flex flex-col ai-center"
@click="$global.commonJump(item.uniapp_url)"
:id="'box-item' + (index)"
>
<image
:src="item.pic"
mode="scaleToFill"
class="img"
/>
<view class="one-t tc menu-name">
{{ item.name }}
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 千县名品和地标好物 -->
<view
v-if="landmarkGoodsImage.image || countyFamousImage.image"
class="land-famous-wrap"
>
<view v-if="countyFamousImage.image" id="qianxian" class="pic-wrap">
<image
:src="countyFamousImage.image"
mode="heightFix"
class="img"
@click="landAndFamousItemClickHandle(countyFamousImage)"
/>
</view>
<view v-if="landmarkGoodsImage.image" id="dibiao" class="pic-wrap">
<image
:src="landmarkGoodsImage.image"
mode="heightFix"
class="img"
@click="landAndFamousItemClickHandle(landmarkGoodsImage)"
/>
</view>
</view>
<!-- 导航v9end -->
<!-- v9 专题 -->
<view class="subject-box">
<view class="section-full flex jc-between">
<swiper
class="swiper"
circular
autoplay
:interval="3000"
>
<swiper-item
v-for="(stay, stayIndex) in contentHomestay"
:key="stayIndex"
>
<image
:src="stay.indexImage"
mode="scaleToFill"
@click="goHomeStay(stay)"
/>
</swiper-item>
</swiper>
<!-- <image
v-if="contentFestival.indexImage"
:src="contentFestival.indexImage"
mode="scaleToFill"
@click="goFestival"
/> -->
<!-- <swiper
class="swiper"
circular
autoplay
:interval="3000">
<swiper-item class="" item-id="" v-if="contentFestival.indexImage">
<image
:src="contentFestival.indexImage"
mode="scaleToFill"
@click="goFestival"
/>
</swiper-item>
<swiper-item class="" item-id="">
<view class="new-zone-wrap">
<view class="kd" @click="toKD">
<view class="img-wrap">
<image style="width: 112rpx; height:26rpx" :src="webUrl + '/orderIcon/kd.png'" mode="heightFix|widthFix"></image>
</view>
<view class="tip-img">
<image style="width: 142rpx; height:66.11rpx;border-radius: 0" :src="webUrl + '/orderIcon/dot.png'" mode="heightFix|widthFix"></image>
</view>
<view class="kd-cover">
<video v-if="indexVideo" class="kd-cover v12-mt-0" :src="indexVideo" controls :poster="indexVideo + '?vframe/jpg/offset/1'"></video>
<view class="enter-btn">点击进入</view>
</view>
</view>
<view class="xpsx">
<view class="img-wrap">
<image style="width: 140rpx; height:26.44rpx" :src="webUrl + '/orderIcon/xp.png'" mode="heightFix|widthFix"></image>
</view>
<view class="new-zone v12-mt-2" @click="toNewZone">
<swiper autoplay circular style="width: 100%;" interval="3000" next-margin="40rpx">
<swiper-item v-for="(item, index) in newZone" :key="index">
<view class="new-item">
<image :src="item.productImage" style="width: 120rpx; height: 120rpx; border-radius:10rpx"></image>
<view class="goods-info">
<view class="v12-font-22 more-t">{{ item.productTitle }}</view>
<view class="v12-primary-text v12-font-bold price-wrap">
<text class="v12-font-16"></text>
<text class="v12-font-24">{{ item.productPrice }}</text>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
</swiper-item>
</swiper> -->
<view class="new-zone-wrap">
<view v-if="indexVideo" class="kd" id="xkd">
<view class="img-wrap" style="padding-top: 10rpx; box-sizing:border-box">
<image style="width: 112rpx; height:26rpx" :src="webUrl + '/orderIcon/kd.png'" mode="heightFix|widthFix"></image>
</view>
<view class="tip-img">
<image style="width: 142rpx; height:66.11rpx;border-radius: 0" :src="webUrl + '/orderIcon/dot.png'" mode="heightFix|widthFix"></image>
</view>
<view class="kd-cover" @click.stop="played">
<video play-btn-position="center" id="indexVideo" :show-fullscreen-btn="false" class="kd-cover v12-mt-0" :src="indexVideo" controls autoplay :poster="indexVideo + '?vframe/jpg/offset/1'"></video>
<view class="enter-btn" >点击进入</view>
</view>
</view>
<view class="xpsx" id="xpsx">
<view class="img-wrap">
<image style="width: 140rpx; height:26.44rpx" :src="webUrl + '/orderIcon/xp.png'" mode="heightFix|widthFix"></image>
</view>
<view class="new-zone v12-mt-2" @click="toNewZone">
<swiper autoplay circular style="width: 100%;" interval="3000" next-margin="40rpx">
<swiper-item v-for="(item, index) in newZone" :key="index">
<view class="new-item">
<image :src="item.productImage" style="width: 120rpx; height: 120rpx; border-radius:10rpx"></image>
<view class="goods-info">
<view class="v12-font-22 more-t">{{ item.productTitle }}</view>
<view class="v12-primary-text v12-font-bold price-wrap">
<text class="v12-font-16"></text>
<text class="v12-font-24">{{ item.productPrice }}</text>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
</view>
</view>
<!-- 2022/6/20 add 尖货推荐 -->
<view class="bast-box">
<view>
<image
:src="webUrl + '/home/bast-list-title.png'"
class="bast-title"
mode="scaleToFill"
/>
</view>
<view class="bast-list">
<view class="bast-list-left">
<view
v-for="(item, index) in bastLeftList"
:key="index"
class="item flex"
>
<view
v-if="item.type === 'hotel'"
class="hotel-list-wrap"
>
<image
:src="webUrl + '/home/hotel-list-bg.png'"
mode="widthFix"
class="bg"
/>
<view class="list">
<view
v-for="(hotelItem, hotelIndex) in item.list"
:key="hotelIndex"
class="hotel-item"
@click="hotelItemClickHandle(hotelItem)"
>
<image :src="webUrl + '/home/home-number' + (hotelIndex + 1) + '.png'" class="mark" />
<image :src="webUrl + '/home/icon-hotel-btn.png'" class="btn" />
<image :src="hotelItem.logo" class="logo" />
<view class="info">
<view class="name one-t">{{ hotelItem.name }}</view>
<view class="desc more-t">{{ hotelItem.content }}</view>
</view>
</view>
</view>
</view>
<xdd-product-item
v-else
:item="item"
@view="goGoodsCon(item)"
@add="addToCart(item)"
/>
</view>
</view>
<view class="bast-list-right">
<view
v-for="(item, index) in bastRightList"
:key="index"
class="item flex"
>
<view
v-if="item.type === 'swiper'"
class="swiper-wrap"
>
<swiper
class="swiper"
circular
autoplay
:interval="3000"
>
<swiper-item
v-for="(swiperItem, swiperIndex) in item.list"
:key="swiperIndex"
>
<image
:src="swiperItem.indexImage"
mode="scaleToFill"
class="swiper-img"
@click="productSwiperItemClickHandle(swiperItem)"
/>
</swiper-item>
</swiper>
</view>
<xdd-product-item
v-else
:item="item"
@view="goGoodsCon(item)"
@add="addToCart(item)"
/>
</view>
</view>
</view>
</view>
</view>
<!-- v9 老用户弹窗 -->
<u-popup
mode="center"
bgColor="transparent"
:show="isOldUser && oldUserPopup.image && lotteryCanDraw"
>
<view class="popup-old-user flex flex-col ai-center">
<image
:src="oldUserPopup.image"
class="main"
mode="scaleToFill"
@click="tapOld()"
/>
<view
class="icon-box flex jc-center ai-center"
@click="changeOldPopup(false)"
>
<image
:src="webUrl+'/20230608112219219303.png'"
mode="scaleToFill"
/>
</view>
</view>
</u-popup>
<!-- 尖货推荐结束 -->
<u-back-top :scroll-top="scrollTop">
<image
:src="webUrl+'/icon/setTop.png'"
mode="scaleToFill"
style="width: 40px;height: 40px;"
@click="setTopHandle"
/>
</u-back-top>
<ProductWindow
ref="attrWindow"
:attr="attr"
:cartNum="cart_num"
:showOk="true"
@changeFun="changeFun"
@ok="handleOk"
paddingBottom="200rpx"
/>
<FunctionGuide :maxStep="15" @hide="setGuide('index')" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
<AiEntrance />
<xdd-tabbar :curr-index="0" @getElementData="elementData" @getIcon="getIcon"/>
</view>
</template>
<script>
import XddTabbar from '@/components/xdd-tabbar'
import XddProductItem from '@/components/xdd-product-item'
import { getCouponReceive } from '@/api/user'
import { getHomeData, getShareImage } from '@/api/public'
import { sharpBannar } from '@/api/goods'
import { pageListenMixins } from '@/mixins/pageListenMixins'
import ProductWindow from '@/components/ProductWindow'
import goCartMixin from '@/mixins/goCartMixins'
import FunctionGuide from '@/components/FunctionGuide'
import GuideMixins from '@/mixins/GuideMixins'
import AiEntrance from '@/components/aiChat/entrance'
import {
getSearchPageConfig
} from '@/api/search'
import {
getCurAddress,
getLocationPromise,
getLocationSetting,
openLocationSettting
} from "@/utils/common"
export default {
name: 'IndexPage',
components: {
XddTabbar,
XddProductItem,
ProductWindow,
FunctionGuide,
AiEntrance
},
mixins: [pageListenMixins, goCartMixin, GuideMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
// 状态栏高度
statusBarHeight: 20,
// 右侧距离
rightDistance: 10,
banner: [],
menus: [],
// 定位中
isLocating: true,
cityName: '',
// 地标好物
landmarkGoodsImage: {},
// 千县名品
countyFamousImage: {},
// 尖货推荐左侧
bastLeftList: [],
// 尖货推荐右侧
bastRightList: [],
// 尖货推荐横幅
bannerList: [],
// 分享图片
shareAppImg: '',
// 老用户弹窗
isOldUser: true,
oldUserPopup: {},
// 民宿专题轮播
contentHomestay: [],
// 新品推荐
newZone: [],
indexVideo: '',
// 节日专题
contentFestival: {},
pageKeyId: Object.freeze('appIndex'),
scrollTop: 0,
lotteryCanDraw: false,
videoContext: null,
isPlay: true,
tabIconPostion: {},
messageIcon: {},
recommendKeyword: [],
keywordIndex: 0
}
},
onLoad() {
// uni.hideTabBar()
const _this = this
_this.init()
_this.queryGuide('index')
this.getSearch()
uni.getSystemInfo({
success: (e) => {
let statusBar = 0
// #ifdef MP-WEIXIN
statusBar = e.statusBarHeight
const custom = uni.getMenuButtonBoundingClientRect()
_this.rightDistance = e.windowWidth - custom.left + 10
// #endif
// 状态栏高度
_this.statusBarHeight = statusBar
}
})
},
onShow() {
wx.offKeyboardHeightChange()
},
onHide() {
this.pageToHideHandle()
},
onShareAppMessage() {
return {
title: '探寻有趣有味的生活方式',
path: '/pages/home/index',
imageUrl: this.shareAppImg
}
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
methods: {
changeRecommendKeyword(e) {
this.keywordIndex = e
},
getSearch() {
getSearchPageConfig().then(res => {
const { success, data } = res
if (success) {
this.recommendKeyword = data.recommendKeyword.split(',')
}
})
},
elementData(e) {
this.tabIconPostion = e
},
getIcon(e) {
this.messageIcon = e
},
onscroll(e) {
this.scrollViewWidth = e.detail.scrollWidth
const imgs = []
this.getElementData(`#${this.scrollView}`, res=>{
this.setFunctionGuideData({
imgs: this.imgs,
btnGroupPosition: '20rpx',
tipsPosition: '',
position: {
top: res.top + 'px',
left: res.left + 'px',
width: `${res.height}px`,
height: `${res.height}px`
}
})
})
},
showFunctionGuide() {
if(this._step == this.functionGuideData.step) return
this._step = this.functionGuideData.step
if(this.functionGuideData.step == 1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group1/Group 1-1.png',
style: {
position: 'absolute',
zIndex: 99,
width: '474rpx',
top: '100rpx',
left: '-110rpx',
right: 0,
margin: 'auto',
height: '289rpx',
/* px: ; */
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group1/Group 1-2.png',
style: {
position: 'absolute',
zIndex: 99,
width: '186rpx',
top: '350rpx',
left: '240rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group1/Group 1-3.png',
style: {
position: 'absolute',
zIndex: 99,
width: '173rpx',
top: '180rpx',
right: '100rpx',
height: '248rpx',
},
isBtn: false
},
]
this.getElementData('#step1', res=>{
this.screenWidth = res.width - 20
this.setFunctionGuideData({
imgs: imgs,
btnGroupPosition: {
top: 510 - 100 + 'rpx',
},
tipsPosition: '420rpx',
position: {
top: 510 - 100 + 'rpx',
left: res.left + 10 + 'px',
width: `${res.width - 20}px`,
height: `${160 + 228 + 16 + 514 + 16}rpx`,
}
})
})
}else {
const menusUrl = this.menus.map(item => item.uniapp_url)
const urls = {
2: '/pages/chose-city/chose-city?type=0',
3: '/pages/chose-city/chose-city?type=1',
4: '/pkg_product/views/healthList',
5: '/pkg_product/views/giftList',
6: '/pkg_product/views/heritage',
7: '/pkg_join/views/index',
8: '/v4/views/attract/attract'
}
if(this.functionGuideData.step == 2) {
if(menusUrl.indexOf(urls[2]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[2]) > -1) {
const index = menusUrl.indexOf(urls[2])
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group2/Group 2-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '454rpx',
top: '140rpx',
left: '-130rpx',
right: 0,
margin: 'auto',
height: '258rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group2/Group 2-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: '-110rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group2/Group 2-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: '200rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
this.toEle('box-item' + index, imgs)
}
return
}
if(this.functionGuideData.step == 3) {
if(menusUrl.indexOf(urls[3]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[3]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group3/Group 3-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '620rpx',
top: '540rpx',
left: '-50rpx',
right: 0,
margin: 'auto',
height: '254rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group3/Group 3-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: '530rpx',
left: '110rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group3/Group 3-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: '530rpx',
left: '410rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
const index = menusUrl.indexOf(urls[3])
this.toEle('box-item' + index, imgs)
}
return
}
if(this.functionGuideData.step == 4) {
if(menusUrl.indexOf(urls[4]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[4]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group4/Group 4-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '578rpx',
top: '180rpx',
left: '150rpx',
right: 0,
margin: 'auto',
height: '226rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group4/Group 4-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: '340rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group4/Group 4-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: '610rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
const index = menusUrl.indexOf(urls[4])
this.toEle('box-item' + index, imgs)
}
return
}
if(this.functionGuideData.step == 5) {
if(menusUrl.indexOf(urls[5]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[5]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group5/Group 5-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '495rpx',
top: '540rpx',
left: '230rpx',
right: 0,
margin: 'auto',
height: '267rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group5/Group 5-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 265*2+'rpx',
left: -120*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group5/Group 5-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 265*2+'rpx',
left: 20*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
const index = menusUrl.indexOf(urls[5])
this.toEle('box-item' + index, imgs)
}
return
}
if(this.functionGuideData.step == 6) {
if(menusUrl.indexOf(urls[6]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[6]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group6/Group 6-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '534rpx',
top: '140rpx',
left: '230rpx',
right: 0,
margin: 'auto',
height: '280rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group6/Group 6-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: -20*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group6/Group 6-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: 140*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
const index = menusUrl.indexOf(urls[6])
this.toEle('box-item' + index, imgs)
}
return
}
// 7 商户, 8 招商
if(this.functionGuideData.step == 7) {
if(menusUrl.indexOf(urls[7]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[7]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group13/Group 13-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: 291.5*2+'rpx',
top: 280*2+'rpx',
left: 10*2+'rpx',
right: 0,
margin: 'auto',
height: 116.5*2+'rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group13/Group 13-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: -280*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group13/Group 13-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: -150*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
const index = menusUrl.indexOf(urls[7])
this.toEle('box-item' + index, imgs)
}
return
}
if(this.functionGuideData.step == 8) {
if(menusUrl.indexOf(urls[8]) < 0) {
this.$refs.FunctionGuide.next()
return
}
if(menusUrl.indexOf(urls[8]) > -1) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group14/Group 14-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '539rpx',
top: 80*2+'rpx',
left: 100*2+'rpx',
right: 0,
margin: 'auto',
height: '265rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group14/Group 14-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: 150*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group14/Group 14-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '117rpx',
top: 213*2+'rpx',
left: 10*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
]
const index = menusUrl.indexOf(urls[8])
this.toEle('box-item' + index, imgs)
}
return
}
if (this.functionGuideData.step == 10) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group7/Group 7-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '438rpx',
top: 140*2+'rpx',
left: -164*2+'rpx',
right: 0,
margin: 'auto',
height: '336rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group8/Group 8-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '129rpx',
top: 285*2+'rpx',
left: 0+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group8/Group 8-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '129rpx',
top: 285*2+'rpx',
left: 139 * 2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
},
]
this.toEle('dibiao', imgs)
return
}
if (this.functionGuideData.step == 9) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group8/Group 8-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '574rpx',
top: 170*2+'rpx',
left: -0+'rpx',
right: 0,
margin: 'auto',
height: '238rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group8/Group 8-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 285*2+'rpx',
left: -290*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group8/Group 8-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 285*2+'rpx',
left: -(290-130)*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
}
]
this.toEle('qianxian', imgs)
return
}
if (this.functionGuideData.step == 11) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group9/Group 9-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '444rpx',
top: 310*2+'rpx',
left: 144*2+'rpx',
right: 0,
margin: 'auto',
height: '252rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group9/Group 9-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 435*2+'rpx',
left: -235*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group9/Group 9-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 435*2+'rpx',
left: -90*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
}
]
this.toEle('xkd', imgs)
return
}
if (this.functionGuideData.step == 12) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group11/Group 11-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '450rpx',
top: 465*2+'rpx',
left: 120*2+'rpx',
right: 0,
margin: 'auto',
height: '218rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group11/Group 11-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 575*2+'rpx',
left: -210*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group11/Group 11-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 575*2+'rpx',
left: -70*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
}
]
this.toEle('xpsx', imgs)
return
}
// top 140, buttom: 540
if(this.functionGuideData.step == 13) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group10/Group 10-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '489rpx',
top: 580*2+'rpx',
left: 0+'rpx',
right: 0,
margin: 'auto',
height: '267rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group10/Group 10-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 555*2+'rpx',
left: 0+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'jump'
},
{
url: this.webUrl + '/引导页素材/首页引导/Group10/Group 10-3.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 555*2+'rpx',
left: 140*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
}
]
this.$nextTick(() => {
this.setFunctionGuideData({
imgs: imgs,
btnGroupPosition: '',
tipsPosition: '',
position: {
bottom: '10px',
left: this.tabIconPostion.left + 'px',
width: `${this.tabIconPostion.width}px`,
height: `${this.tabIconPostion.height}px`,
}
})
})
return
}
if (this.functionGuideData.step == 14) {
const imgs = [
{
url: this.webUrl + '/引导页素材/首页引导/Group12/Group 12-1.png',
style:{
position: 'absolute',
zIndex: 99,
width: '479rpx',
top: 665*2+'rpx',
left: 40*2+'rpx',
right: 0,
margin: 'auto',
height: '180rpx',
},
isBtn: false
},
{
url: this.webUrl + '/引导页素材/首页引导/Group12/Group 12-2.png',
style:{
position: 'absolute',
zIndex: 99,
width: '118rpx',
top: 750*2+'rpx',
left: 40*2+'rpx',
right: 0,
margin: 'auto',
height: '46rpx',
},
isBtn: 'next'
}
]
this.setFunctionGuideData({
imgs: imgs,
btnGroupPosition: '',
tipsPosition: '',
position: {
bottom: 10 + 'px',
left: this.messageIcon.left + 'px',
width: `${this.messageIcon.width}px`,
height: `${this.messageIcon.height}px`,
}
})
return
}
}
},
toEle(id, imgs) {
this.getElementData(`#${id}`, res=>{
if(res.left + res.width / 2 > this.screenWidth) {
this.$nextTick(()=> {
this.scrollView = id
this.imgs = imgs
})
return
}
this.setFunctionGuideData({
imgs: imgs,
btnGroupPosition: '',
tipsPosition: '',
position: {
top: res.top + 'px',
left: res.left + 'px',
width: `${res.width}px`,
height: `${res.height}px`,
}
})
})
},
played() {
this.isPlay = !this.isPlay
if(this.isPlay) {
this.videoContext.play()
} else {
this.videoContext.pause()
}
this.toKD()
},
pause() {
},
toKD() {
this.$yrouter.push('/pages/VideoPlayBackList/VideoPlayBackList?click=1')
},
toNewZone() {
this.$yrouter.push('/pages/home/newZone')
},
init() {
getShareImage().then(({ data }) => this.shareAppImg = data)
sharpBannar().then(res => {
const { data } = res
this.bannerList = data.banner || []
})
this.getLocationData()
},
// 定位失败,重新唤起定位授权
reLocateHandle() {
if (this.cityName) return
getLocationSetting(() => openLocationSettting().then(() => {
this.getLocationData()
}))
},
getLocationData() {
this.isLocating = true
getLocationPromise().then(mapData => {
if (mapData.errMsg) {
const { latitude, longitude } = mapData
getCurAddress(latitude, longitude).then(address => {
this.cityName = address[1].data.result.ad_info.city
this.isLocating = false
this.getPageData()
}).catch(() => {
this.getPageData()
})
} else {
this.isLocating = false
this.getPageData()
}
}).catch(() => {
this.getPageData()
})
},
getPageData() {
const _this = this
uni.showLoading({ title: '加载中' })
getHomeData({ cityName: this.cityName }).then(res => {
const { success, data } = res
if (success && data) {
_this.$set(_this, 'banner', data.banner || [])
_this.$set(_this, 'menus', data.menus || [])
_this.$set(_this, 'landmarkGoodsImage', data.landmarkGoodsImage || {})
_this.$set(_this, 'countyFamousImage', data.countyFamousImage || {})
_this.$set(_this, 'oldUserPopup', data.oldUserPopup || {})
_this.$set(_this, 'contentHomestay', data.contentHomestayV2 || [])
_this.$set(_this, 'contentFestival', data.contentFestivalV2 || [])
_this.$set(_this, 'newZone', data.newGoods || [])
_this.indexVideo = data.indexVideo ? data.indexVideo.videoUrl : ''
_this.bastLeftList = []
_this.bastRightList = []
_this.lotteryCanDraw = data.lotteryCanDraw || false
if (data.bastList) {
for (let i = 0; i < data.bastList.length; i++) {
if (i % 2 === 0) {
// 店铺排名
if (i === 4 && data.hotelList.length > 0) {
_this.bastLeftList.push({
type: 'hotel',
list: data.hotelList
})
}
_this.bastLeftList.push(data.bastList[i])
}
if (i % 2 === 1) {
// 尖货专题
if (i === 3 && data.contentBest.length > 0) {
_this.bastRightList.push({
type: 'swiper',
list: data.contentBest
})
}
_this.bastRightList.push(data.bastList[i])
}
}
}
}
uni.hideLoading()
}).catch(() => {
uni.hideLoading()
})
},
goRoll(item) {
if (item.uniapp_url) {
this.$yrouter.push(item.uniapp_url)
}
},
goGoodSearch() {
this.$yrouter.push('/pages/shop/GoodSearch/index?keywords=' + this.recommendKeyword[this.keywordIndex] )
},
goGoodsCon(item) {
if(item.isFarmerShop) {
if (item.farmerShopId === 0) {
uni.showToast({
title: '店铺装修中~',
icon: 'none',
duration: 3000
})
return
}
uni.navigateTo({
url: '/pagesInn/inn/farmerStore?id=' + item.farmerShopId + '&isQianxian=1&from=famous&isFarmer=1'
})
return
}
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.id
}
})
},
changeOldPopup(state) {
this.isOldUser = state
},
// 民宿专题
goHomeStay(item) {
if (item.type === 1) {
uni.navigateTo({ url: '/pkg_product/views/homestay?id=' + item.id })
return
}
this.linkToThemePage(item)
},
// 节日专题
goFestival() {
if (this.contentFestival.type === 1) {
uni.navigateTo({ url: '/pkg_product/views/festival' })
return
}
this.linkToThemePage(this.contentFestival)
},
// 尖货专题
productSwiperItemClickHandle(item) {
if (item.type === 1) {
uni.navigateTo({ url: `/pkg_product/views/festival?id=${item.id}&from=index&theme=best` })
return
}
this.linkToThemePage(item)
},
linkToThemePage(item) {
/**
* type:1-专题页,2-商品,3-时令尝鲜
* 当type=2,且uniappUrl有值,以跳转界面地址为准
*/
const type = item.type
// 链接到特定页面
if (type === 2 && item.uniappUrl) {
this.$global.commonJump(item.uniappUrl)
return
}
// 商品详情
if (type === 2 && item.productId) {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.productId
}
})
}
// 时令尝鲜
if (type === 3) {
uni.navigateTo({ url: '/pkg_product/views/seasonList' })
}
},
tapOld() {
this.isOldUser = false
const {
type,
text,
jumpTime,
pageLevel,
url,
params,
couponId
} = this.oldUserPopup
if (couponId != null) {
getCouponReceive(couponId).then(res => {
if (res.status === 200) {
uni.showToast({
title: text,
icon: 'none',
success: () => {
}
})
}
}).catch((err) => {
uni.showToast({
title: err.data.msg + '',
icon: 'none',
duration: 3000
})
})
}
// type 1-定时跳转,2-点击跳转,3-不跳转
if (type === 1) {
setTimeout(() => {
this.$global.levelJump(pageLevel, url, params)
}, jumpTime * 1000)
} else if (type === 2) {
this.$global.levelJump(pageLevel, url, params)
}
},
// 千县名品和地标好物
landAndFamousItemClickHandle(item) {
const url = item.url
if (!url) return
if (item.level === '1') {
uni.switchTab({ url })
}
if (item.level === '2') {
uni.navigateTo({ url })
}
},
// 店铺排名
hotelItemClickHandle(item) {
uni.navigateTo({ url: `/pagesInn/inn/innHome?id=${item.id}&from=index` })
},
setTopHandle() {
uni.pageScrollTo({
scrollTop: 0,
duration: 200
})
}
}
}
</script>
<style scoped lang="less">
.swiper-item {
height: 100%;
}
.slider-banner {
position: relative;
z-index: 2;
}
.subject-box {
padding: 12rpx;
margin: 16rpx 0 0 0;
border-radius: 20rpx;
background: #fff;
image {
vertical-align: middle;
}
.section-full {
image {
width: 336rpx;
height: 480rpx;
border-radius: 20rpx;
}
.swiper {
width: 336rpx;
height: 480rpx;
border-radius: 20rpx;
overflow: hidden;
}
}
}
.popup-old-user {
image {
vertical-align: middle;
}
.main {
width: 560rpx;
height: 840rpx;
border-radius: 40rpx;
}
.icon-box {
width: 96rpx;
height: 96rpx;
margin-top: 40rpx;
background: rgba(51, 51, 51, .4);
border-radius: 50%;
image {
width: 40rpx;
height: 40rpx;
}
}
}
.bast-box {
.bast-title {
width: 350rpx;
height: 52rpx;
margin: 21rpx 0 0 0;
}
.bannar-swiper {
height: 534rpx;
image {
width: 332rpx;
height: 534rpx;
}
}
.bast-list {
display: flex;
justify-content: space-between;
.bast-list-left,
.bast-list-right {
width: calc(50% - 11rpx);
}
.item {
position: relative;
margin: 21rpx 0 0 0;
.swiper-wrap {
width: 100%;
border-radius: 20rpx;
overflow: hidden;
}
.swiper {
width: 100%;
height: 486rpx;
.swiper-img {
width: 100%;
height: 486rpx;
}
}
}
}
}
.tabbar-page {
padding: 0 0 180rpx 0;
background-color: #F0F0F0;
}
.home-body {
position: relative;
z-index: 5;
padding: 21rpx 21rpx 0 21rpx;
}
.scroll-view{
background: #fff;
border-radius: 16rpx;
margin: -120rpx 0 0 0;
}
.menus-wrap {
position: relative;
.menus-list {
position: relative;
z-index: 5;
display: flex;
flex-shrink: 0;
padding: 12rpx 24rpx;
border-radius: 16rpx;
// background-color: #fff;
.item + .item {
// margin: 0 0 0 36rpx;
}
.item {
width: 150rpx;
padding: 10rpx 20rpx;
background-color: #fff;
.img {
width: 86rpx;
height: 86rpx;
}
.menu-name {
margin: 16rpx 0 0 0;
color: #666;
font-size: 26rpx;
}
}
}
.menus-bg {
position: absolute;
top: 0;
left: -21rpx;
z-index: -1;
width: calc(100% + 40rpx);
height: 180rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 6) 40%, rgba(255, 255, 255, 1) 100%);
content: " ";
}
}
.land-famous-wrap {
position: relative;
z-index: 5;
display: flex;
flex-shrink: 0;
justify-content: space-between;
padding: 20rpx;
margin: 16rpx 0 0 0;
border-radius: 20rpx;
background: #fff;
.pic-wrap {
.img + .img {
margin: 0 0 0 20rpx;
}
.img {
display: block;
height: 188rpx;
}
}
}
.hotel-list-wrap {
position: relative;
width: 344rpx;
.bg {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 2;
width: 100%;
}
.list {
position: relative;
z-index: 5;
padding: 100rpx 21rpx 21rpx 21rpx;
.hotel-item + .hotel-item {
margin: 21rpx 0 0 0;
}
.hotel-item {
position: relative;
display: flex;
padding: 8rpx 16rpx 8rpx 8rpx;
border-radius: 16rpx;
background-color: #fff;
.mark {
position: absolute;
top: 8rpx;
left: 20rpx;
z-index: 5;
width: 26rpx;
height: 26rpx;
}
.btn {
position: absolute;
bottom: 8rpx;
right: 0;
z-index: 5;
width: 60rpx;
height: 22rpx;
}
.logo {
display: block;
width: 116rpx;
height: 116rpx;
border-radius: 16rpx;
}
.info {
width: calc(100% - 116rpx);
padding: 0 0 0 16rpx;
box-sizing: border-box;
.name {
font-size: 24rpx;
color: #333;
line-height: 40rpx;
font-weight: bold;
}
.desc {
font-size: 20rpx;
color: #999;
line-height: 28rpx;
}
}
}
}
}
.swpier-bar{
width: 100%;
}
.fix-header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99;
display: flex;
align-items: center;
height: 44px;
padding-left: 21rpx;
line-height: 32px;
&.blur {
backdrop-filter: blur(5px);
}
.location {
display: flex;
align-items: center;
margin: -4px 20rpx 0 0;
color: #fff;
font-size: 32rpx;
.icon {
display: block;
width: 32rpx;
height: 32rpx;
margin: 0 0 0 10rpx;
}
}
.search-wrap {
display: flex;
align-items: center;
flex: 1;
height: 36px;
margin: -4px 0 0 0;
border-radius: 18px;
background-color: rgba(255, 255, 255, 0.5);
.icon {
display: block;
width: 36rpx;
height: 36rpx;
margin: 0 0 0 20rpx;
}
}
}
.new-zone-wrap{
width: 336rpx;
height: 480rpx;
background: rgba(240,240,240,0.8);
border-radius: 16rpx;
padding: 10rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
.kd{
width: 100%;
height: 266rpx;
background: #fff;
border-radius: 16rpx;
padding: 10rpx;
box-sizing: border-box;
position: relative;
}
.xpsx{
width: 100%;
height: 180rpx;
background: #fff;
border-radius: 16rpx;
padding: 10rpx;
box-sizing: border-box;
}
}
.img-wrap{
height: 27rpx;
width: 140rpx;
image{
border-radius: 0 !important;
vertical-align: text-top !important
}
}
.tip-img{
position: absolute;
right: 0;
top: 0;
}
.kd-cover{
width: 100%;
height: 180rpx;
border-radius: 20rpx;
margin-top: 15rpx;
}
.enter-btn{
color: #333;
background-color: rgba(255,255,255,0.6);
font-size: 28rpx;
width: fit-content;
padding: 6rpx 20rpx;
border-radius: 100rpx;
position: absolute;
left: 0;
right: 0;
bottom: 40rpx;
margin: auto;
}
.new-zone{
display: flex;
align-items: center;
justify-content: flex-start;
overflow: scroll;
}
.new-item{
display: flex;
margin-right: 20rpx;
align-items: center;
}
.goods-info{
width: 122rpx;
height: 110rpx;
background: rgba(240,240,240,0.8);
border-radius: 0rpx 20rpx 20rpx 0rpx;
box-sizing: border-box;
padding: 10rpx;
}
.price-wrap{
}
</style>