Files
lucky_shop/pages_tool/member/index.vue

234 lines
6.3 KiB
Vue

<template>
<view :style="themeColor">
<view :style="pageStyle"
class="page-img">
<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="!isTabRootPage" />
</view>
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
:haveTopCategory="true" />
<ns-copyright v-show="isShowCopyRight" />
</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" />
<ns-copyright v-show="isShowCopyRight" />
<view class="foot">
<view class="item" @tap="tourl('/pages_tool/agreement/contenr?type=0')">{{
$lang('privacyPolicy') }}</view>
<view class="item" @tap="tourl('/pages_tool/agreement/contenr?type=1')">{{
$lang('registrationAgreement') }}</view>
</view>
<!-- 退出登录和账号注销按钮 -->
<view class="action-buttons" v-if="storeToken">
<view class="action-btn cancel-btn" v-if="isShowCancelButton"
@tap="cancellation">{{ $lang('cancellation') }}</view>
<view class="action-btn logout-btn" v-if="isShowLogoutButton"
@tap="logout">{{ $lang('logout') }}</view>
</view>
</view>
<template
v-if="diyData.global && diyData.global.popWindow && diyData.global.popWindow.count != -1 && diyData.global.popWindow.imageUrl">
<view @touchmove.prevent.stop>
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
<view class="image-wrap">
<image :src="$util.img(diyData.global.popWindow.imageUrl)" :style="popWindowStyle"
@tap="uniPopupWindowFn()" mode="aspectFit" show-menu-by-longpress/>
</view>
<text class="iconfont icon-round-close" @tap="closePopupWindow"></text>
</uni-popup>
</view>
</template>
<!-- 底部tabBar -->
<view id="tab-bar" :class="{ hide: bottomNavHidden }" v-if="openBottomNav">
<diy-bottom-nav @callback="callback" />
</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" show-menu-by-longpress/>
<text @tap="closeCollectPopupWindow">{{ $lang('member.index.iKnow') }}</text>
</view>
</uni-popup>
<ns-birthday-gift ref="birthdayGift"></ns-birthday-gift>
<ns-new-gift ref="nsNewGift"></ns-new-gift>
<hover-nav></hover-nav>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
</view>
</view>
</template>
<script>
import diyJs from '@/common/js/diy.js';
import scroll from '@/common/js/scroll-view.js';
import indexJs from './public/js/index.js';
import memberPublic from './public/js/member-public.js';
import nsBirthdayGift from '../_components/ns-birthday-gift/ns-birthday-gift.vue';
import nsNewGift from '../_components/ns-new-gift/ns-new-gift.vue';
export default {
components: {
nsBirthdayGift,
nsNewGift
},
mixins: [diyJs, scroll, indexJs, memberPublic],
computed: {
pageStyle() {
return {
backgroundColor: this.bgColor,
minHeight: this.openBottomNav ? 'calc(100vh - 55px)' : ''
};
},
globalCfg() {
return this.diyData?.global;
},
isShowCancelButton() {
return [1, undefined].includes(this.globalCfg?.isShowCancelButton?.[`${this.getAppType()}`]);
},
isShowLogoutButton() {
return [1, undefined].includes(this.globalCfg?.isShowLogoutButton?.[`${this.getAppType()}`]);
}
},
onLoad() {
this.$util.hideHomeButton();
},
onShow() {
this.$util.hideHomeButton();
},
// 覆写 mixin 的分享钩子:优先使用推荐码组件存储的分享数据
onShareAppMessage() {
try {
var shareDataStr = uni.getStorageSync('_recommendShareData');
if (shareDataStr) {
uni.removeStorageSync('_recommendShareData');
return JSON.parse(shareDataStr);
}
} catch(e) {}
return this.mpShareData?.appMessage;
},
onShareTimeline() {
try {
var shareDataStr = uni.getStorageSync('_recommendShareData');
if (shareDataStr) {
uni.removeStorageSync('_recommendShareData');
var d = JSON.parse(shareDataStr);
var query = '';
if (d.path && d.path.indexOf('?') >= 0) {
query = d.path.split('?')[1];
}
return { title: d.title, query: query, imageUrl: d.imageUrl || '' };
}
} catch(e) {}
return this.mpShareData?.timeLine;
},
methods: {
tourl(url) {
this.$util.redirectTo(url);
}
}
};
</script>
<style lang="scss">
@import '@/common/css/diy.scss';
.foot {
display: flex;
// position: absolute;
width: 100%;
margin-bottom: 40rpx;
.item {
width: 50%;
text-align: center;
// P0: 硬编码主色 → var(--main-color)
// 兼容: 微信小程序 / 鸿蒙元服务 — color 接受 var() 无问题
color: var(--main-color, #F4391c);
}
}
</style>
<style scoped>
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none !important;
}
::v-deep .diy-index-page .uni-popup .uni-popup__wrapper-box {
border-radius: 0;
}
.choose-store>>>.goodslist-uni-popup-box {
width: 80%;
}
::v-deep .placeholder {
height: 0;
}
::v-deep ::-webkit-scrollbar {
width: 0;
height: 0;
background-color: transparent;
display: none;
}
.hide {
display: none;
}
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
max-height: unset !important;
}
.action-buttons {
display: flex;
flex-direction: column;
align-items: center;
margin: 20rpx 30rpx 40rpx;
gap: 20rpx;
}
.action-btn {
width: 80%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
}
.logout-btn {
background-color: var(--main-color);
color: #fff;
border: 1rpx solid #ddd;
}
.cancel-btn {
background-color:var(--main-color);
color: #fff;
}
</style>