|
@@ -78,10 +78,9 @@
|
|
|
<checkbox-group @change='ChangeIsDefault'>
|
|
|
<checkbox :class="inAnimation ? 'trembling' : ''" @animationend='inAnimation = false'
|
|
|
:checked="protocol ? true : false" />{{ $t(`已同意`) }} <text class="main-color"
|
|
|
- @click="privacy('2.html','注册协议')">{{ $t(`《注册协议》`) }}</text>
|
|
|
- <text class="main-color"
|
|
|
- @click="privacy('3.html','商城须知')">{{ $t(`《商城须知》`) }}</text>
|
|
|
- <text class="main-color" @click="privacy('1.html','隐私政策')">{{ $t(`《隐私政策》`) }}</text>
|
|
|
+ @click="privacy('2.html', '注册协议')">{{ $t(`《注册协议》`) }}</text>
|
|
|
+ <text class="main-color" @click="privacy('3.html', '商城须知')">{{ $t(`《商城须知》`) }}</text>
|
|
|
+ <text class="main-color" @click="privacy('1.html', '隐私政策')">{{ $t(`《隐私政策》`) }}</text>
|
|
|
</checkbox-group>
|
|
|
</view>
|
|
|
<view class="logon" @click="loginMobile" v-if="current !== 0">{{ $t(`同意协议注册`) }}</view>
|
|
@@ -131,6 +130,10 @@ import {
|
|
|
getUserInfo,
|
|
|
appleLogin
|
|
|
} from "@/api/user";
|
|
|
+import {
|
|
|
+ postSendValidate,
|
|
|
+ postUserRegister
|
|
|
+} from "@/api/home";
|
|
|
import attrs, {
|
|
|
required,
|
|
|
alpha_num,
|
|
@@ -165,6 +168,7 @@ export default {
|
|
|
password: "",
|
|
|
passwordConfirm: "",
|
|
|
codeInvitation: "",
|
|
|
+ captchaId: "",
|
|
|
captcha: "",
|
|
|
formItem: 1,
|
|
|
type: "login",
|
|
@@ -208,12 +212,18 @@ export default {
|
|
|
codeChange(text) {
|
|
|
this.tips = text;
|
|
|
},
|
|
|
+ end() {
|
|
|
+ this.keyLock = false
|
|
|
+ },
|
|
|
+ start() {
|
|
|
+ // this.keyLock = !this.keyLock
|
|
|
+ },
|
|
|
ChangeIsDefault(e) {
|
|
|
this.$set(this, 'protocol', !this.protocol);
|
|
|
},
|
|
|
- privacy(type,title) {
|
|
|
+ privacy(type, title) {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/users/privacy/index?type=" + type+"&title=" + title
|
|
|
+ url: "/pages/users/privacy/index?type=" + type + "&title=" + title
|
|
|
})
|
|
|
},
|
|
|
// IOS 版本号判断
|
|
@@ -453,7 +463,7 @@ export default {
|
|
|
if (!that.captcha) return that.$util.Tips({
|
|
|
title: that.$t(`请输入验证码`)
|
|
|
});
|
|
|
- if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
|
|
|
+ if (!/^[\w\d]+$/i.test(that.captcha) || that.captcha.length != 6) return that.$util.Tips({
|
|
|
title: that.$t(`请输入正确的验证码`)
|
|
|
});
|
|
|
if (!that.password) return that.$util.Tips({
|
|
@@ -489,29 +499,42 @@ export default {
|
|
|
title: that.$t(`请勿重复点击`)
|
|
|
});
|
|
|
}
|
|
|
- loginMobile({
|
|
|
+ uni.showLoading({
|
|
|
+ title: that.$t(`注册中`)
|
|
|
+ });
|
|
|
+ postUserRegister({
|
|
|
phone: that.account,
|
|
|
- captcha: that.captcha,
|
|
|
- spread: that.$Cache.get("spread")
|
|
|
+ captchaCode: that.captcha,
|
|
|
+ password: that.password,
|
|
|
+ inviteCode: that.codeInvitation,
|
|
|
+ captchaId: that.captchaId,
|
|
|
+ // spread: that.$Cache.get("spread")
|
|
|
})
|
|
|
.then(res => {
|
|
|
- let data = res.data;
|
|
|
- that.$store.commit("LOGIN", {
|
|
|
- 'token': data.token,
|
|
|
- 'time': data.expires_time - this.$Cache.time()
|
|
|
- });
|
|
|
- let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
|
|
- that.$Cache.clear(BACK_URL);
|
|
|
- getUserInfo().then(res => {
|
|
|
- this.keyLock = true
|
|
|
- that.$store.commit("SETUID", res.data.userId);
|
|
|
- if (backUrl.indexOf('/pages/users/login/index') !== -1) {
|
|
|
- backUrl = '/pages/index/index';
|
|
|
- }
|
|
|
- uni.reLaunch({
|
|
|
- url: backUrl
|
|
|
- });
|
|
|
- })
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.$u.toast('注册成功');
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/users/wechat_login/index'
|
|
|
+ })
|
|
|
+ }, 1500);
|
|
|
+ // let data = res.data;
|
|
|
+ // that.$store.commit("LOGIN", {
|
|
|
+ // 'token': data.token,
|
|
|
+ // 'time': data.expires_time - this.$Cache.time()
|
|
|
+ // });
|
|
|
+ // let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
|
|
+ // that.$Cache.clear(BACK_URL);
|
|
|
+ // getUserInfo().then(res => {
|
|
|
+ // this.keyLock = true
|
|
|
+ // that.$store.commit("SETUID", res.data.userId);
|
|
|
+ // if (backUrl.indexOf('/pages/users/login/index') !== -1) {
|
|
|
+ // backUrl = '/pages/index/index';
|
|
|
+ // }
|
|
|
+ // uni.reLaunch({
|
|
|
+ // url: backUrl
|
|
|
+ // });
|
|
|
+ // })
|
|
|
})
|
|
|
.catch(res => {
|
|
|
this.keyLock = true
|
|
@@ -573,13 +596,28 @@ export default {
|
|
|
uni.showLoading({
|
|
|
title: '正在获取验证码'
|
|
|
})
|
|
|
- setTimeout(() => {
|
|
|
- uni.hideLoading();
|
|
|
- // 这里此提示会被this.start()方法中的提示覆盖
|
|
|
- uni.$u.toast('验证码已发送');
|
|
|
- // 通知验证码组件内部开始倒计时
|
|
|
- this.$refs.uCode.start();
|
|
|
- }, 2000);
|
|
|
+ if (!that.account) return that.$util.Tips({
|
|
|
+ title: that.$t(`请填写手机号码`)
|
|
|
+ });
|
|
|
+ if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
|
|
+ title: that.$t(`请输入正确的手机号码`)
|
|
|
+ });
|
|
|
+ await postSendValidate({
|
|
|
+ phone: that.account
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ that.captchaId = res.data.id
|
|
|
+ // 这里此提示会被this.start()方法中的提示覆盖
|
|
|
+ uni.$u.toast('验证码已发送');
|
|
|
+ // 通知验证码组件内部开始倒计时
|
|
|
+ this.$refs.uCode.start();
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ that.$util.Tips({
|
|
|
+ title: res
|
|
|
+ });
|
|
|
+ });
|
|
|
} else {
|
|
|
uni.$u.toast('倒计时结束后再发送');
|
|
|
}
|
|
@@ -589,31 +627,6 @@ export default {
|
|
|
// title: '请先阅读并同意协议'
|
|
|
// });
|
|
|
// }
|
|
|
- // if (!that.account) return that.$util.Tips({
|
|
|
- // title: that.$t(`请填写手机号码`)
|
|
|
- // });
|
|
|
- // if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
|
|
- // title: that.$t(`请输入正确的手机号码`)
|
|
|
- // });
|
|
|
- // if (that.formItem == 2) that.type = "register";
|
|
|
-
|
|
|
- // await registerVerify({
|
|
|
- // phone: that.account,
|
|
|
- // type: that.type,
|
|
|
- // key: that.keyCode,
|
|
|
- // code: that.codeVal
|
|
|
- // })
|
|
|
- // .then(res => {
|
|
|
- // that.$util.Tips({
|
|
|
- // title: res.msg
|
|
|
- // });
|
|
|
- // that.sendCode();
|
|
|
- // })
|
|
|
- // .catch(res => {
|
|
|
- // that.$util.Tips({
|
|
|
- // title: res
|
|
|
- // });
|
|
|
- // });
|
|
|
},
|
|
|
navTap: function (index) {
|
|
|
this.current = index;
|