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
b103a56c
Commit
b103a56c
authored
Nov 04, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Plain Diff
ui问题
parents
6a329e43
5fe4637c
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
384 additions
and
305 deletions
+384
-305
src/App.js
+3
-0
src/common/closable-popup/index.scss
+1
-1
src/components/activity/index.js
+1
-1
src/components/blessingPreheat/ReserveCourse/index.js
+2
-2
src/components/blessingPreheat/banner/index.scss
+2
-2
src/components/blessingPreheat/coursePopup/index.scss
+1
-1
src/components/blessingPreheat/levelTest/index.js
+1
-1
src/components/blessingPreheat/levelTest/index.scss
+4
-0
src/components/blessingPreheat/live/index.js
+63
-27
src/components/blessingPreheat/live/index.scss
+16
-1
src/components/blessingPreheat/luckDraw/index.scss
+5
-5
src/components/blessingPreheat/recordPopup/index.js
+4
-2
src/components/blessingPreheat/recordPopup/index.scss
+9
-6
src/components/blessingPreheat/sharePopup/index.js
+2
-2
src/components/blessingPreheat/sharePopup/index.scss
+4
-0
src/components/order/deposit/final-order/index.js
+3
-2
src/components/passport/bindingTel/index.js
+132
-131
src/components/passport/index.js
+6
-4
src/components/passport/setPassword/index.js
+122
-116
src/utils/index.js
+3
-1
No files found.
src/App.js
View file @
b103a56c
...
...
@@ -63,6 +63,9 @@ class App extends Component {
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
}
if
(
location
.
pathname
===
'/passport'
){
window
.
localStorage
.
setItem
(
'binding_redirect'
,
JSON
.
stringify
(
this
.
previousLocation
))
}
const
{
pathname
,
state
}
=
location
if
(
pathname
.
startsWith
(
'/passport'
))
{
location
.
state
=
{
...
...
src/common/closable-popup/index.scss
View file @
b103a56c
...
...
@@ -25,7 +25,7 @@
.close
{
position
:
absolute
;
bottom
:
-
88
px
;
bottom
:
-
74
px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
font-size
:
36px
;
...
...
src/components/activity/index.js
View file @
b103a56c
...
...
@@ -26,7 +26,7 @@ class Activity extends Component {
getGift
=
()
=>
{
if
(
this
.
props
.
user
.
hasError
)
{
this
.
props
.
history
.
push
(
'/passport'
);
this
.
props
.
history
.
push
(
'/passport'
,
{
from
:
this
.
props
.
location
.
pathname
}
);
}
else
{
Toast
.
info
(
'领取成功,你可前往七月在线官网/APP进行查看'
,
2
);
localStorage
.
setItem
(
'lingqu'
,
1
);
...
...
src/components/blessingPreheat/ReserveCourse/index.js
View file @
b103a56c
...
...
@@ -34,7 +34,7 @@ class ReserveCourse extends Component {
const
{
code
,
data
,
msg
}
=
res
.
data
;
if
(
code
===
200
)
{
this
.
setState
({
courseData
:
data
.
filter
((
item
,
index
)
=>
index
<
4
),
courseData
:
JSON
.
stringify
(
data
)
==
'{}'
?
[]:
data
.
filter
((
item
,
index
)
=>
index
<
4
),
courseDataAll
:
data
})
}
else
{
...
...
@@ -172,7 +172,7 @@ function CourseList(props) {
}
{
item
.
is_buy
===
1
&&
<
button
<
button
className
=
"to-expand-buy2"
onClick
=
{()
=>
expandPaywk
(
item
.
course_id
,
item
.
start_timestamp
,
item
.
final_start_time
)}
>
立即付尾款
<
/button
>
...
...
src/components/blessingPreheat/banner/index.scss
View file @
b103a56c
...
...
@@ -24,11 +24,11 @@
li
{
flex
:
1
;
width
:
63px
;
height
:
3
0px
;
height
:
4
0px
;
font-size
:
11px
;
color
:
#fff
;
text-align
:
center
;
line-height
:
3
0px
;
line-height
:
4
0px
;
&
.active
{
background
:
#FF42F9
;
}
...
...
src/components/blessingPreheat/coursePopup/index.scss
View file @
b103a56c
...
...
@@ -12,7 +12,7 @@
.iconfont
{
margin
:
16px
0
0
;
font-size
:
2
4
px
;
font-size
:
2
8
px
;
color
:
#fff
;
cursor
:
pointer
;
}
...
...
src/components/blessingPreheat/levelTest/index.js
View file @
b103a56c
...
...
@@ -75,7 +75,7 @@ class LevelTest extends Component {
<>
<
div
className
=
"level__test_module"
>
<
div
className
=
'start__test'
onClick
=
{
this
.
startTest
}
>
<
img
src
=
"https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/test_icon.png"
/>
<
img
className
=
'test-img'
src
=
"https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/test_icon.png"
/>
<
div
className
=
"button__text"
>
<
p
>
点击测试
<
/p
>
<
/div
>
...
...
src/components/blessingPreheat/levelTest/index.scss
View file @
b103a56c
...
...
@@ -29,6 +29,10 @@
font-size
:
12px
;
}
}
.test-img
{
width
:
14px
;
height
:
14px
;
}
}
.test__number
{
...
...
src/components/blessingPreheat/live/index.js
View file @
b103a56c
import
React
,
{
Component
}
from
'react'
import
'./index.scss'
import
{
Tabs
,
Toast
}
from
"antd-mobile"
import
{
getParam
,
http
,
SendMessageToApp
}
from
"@/utils"
import
{
getParam
,
http
,
SendMessageToApp
,
browser
}
from
"@/utils"
import
{
Popup
}
from
"@common/index"
import
QRCode
from
'qrcode'
import
{
uniqBy
}
from
'lodash'
...
...
@@ -12,12 +12,15 @@ import { withRouter } from 'react-router-dom'
@
connect
(
state
=>
({
user
:
state
.
user
}))
class
Live
extends
Component
{
popupInstance
=
null
state
=
{
tabs
:
[],
lives
:
{},
preheatLives
:
[],
today
:
''
,
isApp
:
getParam
(
'version'
)
isApp
:
getParam
(
'version'
),
QRCodeUrl
:
''
,
}
...
...
@@ -69,22 +72,33 @@ class Live extends Component {
}
toLiveRoom
=
id
=>
{
const
{
history
,
isLogin
}
=
this
.
props
;
const
{
history
,
isLogin
}
=
this
.
props
if
(
this
.
state
.
isApp
)
{
if
(
isLogin
)
{
if
(
isLogin
)
{
SendMessageToApp
(
'toLiveRoom'
,
id
)
}
else
{
}
else
{
SendMessageToApp
(
"toLogin"
)
}
}
else
{
if
(
isLogin
)
{
if
(
isLogin
)
{
window
.
location
.
href
=
`
${
window
.
location
.
protocol
}
//www.julyedu.com/live/m_room/
${
id
}
`
}
else
{
}
else
{
history
.
push
(
'/passport'
)
}
}
}
saveImage
=
()
=>
{
let
version
=
getParam
(
'version'
)
version
=
typeof
version
===
'string'
?
version
.
replace
(
'.'
,
''
).
replace
(
'.'
,
''
).
slice
(
0
,
3
)
:
''
const
{
QRCodeUrl
}
=
this
.
state
if
(
version
&&
parseInt
(
version
)
<
451
)
{
Toast
.
info
(
'当前不支持此功能,升级到最新版本app可以点击保存二维码!'
,
2
,
null
,
false
)
}
else
{
SendMessageToApp
(
'generateQRCode'
,
QRCodeUrl
)
}
}
makeSubscribe
=
id
=>
{
const
{
user
,
history
}
=
this
.
props
if
(
user
.
hasError
)
{
...
...
@@ -94,11 +108,29 @@ class Live extends Component {
.
then
(
res
=>
{
const
{
data
}
=
res
if
(
data
.
errno
==
200
)
{
this
.
setState
(()
=>
({
QRCodeUrl
:
data
.
data
.
url
,
}))
QRCode
.
toDataURL
(
data
.
data
.
url
,
(
err
,
url
)
=>
{
Popup
({
title
:
'扫码关注“七月在线”服务号即可预约'
,
content
:
<
img
id
=
{
'live-qr-code'
}
src
=
{
url
}
alt
=
""
/>
})
if
(
!
this
.
popupInstance
)
{
this
.
popupInstance
=
Popup
({
title
:
'扫码关注“七月在线”服务号即可预约'
,
content
:
(
<>
<
img
id
=
{
'live-qr-code'
}
src
=
{
url
}
alt
=
""
/>
{
browser
.
isAndroidApp
?
(
<
button
className
=
{
'save-image'
}
onClick
=
{
this
.
saveImage
}
>
保存二维码
<
/button
>
)
:
null
}
<
/
>
),
close
:
()
=>
new
Promise
(
resolve
=>
{
this
.
popupInstance
=
null
resolve
()
})
})
}
})
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
...
...
@@ -136,27 +168,29 @@ class Live extends Component {
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
:
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
preheatLives
[
item
.
title
]
return
(
<
div
key
=
{
index
}
>
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
:
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
preheatLives
[
item
.
title
]
return
(
<
div
key
=
{
index
}
>
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
}
<
/Tabs
>
...
...
@@ -201,7 +235,9 @@ function LiveContent({item, makeSubscribe, toLiveRoom}) {
<
/div
>
{
item
[
'on_live'
]
?
<
button
className
=
{
'on-living'
}
onClick
=
{()
=>
{
toLiveRoom
(
item
[
'room_url'
])}}
>
正在直播
<
/button
>
?
<
button
className
=
{
'on-living'
}
onClick
=
{()
=>
{
toLiveRoom
(
item
[
'room_url'
])
}}
>
正在直播
<
/button
>
:
item
[
'is_end'
]
?
<
button
className
=
{
'subscribed'
}
>
已结束
<
/button
>
...
...
src/components/blessingPreheat/live/index.scss
View file @
b103a56c
...
...
@@ -227,12 +227,27 @@
.content
{
display
:
flex
;
justify-content
:
center
;
flex-direction
:
column
;
align-items
:
center
;
img
{
width
:
120px
;
height
:
120px
;
margin-top
:
10px
;
}
}
.save-image
{
width
:
133px
;
height
:
30px
;
margin-top
:
16px
;
background
:
rgba
(
83
,
39
,
250
,
1
);
border-radius
:
15px
;
font-size
:
14px
;
color
:
#fff
;
-webkit-appearance
:
none
;
outline
:
0
;
border
:
none
;
}
}
src/components/blessingPreheat/luckDraw/index.scss
View file @
b103a56c
...
...
@@ -8,7 +8,7 @@
height
:
33px
;
border
:
1px
solid
rgba
(
255
,
246
,
4
,
1
);
border-radius
:
0
0
6px
6px
;
.am-tabs-default-bar
{
.am-tabs-default-bar-tab
:nth-of-type
(
3
)
{
...
...
@@ -16,11 +16,11 @@
display
:
none
;
}
}
.am-tabs-default-bar-tab
{
height
:
auto
;
line-height
:
1
;
&
:
:
after
{
content
:
''
;
display
:
block
;
...
...
@@ -74,7 +74,7 @@
.prize__content
{
display
:
flex
;
flex-wrap
:
nowrap
;
padding
:
10px
7px
0
;
padding
:
10px
7px
0
0
;
overflow-y
:
auto
;
}
...
...
@@ -86,7 +86,7 @@
background-image
:
url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/prize-border.png')
;
background-size
:
cover
;
overflow
:
hidden
;
img
{
display
:
block
;
width
:
100%
;
...
...
src/components/blessingPreheat/recordPopup/index.js
View file @
b103a56c
...
...
@@ -41,6 +41,7 @@ export default class RecordPopup extends Component {
<
/div
>
<
div
className
=
"table__body"
>
{
recordList
.
length
>
0
?
recordList
.
map
((
item
,
index
)
=>
{
return
(
<
div
className
=
"tr__container"
key
=
{
index
}
>
<
span
className
=
"tr"
>
{
item
.
submit_time
}
<
/span
>
...
...
@@ -54,12 +55,13 @@ export default class RecordPopup extends Component {
<
/span
>
<
/div
>
)
})
}):
<
div
className
=
{
'notdata'
}
>
暂无测试记录
<
/div
>
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
}
...
...
src/components/blessingPreheat/recordPopup/index.scss
View file @
b103a56c
...
...
@@ -14,10 +14,9 @@
.gift__record
{
width
:
300px
;
height
:
250px
;
background
:
rgba
(
255
,
255
,
255
,
1
);
border-radius
:
5px
;
padding
:
18px
24px
0
24px
;
padding
:
18px
24px
30px
24px
;
position
:
relative
;
span
.tr
{
display
:
flex
;
...
...
@@ -60,7 +59,6 @@
}
.table__body
{
width
:
250px
;
height
:
102px
;
border
:
1px
solid
rgba
(
207
,
219
,
229
,
0
.4
);
border-radius
:
0px
0px
1px
1px
;
box-sizing
:
border-box
;
...
...
@@ -78,10 +76,15 @@
}
}
}
.notdata
{
text-align
:
center
;
color
:
#999999
;
line-height
:
35px
;
}
.close__button
{
width
:
32
px
;
height
:
32
px
;
width
:
24
px
;
height
:
24
px
;
border-radius
:
50%
;
position
:
absolute
;
left
:
50%
;
...
...
@@ -92,7 +95,7 @@
justify-content
:
center
;
align-items
:
center
;
i
{
font-size
:
32
px
;
font-size
:
24
px
;
color
:
#fff
;
}
}
...
...
src/components/blessingPreheat/sharePopup/index.js
View file @
b103a56c
...
...
@@ -11,7 +11,7 @@ export default class SharePopup extends Component {
}
}}
>
{
browser
.
isWeixin
&&
browser
.
isWeixin
&&
<
div
className
=
"share__row"
>
<
img
src
=
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/throw_icon.png'
/>
<
/div
>
...
...
@@ -19,7 +19,7 @@ export default class SharePopup extends Component {
<
div
className
=
"share__content"
>
<
p
className
=
"share__text"
>
分享活动页到朋友圈、
qq
、微博分别
<
/p
>
<
div
className
=
'share__rule'
>
<
img
src
=
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/add2.png'
/>
<
img
className
=
{
'share__add2'
}
src
=
'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/add2.png'
/>
<
span
>
(每个平台每天一次)
<
/span
>
<
/div
>
<
/div
>
...
...
src/components/blessingPreheat/sharePopup/index.scss
View file @
b103a56c
...
...
@@ -45,5 +45,8 @@
font-size
:
12px
;
color
:
#525C65
;
}
.share__add2
{
width
:
95px
;
}
}
}
\ No newline at end of file
src/components/order/deposit/final-order/index.js
View file @
b103a56c
...
...
@@ -400,8 +400,9 @@ class FinalDepositOrder extends Component {
getBalanceOffset
=
()
=>
{
let
originalTotalPrice
=
this
.
getOriginTotalPrice
()
let
offset
=
parseFloat
(
this
.
state
.
user_account
)
-
parseFloat
(
originalTotalPrice
)
offset
=
offset
>=
0
?
originalTotalPrice
:
this
.
state
.
user_account
let
currentPrice
=
this
.
moneyOff
(
originalTotalPrice
)
let
offset
=
parseFloat
(
this
.
state
.
user_account
)
-
parseFloat
(
currentPrice
)
offset
=
offset
>=
0
?
currentPrice
:
this
.
state
.
user_account
return
offset
}
...
...
src/components/passport/bindingTel/index.js
View file @
b103a56c
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
'./binding-tel.scss'
import
{
withFormik
,
Field
,
Form
}
from
"formik"
;
import
{
http
,
getParam
}
from
"@/utils"
;
import
{
compose
}
from
"redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
}
from
"@/store/userAction"
;
import
{
withFormik
,
Field
,
Form
}
from
"formik"
import
{
http
,
getParam
}
from
"@/utils"
import
{
compose
}
from
"redux"
import
{
connect
}
from
"react-redux"
import
{
setCurrentUser
}
from
"@/store/userAction"
import
Captcha
from
'@/common/Captcha'
import
{
HeaderBar
}
from
'@/common'
...
...
@@ -13,147 +13,148 @@ import { HeaderBar } from '@/common'
import
ClearableInput
from
'../common/clearableInputWithCountryCodes'
import
Button
from
'../common/Button'
import
VeriCodeInput
from
'../common/veriCodeInput'
import
{
Toast
}
from
"antd-mobile"
;
import
{
isEmpty
}
from
"lodash"
;
import
{
Toast
}
from
"antd-mobile"
import
{
isEmpty
}
from
"lodash"
class
BindingTel
extends
Component
{
state
=
{
validate
:
null
,
captchaInstance
:
null
}
state
=
{
validate
:
null
,
captchaInstance
:
null
}
getCaptchaInstance
=
instance
=>
{
this
.
setState
({
captchaInstance
:
instance
})
}
onVerify
=
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
err
)
}
else
{
this
.
setState
({
validate
:
data
.
validate
})
}
getCaptchaInstance
=
instance
=>
{
this
.
setState
({
captchaInstance
:
instance
})
}
onVerify
=
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
err
)
}
else
{
this
.
setState
({
validate
:
data
.
validate
})
}
}
render
()
{
const
{
values
,
errors
,
country
}
=
this
.
props
return
(
<>
<
HeaderBar
title
=
{
'绑定手机号'
}
arrow
=
{
true
}
/
>
<
div
className
=
{
'binding-tel'
}
>
<
p
className
=
{
'title'
}
>
为提高您的账号安全,请绑定手机号
<
/p
>
<
Form
>
<
Field
name
=
'tel'
render
=
{({
field
,
form
})
=>
{
return
(
<
ClearableInput
{...
field
}
setFieldValue
=
{
form
.
setFieldValue
}
placeholder
=
{
'请输入需要绑定的手机号'
}
wrapperClass
=
{
'tel'
}
country
=
{
country
}
/
>
render
()
{
const
{
values
,
errors
,
country
}
=
this
.
props
return
(
<>
<
HeaderBar
title
=
{
'绑定手机号'
}
arrow
=
{
true
}
/
>
<
div
className
=
{
'binding-tel'
}
>
<
p
className
=
{
'title'
}
>
为提高您的账号安全,请绑定手机号
<
/p
>
<
Form
>
<
Field
name
=
'tel'
render
=
{({
field
,
form
})
=>
{
return
(
<
ClearableInput
{...
field
}
setFieldValue
=
{
form
.
setFieldValue
}
placeholder
=
{
'请输入需要绑定的手机号'
}
wrapperClass
=
{
'tel'
}
country
=
{
country
}
/
>
)
}}
/
>
<
Field
name
=
'veriCode'
render
=
{({
field
})
=>
{
return
(
<
VeriCodeInput
{...
field
}
className
=
{
'verification'
}
icon
=
{
<
i
className
=
{
'iconfont iconduanxin'
}
style
=
{{
fontSize
:
'20px'
,
left
:
'12px'
}}
/>
}
placeholder
=
{
'验证码'
}
account
=
{
values
.
tel
}
tel
=
{
values
.
tel
}
challenge
=
{
this
.
state
.
validate
}
instance
=
{
this
.
state
.
captchaInstance
}
action
=
{
'auth'
}
country
=
{
country
}
/
>
)
}}
/
>
<
Field
name
=
'veriCode'
render
=
{({
field
})
=>
{
return
(
<
VeriCodeInput
{...
field
}
className
=
{
'verification'
}
icon
=
{
<
i
className
=
{
'iconfont iconduanxin'
}
style
=
{{
fontSize
:
'20px'
,
left
:
'12px'
}}
/>
}
placeholder
=
{
'验证码'
}
account
=
{
values
.
tel
}
tel
=
{
values
.
tel
}
challenge
=
{
this
.
state
.
validate
}
instance
=
{
this
.
state
.
captchaInstance
}
action
=
{
'auth'
}
country
=
{
country
}
/
>
)
}}
/
>
<
Captcha
onVerify
=
{
this
.
onVerify
}
getInstance
=
{
this
.
getCaptchaInstance
}
/
>
<
Button
className
=
{
'complete-btn'
}
active
=
{
values
.
tel
&&
values
.
veriCode
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
/Form
>
<
/div
>
<
/
>
);
}
)
}}
/
>
<
Captcha
onVerify
=
{
this
.
onVerify
}
getInstance
=
{
this
.
getCaptchaInstance
}
/
>
<
Button
className
=
{
'complete-btn'
}
active
=
{
values
.
tel
&&
values
.
veriCode
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
/Form
>
<
/div
>
<
/
>
)
}
}
const
formikConfig
=
{
mapPropsToValues
()
{
return
{
tel
:
''
,
veriCode
:
''
}
},
validateOnChange
:
true
,
validate
(
values
)
{
let
errors
=
{}
if
(
!
/
\d
/
.
test
(
values
.
tel
))
{
errors
.
tel
=
'请输入正确的手机号'
}
if
(
!
values
.
veriCode
)
{
errors
.
veriCode
=
'请填写验证码'
mapPropsToValues
()
{
return
{
tel
:
''
,
veriCode
:
''
}
},
validateOnChange
:
true
,
validate
(
values
)
{
let
errors
=
{}
if
(
!
/
\d
/
.
test
(
values
.
tel
))
{
errors
.
tel
=
'请输入正确的手机号'
}
if
(
!
values
.
veriCode
)
{
errors
.
veriCode
=
'请填写验证码'
}
return
errors
},
handleSubmit
(
values
,
{
props
})
{
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile`
,
{
phone_num
:
values
.
tel
,
phone_code
:
values
.
veriCode
,
mkey
:
getParam
(
'mkey'
),
area_code
:
'00'
+
props
.
country
.
num
,
plat
:
5
}).
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
==
200
)
{
if
(
data
.
data
[
'is_set_pwd'
])
{
const
{
history
}
=
props
history
.
replace
(
`/passport/set-password`
,
{
user
:
{
hasError
:
false
,
data
:
{
uid
:
data
.
data
.
uid
},
msg
:
data
.
data
.
msg
,
stage
:
'binding'
}
})
}
else
{
location
.
assign
(
data
.
data
[
'jump_url'
])
}
return
errors
},
handleSubmit
(
values
,
{
props
})
{
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile`
,
{
phone_num
:
values
.
tel
,
phone_code
:
values
.
veriCode
,
mkey
:
getParam
(
'mkey'
),
area_code
:
'00'
+
props
.
country
.
num
,
plat
:
5
}).
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
==
200
)
{
if
(
data
.
data
[
'is_set_pwd'
])
{
props
.
setCurrentUser
({
hasError
:
false
,
data
:
{
uid
:
data
.
data
.
uid
},
msg
:
data
.
data
.
msg
,
stage
:
'binding'
})
props
.
history
.
replace
(
`/passport/set-password`
)
}
else
{
location
.
assign
(
data
.
data
[
'jump_url'
])
}
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
}
})
}
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
}
})
}
}
export
default
compose
(
connect
(
state
=>
({
country
:
state
.
country
}),
{
setCurrentUser
}
),
withFormik
(
formikConfig
),
)(
BindingTel
)
;
connect
(
state
=>
({
country
:
state
.
country
}),
{
setCurrentUser
}
),
withFormik
(
formikConfig
),
)(
BindingTel
)
src/components/passport/index.js
View file @
b103a56c
...
...
@@ -23,6 +23,7 @@ class Passport extends Component {
redirectURL
=
'/'
count
=
1
blackList
=
new
Set
([
'/passport/binding-tel'
,
'/passport/set-password'
])
constructor
(
props
)
{
super
(
props
)
...
...
@@ -85,7 +86,7 @@ class Passport extends Component {
routeWhenUserLoggedIn
=
()
=>
{
let
{
hasError
}
=
this
.
props
.
user
if
(
!
hasError
)
{
if
(
!
hasError
&&
!
this
.
blackList
.
has
(
this
.
props
.
location
.
pathname
)
)
{
const
redirectURI
=
getParam
(
'redirect'
)
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
this
.
props
.
history
.
go
(
-
this
.
count
)
}
...
...
@@ -108,7 +109,9 @@ class Passport extends Component {
<
Route
path
=
{
match
.
url
+
'/account-login'
}
component
=
{
AccountLogin
}
/
>
<
Route
path
=
{
match
.
url
+
'/forgot-password'
}
component
=
{
ForgotPassword
}
/
>
<
Route
path
=
{
match
.
url
+
'/forgot-password-email'
}
component
=
{
ForgotPasswordEmail
}
/
>
<
Route
path
=
{
match
.
url
+
'/set-password'
}
component
=
{
SetPassword
}
/
>
<
Route
path
=
{
match
.
url
+
'/set-password'
}
render
=
{
props
=>
{
return
<
SetPassword
{...
props
}
count
=
{
this
.
count
}
/
>
}}
/
>
<
Route
path
=
{
match
.
url
+
'/binding-tel'
}
component
=
{
BindingTel
}
/
>
<
/Switch
>
<
/div
>
...
...
@@ -123,4 +126,4 @@ export default compose(
null
),
WithFullSize
)(
Passport
)
\ No newline at end of file
)(
Passport
)
src/components/passport/setPassword/index.js
View file @
b103a56c
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
'./set-password.scss'
import
{
withFormik
,
Form
,
Field
}
from
"formik"
;
import
{
withFormik
,
Form
,
Field
}
from
"formik"
import
PasswordInput
from
'../common/passwordInput'
import
Button
from
'../common/Button'
import
classnames
from
'classnames'
import
{
compose
}
from
'redux'
import
{
HeaderBar
}
from
"@/common"
;
import
{
http
,
api
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
encrypt
}
from
"@/components/passport/encryption"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
isEmpty
}
from
"lodash"
;
import
{
connect
}
from
"react-redux"
;
import
{
HeaderBar
}
from
"@/common"
import
{
http
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
import
{
encrypt
}
from
"@/components/passport/encryption"
import
{
Link
}
from
"react-router-dom"
import
{
isEmpty
}
from
"lodash"
import
{
connect
}
from
"react-redux"
import
{
setCurrentUser
}
from
'@/store/userAction'
class
SetPassword
extends
Component
{
render
()
{
let
{
values
,
errors
,
location
}
=
this
.
props
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
return
(
<>
<
HeaderBar
arrow
=
{
true
}
title
=
{
'设置密码'
}
/
>
<
div
className
=
{
'set-password'
}
>
<
p
className
=
'title'
>
密码需要包含
6
-
16
位字母及数字
<
/p
>
<
Form
>
<
Field
name
=
'password'
render
=
{({
field
})
=>
{
return
(
<
PasswordInput
autoComplete
=
{
'on'
}
placeholder
=
{
'设置密码'
}
onChange
=
{
this
.
handleChange
}
{...
field
}
/
>
)
}}
/
>
<
Button
className
=
{
'btn-active'
}
active
=
{
values
.
password
&&
values
.
agreement
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
label
htmlFor
=
"agreement"
className
=
'user-agreement'
>
<
Field
type
=
'checkbox'
name
=
'agreement'
id
=
'agreement'
className
=
{
classnames
([
this
.
props
.
values
.
agreement
?
'iconfont iconiconfront-3'
:
'disagree'
])}
/
>
同意
<
span
>
《七月在线用户使用协议》
<
/span
>
<
/label
>
<
/Form
>
<
div
className
=
"skip"
style
=
{{
display
:
from
&&
from
.
pathname
.
includes
(
'forgot-password'
)
?
'none'
:
'block'
}}
>
<
Link
replace
to
=
'/passport/account-login'
>
跳过
<
/Link
>
<
/div
>
<
/div
>
<
/
>
);
}
render
()
{
let
{
values
,
errors
,
location
}
=
this
.
props
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
return
(
<>
<
HeaderBar
arrow
=
{
true
}
title
=
{
'设置密码'
}
/
>
<
div
className
=
{
'set-password'
}
>
<
p
className
=
'title'
>
密码需要包含
6
-
16
位字母及数字
<
/p
>
<
Form
>
<
Field
name
=
'password'
render
=
{({
field
})
=>
{
return
(
<
PasswordInput
autoComplete
=
{
'on'
}
placeholder
=
{
'设置密码'
}
onChange
=
{
this
.
handleChange
}
{...
field
}
/
>
)
}}
/
>
<
Button
className
=
{
'btn-active'
}
active
=
{
values
.
password
&&
values
.
agreement
&&
isEmpty
(
errors
)}
>
完成
<
/Button
>
<
label
htmlFor
=
"agreement"
className
=
'user-agreement'
>
<
Field
type
=
'checkbox'
name
=
'agreement'
id
=
'agreement'
className
=
{
classnames
([
this
.
props
.
values
.
agreement
?
'iconfont iconiconfront-3'
:
'disagree'
])}
/
>
同意
<
span
>
《七月在线用户使用协议》
<
/span
>
<
/label
>
<
/Form
>
<
div
className
=
"skip"
style
=
{{
display
:
from
&&
from
.
pathname
.
includes
(
'forgot-password'
)
?
'none'
:
'block'
}}
>
<
Link
replace
to
=
'/passport/account-login'
>
跳过
<
/Link
>
<
/div
>
<
/div
>
<
/
>
)
}
}
const
formikConfig
=
{
mapPropsToValues
()
{
return
{
password
:
''
,
agreement
:
true
}
},
handleSubmit
:
(
values
,
{
props
})
=>
{
mapPropsToValues
()
{
return
{
password
:
''
,
agreement
:
true
}
},
handleSubmit
:
(
values
,
{
props
})
=>
{
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
if
(
from
.
pathname
.
includes
(
'forgot-password'
))
{
forgotPasswordReset
(
values
,
props
);
}
else
{
bindMobileSetPassword
(
values
,
props
)
}
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
if
(
from
.
pathname
.
includes
(
'forgot-password'
))
{
forgotPasswordReset
(
values
,
props
)
}
else
{
bindMobileSetPassword
(
values
,
props
)
}
},
validateOnChange
:
false
,
validate
:
values
=>
{
let
errors
=
{}
const
re
=
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,16}
$/
;
if
(
!
re
.
test
(
values
.
password
))
{
errors
.
password
=
'密码需要包含6-16位字母及数字'
Toast
.
info
(
errors
.
password
,
2
,
null
,
false
)
}
if
(
!
values
.
agreement
)
{
errors
.
agreement
=
'您须同意《七月在线用户使用协议》'
Toast
.
info
(
errors
.
agreement
,
2
,
null
,
false
)
}
return
errors
},
validateOnChange
:
false
,
validate
:
values
=>
{
let
errors
=
{}
const
re
=
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,16}
$/
if
(
!
re
.
test
(
values
.
password
))
{
errors
.
password
=
'密码需要包含6-16位字母及数字'
Toast
.
info
(
errors
.
password
,
2
,
null
,
false
)
}
if
(
!
values
.
agreement
)
{
errors
.
agreement
=
'您须同意《七月在线用户使用协议》'
Toast
.
info
(
errors
.
agreement
,
2
,
null
,
false
)
}
return
errors
}
}
function
forgotPasswordReset
(
values
,
props
)
{
let
key
=
sessionStorage
.
getItem
(
'r_type'
)
===
'email'
?
'email'
:
'tel'
let
key
=
sessionStorage
.
getItem
(
'r_type'
)
===
'email'
?
'email'
:
'tel'
let
requestKey
=
key
===
'email'
?
'email'
:
'phone'
http
.
post
(
`
${
API
[
'passport-api'
]}
/account/up_pass_by_
${
requestKey
}
`
,
{
[
requestKey
]:
sessionStorage
.
getItem
(
key
),
password
:
encrypt
(
values
.
password
)
let
requestKey
=
key
===
'email'
?
'email'
:
'phone'
http
.
post
(
`
${
API
[
'passport-api'
]}
/account/up_pass_by_
${
requestKey
}
`
,
{
[
requestKey
]:
sessionStorage
.
getItem
(
key
),
password
:
encrypt
(
values
.
password
)
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
Toast
.
info
(
'密码设置成功'
)
setTimeout
(
function
()
{
props
.
history
.
replace
(
'/passport/account-login'
)
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
Toast
.
info
(
'密码设置成功'
)
setTimeout
(
function
()
{
props
.
history
.
replace
(
'/passport/account-login'
)
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
}
})
}
function
bindMobileSetPassword
(
values
,
props
)
{
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile/set_pwd_new`
,
{
uid
:
props
.
user
.
data
.
uid
,
password
:
encrypt
(
values
.
password
)
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile/set_pwd_new`
,
{
uid
:
props
.
user
.
data
.
uid
,
password
:
encrypt
(
values
.
password
)
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
const
{
location
,
history
}
=
props
Toast
.
info
(
'密码设置成功'
)
let
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
'/'
}
let
local_redirect_url
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'binding_redirect'
))
setTimeout
(
function
()
{
if
(
local_redirect_url
)
{
const
{
pathname
,
search
,
hash
}
=
local_redirect_url
history
.
replace
(
pathname
+
search
+
hash
)
}
else
{
history
.
replace
(
from
.
pathname
)
}
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
errno
==
200
)
{
Toast
.
info
(
'密码设置成功'
)
let
from
=
props
.
location
.
state
&&
props
.
location
.
state
.
from
||
{
pathname
:
'/'
}
setTimeout
(
function
()
{
props
.
history
.
replace
(
from
.
pathname
)
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
}
})
}
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
null
),
withFormik
(
formikConfig
)
)(
SetPassword
);
\ No newline at end of file
connect
(
state
=>
({
user
:
state
.
user
}),
{
setCurrentUser
}
),
withFormik
(
formikConfig
)
)(
SetPassword
)
src/utils/index.js
View file @
b103a56c
...
...
@@ -83,7 +83,9 @@ const browser = (function () {
isWeixin
:
/MicroMessenger/i
.
test
(
ua
),
isAndroid
:
/Android/i
.
test
(
ua
),
isIOS
:
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/i
.
test
(
ua
),
isIPad
:
/iPad/i
.
test
(
ua
)
isIPad
:
/iPad/i
.
test
(
ua
),
isAndroidApp
:
/Android/i
.
test
(
ua
)
&&
getParam
(
'version'
),
isIOSApp
:
/iPhone/i
.
test
(
ua
)
&&
getParam
(
'version'
)
}
})()
...
...
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