feat(ns-login): 增加隐私条款及用户服务协议

This commit is contained in:
2026-01-06 11:16:00 +08:00
parent afd002fad3
commit d9f0d1987e
21 changed files with 224 additions and 171 deletions

View File

@@ -2,7 +2,7 @@
<view>
<!-- 完善会员资料 -->
<view @touchmove.prevent.stop class="complete-info-popup">
<uni-popup ref="completeInfoPopup" type="bottom" :maskClick="false">
<uni-popup ref="completeInfoPopup" type="center" :maskClick="false">
<view class="complete-info-wrap">
<!-- #ifdef H5 -->
<template v-if="forceBindingMobileControl">
@@ -32,21 +32,51 @@
<!-- #ifdef MP -->
<view class="head">
<text class="title">
获取您的昵称头像
<template v-if="forceBindingMobileControl">
手机号
</template>
</text>
<text class="title">欢迎来到 {{ site_name }}</text>
<text class="color-tip tips">
获取用户头像昵称
<template v-if="forceBindingMobileControl">
手机号
</template>
完善个人资料主要用于向用户提供具有辨识度的用户中心界面
<template>{{ forceBindingMobileControl ? '使用手机号登录,' : '注册登录,' }}</template>
获得订单售后等服务
</text>
<text class="iconfont icon-close color-tip" @click="cancelCompleteInfo"></text>
</view>
<!-- 协议勾选 -->
<view style="display: flex;">
<view
class="iconfont"
:class="isAgree ? 'icon-fuxuankuang1 color-base-text' : 'icon-fuxuankuang2'"
@click="isAgree = !isAgree"
></view>
<view style="text-align: left; margin-left: 10rpx; padding-top: 2rpx; font-size: 28rpx;">
我同意
<text style="color: #4395ff;" @click="tourl('/pages_tool/agreement/contenr?type=0')">隐私条款</text>
<text style="color: #4395ff;" @click="tourl('/pages_tool/agreement/contenr?type=1')">用户服务协议</text>
</view>
</view>
<!-- 手机号授权按钮 -->
<block v-if="isAgree">
<button
class="auth-login save-btn border-0"
style="border: none;"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
<text style="color: #fff; font-size: 30rpx;">同意隐私协议并授权手机号</text>
</button>
</block>
<block v-else>
<button class="auth-login save-btn border-0" style="border: none;" @click="authno">
<text style="color: #fff; font-size: 30rpx;">授权手机号码</text>
</button>
</block>
<view @click="closeLogin" style="font-size: 30rpx; color: #888; text-align: center; padding-top: 10rpx;">
暂不登录
</view>
<!-- 昵称和头像模式 -->
<template v-if="enableNickAndAvatar">
<!-- #ifdef MP-WEIXIN -->
<view class="item-wrap">
<text class="label">头像</text>
@@ -79,6 +109,7 @@
maxlength="50" />
</view>
<!-- #endif -->
<view class="item-wrap" v-if="forceBindingMobileControl">
<text class="label">手机号</text>
<button open-type="getPhoneNumber" :plain="true" class="auth-login border-0"
@@ -88,15 +119,14 @@
</button>
</view>
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">保存</button>
</template>
<!-- #endif -->
</view>
</uni-popup>
</view>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
<register-reward ref="registerReward"></register-reward>
</view>
@@ -113,6 +143,10 @@ export default {
name: 'ns-login',
data() {
return {
// 是否开启昵称和头像
enableNickAndAvatar: false,
// 协议勾选
isAgree: false,
url: '',
registerConfig: {},
avatarUrl: '', // 头像预览路径
@@ -142,7 +176,8 @@ export default {
authMobileData: {
iv: '',
encryptedData: ''
}
},
site_name: ''
};
},
options: {
@@ -172,13 +207,10 @@ export default {
if (this.formData.mobile.length == 0) return true;
// #ifdef H5
// 验证码
if (this.isOpenCaptcha == 1 && this.formData.vercode.length == 0) return true;
// 动态码
if (this.formData.dynacode.length == 0) return true;
// #endif
}
return false;
@@ -189,7 +221,25 @@ export default {
else return false;
}
},
created() {
const siteInfo = uni.getStorageSync('siteInfo');
if (siteInfo) {
this.site_name = siteInfo.site_name;
}
},
methods: {
// 同意协议
authno() {
if (!this.isAgree) {
this.$util.showToast({ title: '请确认相关协议' });
}
},
// 关闭登录
closeLogin() {
this.$refs.completeInfoPopup.close();
},
// 获取注册配置
getRegisterConfig(callback = null) {
this.$api.sendRequest({
@@ -202,6 +252,8 @@ export default {
}
});
},
// 打开弹窗
open(url) {
if (url) this.url = url;
// #ifdef MP
@@ -229,6 +281,7 @@ export default {
this.toLogin();
// #endif
},
// 跳转去登录页
toLogin() {
if (this.url) this.$util.redirectTo('/pages_tool/login/login', {
@@ -236,13 +289,19 @@ export default {
});
else this.$util.redirectTo('/pages_tool/login/login');
},
// 取消完善信息
cancelCompleteInfo() {
if (this.$refs.completeInfoPopup) this.$refs.completeInfoPopup.close();
this.$store.commit('setBottomNavHidden', false); // 显示底部导航
},
// 昵称失焦
blurNickName(e) {
if (e.detail.value) this.nickName = e.detail.value;
},
// 选择头像
onChooseAvatar(e) {
this.avatarUrl = e.detail.avatarUrl;
uni.getFileSystemManager().readFile({
@@ -250,7 +309,6 @@ export default {
encoding: 'base64', //编码格式
success: res => {
let base64 = 'data:image/jpeg;base64,' + res.data; //不加上这串字符,在页面无法显示的哦
this.$api.uploadBase64({
base64,
success: res => {
@@ -271,6 +329,8 @@ export default {
}
});
},
// 打开完善信息弹窗
openCompleteInfoPop() {
this.getRegisterConfig();
@@ -283,6 +343,7 @@ export default {
});
this.$store.commit('setBottomNavHidden', true); //隐藏底部导航
},
// 获取前台登录验证码开关配置
getCaptchaConfig() {
this.$api.sendRequest({
@@ -295,6 +356,7 @@ export default {
}
});
},
// 获取验证码
getCaptcha() {
this.$api.sendRequest({
@@ -310,6 +372,7 @@ export default {
}
});
},
// 发送手机动态码
sendMobileCode() {
if (this.dynacodeData.seconds != 120 || this.dynacodeData.isSend) return;
@@ -371,6 +434,8 @@ export default {
}
});
},
// 刷新动态码数据
refreshDynacodeData() {
this.getCaptcha();
clearInterval(this.dynacodeData.timer);
@@ -381,6 +446,8 @@ export default {
isSend: false
};
},
// 表单验证
verify(data) {
let rule = [{
@@ -415,6 +482,7 @@ export default {
return false;
}
},
// 微信公众号强制绑定手机号
forceBindMobile() {
let authData = uni.getStorageSync('authInfo');
@@ -462,13 +530,16 @@ export default {
}
});
},
// 微信小程序获取手机号
getPhoneNumber(e) {
console.log(e)
if (e.detail.errMsg == 'getPhoneNumber:ok') {
let authData = uni.getStorageSync('authInfo');
if (authData) Object.assign(this.authMobileData, authData, e.detail);
if (uni.getStorageSync('source_member')) this.authMobileData.source_member = uni.getStorageSync('source_member');
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const authInfo = uni.getStorageSync('authInfo');
if (authInfo) { Object.assign(this.authMobileData, authInfo, e.detail);
}
if (uni.getStorageSync('source_member')) {
this.authMobileData.source_member = uni.getStorageSync('source_member');
}
this.$api.sendRequest({
url: '/api/tripartite/getPhoneNumber',
@@ -476,6 +547,9 @@ export default {
success: res => {
if (res.code >= 0) {
this.formData.mobile = res.data.mobile;
if (!this.enableNickAndAvatar) { // 不开启昵称和头像绑定,直接保存手机号
this.saveMp();
}
} else {
this.formData.mobile = '';
this.$util.showToast({
@@ -490,6 +564,7 @@ export default {
})
}
},
// 微信小程序强制绑定手机号
bindMobile() {
let data = this.authMobileData;
@@ -521,9 +596,8 @@ export default {
}
});
},
/**
* 授权登录
*/
// 授权登录
authLogin(data, type = 'authLogin') {
uni.showLoading({
title: '登录中'
@@ -571,7 +645,8 @@ export default {
}
});
},
// 微信公众号,强制绑定手机号,验证
// H5保存:微信公众号,强制绑定手机号,验证
saveH5() {
if (this.$util.isWeiXin() && this.forceBindingMobileControl) {
let data = {
@@ -587,24 +662,35 @@ export default {
}
this.forceBindMobile();
},
// 微信小程序保存数据
saveMp() {
if (this.nickName.length == 0) {
this.$util.showToast({
title: '请输入昵称'
});
if (this.formData.mobile === '') {
this.$util.showToast({ title: '请授权您的手机号码' });
return;
}
let authData = uni.getStorageSync('authInfo');
if (authData) Object.assign(authData, {
if (this.nickName.length == 0 && this.enableNickAndAvatar) {
this.$util.showToast({ title: '请输入昵称' });
return;
}
let authInfo = uni.getStorageSync('authInfo');
if (authInfo) {
Object.assign(authInfo, {
nickName: this.nickName,
avatarUrl: this.headImg
});
uni.setStorageSync('authInfo', authData);
uni.setStorageSync('authInfo', authInfo);
}
if (this.forceBindingMobileControl) this.bindMobile();
else this.authLogin(authData);
if (this.forceBindingMobileControl) {
this.bindMobile();
} else {
this.authLogin(authInfo);
}
},
// #ifdef MP-ALIPAY
aliappGetUserinfo() {
my.getOpenUserInfo({
@@ -646,6 +732,8 @@ export default {
});
},
// #endif
// 获取会员信息
getMemberInfo() {
this.$api.sendRequest({
url: '/api/member/info',
@@ -656,12 +744,17 @@ export default {
}
}
});
},
// 跳转页面
tourl(url) {
this.$util.redirectTo(url);
}
}
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.complete-info-popup {
.complete-info-wrap {
background: #fff;
@@ -669,16 +762,16 @@ export default {
.head {
position: relative;
border-bottom: 2rpx solid $color-line;
padding-bottom: 20rpx;
text-align: center;
.title {
font-size: $font-size-toolbar;
font-size: 30rpx;
display: block;
}
.tips {
font-size: $font-size-base;
font-size: 28rpx;
display: block;
}
@@ -691,19 +784,19 @@ export default {
height: 56rpx;
line-height: 56rpx;
text-align: right;
font-size: $font-size-toolbar;
font-weight: bold;
font-size: 32rpx;
font-weight: 700;
}
}
.item-wrap {
border-bottom: 2rpx solid $color-line;
border-bottom: 2rpx solid #eee;
display: flex;
align-items: center;
padding: 16rpx 0;
.label {
font-size: $font-size-toolbar;
font-size: 32rpx;
margin-right: 40rpx;
width: 100rpx;
}
@@ -717,7 +810,7 @@ export default {
text-align: left;
display: flex;
align-items: center;
font-size: $font-size-toolbar;
font-size: 32rpx;
border: none;
image {
@@ -726,27 +819,27 @@ export default {
border-radius: 10rpx;
overflow: hidden;
}
}
.iconfont {
flex: 1;
text-align: right;
font-size: $font-size-tag;
font-size: 24rpx;
}
}
input {
flex: 1;
height: 80rpx;
box-sizing: border-box;
font-size: $font-size-toolbar;
font-size: 32rpx;
}
.send {
border: 2rpx solid $base-color;
border: 2rpx solid var(--base-color);
height: 60rpx;
line-height: 60rpx;
border-radius: 60rpx;
font-size: $font-size-tag;
font-size: 24rpx;
text-align: center;
padding: 0 40rpx;
}
@@ -765,27 +858,27 @@ export default {
}
.save-btn {
width: 280rpx;
width: 100%;
height: 90rpx;
line-height: 90rpx;
background-color: #07c160;
color: #fff;
margin: 40rpx auto 20rpx;
border-radius: 50rpx;
}
}
}
</style>
<style scoped>
/deep/ .reward-popup .uni-popup__wrapper-box {
&.reward-popup .uni-popup__wrapper-box {
background: none !important;
max-width: unset !important;
max-height: unset !important;
overflow: unset !important;
}
.complete-info-popup /deep/ .uni-popup__wrapper.bottom,
.complete-info-popup /deep/ .uni-popup__wrapper.bottom .uni-popup__wrapper-box {
&.uni-popup__wrapper.bottom,
&.uni-popup__wrapper.bottom .uni-popup__wrapper-box {
border-top-left-radius: 30rpx !important;
border-top-right-radius: 30rpx !important;
}
}
</style>

View File

@@ -358,10 +358,8 @@
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -12,10 +12,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
<!-- 底部tabBar -->
<view id="tab-bar">

View File

@@ -513,10 +513,8 @@
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -294,10 +294,8 @@
</uni-drawer>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
<!-- 底部tabBar -->
<view id="tab-bar">

View File

@@ -124,10 +124,8 @@
</uni-popup>
</view>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -35,10 +35,8 @@
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -308,10 +308,8 @@
</uni-drawer>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -220,10 +220,8 @@
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>

View File

@@ -127,10 +127,8 @@
</view>
</uni-drawer>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -253,10 +253,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>

View File

@@ -17,10 +17,8 @@
</view>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -26,10 +26,8 @@
</block>
</mescroll-uni>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -16,10 +16,8 @@
</mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -73,10 +73,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -30,10 +30,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -7,10 +7,8 @@
</view>
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -10,10 +10,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -8,10 +8,8 @@
<loading-cover ref="loadingCover"></loading-cover>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -20,10 +20,8 @@
</block>
</mescroll-uni>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>

View File

@@ -3,10 +3,8 @@
<view class="iconfont iconshang navigate-back" @click="navigateBack"></view>
<web-view :src="src"></web-view>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>