forked from zhongyuanhaiju/uniapp
添加:注册流程重构,未注册不能直接登录,必须进行注册流程,注册前必须填写承诺书并且同意。
This commit is contained in:
parent
a8d5d0a513
commit
30a0d2979c
|
|
@ -1,14 +1,14 @@
|
|||
var config = {
|
||||
// api请求地址
|
||||
baseUrl: 'https://zyhj.zoomtk.com/',
|
||||
baseUrl: 'https://miaogou.cdlfjy.com/',
|
||||
// 图片域名
|
||||
imgDomain: 'https://zyhj.zoomtk.com/',
|
||||
imgDomain: 'https://miaogou.cdlfjy.com/',
|
||||
// H5端域名
|
||||
h5Domain: 'https://zyhj.zoomtk.com/',
|
||||
h5Domain: 'https://miaogou.cdlfjy.com/',
|
||||
// 腾讯地图key
|
||||
mpKey: '',
|
||||
//客服地址
|
||||
webSocket : 'https://zyhj.zoomtk.com/',
|
||||
webSocket : 'https://miaogou.cdlfjy.com/',
|
||||
//本地端主动给服务器ping的时间, 0 则不开启 , 单位秒
|
||||
pingInterval: 1500
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,105 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view @touchmove.prevent.stop class="new-complete-info-popup">
|
||||
<uni-popup ref="completeInfoPopup" type="center" :maskClick="true" @change="popupChange">
|
||||
<view class="new-complete-info-wrap">
|
||||
<!--登录主要内容-->
|
||||
<view class="login-content">
|
||||
<!--登录注册按钮-->
|
||||
<view class="login-buttons">
|
||||
<button class="mini-btn" type="default" size="mini" @click="promiseRegisterShow">我要注册</button>
|
||||
<button class="mini-btn" type="primary" size="mini" @click="promiseLogin">我要登录</button>
|
||||
</view>
|
||||
<!-- 取消 -->
|
||||
<view class="login-cancel-button">
|
||||
<button class="mini-btn" type="default" size="mini" @click="$refs.completeInfoPopup.close()">取消</button>
|
||||
</view>
|
||||
</view>
|
||||
<!--小程序授权信息-->
|
||||
<view @touchmove.prevent.stop class="complete-info-popup">
|
||||
<uni-popup ref="subCompleteInfoPopup" type="bottom" :maskClick="true">
|
||||
<view class="complete-info-wrap">
|
||||
<view class="head">
|
||||
<text class="title">
|
||||
获取您的昵称、头像
|
||||
<template v-if="forceBindingMobileControl">
|
||||
、手机号
|
||||
</template>
|
||||
</text>
|
||||
<text class="color-tip tips">
|
||||
获取用户头像、昵称
|
||||
<template v-if="forceBindingMobileControl">
|
||||
、手机号
|
||||
</template>
|
||||
完善个人资料,主要用于向用户提供具有辨识度的用户中心界面
|
||||
</text>
|
||||
<text class="iconfont icon-close color-tip" @click="cancelCompleteInfo"></text>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">头像</text>
|
||||
<button open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image :src="avatarUrl ? avatarUrl : $util.getDefaultImage().head" @error="avatarUrl = $util.getDefaultImage().head" mode="aspectFill"></image>
|
||||
<text class="iconfont icon-right color-tip"></text>
|
||||
</button>
|
||||
</view>
|
||||
<view class="item-wrap">
|
||||
<text class="label">昵称</text>
|
||||
<input type="nickname" placeholder="请输入昵称" v-model="nickName" @blur="blurNickName" maxlength="50" />
|
||||
</view>
|
||||
<view class="item-wrap" v-if="forceBindingMobileControl">
|
||||
<text class="label">手机号</text>
|
||||
<button open-type="getPhoneNumber" class="auth-login" @getphonenumber="getPhoneNumber">
|
||||
<text class="mobile" v-if="formData.mobile">{{ formData.mobile }}</text>
|
||||
<text class="color-base-text" v-else>获取手机号</text>
|
||||
</button>
|
||||
</view>
|
||||
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">保存</button>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<!--注册时 承诺书填写弹框-->
|
||||
<view @touchmove.prevent.stop class="complete-info-popup">
|
||||
<uni-popup ref="registerPopup" type="bottom" :maskClick="true">
|
||||
<view class="complete-info-wrap">
|
||||
<view class="head">
|
||||
<!--承诺书相关操作-->
|
||||
<view class="promise-block">
|
||||
<textarea v-model="promise_text" class="promise-textarea" placeholder-style="color: #e04242" placeholder="请输入以下承诺内容!" auto-height focus/>
|
||||
<view class="promise-content">
|
||||
<view class="promise-text">
|
||||
<span class="promise-text-title">承诺内容:</span>
|
||||
{{ registerConfig.promise }}
|
||||
<span class="promise-copy-button" @click="$util.copy(registerConfig.promise)">[复制]</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--同意协议-->
|
||||
<view class="agreement">
|
||||
<checkbox-group @change="checkboxChange">
|
||||
<label>
|
||||
<checkbox value="agree" style="transform: scale(0.8)"/>同意并且接受如上段落的注册协议
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<!--改变按钮-->
|
||||
<text class="iconfont icon-close color-tip" @click="$refs.registerPopup.close()"></text>
|
||||
</view>
|
||||
<!--确认按钮-->
|
||||
<button type="primary" class="save-btn" @click="promiseRegister">注册</button>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<!-- 完善会员资料 -->
|
||||
<view @touchmove.prevent.stop class="complete-info-popup">
|
||||
<uni-popup ref="completeInfoPopup" type="bottom" :maskClick="false">
|
||||
<uni-popup ref="completeInfoPopup" type="bottom" :maskClick="true">
|
||||
<view class="complete-info-wrap">
|
||||
<!-- #ifdef H5 -->
|
||||
<template v-if="forceBindingMobileControl">
|
||||
|
|
@ -29,7 +126,7 @@
|
|||
<button type="default" class="save-btn" @click="saveH5" :disabled="isDisabled">保存</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
|
||||
<!-- #ifdef MP-QQ || MP-BAIDU -->
|
||||
<view class="head">
|
||||
<text class="title">
|
||||
获取您的昵称、头像
|
||||
|
|
@ -69,7 +166,10 @@
|
|||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
|
||||
<!--注册内容-->
|
||||
<register-reward ref="registerReward"></register-reward>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -119,11 +219,17 @@ export default {
|
|||
authMobileData: {
|
||||
iv: '',
|
||||
encryptedData: ''
|
||||
}
|
||||
},
|
||||
// 承诺登录相关内容
|
||||
promise_text: '',// 用户输入的承诺书
|
||||
request_type: 'login',// 请求场景 register=注册 login=登录
|
||||
popup_show: false,
|
||||
is_checked: false,
|
||||
};
|
||||
},
|
||||
options: { styleIsolation: 'shared' },
|
||||
created() {
|
||||
// 其他登录方式
|
||||
this.getRegisterConfig();
|
||||
// #ifdef H5
|
||||
if (!uni.getStorageSync('token')) this.getCaptchaConfig();
|
||||
|
|
@ -182,6 +288,13 @@ export default {
|
|||
});
|
||||
},
|
||||
open(url) {
|
||||
// 判断:如果登录框未弹出 则弹出登录框
|
||||
if(!this.popup_show){
|
||||
this.$refs.completeInfoPopup.open();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (url) this.url = url;
|
||||
// #ifdef MP-WEIXIN
|
||||
this.getCode((authData) => {
|
||||
|
|
@ -209,8 +322,14 @@ export default {
|
|||
else this.$util.redirectTo('/pages_tool/login/login');
|
||||
},
|
||||
cancelCompleteInfo() {
|
||||
if (this.$refs.completeInfoPopup) this.$refs.completeInfoPopup.close();
|
||||
this.$store.commit('setBottomNavHidden', false); // 显示底部导航
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$refs.subCompleteInfoPopup.close()
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
if (this.$refs.completeInfoPopup) this.$refs.completeInfoPopup.close();
|
||||
this.$store.commit('setBottomNavHidden', false); // 显示底部导航
|
||||
// #endif
|
||||
},
|
||||
blurNickName(e) {
|
||||
if (e.detail.value) this.nickName = e.detail.value;
|
||||
|
|
@ -483,10 +602,19 @@ export default {
|
|||
key: 'authInfo',
|
||||
data: data
|
||||
});
|
||||
if (uni.getStorageSync('source_member')) data.source_member = uni.getStorageSync('source_member');
|
||||
|
||||
if (uni.getStorageSync('source_member')) data.source_member = uni.getStorageSync('source_member');
|
||||
//let url = type === 'authLogin' ? '/api/login/auth' : '/api/login/authonlylogin';
|
||||
let url = '/api/login/auth';
|
||||
// 获取登录接口
|
||||
if(this.registerConfig.promise){
|
||||
data.promise_text = this.promise_text;
|
||||
data.is_promise = 1;
|
||||
data.request_type = this.request_type;
|
||||
url = '/api/login/auth';
|
||||
}
|
||||
// 请求登录
|
||||
this.$api.sendRequest({
|
||||
url: type == 'authLogin' ? '/api/login/auth' : '/api/login/authonlylogin',
|
||||
url: url,
|
||||
data,
|
||||
success: res => {
|
||||
if (res.code >= 0) {
|
||||
|
|
@ -497,13 +625,18 @@ export default {
|
|||
this.$store.dispatch('getCartNumber');
|
||||
this.$store.commit('setToken', res.data.token);
|
||||
if (res.data.is_register) this.$refs.registerReward.open();
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$refs.completeInfoPopup.close()
|
||||
// #endif
|
||||
this.cancelCompleteInfo();
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
} else if (res.code == -10016) {
|
||||
}
|
||||
else if (res.code == -10016) {
|
||||
let register_error = res.message;
|
||||
this.$api.sendRequest({
|
||||
url: '/api/register/config',
|
||||
|
|
@ -526,6 +659,10 @@ export default {
|
|||
} else {
|
||||
uni.hideLoading();
|
||||
this.$util.showToast({ title: res.message });
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
this.cancelCompleteInfo()
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
|
|
@ -553,18 +690,52 @@ export default {
|
|||
});
|
||||
return;
|
||||
}
|
||||
let authData = uni.getStorageSync('authInfo');
|
||||
if (authData) Object.assign(authData, {nickName: this.nickName, avatarUrl: this.headImg});
|
||||
let authData = uni.getStorageSync('authInfo');
|
||||
if (authData) Object.assign(authData, {nickName: this.nickName, avatarUrl: this.headImg});
|
||||
uni.setStorageSync('authInfo', authData);
|
||||
|
||||
if (this.forceBindingMobileControl) this.bindMobile();
|
||||
else this.authLogin(authData);
|
||||
}
|
||||
},
|
||||
// 承诺书 登录
|
||||
promiseLogin(){
|
||||
this.request_type = 'login';
|
||||
this.getCode((authData) => {
|
||||
this.authLogin(authData);
|
||||
})
|
||||
},
|
||||
// 弹框状态改变
|
||||
popupChange(e){
|
||||
this.popup_show = e.show;
|
||||
},
|
||||
// 承诺书 注册 - 显示弹框
|
||||
promiseRegisterShow(){
|
||||
this.request_type = 'register';
|
||||
this.$refs.registerPopup.open()
|
||||
},
|
||||
// 承诺书 注册 - 申请注册
|
||||
promiseRegister(){
|
||||
// 判断:是否同意协议内容
|
||||
if(!this.is_checked){
|
||||
this.$util.showToast({ title: '请同意协议后进行后续操作!' });
|
||||
return false;
|
||||
}
|
||||
// 开始注册
|
||||
this.$refs.registerPopup.close()
|
||||
this.$refs.subCompleteInfoPopup.open();
|
||||
},
|
||||
// 同意协议状态变更
|
||||
checkboxChange(e){
|
||||
let values = e.detail.value;
|
||||
this.is_checked = values.includes('agree');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
//旧版登录
|
||||
.complete-info-popup {
|
||||
.complete-info-wrap {
|
||||
background: #fff;
|
||||
|
|
@ -669,6 +840,124 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
//新版登录
|
||||
.new-complete-info-popup{
|
||||
.new-complete-info-wrap{
|
||||
|
||||
.login-content{
|
||||
background: #e2ea00;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
margin: 0!important;
|
||||
padding: 0!important;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
.login-buttons{
|
||||
height: 160rpx;
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
align-content: center;
|
||||
}
|
||||
.mini-btn{
|
||||
display: block;
|
||||
width: 70vw;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 350rpx;
|
||||
}
|
||||
.mini-btn:nth-child(1){
|
||||
margin-bottom: 20rpx!important;
|
||||
}
|
||||
|
||||
.login-cancel-button{
|
||||
margin: 0!important;
|
||||
padding: 0!important;
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 100rpx;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.complete-info-popup{
|
||||
width: 100vw!important;
|
||||
.complete-info-wrap{
|
||||
width: calc(100vw - 80rpx)!important;
|
||||
|
||||
.head {
|
||||
position: relative;
|
||||
border-bottom: none;
|
||||
padding-top: 30rpx;
|
||||
|
||||
.promise-textarea{
|
||||
width: calc(100% - 20rpx);
|
||||
min-height: 300rpx;
|
||||
border: 1px solid #004cff;
|
||||
padding: 10rpx;
|
||||
}
|
||||
.promise-content{
|
||||
|
||||
.promise-text{
|
||||
color: #000000;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
.promise-text-title{
|
||||
color: #e04242;
|
||||
font-weight: 100;
|
||||
}
|
||||
}
|
||||
.promise-copy-button{
|
||||
font-size: 26rpx;
|
||||
color: #0e940d;
|
||||
font-weight: 100;
|
||||
}
|
||||
}
|
||||
.agreement{
|
||||
border: 1px solid #cccccc;
|
||||
padding: 10rpx 20rpx;
|
||||
margin-top: 20rpx;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
}
|
||||
.save-btn {
|
||||
width: 70%;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
margin: 20rpx auto;
|
||||
border-radius: 70rpx;
|
||||
}
|
||||
}
|
||||
/deep/ .goodslist-uni-popup-box{
|
||||
width: 100vw!important;
|
||||
}
|
||||
/deep/ .uni-popup__wrapper-box {
|
||||
background: none !important;
|
||||
max-width: unset !important;
|
||||
max-height: unset !important;
|
||||
overflow: unset !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<style scoped>
|
||||
/deep/ .reward-popup .uni-popup__wrapper-box {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx8bbb428472fccb07",
|
||||
"appid" : "wx886b46d12e1a234d",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"postcss" : false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue