1
This commit is contained in:
parent
d169dca894
commit
d8dcbfa57c
31
pages.json
31
pages.json
@ -176,37 +176,6 @@
|
||||
"navigationBarTitleText": "模板"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/user/bindPhone",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定手机号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/forget",
|
||||
"style": {
|
||||
"navigationBarTitleText": "忘记密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/protocol",
|
||||
"style": {
|
||||
"navigationBarTitleText": "协议"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/register",
|
||||
"style": {
|
||||
"navigationBarTitleText": "注册"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/sdkDemo/common",
|
||||
"style": {
|
||||
|
@ -1,282 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<nav-bar title="绑定手机号"></nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="bindAccountBox">
|
||||
<image :src="logoUrl"></image>
|
||||
<view><image src="../../static/icon/bindingIcon.png"></image></view>
|
||||
<image src="../../static/icon/WeChatIcon.png"></image>
|
||||
</view>
|
||||
<view class="inputItem">
|
||||
<view class="title">*手机号</view>
|
||||
<view class="info"><input type="number" placeholder="请输入" v-model="phone" /></view>
|
||||
</view>
|
||||
<view class="inputItem">
|
||||
<view class="title">*验证码</view>
|
||||
<view class="info">
|
||||
<input type="number" placeholder="请输入" v-model="code" />
|
||||
<button @click="getCode">{{ codeText }}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="registeredBut bindAccountBut"><button @click="onSubmit">立即绑定</button></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var clear;
|
||||
import { mapState, mapMutations } from 'vuex';
|
||||
import socket from '@/config/socket';
|
||||
// #ifdef H5
|
||||
import {publicShare} from '@/config/utils';
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
logoUrl: '',
|
||||
readonly: false,
|
||||
codeText: '获取验证码',
|
||||
phone: '',
|
||||
code: ''
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
this.logoUrl = this.$base.logoUrl;
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo','chatScenesInfo'])
|
||||
},
|
||||
//页面显示
|
||||
onShow() {},
|
||||
//方法
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
//验证码按钮文字状态
|
||||
getCodeState() {
|
||||
const _this = this;
|
||||
this.readonly = true;
|
||||
this.codeText = '60S后重新获取';
|
||||
var s = 60;
|
||||
clear = setInterval(() => {
|
||||
s--;
|
||||
_this.codeText = s + 'S后重新获取';
|
||||
if (s <= 0) {
|
||||
clearInterval(clear);
|
||||
_this.codeText = '获取验证码';
|
||||
_this.readonly = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
//获取验证码
|
||||
getCode() {
|
||||
if (this.readonly) {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.phone == '') {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.phoneRegular.test(this.phone)) {
|
||||
uni.showToast({
|
||||
title: '手机号格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.post('api/open/v1/send_sms', {
|
||||
phone: this.phone,
|
||||
type: 3104
|
||||
})
|
||||
.then(res => {
|
||||
this.getCodeState();
|
||||
});
|
||||
},
|
||||
//账号绑定
|
||||
onSubmit() {
|
||||
if (this.phone == '') {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.phoneRegular.test(this.phone)) {
|
||||
uni.showToast({
|
||||
title: '手机号格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.code == '') {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!/^[0-9]{6}$/.test(this.code)) {
|
||||
uni.showToast({
|
||||
title: '验证码必须是6位数',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!(this.userInfo.wxSmallOpenId || this.userInfo.openId || this.userInfo.wxPublicOpenId)) {
|
||||
uni.showToast({
|
||||
title: '数据丢失',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let httpData = {
|
||||
openId: this.userInfo.openId || this.userInfo.wxSmallOpenId || this.userInfo.wxPublicOpenId,
|
||||
phone: this.phone,
|
||||
code: this.code,
|
||||
// #ifdef MP-WEIXIN
|
||||
type: 1201,
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
type: 1301,
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
type: 1101
|
||||
// #endif
|
||||
};
|
||||
if(this.userInfo.unionid || this.userInfo.wxUnionid){
|
||||
httpData.unionid = this.userInfo.unionid || this.userInfo.wxUnionid;
|
||||
}
|
||||
// #ifdef H5
|
||||
let recommendCode = uni.getStorageSync("recommendCode");
|
||||
if(recommendCode){
|
||||
httpData.recommendCode = recommendCode;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
if(this.chatScenesInfo.recommendCode){
|
||||
httpData.recommendCode = this.chatScenesInfo.recommendCode;
|
||||
}
|
||||
// #endif
|
||||
this.$http
|
||||
.post('api/open/v1/third_bind',httpData)
|
||||
.then(res => {
|
||||
this.setUserInfo(res);
|
||||
// #ifdef H5
|
||||
publicShare();
|
||||
// #endif
|
||||
socket.init();
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '账号绑定成功!',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
onHide() {},
|
||||
//页面卸载
|
||||
onUnload() {},
|
||||
//页面下来刷新
|
||||
onPullDownRefresh() {},
|
||||
//页面上拉触底
|
||||
onReachBottom() {},
|
||||
//用户点击分享
|
||||
onShareAppMessage(e) {
|
||||
return this.wxShare();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.bindAccountBox {
|
||||
height: 283upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.bindAccountBox > image {
|
||||
width: 95upx;
|
||||
height: 95upx;
|
||||
border-radius: 15upx;
|
||||
}
|
||||
.bindAccountBox > view {
|
||||
width: 95upx;
|
||||
height: 95upx;
|
||||
padding: 0upx 20upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.bindAccountBox > view image {
|
||||
width: 100%;
|
||||
height: 40upx;
|
||||
}
|
||||
.bindAccountBut {
|
||||
margin-top: 60upx;
|
||||
}
|
||||
.registeredBut {
|
||||
margin-bottom: 30upx;
|
||||
padding: 0upx 20upx;
|
||||
}
|
||||
|
||||
.registeredBut button {
|
||||
font-size: 36upx;
|
||||
border-radius: 3upx;
|
||||
text-align: center;
|
||||
line-height: 90upx;
|
||||
height: 90upx;
|
||||
background-color: $themeColor;
|
||||
color: #fff;
|
||||
}
|
||||
.inputItem {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
margin-top: 12upx;
|
||||
padding: 0 25upx;
|
||||
}
|
||||
|
||||
.inputItem .title {
|
||||
min-width: 190upx;
|
||||
height: 100upx;
|
||||
line-height: 100upx;
|
||||
flex-shrink: 0;
|
||||
font-size: 30upx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.inputItem .info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.inputItem .info input {
|
||||
height: 100upx;
|
||||
line-height: 100upx;
|
||||
font-size: 30upx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inputItem .info button {
|
||||
height: 80upx;
|
||||
line-height: 80upx;
|
||||
font-size: 28upx;
|
||||
flex-shrink: 0;
|
||||
padding: 0 15upx;
|
||||
border: 1upx solid $themeColor;
|
||||
background-color: #fff;
|
||||
color: $themeColor;
|
||||
}
|
||||
</style>
|
@ -1,219 +0,0 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<nav-bar></nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="title">忘记密码</view>
|
||||
<view class="input_box"><input type="text" v-model="email" placeholder="请输入邮箱" /></view>
|
||||
<view class="input_box">
|
||||
<input type="number" v-model="code" placeholder="请输入邮箱验证码" />
|
||||
<button @click="getCode">{{codeText}}</button>
|
||||
</view>
|
||||
<view class="input_box"><input type="password" v-model="password" placeholder="请输入密码" /></view>
|
||||
<view class="input_box"><input type="password" v-model="confirmPassword" placeholder="请确认密码" /></view>
|
||||
<view class="btn_box"><button @click="onSubmit">提交</button></view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import md5 from '@/plugins/md5';
|
||||
var clear;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//邮箱
|
||||
email: '',
|
||||
// 密码
|
||||
password: '',
|
||||
//验证码
|
||||
code: '',
|
||||
//确认密码
|
||||
confirmPassword: '',
|
||||
//验证码
|
||||
codeText: '获取验证码',
|
||||
//验证码已发
|
||||
readonly: false
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {},
|
||||
//页面显示
|
||||
onShow() {},
|
||||
//方法
|
||||
methods: {
|
||||
//获取验证码
|
||||
getCode() {
|
||||
if (this.readonly) {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.post('api/common/v1/send_sms', {
|
||||
email: this.email,
|
||||
type: 3000
|
||||
})
|
||||
.then(res => {
|
||||
this.getCodeState();
|
||||
});
|
||||
},
|
||||
//验证码按钮文字状态
|
||||
getCodeState() {
|
||||
const _this = this;
|
||||
this.readonly = true;
|
||||
this.codeText = '60S后重新获取';
|
||||
var s = 60;
|
||||
clear = setInterval(() => {
|
||||
s--;
|
||||
_this.codeText = s + 'S后重新获取';
|
||||
if (s <= 0) {
|
||||
clearInterval(clear);
|
||||
_this.codeText = '获取验证码';
|
||||
_this.readonly = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
onSubmit() {
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.code) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.password) {
|
||||
uni.showToast({
|
||||
title: '请输入密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.confirmPassword) {
|
||||
uni.showToast({
|
||||
title: '请输入确认密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.confirmPassword != this.password) {
|
||||
uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.post('api/common/v1/forget_password', {
|
||||
email: this.email,
|
||||
code:this.code,
|
||||
password: md5(this.password),
|
||||
})
|
||||
.then(res => {
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
content:"密码修改成功!",
|
||||
showCancel:false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
onHide() {},
|
||||
//页面卸载
|
||||
onUnload() {},
|
||||
//页面下来刷新
|
||||
onPullDownRefresh() {},
|
||||
//页面上拉触底
|
||||
onReachBottom() {},
|
||||
//用户点击分享
|
||||
onShareAppMessage(e) {
|
||||
return this.wxShare();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.page {
|
||||
background-color: #ffffff;
|
||||
padding: 0 65upx;
|
||||
min-height: 100vh;
|
||||
.title {
|
||||
padding: 60upx 0 40upx 0;
|
||||
font-size: 60upx;
|
||||
color: #333333;
|
||||
}
|
||||
.input_box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 100upx;
|
||||
padding-top: 20upx;
|
||||
border-bottom: 1upx solid #eeeeee;
|
||||
input {
|
||||
flex: 1;
|
||||
height: 80upx;
|
||||
line-height: 80upx;
|
||||
font-size: 30upx;
|
||||
}
|
||||
button {
|
||||
height: 78upx;
|
||||
line-height: 78upx;
|
||||
font-size: 30upx;
|
||||
color: $themeColor;
|
||||
&:active {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn_box {
|
||||
margin-top: 70upx;
|
||||
button {
|
||||
height: 86upx;
|
||||
@include theme("btn_bg");
|
||||
border-radius: 43upx;
|
||||
font-size: 36upx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.protocol {
|
||||
font-size: 24upx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin-top: 20upx;
|
||||
text {
|
||||
color: $themeColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,357 +0,0 @@
|
||||
<template>
|
||||
<view class="register_page">
|
||||
<nav-bar></nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="title">
|
||||
<text :class="{active:type == 2000}" @click="type = 2000">密码登录</text>
|
||||
<text :class="{active:type == 1000}" @click="type = 1000">验证码登录</text>
|
||||
</view>
|
||||
<view class="input_box"><input type="text" v-model="email" placeholder="请输入您的邮箱" /></view>
|
||||
<view class="input_box" v-if="type == 1000">
|
||||
<input type="number" v-model="code" placeholder="请输入邮箱验证码" maxlength="6" @confirm="onSubmit" />
|
||||
<button class="active" @click="onSetCode">{{ codeText }}</button>
|
||||
</view>
|
||||
<view class="input_box" v-if="type == 2000"><input type="text" v-model="password" password placeholder="请输入密码" @confirm="onSubmit" /></view>
|
||||
<view class="btn_box"><button @click="onSubmit">登录</button></view>
|
||||
<view class="nav_box" v-if="type == 1000">
|
||||
<view class="agreement" v-if="type == 1000">
|
||||
进入即代表你已同意
|
||||
<text @click="onPageJump('/pages/user/protocol')">《用户协议》</text>
|
||||
</view>
|
||||
<text class="color" @click="onPageJump('/pages/user/register')">去注册</text>
|
||||
</view>
|
||||
<view class="nav_box" v-if="type == 2000">
|
||||
<text class="color" @click="onPageJump('/pages/user/register')">去注册</text>
|
||||
<text @click="onPageJump('/pages/user/forget')">忘记密码?</text>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="station" v-if="!isIos"></view>
|
||||
<view class="third_party_login_box" v-if="!isIos">
|
||||
<view class="third_party_title"><text>第三方登录</text></view>
|
||||
<view class="third_party_content"><image src="../../static/icon/wechat.png" @click="onWxAppLogin" mode="aspectFit"></image></view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import md5 from '@/plugins/md5';
|
||||
var clear;
|
||||
import { mapState, mapMutations } from 'vuex';
|
||||
import socket from '@/config/socket';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 2000,
|
||||
code: '',
|
||||
email: '',
|
||||
password: '',
|
||||
//验证码
|
||||
codeText: '获取验证码',
|
||||
//验证码已发
|
||||
readonly: false,
|
||||
isIos:true
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
// #ifdef APP-PLUS
|
||||
this.isIos = (plus.os.name == "iOS");
|
||||
// #endif
|
||||
},
|
||||
//页面显示
|
||||
onShow() {},
|
||||
//方法
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
onPageJump(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
//验证码按钮文字状态
|
||||
getCodeState() {
|
||||
clear && clearInterval(clear);
|
||||
const _this = this;
|
||||
this.readonly = true;
|
||||
this.codeText = '60S后重新获取';
|
||||
var s = 60;
|
||||
clear = setInterval(() => {
|
||||
s--;
|
||||
_this.codeText = s + 'S后重新获取';
|
||||
if (s <= 0) {
|
||||
clearInterval(clear);
|
||||
_this.codeText = '获取验证码';
|
||||
_this.readonly = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
// 发送验证码
|
||||
onSetCode() {
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '邮箱格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.post('api/common/v1/send_sms', {
|
||||
email: this.email,
|
||||
type: 2000
|
||||
})
|
||||
.then(res => {
|
||||
this.getCodeState();
|
||||
});
|
||||
},
|
||||
onSubmit() {
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '邮箱格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let httpData = {
|
||||
email: this.email
|
||||
};
|
||||
if (this.type == 1000) {
|
||||
if (!this.code) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
httpData.code = this.code;
|
||||
} else {
|
||||
if (!this.password) {
|
||||
uni.showToast({
|
||||
title: '请输入密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
httpData.password = md5(this.password);
|
||||
}
|
||||
this.$http.post('api/common/v1/login', httpData).then(res => {
|
||||
this.setUserInfo(res);
|
||||
socket.init();
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
});
|
||||
},
|
||||
// 微信APP登录
|
||||
onWxAppLogin() {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: res => {
|
||||
if(res.authResult.openid && res.authResult.unionid){
|
||||
this.$http
|
||||
.post('api/open/v1/login', {
|
||||
wxAppOpenId: res.authResult.openid,
|
||||
unionid: res.authResult.unionid
|
||||
})
|
||||
.then(data => {
|
||||
this.setUserInfo({
|
||||
openId: res.authResult.openid,
|
||||
unionid: res.authResult.unionid,
|
||||
...data,
|
||||
});
|
||||
if (data.thirdLoginSuccess) {
|
||||
socket.init();
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未绑定邮箱,请先绑定~',
|
||||
confirmText: '去绑定',
|
||||
cancelText: '再逛会',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/user/bindPhone'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '数据缺失,请重新点击',
|
||||
icon:"none"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
onHide() {},
|
||||
//页面卸载
|
||||
onUnload() {},
|
||||
//页面下来刷新
|
||||
onPullDownRefresh() {},
|
||||
//页面上拉触底
|
||||
onReachBottom() {},
|
||||
//用户点击分享
|
||||
onShareAppMessage(e) {
|
||||
return this.wxShare();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.register_page {
|
||||
padding: calc(var(--status-bar-height) + 70upx) 50upx 50upx 50upx;
|
||||
background-color: #fff;
|
||||
min-height: 100vh;
|
||||
.title {
|
||||
margin-bottom: 50upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
font-size: 36upx;
|
||||
color: #999;
|
||||
&.active {
|
||||
font-size: 48upx;
|
||||
color: #333333;
|
||||
font-weight: bold;
|
||||
}
|
||||
&:nth-child(2){
|
||||
margin-left: 70upx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.input_box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 2upx solid #e5e5e5;
|
||||
padding: 30upx 0;
|
||||
margin-top: 20upx;
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 32upx;
|
||||
color: #333;
|
||||
height: 60upx;
|
||||
}
|
||||
button {
|
||||
height: 60upx;
|
||||
background-color: #f7f7f7;
|
||||
font-size: 24upx;
|
||||
border-radius: 8upx;
|
||||
padding: 0 14upx;
|
||||
color: #333;
|
||||
line-height: 60upx;
|
||||
margin-left: 20upx;
|
||||
&.active {
|
||||
@include theme('btn_bg');
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn_box {
|
||||
margin-top: 60upx;
|
||||
button {
|
||||
@include theme('btn_bg');
|
||||
color: #fff;
|
||||
height: 92upx;
|
||||
line-height: 92upx;
|
||||
border-radius: 8upx;
|
||||
}
|
||||
}
|
||||
.agreement {
|
||||
font-size: 24upx;
|
||||
color: #999999;
|
||||
> text {
|
||||
color: $themeColor;
|
||||
}
|
||||
}
|
||||
.password_register {
|
||||
margin-top: 110upx;
|
||||
text-align: center;
|
||||
text {
|
||||
font-size: 24upx;
|
||||
color: #333333;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
.nav_box {
|
||||
margin-top: 30upx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
> text {
|
||||
font-size: 24upx;
|
||||
color: #333333;
|
||||
&.color {
|
||||
color: $themeColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.station {
|
||||
height: 230upx;
|
||||
}
|
||||
.third_party_login_box {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
height: 230upx;
|
||||
padding: 0 30upx;
|
||||
.third_party_title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&:before,
|
||||
&:after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
height: 2upx;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
text {
|
||||
font-size: 24upx;
|
||||
color: #999999;
|
||||
flex-shrink: 0;
|
||||
padding: 0 20upx;
|
||||
}
|
||||
}
|
||||
.third_party_content {
|
||||
height: 200upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
image {
|
||||
width: 60upx;
|
||||
height: 52upx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,75 +0,0 @@
|
||||
<template>
|
||||
<view class="protocol_page">
|
||||
<nav-bar title="协议"></nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="title">{{title}}</view>
|
||||
<jyf-parser ref="article"></jyf-parser>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import jyfParser from '@/components/common/jyf-parser/jyf-parser.vue';
|
||||
export default {
|
||||
components: { jyfParser },
|
||||
data() {
|
||||
return {
|
||||
type:1000,
|
||||
title:"用户协议"
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
if(e.type){
|
||||
this.type = parseInt(e.type);
|
||||
let title;
|
||||
switch (this.type) {
|
||||
case 1000:
|
||||
title = "登录注册用户协议";
|
||||
break;
|
||||
}
|
||||
this.title = title;
|
||||
}
|
||||
this.pageData();
|
||||
},
|
||||
//页面显示
|
||||
onShow() {},
|
||||
//方法
|
||||
methods: {
|
||||
pageData() {
|
||||
this.$http
|
||||
.get('api/common/v1/protocol', {
|
||||
type: this.type
|
||||
})
|
||||
.then(res => {
|
||||
this.$refs.article.setContent(res);
|
||||
});
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
onHide() {},
|
||||
//页面卸载
|
||||
onUnload() {},
|
||||
//页面下来刷新
|
||||
onPullDownRefresh() {},
|
||||
//页面上拉触底
|
||||
onReachBottom() {},
|
||||
//用户点击分享
|
||||
onShareAppMessage(e) {
|
||||
return this.wxShare();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.protocol_page {
|
||||
background-color: #fff;
|
||||
padding: 30upx;
|
||||
font-size: 30upx;
|
||||
line-height: 180%;
|
||||
.title {
|
||||
font-size: 50upx;
|
||||
padding-bottom: 30upx;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,235 +0,0 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<nav-bar></nav-bar>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="title">注册</view>
|
||||
<view class="input_box"><input type="text" v-model="email" placeholder="请输入邮箱" /></view>
|
||||
<view class="input_box">
|
||||
<input type="number" v-model="code" placeholder="请输入邮箱验证码" />
|
||||
<button @click="getCode">{{codeText}}</button>
|
||||
</view>
|
||||
<view class="input_box"><input type="password" v-model="password" placeholder="请输入密码" /></view>
|
||||
<view class="input_box"><input type="password" v-model="confirmPassword" placeholder="请确认密码"/></view>
|
||||
<!-- <view class="input_box"><input type="number" v-model="recommendCode" placeholder="推荐人邮箱码(非必填)" @confirm="onSubmit"/></view> -->
|
||||
<view class="btn_box"><button @click="onSubmit">注册</button></view>
|
||||
<view class="protocol">
|
||||
注册代表您已同意
|
||||
<text @click="onJumpPage('/pages/user/protocol')">《用户协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import md5 from '@/plugins/md5';
|
||||
var clear;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//邮箱
|
||||
email: '',
|
||||
// 密码
|
||||
password: '',
|
||||
//验证码
|
||||
code: '',
|
||||
//确认密码
|
||||
confirmPassword: '',
|
||||
// 推荐码
|
||||
recommendCode:"",
|
||||
//验证码
|
||||
codeText: '获取验证码',
|
||||
//验证码已发
|
||||
readonly: false
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {},
|
||||
//页面显示
|
||||
onShow() {},
|
||||
//方法
|
||||
methods: {
|
||||
onJumpPage(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
//获取验证码
|
||||
getCode() {
|
||||
if (this.readonly) {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$http
|
||||
.post('api/common/v1/send_sms', {
|
||||
email: this.email,
|
||||
type: 1000
|
||||
})
|
||||
.then(res => {
|
||||
this.getCodeState();
|
||||
});
|
||||
},
|
||||
//验证码按钮文字状态
|
||||
getCodeState() {
|
||||
const _this = this;
|
||||
this.readonly = true;
|
||||
this.codeText = '60S后重新获取';
|
||||
var s = 60;
|
||||
clear = setInterval(() => {
|
||||
s--;
|
||||
_this.codeText = s + 'S后重新获取';
|
||||
if (s <= 0) {
|
||||
clearInterval(clear);
|
||||
_this.codeText = '获取验证码';
|
||||
_this.readonly = false;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
onSubmit() {
|
||||
if (!this.email) {
|
||||
uni.showToast({
|
||||
title: '请输入邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.$base.mailRegular.test(this.email)) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的邮箱',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.code) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.password) {
|
||||
uni.showToast({
|
||||
title: '请输入密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.confirmPassword) {
|
||||
uni.showToast({
|
||||
title: '请输入确认密码',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.confirmPassword != this.password) {
|
||||
uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let httpData = {
|
||||
email: this.email,
|
||||
code:this.code,
|
||||
password: md5(this.password),
|
||||
};
|
||||
if(this.recommendCode){
|
||||
httpData.recommendCode = this.recommendCode;
|
||||
}
|
||||
this.$http
|
||||
.post('api/common/v1/register',httpData)
|
||||
.then(res => {
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
content:"注册成功,去登录!",
|
||||
showCancel:false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
//页面隐藏
|
||||
onHide() {},
|
||||
//页面卸载
|
||||
onUnload() {},
|
||||
//页面下来刷新
|
||||
onPullDownRefresh() {},
|
||||
//页面上拉触底
|
||||
onReachBottom() {},
|
||||
//用户点击分享
|
||||
onShareAppMessage(e) {
|
||||
return this.wxShare();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.page {
|
||||
background-color: #FFF;
|
||||
padding: 0 65upx;
|
||||
min-height: 100vh;
|
||||
.title {
|
||||
padding: 60upx 0 40upx 0;
|
||||
font-size: 60upx;
|
||||
color: #333333;
|
||||
}
|
||||
.input_box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 100upx;
|
||||
padding-top: 20upx;
|
||||
border-bottom: 1upx solid #eeeeee;
|
||||
input {
|
||||
flex: 1;
|
||||
height: 80upx;
|
||||
line-height: 80upx;
|
||||
font-size: 30upx;
|
||||
}
|
||||
button {
|
||||
height: 78upx;
|
||||
line-height: 78upx;
|
||||
font-size: 30upx;
|
||||
color: $themeColor;
|
||||
&:active {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn_box {
|
||||
margin-top: 70upx;
|
||||
button {
|
||||
height: 86upx;
|
||||
@include theme("btn_bg");
|
||||
border-radius: 43upx;
|
||||
font-size: 36upx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.protocol {
|
||||
font-size: 24upx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin-top: 20upx;
|
||||
text {
|
||||
color: $themeColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user