Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sass-admin
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj_app
sass-admin
Commits
73bbae3a
Commit
73bbae3a
authored
Feb 18, 2021
by
王阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录优化
parent
cd31cb68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
50 deletions
+57
-50
src/pages/Login/index.jsx
+57
-50
No files found.
src/pages/Login/index.jsx
View file @
73bbae3a
...
...
@@ -7,12 +7,12 @@ import React from "react";
import
{
connect
}
from
"react-redux"
;
import
{
Button
,
Form
,
Input
,
message
}
from
"antd"
;
import
style
from
"./Style/login.less"
;
import
{
exfetchR
,
getSkinData
,
toAssToken
}
from
"./redux/actions"
;
import
{
exfetchR
,
getSkinData
,
toAssToken
}
from
"./redux/actions"
;
import
commonFunc
from
"@/util/commonFunc"
;
import
SelectLang
from
"@/common/Layout/Header/SelectLang"
;
{
/* bug-11961-cwj暂时注释 2期上 */
}
import
SelectLang
from
"@/common/Layout/Header/SelectLang"
;
{
/* bug-11961-cwj暂时注释 2期上 */
}
import
moment
from
'moment'
import
md5
from
"md5"
;
import
{
sm2
}
from
'sm-crypto'
import
{
sm2
}
from
'sm-crypto'
import
intl
from
'react-intl-universal'
;
const
FormItem
=
Form
.
Item
;
...
...
@@ -25,27 +25,27 @@ class Login extends React.Component {
this
.
handleSubmit
(
e
);
};
componentDidMount
(){
const
{
getSkinData
}
=
this
.
props
;
getSkinData
((
res
)
=>
{
console
.
log
(
"primary-color:"
,
res
)
componentDidMount
()
{
const
{
getSkinData
}
=
this
.
props
;
getSkinData
((
res
)
=>
{
console
.
log
(
"primary-color:"
,
res
)
document
.
documentElement
.
style
.
setProperty
(
'--primary-color'
,
res
.
data
.
themeColor
);
})
}
generateCharacter
(
n
){
var
chars
=
[
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
]
generateCharacter
(
n
)
{
var
chars
=
[
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
]
var
res
=
""
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
id
=
Math
.
ceil
(
Math
.
random
()
*
35
);
res
+=
chars
[
id
];
}
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
id
=
Math
.
ceil
(
Math
.
random
()
*
35
);
res
+=
chars
[
id
];
}
return
res
;
return
res
;
}
getCurrentDay
(){
let
date
=
""
getCurrentDay
()
{
let
date
=
""
date
=
moment
(
new
Date
()).
format
(
"YYYYMMDD"
)
return
date
}
...
...
@@ -55,6 +55,8 @@ class Login extends React.Component {
// 提交登录按钮发送给后台json
handleSubmit
=
e
=>
{
e
.
preventDefault
();
this
.
props
.
form
.
validateFields
((
errors
,
values
)
=>
{
if
(
errors
)
{
return
;
...
...
@@ -65,35 +67,35 @@ class Login extends React.Component {
const
private_key
=
'00a2bbe941a177ca9f200d1c4d37e8f0b43b9cd2ea662304a05c064c6416e74d49'
let
salt
=
""
let
date
=
""
let
key
=
""
let
sign
=
""
let
password
=
""
let
account
=
""
let
salt
=
""
let
date
=
""
let
key
=
""
let
sign
=
""
let
password
=
""
let
account
=
""
salt
=
this
.
generateCharacter
(
16
)
console
.
log
(
"validate-salt"
,
salt
)
console
.
log
(
"validate-salt"
,
salt
)
date
=
this
.
getCurrentDay
()
console
.
log
(
"validate-date"
,
date
)
password
=
sm2
.
doEncrypt
(
values
.
password
+
salt
,
public_key
,
1
);
account
=
sm2
.
doEncrypt
(
values
.
account
.
trim
()
+
salt
,
public_key
,
1
)
console
.
log
(
"validate-date"
,
date
)
password
=
sm2
.
doEncrypt
(
values
.
password
+
salt
,
public_key
,
1
);
account
=
sm2
.
doEncrypt
(
values
.
account
.
trim
()
+
salt
,
public_key
,
1
)
password
=
"04"
+
password
account
=
"04"
+
account
if
(
salt
&&
date
)
{
key
=
salt
+
date
console
.
log
(
"validate-key"
,
key
)
if
(
salt
&&
date
)
{
key
=
salt
+
date
console
.
log
(
"validate-key"
,
key
)
}
sign
=
"account="
+
account
+
"&password="
+
password
+
"&salt="
+
salt
+
"&key="
+
key
sign
=
"account="
+
account
+
"&password="
+
password
+
"&salt="
+
salt
+
"&key="
+
key
console
.
log
(
"validate-sign"
,
md5
(
sign
))
console
.
log
(
"validate-sign"
,
md5
(
sign
))
let
parms
=
{
let
parms
=
{
account
,
password
,
salt
:
salt
,
salt
:
salt
,
sign
:
md5
(
sign
),
languageCode
:
sessionStorage
.
getItem
(
"lang"
)
||
null
//用户选择的语种,否则为null
}
...
...
@@ -105,22 +107,27 @@ class Login extends React.Component {
// };
exfetchR
(
parms
,
res
=>
{
//只有社群的话直接滚走去社群
if
(
res
.
data
.
isOnlyCommunity
)
{
if
(
res
.
data
.
isOnlyCommunity
)
{
toAssToken
()
}
else
{
}
else
{
if
(
res
.
code
==
1000
)
{
console
.
log
(
location
.
search
.
split
(
"?referrer="
)[
1
],
"===========重定向========="
);
if
(
location
.
search
)
{
this
.
props
.
history
.
push
(
location
.
search
.
split
(
"?referrer="
)[
1
]);
}
else
{
this
.
props
.
history
.
push
(
`/
${
companySiteCode
}
/index/homepage`
);
}
console
.
log
(
location
.
search
.
split
(
"?referrer="
)[
1
],
"===========重定向========="
);
if
(
location
.
search
)
{
if
(
location
.
search
.
split
(
"?referrer="
)[
1
]
==
`/
${
companySiteCode
}
/`
)
{
this
.
props
.
history
.
push
(
`/
${
companySiteCode
}
/index/homepage`
);
}
else
{
this
.
props
.
history
.
push
(
location
.
search
.
split
(
"?referrer="
)[
1
]);
}
}
else
{
this
.
props
.
history
.
push
(
`/
${
companySiteCode
}
/index/homepage`
);
}
// this.props.history.push(`/${companySiteCode}/index/homepage`);
}
else
{
// this.props.history.push(`/${companySiteCode}/index/homepage`);
}
else
{
message
.
error
(
res
.
msg
)
}
}
...
...
@@ -231,11 +238,11 @@ class Login extends React.Component {
</
div
>
</
div
>
</
div
>
<
div
className=
{
style
.
bottom
}
>
版权所有 上海复深蓝软件股份有限公司 备案号:沪ICP备11042121号-1
<
div
className=
{
style
.
bottom
}
>
版权所有 上海复深蓝软件股份有限公司 备案号:沪ICP备11042121号-1
</
div
>
</
div
>
);
}
...
...
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