|
@@ -66,18 +66,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import {
|
|
|
- reactive,
|
|
|
- onMounted,
|
|
|
- ref,
|
|
|
- watch,
|
|
|
- defineComponent
|
|
|
- } from 'vue';
|
|
|
-import http from '@/utils/request'
|
|
|
+ import { reactive,onMounted,ref,watch,defineComponent } from 'vue';
|
|
|
+ import http from '@/utils/request'
|
|
|
|
|
|
+ // 验证码请求参数
|
|
|
const sendCodeData = reactive({
|
|
|
- Mobile: '',
|
|
|
- UserType: '2'
|
|
|
+ phone:''
|
|
|
})
|
|
|
|
|
|
//手机号校验
|
|
@@ -248,7 +242,8 @@ import http from '@/utils/request'
|
|
|
userCode: valiFormData.userCode,
|
|
|
userName: valiFormData.name,
|
|
|
openId: uni.getStorageSync("openId"),
|
|
|
- userMailbox: valiFormData.email
|
|
|
+ userMailbox: valiFormData.email,
|
|
|
+ code:valiFormData.code
|
|
|
}
|
|
|
// 注册
|
|
|
registerPost(data)
|
|
@@ -266,7 +261,7 @@ import http from '@/utils/request'
|
|
|
const registerPost = (data) => {
|
|
|
http.post("app-api/wxLogin/register",data).then(e =>{
|
|
|
console.log(e);
|
|
|
- if (e == true){
|
|
|
+ if (e.code == 200){
|
|
|
uni.showToast({
|
|
|
title: '注册成功',
|
|
|
icon: 'none'
|
|
@@ -277,28 +272,59 @@ import http from '@/utils/request'
|
|
|
return
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
- title: '手机号码已存在!',
|
|
|
+ title: e.error,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
//发送验证码
|
|
|
const sendCode = () => {
|
|
|
- sendCodeData.Mobile = valiFormData.Mobile
|
|
|
+ console.log(valiFormData.phone);
|
|
|
+ sendCodeData.phone = valiFormData.phone
|
|
|
+ if(!phoneRegs.test(valiFormData.phone)){
|
|
|
+ uni.showToast({
|
|
|
+ title: '手机号码格式不正确',
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ http.get("app-api/wxLogin/obtainCode",sendCodeData).then(res=>{
|
|
|
+ console.log(res);
|
|
|
+ // 验证码发送失败
|
|
|
+ if(res.code!=200){
|
|
|
+ uni.showToast({
|
|
|
+ title: res.error,
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message,
|
|
|
+ icon:'none',
|
|
|
+ success: () => {
|
|
|
+ // 发送验证码
|
|
|
+ codeSend.send = false;
|
|
|
+ // 倒计时
|
|
|
+ time();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
// http.post('up/Oauth/GetVerificationCode', sendCodeData).then(res => {
|
|
|
// console.log(res)
|
|
|
// if (res.code == 0) {
|
|
|
// 发送验证码
|
|
|
- codeSend.send = false;
|
|
|
- uni.showToast({
|
|
|
- title: '发送成功',
|
|
|
- icon: 'none',
|
|
|
- success: () => {
|
|
|
- time(); // 倒计时
|
|
|
- }
|
|
|
- })
|
|
|
+ // codeSend.send = false;
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '发送成功',
|
|
|
+ // icon: 'none',
|
|
|
+ // success: () => {
|
|
|
+ // time(); // 倒计时
|
|
|
+ // }
|
|
|
+ // })
|
|
|
// } else {
|
|
|
// Message.error(res.message)
|
|
|
// }
|