init
This commit is contained in:
226
pages/index/index.vue
Normal file
226
pages/index/index.vue
Normal file
@@ -0,0 +1,226 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }" class="page-img">
|
||||
<view class="site-info-box" v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
|
||||
<view class="site-info">
|
||||
<view class="img-box" v-if="siteInfo.logo_square">
|
||||
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="info-box" :style="{ color: '#ffffff' }">
|
||||
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
||||
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="dite-button" @click="officialAccountsOpen">关注公众号</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
|
||||
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="false"/>
|
||||
</view> -->
|
||||
|
||||
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl" :scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
||||
<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>
|
||||
|
||||
<view v-else class="bg-index" :style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
|
||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" :followOfficialAccount="followOfficialAccount"/>
|
||||
<ns-copyright v-show="isShowCopyRight"/>
|
||||
</view>
|
||||
|
||||
<template v-if="adv.advshow != -1">
|
||||
<view @touchmove.prevent.stop>
|
||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||
<view class="small-bot">
|
||||
<!-- <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">
|
||||
<diy-bottom-nav @callback="callback" :name="name"/>
|
||||
</view>
|
||||
|
||||
<!-- 关注公众号弹窗 -->
|
||||
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
||||
<uni-popup ref="officialAccountsPopup" type="center">
|
||||
<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>
|
||||
|
||||
<!-- 收藏 -->
|
||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||
<view v-if="showTip" class="collectPopupWindow" :style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit"/>
|
||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<!-- 选择门店弹出框,定位当前位置,展示最近的一个门店 -->
|
||||
<view @touchmove.prevent.stop class="choose-store">
|
||||
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
||||
<view class="choose-store-popup">
|
||||
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
||||
<view class="position-wrap">
|
||||
<text class="iconfont icon-dizhi"></text>
|
||||
<text class="address">{{ currentPosition }}</text>
|
||||
<view class="reposition" @click="reposition" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||
<text class="iconfont icon-dingwei"></text>
|
||||
<text>重新定位</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="store-wrap" v-if="nearestStore">
|
||||
<text class="tag">当前门店</text>
|
||||
<view class="store-name">{{ nearestStore.store_name }}</view>
|
||||
<view class="address">{{ nearestStore.show_address }}</view>
|
||||
<view class="distance" v-if="nearestStore.distance">
|
||||
<text class="iconfont icon-dizhi"></text>
|
||||
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' : nearestStore.distance * 1000 + 'm' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<button type="primary" @click="enterStore">确认进入</button>
|
||||
<view class="other-store" @click="chooseOtherStore" v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||
<text>选择其他门店</text>
|
||||
<text class="iconfont icon-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<hover-nav></hover-nav>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 小程序隐私协议 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
<!-- #endif -->
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue';
|
||||
import nsNavbar from '@/components/ns-navbar/ns-navbar.vue';
|
||||
import diyJs from '@/common/js/diy.js';
|
||||
import indexJs from './public/js/index.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uniPopup,
|
||||
nsNavbar
|
||||
},
|
||||
mixins: [diyJs, indexJs]
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/common/css/diy.scss';
|
||||
@import './public/css/index.scss';
|
||||
|
||||
|
||||
|
||||
.small-bot {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 122;
|
||||
}
|
||||
|
||||
.small-bot swiper {
|
||||
width: 560rpx;
|
||||
height: 784rpx;
|
||||
margin: 120rpx auto 0;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.small-bot swiper .slide-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.small-bot-close {
|
||||
width: 66rpx;
|
||||
height: 66rpx;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
line-height: 64rpx;
|
||||
font-size: 64rpx;
|
||||
color: #fff;
|
||||
margin: 30rpx auto 0;
|
||||
}
|
||||
|
||||
.small-bot-close i {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<style scoped>
|
||||
.swiper /deep/ .uni-swiper-dots-horizontal {
|
||||
left: 40%;
|
||||
bottom:40px
|
||||
}
|
||||
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.choose-store>>>.goodslist-uni-popup-box {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/deep/ .placeholder {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/deep/::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
background-color: transparent;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
</style>
|
||||
88
pages/index/public/css/index.scss
Normal file
88
pages/index/public/css/index.scss
Normal file
@@ -0,0 +1,88 @@
|
||||
.site-info-box {
|
||||
padding: 20rpx 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
width: calc(100% - 40rpx);
|
||||
z-index: 999;
|
||||
.site-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.img-box {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.info-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: #fff;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
text-align: left;
|
||||
width: 400rpx;
|
||||
text {
|
||||
display: -webkit-box;
|
||||
font-size: $font-size-tag;
|
||||
overflow: hidden;
|
||||
opacity: 0.8;
|
||||
white-space: normal;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
line-height: 1.4;
|
||||
&:nth-child(1) {
|
||||
width: 300rpx;
|
||||
font-weight: bold;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.dite-button {
|
||||
background-color: #fff;
|
||||
width: 180rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
border-radius: 66rpx;
|
||||
color: $base-color;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
|
||||
.official-accounts-inner /deep/ .uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
|
||||
overflow: inherit;
|
||||
}
|
||||
.official-accounts-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 30rpx;
|
||||
.content {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
.desc {
|
||||
margin-top: 10rpx;
|
||||
font-size: $font-size-tag;
|
||||
color: $color-tip;
|
||||
}
|
||||
.close {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: -130rpx;
|
||||
transform: translateX(-50%);
|
||||
z-index: 99;
|
||||
color: #fff;
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
41
pages/index/public/js/index.js
Normal file
41
pages/index/public/js/index.js
Normal file
@@ -0,0 +1,41 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
wechatQrcode: '', // 公众号二维码
|
||||
diyRoute: '/pages/index/index'
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
// #ifdef H5
|
||||
// H5地图选择位置回调数据
|
||||
if (option.module && option.module == 'locationPicker') {
|
||||
option.name = ''; // 清空地址
|
||||
}
|
||||
// #endif
|
||||
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
||||
|
||||
},
|
||||
onShow() {
|
||||
this.getFollowQrcode();
|
||||
},
|
||||
methods: {
|
||||
// 关注公众号
|
||||
getFollowQrcode() {
|
||||
if (!this.$util.isWeiXin()) return;
|
||||
this.$api.sendRequest({
|
||||
url: '/wechat/api/wechat/followqrcode',
|
||||
success: res => {
|
||||
if (res.code >= 0 && res.data) {
|
||||
this.wechatQrcode = res.data.qrcode;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
officialAccountsOpen() {
|
||||
this.$refs.officialAccountsPopup.open();
|
||||
},
|
||||
officialAccountsClose() {
|
||||
this.$refs.officialAccountsPopup.close();
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user