Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
4331b905
Commit
4331b905
authored
Sep 25, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
countdown
parent
65678b26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
34 deletions
+50
-34
src/components/detail/bargain/bargainInfo/bargain-info.scss
+2
-1
src/components/detail/bargain/bargainInfo/index.js
+45
-23
src/components/search/search-result.js
+3
-10
No files found.
src/components/detail/bargain/bargainInfo/bargain-info.scss
View file @
4331b905
...
...
@@ -56,10 +56,11 @@
}
.bargain-phone-popup__button--send
{
width
:
1
20
px
;
width
:
1
36
px
;
border-style
:
none
;
font-size
:
13px
;
color
:
$color_999
;
text-align
:
right
;
background-color
:
transparent
;
cursor
:
pointer
;
outline
:
none
;
...
...
src/components/detail/bargain/bargainInfo/index.js
View file @
4331b905
...
...
@@ -17,7 +17,9 @@ class BargainInfo extends Component {
isBargain
:
true
,
isFocus
:
false
,
bindInfo
:
{},
isTip
:
false
isTip
:
false
,
seconds
:
60
,
isTimer
:
false
,
// 是否开始倒计时
}
handleChange
=
e
=>
{
...
...
@@ -32,28 +34,46 @@ class BargainInfo extends Component {
// 获取短信验证码
sendCode
=
()
=>
{
const
{
country
}
=
this
.
props
;
const
{
mobile
}
=
this
.
state
;
if
(
!
/^
\d
+$/
.
test
(
mobile
)){
Toast
.
info
(
'请输入正确的手机号'
);
return
;
}
// 获取验证码
http
.
post
(
`
${
API
[
'passport-api'
]}
/m/personal/bindPhoneSendCode`
,
{
area_code
:
country
.
padStart
(
4
,
'0'
),
phone_num
:
mobile
let
{
mobile
,
isTimer
,
seconds
}
=
this
.
state
;
if
(
!
isTimer
)
{
if
(
!
/^
\d
+$/
.
test
(
mobile
)){
Toast
.
info
(
'请输入正确的手机号'
);
return
;
}
).
then
(
res
=>
{
const
{
errno
,
msg
}
=
res
.
data
;
if
(
errno
===
200
)
{
Toast
.
info
(
'验证码发送成功'
,
2
,
null
,
false
);
}
else
{
Toast
.
info
(
msg
);
}
});
// 获取验证码
http
.
post
(
`
${
API
[
'passport-api'
]}
/m/personal/bindPhoneSendCode`
,
{
area_code
:
country
.
padStart
(
4
,
'0'
),
phone_num
:
mobile
}
).
then
(
res
=>
{
const
{
errno
,
msg
}
=
res
.
data
;
if
(
errno
===
200
)
{
Toast
.
info
(
'验证码发送成功'
,
2
,
null
,
false
);
// 倒计时
this
.
timer
=
window
.
setInterval
(()
=>
{
console
.
log
(
seconds
);
if
(
seconds
<=
0
)
{
window
.
clearInterval
(
this
.
timer
);
this
.
setState
({
isTimer
:
false
,
seconds
:
60
});
}
else
{
this
.
setState
({
isTimer
:
true
,
seconds
:
--
seconds
});
}
},
1000
);
}
else
{
Toast
.
info
(
msg
);
}
});
}
// http.post(`${API['base-api']}/sys/bind_send_sms`, {
// phone_num: this.state.mobile
...
...
@@ -127,7 +147,7 @@ class BargainInfo extends Component {
render
()
{
const
{
country
,
toClose
}
=
this
.
props
;
const
{
mobile
,
code
,
isBargain
,
isFocus
,
bindInfo
,
isTip
}
=
this
.
state
;
const
{
mobile
,
code
,
isBargain
,
isFocus
,
bindInfo
,
isTip
,
isTimer
,
seconds
}
=
this
.
state
;
const
bool
=
/^
\d
+$/
.
test
(
mobile
);
return
(
<>
...
...
@@ -243,7 +263,9 @@ class BargainInfo extends Component {
}
)}
onClick
=
{
this
.
sendCode
}
>
发送验证码
<
/button
>
>
{
isTimer
?
`重新发送
${
seconds
}
s`
:
'发送验证码'
}
<
/button
>
<
/div
>
{
isBargain
...
...
src/components/search/search-result.js
View file @
4331b905
...
...
@@ -78,18 +78,15 @@ class SearchResult extends PureComponent {
handleScroll
=
throttle
(()
=>
{
let
y
=
window
.
scrollY
,
headY
=
this
.
searchHead
.
current
.
offsetTop
;
// console.log(y);
if
(
y
<
this
.
prevScrollY
&&
y
>
0
)
{
if
(
this
.
state
.
swipeDirection
===
this
.
swipeDown
)
{
y
<=
headY
&&
this
.
state
.
searchHeadStyle
.
position
!==
'fixed'
&&
this
.
setState
({
y
<=
headY
&&
this
.
state
.
searchHeadStyle
.
position
!==
'fixed'
&&
this
.
setState
({
searchHeadStyle
:
{
top
:
`0`
,
position
:
'fixed'
}
})
}
else
{
this
.
setState
({
swipeDirection
:
this
.
swipeDown
...
...
@@ -97,15 +94,12 @@ class SearchResult extends PureComponent {
if
(
this
.
state
.
swipeDirection
===
this
.
swipeDown
)
{
this
.
setState
({
searchHeadStyle
:
{
// top: `${y > headY ? y - 44 : y}px`
top
:
`
${
y
}
px`
top
:
`
${
y
>
headY
?
y
-
44
:
y
}
px`
}
})
}
})
}
}
else
{
this
.
state
.
swipeDirection
!==
this
.
swipeUp
&&
this
.
setState
({
...
...
@@ -115,7 +109,6 @@ class SearchResult extends PureComponent {
top
:
`
${
y
}
px`
}
})
}
this
.
prevScrollY
=
y
;
},
0
)
...
...
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