293 lines
7.6 KiB
Vue
293 lines
7.6 KiB
Vue
<template>
|
|
<view class="containerDEghTTorsp">
|
|
<view class="wrapperDEghTTorsp">
|
|
<view class="input-contentDEghTTorsp">
|
|
<view class="cu-form-group"
|
|
style="border-bottom: 2upx solid whitesmoke;margin-bottom: 20px;">
|
|
<view class="title text-black">手机号</view>
|
|
<input type="number" :value="phone" placeholder="请输入手机号" maxlength="11" data-key="phone"
|
|
@input="inputChangeDEghTTorsp" />
|
|
</view>
|
|
<view class="cu-form-group padding-right-xs"
|
|
style="border-bottom: 2upx solid whitesmoke;margin-bottom: 20px;">
|
|
<text class="title text-black">验证码</text>
|
|
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code"
|
|
@input="inputChangeDEghTTorsp" @confirm="startRegDEghTTorsp" />
|
|
<button class="send-msgDEghTTorsp" @click="sendMsgDEghTTorsp" :disabled="sending">{{ sendTime }}</button>
|
|
</view>
|
|
|
|
<view class="cu-form-group"
|
|
style="border-bottom: 2upx solid whitesmoke;margin-bottom: 20px;">
|
|
<text class="title text-black">设置密码</text>
|
|
<input type="password" :value="password" placeholder="请设置密码" placeholder-class="input-empty"
|
|
maxlength="20" minlength="6" data-key="password" @input="inputChangeDEghTTorsp" @confirm="startRegDEghTTorsp" />
|
|
</view>
|
|
<!-- <view class="cu-form-group"
|
|
style="border-bottom: 2upx solid whitesmoke;margin-bottom: 20px;"
|
|
v-if="required == '是'">
|
|
<text class="title text-black">邀请码</text>
|
|
<input type="" maxlength="6" :value="invitation" placeholder="请填写邀请码(必填)" data-key="invitation"
|
|
@input="inputChangeDEghTTorsp" @confirm="startRegDEghTTorsp" />
|
|
</view>
|
|
<view class="cu-form-group"
|
|
style="border-bottom: 2upx solid whitesmoke;margin-bottom: 20px;"
|
|
v-if="required == '否'">
|
|
<text class="title text-black">邀请码</text>
|
|
<input type="" maxlength="6" :value="invitation" placeholder="请填写邀请码(选填)" data-key="invitation"
|
|
@input="inputChangeDEghTTorsp" @confirm="startRegDEghTTorsp" />
|
|
</view> -->
|
|
</view>
|
|
<button class="confirm-btnDEghTTorsp" @click="startRegDEghTTorsp">立即注册</button>
|
|
<view class="footerDEghTTorsp">
|
|
<text @tap="isShowAgreeDEghTTorsp" class="cuIcon"
|
|
:class="showAgree ? 'cuIcon-radiobox' : 'cuIcon-round'">同意</text>
|
|
<!-- 协议地址 -->
|
|
<navigator url="/me/setting/mimi" open-type="navigate">《隐私政策》</navigator>
|
|
和
|
|
<navigator url="/me/setting/xieyi" open-type="navigate">《用户服务协议》</navigator>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
var _this;
|
|
export default {
|
|
data() {
|
|
return {
|
|
userName: '',
|
|
showAgree: false,
|
|
code: '',
|
|
phone: '',
|
|
password: '',
|
|
required: '否',
|
|
sending: false,
|
|
sendTime: '获取验证码',
|
|
count: 60,
|
|
relation: "",
|
|
state: '',
|
|
invitation: '',
|
|
platform: 'app',
|
|
sysPhone:1
|
|
}
|
|
},
|
|
onLoad() {
|
|
let a = this.$queue.getData("isEnable")
|
|
if (a) {
|
|
this.isEnable = a;
|
|
}
|
|
this.invitationMaDEghTTorsp();
|
|
// #ifdef APP-PLUS
|
|
switch (uni.getSystemInfoSync().platform) {
|
|
case 'android':
|
|
break;
|
|
case 'ios':
|
|
this.sysPhone = 2;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
// #endif
|
|
},
|
|
|
|
mounted() {
|
|
_this = this;
|
|
},
|
|
methods: {
|
|
// 注册邀请码必填
|
|
invitationMaDEghTTorsp() {
|
|
this.$Request.getT('/app/common/type/3').then(res => {
|
|
if (res.code == 0) {
|
|
this.required = res.data.value;
|
|
|
|
}
|
|
});
|
|
},
|
|
inputChangeDEghTTorsp(e) {
|
|
const key = e.currentTarget.dataset.key;
|
|
this[key] = e.detail.value;
|
|
},
|
|
countDown() {
|
|
const {
|
|
count
|
|
} = this;
|
|
if (count === 1) {
|
|
this.count = 60;
|
|
this.sending = false;
|
|
this.sendTime = '获取验证码';
|
|
} else {
|
|
this.count = count - 1;
|
|
this.sending = true;
|
|
this.sendTime = count - 1 + '秒后重新获取';
|
|
setTimeout(this.countDown.bind(this), 1000);
|
|
}
|
|
},
|
|
sendMsgDEghTTorsp() {
|
|
const {
|
|
phone
|
|
} = this;
|
|
if (!phone) {
|
|
this.$queue.showToast("请输入手机号");
|
|
} else if (phone.length !== 11) {
|
|
this.$queue.showToast("请输入正确的手机号");
|
|
} else {
|
|
this.$queue.showLoading("正在发送验证码...");
|
|
this.$Request.getT("/app/Login/sendMsg/" + phone + "/bindWx").then(res => {
|
|
if (res.code === 0) {
|
|
this.sending = true;
|
|
this.$queue.showToast('验证码发送成功请注意查收');
|
|
this.countDown();
|
|
uni.hideLoading();
|
|
} else {
|
|
console.log(JSON.stringify(res))
|
|
uni.hideLoading();
|
|
uni.showModal({
|
|
showCancel: false,
|
|
title: '短信发送失败',
|
|
content: res.msg ? res.msg : '请一分钟后再获取验证码',
|
|
});
|
|
}
|
|
});
|
|
}
|
|
},
|
|
isShowAgreeDEghTTorsp() {
|
|
//是否选择协议
|
|
_this.showAgree = !_this.showAgree;
|
|
},
|
|
startRegDEghTTorsp() {
|
|
if (this.phone.length != 11) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
position: 'bottom',
|
|
title: '手机号不正确'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.code.length != 6) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
position: 'bottom',
|
|
title: '验证码不正确'
|
|
});
|
|
return false;
|
|
}
|
|
if (!this.password) {
|
|
this.$queue.showToast('请设置密码');
|
|
return false;
|
|
}
|
|
|
|
if (this.password.length < 6) {
|
|
this.$queue.showToast('密码位数必须大于六位');
|
|
return false;
|
|
}
|
|
if (!_this.invitation && this.required == '是') {
|
|
this.$queue.showToast('请填写邀请码');
|
|
return false;
|
|
}
|
|
this.$queue.showLoading('登陆中...')
|
|
_this.isRotate = true;
|
|
let qdCodeion = '';
|
|
if (uni.getStorageSync('qdCodeion')) {
|
|
qdCodeion = uni.getStorageSync('qdCodeion')
|
|
}
|
|
console.error(_this.$queue.getData('weixinToken'))
|
|
console.error(_this.$queue.getData('unionid'))
|
|
console.error(_this.$queue.getData('weixinOpenid'))
|
|
this.$Request.postT("/app/Login/wxBindMobile", {
|
|
password: _this.password,
|
|
phone: _this.phone,
|
|
code: _this.code,
|
|
platform: _this.platform,
|
|
inviterCode: _this.invitation,
|
|
qdCode: qdCodeion,
|
|
sysPhone:_this.sysPhone,
|
|
token: _this.$queue.getData('weixinToken'),
|
|
unionid: _this.$queue.getData('unionid'),
|
|
wxOpenId: _this.$queue.getData("weixinOpenid")
|
|
}).then(res => {
|
|
console.log(JSON.stringify(res))
|
|
if (res.code === 0) {
|
|
this.$queue.setData("mobile", _this.phone);
|
|
this.$queue.setData("token", res.token);
|
|
this.$queue.setData("userId", res.user.userId);
|
|
uni.switchTab({
|
|
url: '/pages/index/index'
|
|
})
|
|
} else {
|
|
_this.isRotate = false;
|
|
uni.hideLoading();
|
|
uni.showModal({
|
|
showCancel: false,
|
|
title: '绑定失败',
|
|
content: res.msg,
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss'>
|
|
page {
|
|
height: 100%;
|
|
background: #FFFFFF !important;
|
|
}
|
|
|
|
.footerDEghTTorsp {
|
|
padding-left: 140upx;
|
|
margin-top: 32upx;
|
|
text-align: center;
|
|
display: flex;
|
|
color: #333;
|
|
}
|
|
|
|
.send-msgDEghTTorsp {
|
|
border-radius: 30px;
|
|
color: white;
|
|
height: 30px;
|
|
font-size: 10px;
|
|
line-height: 30px;
|
|
background: #5E81F9;
|
|
}
|
|
|
|
|
|
.containerDEghTTorsp {
|
|
padding-top: 32upx;
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.wrapperDEghTTorsp {
|
|
position: relative;
|
|
z-index: 90;
|
|
background: #FFFFFF;
|
|
padding-bottom: 20px;
|
|
}
|
|
|
|
|
|
.input-contentDEghTTorsp {
|
|
padding: 32upx 80upx;
|
|
}
|
|
|
|
|
|
.confirm-btnDEghTTorsp {
|
|
width: 600upx;
|
|
height: 80upx;
|
|
line-height: 80upx;
|
|
border-radius: 60upx;
|
|
margin-top: 32upx;
|
|
background: #5E81F9;
|
|
|
|
color: #fff;
|
|
font-size: 32upx;
|
|
|
|
&:after {
|
|
border-radius: 60px;
|
|
}
|
|
}
|
|
</style>
|