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
2dd8b0c3
Commit
2dd8b0c3
authored
Apr 21, 2020
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
3d29968c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
9 deletions
+62
-9
src/components/passport/login/index.js
+16
-1
src/components/passport/setPassword/index.js
+46
-8
No files found.
src/components/passport/login/index.js
View file @
2dd8b0c3
...
...
@@ -71,6 +71,21 @@ class Login extends Component {
history
.
push
(
'/passport/student-login'
)
}
componentDidMount
()
{
const
{
location
}
=
this
.
props
const
{
action
}
=
this
.
props
.
history
let
pathname
=
location
.
state
&&
location
.
state
.
from
&&
location
.
state
.
from
.
pathname
let
search
=
location
.
state
&&
location
.
state
.
from
&&
location
.
state
.
from
.
search
console
.
log
(
action
,
pathname
,
search
);
if
(
action
!==
'POP'
){
let
historyUrl
=
`
${
pathname
}${
search
}
`
window
.
localStorage
.
setItem
(
'HistoryUrl'
,
historyUrl
)
}
}
render
()
{
const
{
loginWays
,
...
...
@@ -122,7 +137,7 @@ class Login extends Component {
onVerify
=
{
this
.
onVerify
}
/
>
<
LoginButton
active
=
{
values
.
tel
&&
values
.
veriCode
&&
isEmpty
(
errors
)}
/
>
{
/* 助学计划 */
}
<
div
className
=
"student-root"
>
<
a
className
=
"student-root__button"
onClick
=
{
this
.
toStudentRegister
}
>
助学计划
<
/a
>
...
...
src/components/passport/setPassword/index.js
View file @
2dd8b0c3
...
...
@@ -15,6 +15,35 @@ import { connect } from "react-redux"
import
{
setCurrentUser
}
from
'@/store/userAction'
class
SetPassword
extends
Component
{
toFrom
=
()
=>
{
let
historyUrl
=
window
.
localStorage
.
getItem
(
'HistoryUrl'
)
const
{
history
}
=
this
.
props
history
.
push
(
historyUrl
)
// window.localStorage.removeItem('HistoryUrl')
return
}
//
// componentDidMount() {
// const {location} = this.props
// const {action} = this.props.history
// let pathname = location.state && location.state.from && location.state.from.pathname
// let search = location.state && location.state.from && location.state.from.search
//
// console.log(location);
// console.log(location.state);
// console.log(action,pathname,search);
//
// // if(action !== 'PUSH'){
// // let historyUrl = `${pathname}${search}`
// // window.localStorage.setItem('HistoryUrl',historyUrl)
// // }
//
// }
render
()
{
let
{
values
,
errors
,
location
}
=
this
.
props
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
...
...
@@ -52,7 +81,7 @@ class SetPassword extends Component {
<
/Form
>
<
div
className
=
"skip"
style
=
{{
display
:
from
&&
from
.
pathname
.
includes
(
'forgot-password'
)
?
'none'
:
'block'
}}
>
<
Link
replace
to
=
'/passport/account-login'
>
跳过
<
/Link
>
<
span
onClick
=
{
this
.
toFrom
}
>
跳过
<
/span
>
<
/div
>
<
/div
>
<
/
>
...
...
@@ -68,7 +97,6 @@ const formikConfig = {
}
},
handleSubmit
:
(
values
,
{
props
})
=>
{
const
{
location
}
=
props
let
from
=
location
.
state
&&
location
.
state
.
records
&&
location
.
state
.
records
[
location
.
state
.
records
.
length
-
2
]
||
{
pathname
:
'/'
}
...
...
@@ -108,7 +136,7 @@ function forgotPasswordReset(values, props) {
if
(
res
.
data
.
errno
==
200
)
{
Toast
.
info
(
'密码设置成功'
)
setTimeout
(
function
()
{
props
.
history
.
replace
(
'/passport/account-login'
)
props
.
history
.
replace
(
'/passport/account-login'
)
},
1000
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
,
null
,
false
)
...
...
@@ -117,7 +145,6 @@ function forgotPasswordReset(values, props) {
}
function
bindMobileSetPassword
(
values
,
props
)
{
http
.
post
(
`
${
API
[
'passport-api'
]}
/bind_mobile/set_pwd_new`
,
{
uid
:
props
.
user
.
data
.
uid
,
password
:
encrypt
(
values
.
password
)
...
...
@@ -128,10 +155,21 @@ function bindMobileSetPassword(values, 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
)
// setTimeout(function () {
// if (local_redirect_url) {
// const {pathname, search, hash} = local_redirect_url
// history.replace(pathname + search + hash)
// } else {
// history.replace(from.pathname)
// }
// }, 1000)
let
HistoryUrl
=
window
.
localStorage
.
getItem
(
'HistoryUrl'
)
setTimeout
(()
=>
{
if
(
HistoryUrl
)
{
let
historyUrl
=
window
.
localStorage
.
getItem
(
'HistoryUrl'
)
props
.
history
.
push
(
historyUrl
)
}
else
{
history
.
replace
(
from
.
pathname
)
}
...
...
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