chore:替换了pages/index/index.vue
This commit is contained in:
@@ -1,159 +1,167 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :style="themeColor">
|
<view :style="themeColor">
|
||||||
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }"
|
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }"
|
||||||
class="page-img">
|
class="page-img">
|
||||||
<view class="site-info-box"
|
<view class="site-info-box"
|
||||||
v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
|
v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
|
||||||
<view class="site-info">
|
<view class="site-info">
|
||||||
<view class="img-box" v-if="siteInfo.logo_square">
|
<view class="img-box" v-if="siteInfo.logo_square">
|
||||||
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-box" :style="{ color: '#ffffff' }">
|
<view class="info-box" :style="{ color: '#ffffff' }">
|
||||||
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
||||||
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
||||||
}}</view>
|
}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
|
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="safeBgUrl"
|
||||||
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="false"/>
|
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
||||||
</view> -->
|
<template v-slot:components>
|
||||||
|
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
||||||
|
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
||||||
|
</template>
|
||||||
|
<template v-slot:default>
|
||||||
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
|
</template>
|
||||||
|
</diy-index-page>
|
||||||
|
|
||||||
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
|
<view v-else class="bg-index"
|
||||||
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
:style="{ backgroundImage: backgroundUrlStyle, paddingTop: paddingTop, marginTop: marginTop }">
|
||||||
<template v-slot:components>
|
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
||||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
:followOfficialAccount="followOfficialAccount" />
|
||||||
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
</template>
|
</view>
|
||||||
<template v-slot:default>
|
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
|
||||||
</template>
|
|
||||||
</diy-index-page>
|
|
||||||
|
|
||||||
<view v-else class="bg-index"
|
<template v-if="adv.advshow != -1">
|
||||||
:style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
|
<view @touchmove.prevent.stop>
|
||||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||||
:followOfficialAccount="followOfficialAccount" />
|
<view class="small-bot">
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
||||||
</view>
|
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
||||||
|
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
||||||
|
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
||||||
|
:src="$util.img(item.imageUrl)" width="100%"></image>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class="small-bot-close" @click="closePopupWindow">
|
||||||
|
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="adv.advshow != -1">
|
<!-- 底部tabBar -->
|
||||||
<view @touchmove.prevent.stop>
|
<view class="page-bottom" v-if="openBottomNav">
|
||||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
<diy-bottom-nav @callback="callback" :name="name" />
|
||||||
<view class="small-bot">
|
</view>
|
||||||
<!-- <view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==1}}">
|
|
||||||
<view bindtap="adverclose">跳过</view>
|
|
||||||
<view class="time">{{clock}}s</view>
|
|
||||||
</view>
|
|
||||||
<view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==0}}">
|
|
||||||
<view class="time" style="line-height: 64rpx;">{{clock}}s</view>
|
|
||||||
</view> -->
|
|
||||||
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
|
||||||
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
|
||||||
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
|
||||||
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
|
||||||
:src="$util.img(item.imageUrl)" width="100%"></image>
|
|
||||||
<!-- <image bindtap="adverclose" class="slide-image" height="100%" src="{{item.imgurl}}" width="100%" wx:if="{{item.click==1}}"></image> -->
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<view bindtap="adverclose" class="small-bot-close" @click="closePopupWindow">
|
|
||||||
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- <view class="image-wrap">
|
|
||||||
<swiper class="swiper" style="width:100%;height: 1200rpx;" :autoplay="true" interval="3000" circular="true" :indicator-dots="true" indicator-color="#000" indicator-active-color="red">
|
|
||||||
<swiper-item class="swiper-item" v-for="(item, index) in adv.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)">
|
|
||||||
<view class="item">
|
|
||||||
<image :src="$util.img(item.imageUrl)" mode="aspectFit" :show-menu-by-longpress="true"/>
|
|
||||||
</view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
</view>
|
|
||||||
<text class="iconfont icon-round-close" @click="closePopupWindow"></text> -->
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 底部tabBar -->
|
<!-- 关注公众号弹窗 -->
|
||||||
<view class="page-bottom" v-if="openBottomNav">
|
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
||||||
<diy-bottom-nav @callback="callback" :name="name" />
|
<uni-popup ref="officialAccountsPopup" type="center">
|
||||||
</view>
|
<view class="official-accounts-wrap">
|
||||||
|
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
||||||
|
<text class="desc">关注了解更多</text>
|
||||||
|
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 关注公众号弹窗 -->
|
<!-- 收藏 -->
|
||||||
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||||
<uni-popup ref="officialAccountsPopup" type="center">
|
<view v-if="showTip" class="collectPopupWindow"
|
||||||
<view class="official-accounts-wrap">
|
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||||
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
||||||
<text class="desc">关注了解更多</text>
|
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||||
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
</view>
|
||||||
</view>
|
</uni-popup>
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 收藏 -->
|
<!-- 选择门店弹出框 -->
|
||||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
<view @touchmove.prevent.stop class="choose-store">
|
||||||
<view v-if="showTip" class="collectPopupWindow"
|
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
||||||
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
<view class="choose-store-popup">
|
||||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
||||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
<view class="position-wrap">
|
||||||
</view>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
</uni-popup>
|
<text class="address">{{ currentPosition }}</text>
|
||||||
|
<view class="reposition" @click="reposition"
|
||||||
<!-- 选择门店弹出框,定位当前位置,展示最近的一个门店 -->
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<view @touchmove.prevent.stop class="choose-store">
|
<text class="iconfont icon-dingwei"></text>
|
||||||
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
<text>重新定位</text>
|
||||||
<view class="choose-store-popup">
|
</view>
|
||||||
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
</view>
|
||||||
<view class="position-wrap">
|
<view class="store-wrap" v-if="nearestStore">
|
||||||
<text class="iconfont icon-dizhi"></text>
|
<text class="tag">当前门店</text>
|
||||||
<text class="address">{{ currentPosition }}</text>
|
<view class="store-name">{{ nearestStore.store_name }}</view>
|
||||||
<view class="reposition" @click="reposition"
|
<view class="address">{{ nearestStore.show_address }}</view>
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
<view class="distance" v-if="nearestStore.distance">
|
||||||
<text class="iconfont icon-dingwei"></text>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
<text>重新定位</text>
|
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
||||||
</view>
|
nearestStore.distance *
|
||||||
</view>
|
1000 +
|
||||||
<view class="store-wrap" v-if="nearestStore">
|
'm' }}</text>
|
||||||
<text class="tag">当前门店</text>
|
</view>
|
||||||
<view class="store-name">{{ nearestStore.store_name }}</view>
|
</view>
|
||||||
<view class="address">{{ nearestStore.show_address }}</view>
|
<button type="primary" @click="enterStore">确认进入</button>
|
||||||
<view class="distance" v-if="nearestStore.distance">
|
<view class="other-store" @click="chooseOtherStore"
|
||||||
<text class="iconfont icon-dizhi"></text>
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
<text>选择其他门店</text>
|
||||||
nearestStore.distance *
|
<text class="iconfont icon-right"></text>
|
||||||
1000 +
|
</view>
|
||||||
'm' }}</text>
|
</view>
|
||||||
</view>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
<button type="primary" @click="enterStore">确认进入</button>
|
<hover-nav :need="true"></hover-nav>
|
||||||
<view class="other-store" @click="chooseOtherStore"
|
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
||||||
<text>选择其他门店</text>
|
<ns-login ref="login"></ns-login>
|
||||||
<text class="iconfont icon-right"></text>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
<hover-nav :need="true"></hover-nav>
|
|
||||||
<!-- 隐私协议 -->
|
|
||||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
|
||||||
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
|
||||||
<ns-login ref="login"></ns-login>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
import diyJs from '@/common/js/diy.js';
|
import diyJs from '@/common/js/diy.js';
|
||||||
import scroll from '@/common/js/scroll-view.js';
|
import scroll from '@/common/js/scroll-view.js';
|
||||||
import indexJs from './public/js/index.js';
|
import indexJs from './public/js/index.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [diyJs, scroll, indexJs]
|
mixins: [diyJs, scroll, indexJs],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
diyData: { global: {}, value: null },
|
||||||
|
followOfficialAccount: {},
|
||||||
|
wechatQrcode: '',
|
||||||
|
adv: { advshow: -1, list: [] },
|
||||||
|
// ❌ 不要定义 siteInfo、bgUrl,除非你明确知道它们不会冲突
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
// ✅ 安全获取 bgUrl(用于 diy-index-page 的 prop)
|
||||||
|
safeBgUrl() {
|
||||||
|
// 优先取全局配置中的 bgUrl,没有则用组件自己的 bgUrl(如有),否则为空
|
||||||
|
return this.diyData?.global?.bgUrl || this.bgUrl || '';
|
||||||
|
},
|
||||||
|
|
||||||
|
// ✅ 安全生成 background-image 样式字符串(用于 fallback 区域)
|
||||||
|
backgroundUrlStyle() {
|
||||||
|
const url = this.diyData?.global?.bgUrl || this.bgUrl || '';
|
||||||
|
return url ? `url(${url})` : 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 如果你的 mixin 中已经处理了数据加载,这里可以留空
|
||||||
|
// 否则建议在 created/mounted 中初始化默认值或请求数据
|
||||||
|
created() {
|
||||||
|
// 可选:如果 mixin 没有初始化 diyData,这里再兜底一次
|
||||||
|
if (!this.diyData) {
|
||||||
|
this.diyData = { global: {}, value: null };
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -162,85 +170,86 @@ export default {
|
|||||||
@import './public/css/index.scss';
|
@import './public/css/index.scss';
|
||||||
|
|
||||||
.small-bot {
|
.small-bot {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 122;
|
z-index: 122;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot swiper {
|
.small-bot swiper {
|
||||||
width: 560rpx;
|
width: 560rpx;
|
||||||
height: 784rpx;
|
height: 784rpx;
|
||||||
margin: 120rpx auto 0;
|
margin: 120rpx auto 0;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot swiper .slide-image {
|
.small-bot swiper .slide-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot-close {
|
.small-bot-close {
|
||||||
width: 66rpx;
|
width: 66rpx;
|
||||||
height: 66rpx;
|
height: 66rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 64rpx;
|
line-height: 64rpx;
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
margin: 30rpx auto 0;
|
margin: 30rpx auto 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot-close i {
|
.small-bot-close i {
|
||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.swiper ::v-deep .uni-swiper-dots-horizontal {
|
.swiper /deep/ .uni-swiper-dots-horizontal {
|
||||||
left: 40%;
|
left: 40%;
|
||||||
bottom: 40px
|
bottom: 40px
|
||||||
}
|
}
|
||||||
|
|
||||||
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.choose-store>>>.goodslist-uni-popup-box {
|
.choose-store>>>.goodslist-uni-popup-box {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .diy-index-page .uni-popup .uni-popup__wrapper-box {
|
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .placeholder {
|
/deep/ .placeholder {
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep ::-webkit-scrollbar {
|
/deep/::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
max-height: unset !important;
|
max-height: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .mescroll-totop {
|
/deep/ .mescroll-totop {
|
||||||
/* #ifdef H5 */
|
/* #ifdef H5 */
|
||||||
right: 28rpx !important;
|
right: 28rpx !important;
|
||||||
bottom: 200rpx !important;
|
bottom: 200rpx !important;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
right: 27rpx !important;
|
right: 27rpx !important;
|
||||||
bottom: 180rpx !important;
|
bottom: 180rpx !important;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user