Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6caf8244
authored
Jul 25, 2019
by
梁建民
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
验证码
parent
21d0e8e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
45 deletions
app.json
pages/person/verifycode/index.js
pages/person/verifycode/index.wxml
app.json
View file @
6caf8244
{
{
"pages"
:
[
"pages"
:
[
"pages/person/verifycode/index"
,
"pages/person/auth/index"
,
"pages/person/auth/index"
,
"pages/person/verifycode/index"
,
"pages/person/login/index"
,
"pages/person/login/index"
,
"pages/person/getphone/index"
,
"pages/person/getphone/index"
,
"pages/person/agreement/index"
,
"pages/person/agreement/index"
,
...
...
pages/person/verifycode/index.js
View file @
6caf8244
...
@@ -17,9 +17,12 @@ Page({
...
@@ -17,9 +17,12 @@ Page({
disabledBtn
:
false
,
disabledBtn
:
false
,
loading
:
false
,
loading
:
false
,
currentTime
:
61
,
currentTime
:
61
,
vcode
:
tru
e
,
vcode
:
fals
e
,
vcodeFlag
:
tru
e
,
vcodeFlag
:
fals
e
,
timeText
:
'发送验证码'
,
timeText
:
'发送验证码'
,
captchaUrl
:
''
,
captchaUuid
:
''
,
captcha
:
''
,
formData
:
{
formData
:
{
mobile
:
''
,
mobile
:
''
,
code
:
''
code
:
''
...
@@ -87,10 +90,9 @@ Page({
...
@@ -87,10 +90,9 @@ Page({
getCode
:
function
()
{
getCode
:
function
()
{
let
self
=
this
;
let
self
=
this
;
let
currentTime
=
this
.
data
.
currentTime
;
var
currentTime
=
this
.
data
.
currentTime
;
let
interval
=
setInterval
(
function
()
{
var
interval
=
setInterval
(
function
()
{
currentTime
--
;
currentTime
--
;
...
@@ -102,7 +104,6 @@ Page({
...
@@ -102,7 +104,6 @@ Page({
if
(
currentTime
<=
0
)
{
if
(
currentTime
<=
0
)
{
clearInterval
(
interval
);
clearInterval
(
interval
);
self
.
setData
({
self
.
setData
({
timeText
:
'重新发送'
,
timeText
:
'重新发送'
,
currentTime
:
61
,
currentTime
:
61
,
...
@@ -117,47 +118,68 @@ Page({
...
@@ -117,47 +118,68 @@ Page({
*/
*/
getVerificationCode
:
function
(
e
)
{
getVerificationCode
:
function
(
e
)
{
let
self
=
this
;
//验证必填手机号
if
(
this
.
data
.
formData
.
mobile
)
{
if
(
self
.
data
.
formData
.
mobile
)
{
//验证是否发送了验证码
if
(
this
.
data
.
captchaUuid
)
{
http
.
getData
(
apis
.
getWxCode
,
{
//是否填写了验证码
mobile
:
self
.
data
.
formData
.
code
,
if
(
this
.
data
.
captcha
)
{
http
.
getData
(
apis
.
getRegistCode
,
{
captchaUuid
:
this
.
data
.
captchaUuid
,
captcha
:
this
.
data
.
captcha
,
mobile
:
this
.
data
.
formData
.
mobile
,
code_type
:
2
code_type
:
2
},
function
(
res
)
{
},
(
res
)
=>
{
if
(
res
.
err_code
===
0
)
{
if
(
res
.
err_code
===
0
)
{
this
.
getCode
();
self
.
getCode
();
this
.
setData
({
self
.
setData
({
disabled
:
true
disabled
:
true
});
});
}
else
{
}
else
{
wx
.
showToast
({
wx
.
showToast
({
title
:
'发送失败'
,
title
:
res
.
err_msg
,
icon
:
'none'
,
icon
:
'none'
,
duration
:
2000
duration
:
2000
});
});
}
}
},
true
);
},
true
);
}
else
{
}
else
{
this
.
setData
({
error
:
true
,
errorText
:
'图形验证码不能为空'
,
vcodeFlag
:
true
});
}
}
else
{
this
.
refreshVerification
();
}
}
else
{
this
.
setData
({
this
.
setData
({
error
:
true
,
error
:
true
,
errorText
:
'手机号不能为空'
,
errorText
:
'手机号不能为空'
,
mobileFlag
:
true
mobileFlag
:
true
});
});
}
}
},
},
/**
/**
* 刷新
验证码
* 刷新图形
验证码
*/
*/
verificationFn
:
function
()
{
refreshVerification
:
function
()
{
this
.
setData
({
vcode
:
true
});
http
.
getData
(
apis
.
captchaInfo
,
null
,
(
res
)
=>
{
this
.
setData
({
captchaUrl
:
res
.
captchaUrl
,
captchaUuid
:
res
.
captchaUuid
});
});
},
},
/**
/**
* 校验字段
* 校验字段
...
@@ -181,28 +203,36 @@ Page({
...
@@ -181,28 +203,36 @@ Page({
});
});
if
(
reg_mobile
.
test
(
value
))
{
if
(
reg_mobile
.
test
(
value
))
{
this
.
setData
({
this
.
setData
({
error
:
false
,
error
:
false
,
errorText
:
''
,
errorText
:
''
,
mobileFlag
:
false
mobileFlag
:
false
});
});
}
}
}
}
}
else
{
}
else
if
(
e
.
currentTarget
.
dataset
.
type
==
2
)
{
if
(
value
)
{
if
(
value
)
{
this
.
setData
({
this
.
setData
({
error
:
false
,
error
:
false
,
errorText
:
''
,
errorText
:
''
,
codeFlag
:
false
codeFlag
:
false
});
});
}
}
}
else
if
(
e
.
currentTarget
.
dataset
.
type
==
3
)
{
if
(
value
)
{
this
.
setData
({
captcha
:
value
});
this
.
setData
({
error
:
false
,
errorText
:
''
,
vcodeFlag
:
false
});
}
}
}
},
},
...
@@ -222,7 +252,6 @@ Page({
...
@@ -222,7 +252,6 @@ Page({
mobileFlag
:
true
mobileFlag
:
true
});
});
return
false
;
return
false
;
}
}
if
(
!
reg_mobile
.
test
(
mobile
))
{
if
(
!
reg_mobile
.
test
(
mobile
))
{
...
@@ -232,9 +261,7 @@ Page({
...
@@ -232,9 +261,7 @@ Page({
errorText
:
'请填写正确的手机号'
,
errorText
:
'请填写正确的手机号'
,
mobileFlag
:
true
mobileFlag
:
true
});
});
return
false
;
return
false
;
}
}
if
(
!
code
)
{
if
(
!
code
)
{
...
@@ -244,9 +271,7 @@ Page({
...
@@ -244,9 +271,7 @@ Page({
errorText
:
'验证码不能为空'
,
errorText
:
'验证码不能为空'
,
codeFlag
:
true
codeFlag
:
true
});
});
return
false
;
return
false
;
}
}
...
@@ -273,8 +298,7 @@ Page({
...
@@ -273,8 +298,7 @@ Page({
loading
:
true
loading
:
true
});
});
http
.
postData
(
apis
.
authMobilelogin
,
e
.
detail
.
value
,
function
(
res
)
{
http
.
postData
(
apis
.
authMobilelogin
,
e
.
detail
.
value
,
(
res
)
=>
{
if
(
res
.
err_code
===
0
)
{
if
(
res
.
err_code
===
0
)
{
//注入token
//注入token
...
@@ -283,26 +307,22 @@ Page({
...
@@ -283,26 +307,22 @@ Page({
data
:
res
.
data
.
access_token
data
:
res
.
data
.
access_token
});
});
//
wx.switchTab({
wx
.
switchTab
({
//
url: '/pages/tab/home/home'
url
:
'/pages/tab/home/home'
//
})
})
}
else
{
}
else
{
wx
.
showToast
({
wx
.
showToast
({
title
:
res
.
err_msg
,
title
:
res
.
err_msg
,
icon
:
'none'
,
icon
:
'none'
,
duration
:
2000
duration
:
2000
});
});
}
}
self
.
setData
({
self
.
setData
({
disabledBtn
:
false
,
disabledBtn
:
false
,
loading
:
false
loading
:
false
});
});
});
});
}
}
}
}
})
})
pages/person/verifycode/index.wxml
View file @
6caf8244
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
<text class="t1">Hi,上午好</text>
<text class="t1">Hi,上午好</text>
<text class="t1">欢迎使用IC业务助手!</text>
<text class="t1">欢迎使用IC业务助手!</text>
</view>
</view>
<form bindsubmit="formSubmit">
<form bindsubmit="formSubmit">
<view class="inp-wrap row verCenter {{mobileFlag ? 'inp-error':''}}">
<view class="inp-wrap row verCenter {{mobileFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
...
@@ -21,9 +20,9 @@
...
@@ -21,9 +20,9 @@
<view class="inp-wrap row verCenter {{vcodeFlag ? 'inp-error':''}}" wx:if="{{vcode}}">
<view class="inp-wrap row verCenter {{vcodeFlag ? 'inp-error':''}}" wx:if="{{vcode}}">
<text class="icon iconfont iconiconxiantiaoshouji"></text>
<text class="icon iconfont iconiconxiantiaoshouji"></text>
<view class="form-item-right row verCenter bothSide">
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入图形验证码" placeholder-class="placeholderClass" name='c
ode
' data-type="3" bindinput='bindinputFn'></input>
<input placeholder="请输入图形验证码" placeholder-class="placeholderClass" name='c
aptcha
' data-type="3" bindinput='bindinputFn'></input>
<view class='code-img'>
<view class='code-img'>
<cover-image src="
http://authapi.icsales.cc/captcha/default/d162987e-6aa8-545e-3b73-8c2cf3c361cc" class="img" bindtap='verificationF
n'></cover-image>
<cover-image src="
{{captchaUrl}}" class="img" bindtap='refreshVerificatio
n'></cover-image>
</view>
</view>
</view>
</view>
</view>
</view>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment