【修改】注册联调
This commit is contained in:
@@ -72,7 +72,9 @@ const UserApi = {
|
|||||||
// 获取用户的信息
|
// 获取用户的信息
|
||||||
getUserInfo: (params) => http.get(`${URL_CONFIG}sys/user/queryById`, params),
|
getUserInfo: (params) => http.get(`${URL_CONFIG}sys/user/queryById`, params),
|
||||||
// 注册
|
// 注册
|
||||||
registerUser: (params) => http.post(`${URL_CONFIG}sys/user/register`, params),
|
registerUser: (params) => http.post(`${URL_CONFIG}home/registerSelf`, params),
|
||||||
|
// 手机号唯一校验
|
||||||
|
checkPhoneOnly: (params) => http.get(`${URL_CONFIG}/sys/duplicate/check`, params),
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UserApi
|
export default UserApi
|
||||||
|
|||||||
+85
-34
@@ -70,21 +70,21 @@ Page({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 手机号
|
// 手机号
|
||||||
if (this.data.currentInfo.phone === '' || this.data.currentInfo.phone === null || this.data.currentInfo.phone === undefined) {
|
// if (this.data.currentInfo.phone === '' || this.data.currentInfo.phone === null || this.data.currentInfo.phone === undefined) {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: '请输入手机号',
|
// title: '请输入手机号',
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 800
|
// duration: 800
|
||||||
})
|
// })
|
||||||
return
|
// return
|
||||||
} else if (this.data.currentInfo.phone && !phoneReg(this.data.currentInfo.phone)) {
|
// } else if (this.data.currentInfo.phone && !phoneReg(this.data.currentInfo.phone)) {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: '请输入正确的手机号',
|
// title: '请输入正确的手机号',
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 800
|
// duration: 800
|
||||||
})
|
// })
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 性别
|
// 性别
|
||||||
if (this.data.currentInfo.gender === '' || this.data.currentInfo.gender === null || this.data.currentInfo.gender === undefined) {
|
if (this.data.currentInfo.gender === '' || this.data.currentInfo.gender === null || this.data.currentInfo.gender === undefined) {
|
||||||
@@ -123,16 +123,27 @@ Page({
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let formData = Object.assign({},this.data.prePageData,this.data.currentInfo,this.data.selectedCompany)
|
let formData = {}
|
||||||
formData.post = e.detail.value.post.trim()
|
let currentPageInfo = Object.assign({},this.data.currentInfo,this.data.selectedCompany)
|
||||||
formData.remarks = e.detail.value.remarks.trim()
|
// this.data.prePageData,
|
||||||
|
currentPageInfo.post = e.detail.value.post.trim()
|
||||||
|
currentPageInfo.remarks = e.detail.value.remarks.trim()
|
||||||
|
// 上一步的的数据加密
|
||||||
formData.rsaPublicKey = this.data.rsaPublicKey
|
formData.rsaPublicKey = this.data.rsaPublicKey
|
||||||
formData.phone = encrypt(this.data.rsaPublicKey,formData.phone),
|
formData.verifyCode =this.data.prePageData.verifyCode
|
||||||
formData.password = encrypt(this.data.rsaPublicKey,formData.password),
|
formData.phone = encrypt(this.data.rsaPublicKey,this.data.prePageData.phone),
|
||||||
formData.confirmPassword = encrypt(this.data.rsaPublicKey,formData.confirmPassword),
|
formData.password = encrypt(this.data.rsaPublicKey,this.data.prePageData.password),
|
||||||
|
formData.verifyPassword = encrypt(this.data.rsaPublicKey,this.data.prePageData.verifyPassword),
|
||||||
|
formData.payContactsManagement = currentPageInfo
|
||||||
|
// formData.payContactsManagement
|
||||||
console.log('表单提交的数据',formData);
|
console.log('表单提交的数据',formData);
|
||||||
UserApi.registerUser(formData).then(res => {
|
UserApi.registerUser(formData).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
wx.showToast({
|
||||||
|
title: res.result,
|
||||||
|
icon:none,
|
||||||
|
duration:800
|
||||||
|
})
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../login/login',
|
url: '../login/login',
|
||||||
success(){
|
success(){
|
||||||
@@ -176,7 +187,7 @@ Page({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 再次校准验证码
|
// 再次校准验证码
|
||||||
if (this.data.prePageData.captcha === '' || this.data.prePageData.captcha === null || this.data.prePageData.captcha === undefined) {
|
if (this.data.prePageData.verifyCode === '' || this.data.prePageData.verifyCode === null || this.data.prePageData.verifyCode === undefined) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入验证码',
|
title: '请输入验证码',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -202,14 +213,14 @@ Page({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 再次校准确认密码
|
// 再次校准确认密码
|
||||||
if (this.data.prePageData.confirmPassword === '' || this.data.prePageData.confirmPassword === null || this.data.prePageData.confirmPassword === undefined) {
|
if (this.data.prePageData.verifyPassword === '' || this.data.prePageData.verifyPassword === null || this.data.prePageData.verifyPassword === undefined) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入确认密码',
|
title: '请输入确认密码',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 800
|
duration: 800
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (this.data.prePageData.phone && this.data.prePageData.password !== this.data.prePageData.confirmPassword) {
|
} else if (this.data.prePageData.password && this.data.prePageData.password !== this.data.prePageData.verifyPassword) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '密码与确认密码不一致',
|
title: '密码与确认密码不一致',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -255,12 +266,23 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
getVerCode() {
|
async getVerCode() {
|
||||||
|
console.log(this.data.phone);
|
||||||
|
// let flag = await this.checkPhoneOnly(this.data.value)
|
||||||
|
|
||||||
|
if(!this.data.phone){
|
||||||
|
// wx.showToast({
|
||||||
|
// title: '手机号已存在',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 2000
|
||||||
|
// })
|
||||||
|
return
|
||||||
|
}
|
||||||
countdown = 60
|
countdown = 60
|
||||||
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.phone)) {
|
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.phone)) {
|
||||||
UserApi.sendCode({
|
UserApi.sendCode({
|
||||||
phone: this.data.phone,
|
phone: this.data.phone,
|
||||||
codeType: 1
|
codeType: 3
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
// 获取成功,倒计时 start
|
// 获取成功,倒计时 start
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
@@ -315,7 +337,7 @@ Page({
|
|||||||
// 倒计时 end
|
// 倒计时 end
|
||||||
},
|
},
|
||||||
// 校验手机号
|
// 校验手机号
|
||||||
validatePhone(e) {
|
async validatePhone(e) {
|
||||||
let value = e.detail.value
|
let value = e.detail.value
|
||||||
this.setData({
|
this.setData({
|
||||||
phone: value,
|
phone: value,
|
||||||
@@ -333,9 +355,24 @@ Page({
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (phoneReg(value)) {
|
} else if (phoneReg(value)) {
|
||||||
this.setData({
|
let flag = await this.checkPhoneOnly(value)
|
||||||
'prePageData.phone': value
|
console.log(flag);
|
||||||
})
|
if(flag){
|
||||||
|
this.setData({
|
||||||
|
'prePageData.phone': value,
|
||||||
|
'phone':value
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.showToast({
|
||||||
|
title: '手机号已存在',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 800
|
||||||
|
})
|
||||||
|
this.setData({
|
||||||
|
'phone': ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: errmsg,
|
title: errmsg,
|
||||||
@@ -345,11 +382,25 @@ Page({
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 判断手机号是否存在
|
||||||
|
checkPhoneOnly(value){
|
||||||
|
return new Promise(resolve => {
|
||||||
|
// 校验手机号是否存在
|
||||||
|
const param = {
|
||||||
|
confusionCode: 'pay_contacts_management_phone',
|
||||||
|
fieldVal: value,
|
||||||
|
encrypt: 1
|
||||||
|
}
|
||||||
|
UserApi.checkPhoneOnly(param).then(res => {
|
||||||
|
resolve(res.success)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// 校验验证码
|
// 校验验证码
|
||||||
validateVerCode(e) {
|
validateVerCode(e) {
|
||||||
let value = e.detail.value
|
let value = e.detail.value
|
||||||
this.setData({
|
this.setData({
|
||||||
'prePageData.captcha': value
|
'prePageData.verifyCode': value
|
||||||
})
|
})
|
||||||
let {
|
let {
|
||||||
message,
|
message,
|
||||||
@@ -365,7 +416,7 @@ Page({
|
|||||||
} else {
|
} else {
|
||||||
this.setData({
|
this.setData({
|
||||||
captcha: value,
|
captcha: value,
|
||||||
'prePageData.captcha': value
|
'prePageData.verifyCode': value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,7 +594,7 @@ Page({
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
let value = e.detail.value
|
let value = e.detail.value
|
||||||
this.setData({
|
this.setData({
|
||||||
'prePageData.confirmPassword': value
|
'prePageData.verifyPassword': value
|
||||||
})
|
})
|
||||||
let {
|
let {
|
||||||
message,
|
message,
|
||||||
@@ -559,7 +610,7 @@ Page({
|
|||||||
} else if (e.detail.value === this.data.password) {
|
} else if (e.detail.value === this.data.password) {
|
||||||
this.setData({
|
this.setData({
|
||||||
confirmPassword: value,
|
confirmPassword: value,
|
||||||
'prePageData.confirmPassword': value
|
'prePageData.verifyPassword': value
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
<view class="item" wx:if="{{currentTab === 2}}">
|
<view class="item" wx:if="{{currentTab === 2}}">
|
||||||
<view class="label validate">手机号</view>
|
<view class="label validate">手机号</view>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<input name="phone2" bindblur="validatePhoneCurent" data-type="phone" data-message='请输入手机号' data-errmsg='请输入正确的手机号' type="number" maxlength="11" value="{{currentInfo.phone}}" placeholder="请输入手机号" />
|
<input name="phone" bindblur="validatePhoneCurent" disabled data-type="phone" data-message='请输入手机号' data-errmsg='请输入正确的手机号' type="number" maxlength="11" value="{{prePageData.phone}}" placeholder="请输入手机号" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user