Commit fe595203 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-wx, litemall-wx-api]: 注册时验证码验证不正确

parent 59592ca0
...@@ -244,11 +244,11 @@ public class WxAuthController { ...@@ -244,11 +244,11 @@ public class WxAuthController {
String username = JacksonUtil.parseString(body, "username"); String username = JacksonUtil.parseString(body, "username");
String password = JacksonUtil.parseString(body, "password"); String password = JacksonUtil.parseString(body, "password");
String mobile = JacksonUtil.parseString(body, "mobile"); String mobile = JacksonUtil.parseString(body, "mobile");
String captcha = JacksonUtil.parseString(body, "captcha");
String code = JacksonUtil.parseString(body, "code"); String code = JacksonUtil.parseString(body, "code");
String wxCode = JacksonUtil.parseString(body, "wxCode");
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(mobile) if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(mobile)
|| StringUtils.isEmpty(captcha) || StringUtils.isEmpty(code)) { || StringUtils.isEmpty(wxCode) || StringUtils.isEmpty(code)) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
} }
...@@ -272,7 +272,7 @@ public class WxAuthController { ...@@ -272,7 +272,7 @@ public class WxAuthController {
String openId = null; String openId = null;
try { try {
WxMaJscode2SessionResult result = this.wxService.getUserService().getSessionInfo(code); WxMaJscode2SessionResult result = this.wxService.getUserService().getSessionInfo(wxCode);
openId = result.getOpenid(); openId = result.getOpenid();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -9,7 +9,7 @@ Page({ ...@@ -9,7 +9,7 @@ Page({
password: '', password: '',
confirmPassword: '', confirmPassword: '',
mobile: '', mobile: '',
captcha: '' code: ''
}, },
onLoad: function (options) { onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
...@@ -31,7 +31,7 @@ Page({ ...@@ -31,7 +31,7 @@ Page({
// 页面关闭 // 页面关闭
}, },
sendCaptcha: function () { sendCode: function () {
let that = this; let that = this;
if (this.data.mobile.length == 0) { if (this.data.mobile.length == 0) {
...@@ -79,7 +79,7 @@ Page({ ...@@ -79,7 +79,7 @@ Page({
} }
}); });
}, },
requestRegister: function (code) { requestRegister: function (wxCode) {
let that = this; let that = this;
wx.request({ wx.request({
url: api.AuthRegister, url: api.AuthRegister,
...@@ -87,8 +87,8 @@ Page({ ...@@ -87,8 +87,8 @@ Page({
username: that.data.username, username: that.data.username,
password: that.data.password, password: that.data.password,
mobile: that.data.mobile, mobile: that.data.mobile,
captcha: that.data.captcha, code: that.data.code,
code: code wxCode: wxCode
}, },
method: 'POST', method: 'POST',
header: { header: {
...@@ -139,7 +139,7 @@ Page({ ...@@ -139,7 +139,7 @@ Page({
return false; return false;
} }
if (this.data.mobile.length == 0 || this.data.captcha.length == 0) { if (this.data.mobile.length == 0 || this.data.code.length == 0) {
wx.showModal({ wx.showModal({
title: '错误信息', title: '错误信息',
content: '手机号和验证码不能为空', content: '手机号和验证码不能为空',
...@@ -195,10 +195,10 @@ Page({ ...@@ -195,10 +195,10 @@ Page({
mobile: e.detail.value mobile: e.detail.value
}); });
}, },
bindCaptchaInput: function (e) { bindCodeInput: function (e) {
this.setData({ this.setData({
captcha: e.detail.value code: e.detail.value
}); });
}, },
clearInput: function (e) { clearInput: function (e) {
...@@ -223,9 +223,9 @@ Page({ ...@@ -223,9 +223,9 @@ Page({
mobile: '' mobile: ''
}); });
break; break;
case 'clear-captcha': case 'clear-code':
this.setData({ this.setData({
captcha: '' code: ''
}); });
break; break;
} }
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
<image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image> <image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view> </view>
<view class="form-item-captcha" > <view class="form-item-code" >
<view class="form-item captcha-item"> <view class="form-item code-item">
<input class="captcha" value="{{captcha}}" bindinput="bindCaptchaInput" placeholder="验证码"/> <input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码"/>
<image class="clear" id="clear-captcha" wx:if="{{ captcha.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image> <image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view> </view>
<view class="captcha-btn" bindtap="sendCaptcha">获取验证码</view> <view class="code-btn" bindtap="sendCode">获取验证码</view>
</view> </view>
<button type="primary" class="register-btn" bindtap="startRegister">注册</button> <button type="primary" class="register-btn" bindtap="startRegister">注册</button>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.form-item .username, .form-item .password, .form-item .mobile, .form-item .captcha{ .form-item .username, .form-item .password, .form-item .mobile, .form-item .code{
position: absolute; position: absolute;
top: 26rpx; top: 26rpx;
left: 0; left: 0;
...@@ -26,19 +26,19 @@ ...@@ -26,19 +26,19 @@
font-size: 30rpx; font-size: 30rpx;
} }
.form-item-captcha{ .form-item-code{
margin-top:32rpx; margin-top:32rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
} }
.form-item-captcha .form-item{ .form-item-code .form-item{
float: left; float: left;
width: 350rpx; width: 350rpx;
} }
.form-item-captcha .captcha-btn{ .form-item-code .code-btn{
float: right; float: right;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment