Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
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
ReactWeb5
CivWeb
Commits
8cafa855
Commit
8cafa855
authored
Aug 24, 2021
by
尚顺利
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业微信登录
parent
155cabe6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
54 deletions
+68
-54
login.js
src/pages/user/login/login.js
+56
-50
infoLogin.js
src/pages/user/login/template/infoLogin.js
+12
-4
No files found.
src/pages/user/login/login.js
View file @
8cafa855
...
@@ -47,8 +47,10 @@ class Login {
...
@@ -47,8 +47,10 @@ class Login {
if
(
token
)
{
if
(
token
)
{
self
.
getToweb
(
token
);
self
.
getToweb
(
token
);
// eslint-disable-next-line no-empty
// eslint-disable-next-line no-empty
}
else
if
(
ddCode
)
{
}
else
if
(
ddCode
&&
loginMode
!==
'qywx'
)
{
self
.
ddLoginIn
(
ddCode
);
self
.
ddLoginIn
(
ddCode
);
}
else
if
(
ddCode
&&
loginMode
===
'qywx'
)
{
self
.
qywxLoginIn
(
ddCode
);
}
else
if
(
!!
loginName
&&
!!
password
)
{
}
else
if
(
!!
loginName
&&
!!
password
)
{
self
.
otherLoginIn
(
loginName
,
password
);
self
.
otherLoginIn
(
loginName
,
password
);
}
else
if
(
}
else
if
(
...
@@ -397,38 +399,40 @@ class Login {
...
@@ -397,38 +399,40 @@ class Login {
id
:
'wxlogin_container'
,
id
:
'wxlogin_container'
,
appid
:
'wxec56ca668e7f9155'
,
appid
:
'wxec56ca668e7f9155'
,
agentid
:
'1000083'
,
agentid
:
'1000083'
,
redirect_uri
:
encodeURIComponent
(
'https://mis.panda-water.cn'
),
redirect_uri
:
encodeURIComponent
(
window
.
location
.
href
),
href
:
'https://mis.panda-water.cn/web4/styles/wx.css'
,
href
:
'https://mis.panda-water.cn/web4/styles/wx.css'
,
});
});
}
}
qywxLoginIn
(
code
)
{
qywxLoginIn
(
code
)
{
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
Http
.
getInfo
({
appService
query
:
{
.
getInfo
({
code
,
query
:
{
},
code
,
cacheBust
:
true
,
},
}).
then
(
response
=>
{
cacheBust
:
true
,
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
})
const
tk
=
response
.
data
.
getMe
[
0
].
Token
;
.
then
(
response
=>
{
this
.
globalConfig
.
token
=
tk
;
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
const
tk
=
response
.
data
.
getMe
[
0
].
Token
;
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
this
.
globalConfig
.
token
=
tk
;
// 判断是否存在参数
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
// eslint-disable-next-line no-useless-escape
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
// 判断是否存在参数
window
.
history
.
pushState
({},
0
,
url
);
// eslint-disable-next-line no-useless-escape
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
window
.
history
.
pushState
({},
0
,
url
);
}
this
.
isSignIn
=
true
;
this
.
getUserInfoAndConfig
();
}
else
{
this
.
handleLoginError
();
// msgUtils.fault("登录失败,请检查用户名或密码");
// msgUtils.fault("登录失败," + error.message);
this
.
hasTry
=
true
;
// 已经输错过密码
}
}
this
.
isSignIn
=
true
;
});
this
.
getUserInfoAndConfig
();
}
else
{
this
.
handleLoginError
();
// msgUtils.fault("登录失败,请检查用户名或密码");
// msgUtils.fault("登录失败," + error.message);
this
.
hasTry
=
true
;
// 已经输错过密码
}
});
}
}
loginByDD
()
{
loginByDD
()
{
...
@@ -466,31 +470,33 @@ class Login {
...
@@ -466,31 +470,33 @@ class Login {
ddLoginIn
(
code
)
{
ddLoginIn
(
code
)
{
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
Http
.
getOA
({
appService
query
:
{
.
getOA
({
TmpAuthCode
:
code
,
query
:
{
},
TmpAuthCode
:
code
,
cacheBust
:
true
,
},
}).
then
(
response
=>
{
cacheBust
:
true
,
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
})
const
tk
=
response
.
data
.
getMe
[
0
].
token
;
.
then
(
response
=>
{
this
.
globalConfig
.
token
=
tk
;
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
const
tk
=
response
.
data
.
getMe
[
0
].
token
;
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
this
.
globalConfig
.
token
=
tk
;
// 判断是否存在参数
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
// eslint-disable-next-line no-useless-escape
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
// 判断是否存在参数
window
.
history
.
pushState
({},
0
,
url
);
// eslint-disable-next-line no-useless-escape
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
window
.
history
.
pushState
({},
0
,
url
);
}
this
.
isSignIn
=
true
;
this
.
getUserInfoAndConfig
();
}
else
{
this
.
handleLoginError
();
// msgUtils.fault("登录失败,请检查用户名或密码");
// msgUtils.fault("登录失败," + error.message);
this
.
hasTry
=
true
;
// 已经输错过密码
}
}
this
.
isSignIn
=
true
;
});
this
.
getUserInfoAndConfig
();
}
else
{
this
.
handleLoginError
();
// msgUtils.fault("登录失败,请检查用户名或密码");
// msgUtils.fault("登录失败," + error.message);
this
.
hasTry
=
true
;
// 已经输错过密码
}
});
}
}
qrcodeLogin
(
code
)
{
qrcodeLogin
(
code
)
{
...
...
src/pages/user/login/template/infoLogin.js
View file @
8cafa855
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/*
/*
* @Author: shangshunli;
* @Author: shangshunli;
* @Date: 2021-08-02 09:39:46;
* @Date: 2021-08-02 09:39:46;
* @LastEditTime: 2021-08-23 1
0:31:31
* @LastEditTime: 2021-08-23 1
1:07:30
* @LastEditors: shangshunli
* @LastEditors: shangshunli
* @Description:信息化登录页;
* @Description:信息化登录页;
*/
*/
...
@@ -22,6 +22,7 @@ import Selected from '@/assets/oa/login/selected.jpg'
...
@@ -22,6 +22,7 @@ import Selected from '@/assets/oa/login/selected.jpg'
import
UnSelected
from
'@/assets/oa/login/unselected.jpg'
import
UnSelected
from
'@/assets/oa/login/unselected.jpg'
import
LoginAction
from
'../login'
;
import
LoginAction
from
'../login'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
Cookies
from
'js-cookie'
;
const
Logger
=
logger
(
'login'
);
const
Logger
=
logger
(
'login'
);
// 、登录页
// 、登录页
class
InfoLogin
extends
React
.
Component
{
class
InfoLogin
extends
React
.
Component
{
...
@@ -38,6 +39,9 @@ class InfoLogin extends React.Component{
...
@@ -38,6 +39,9 @@ class InfoLogin extends React.Component{
loginStyle
:
!
this
.
state
.
loginStyle
,
loginStyle
:
!
this
.
state
.
loginStyle
,
ddOrWeixin
:
ddOrWeixin
==
'dingding'
?
''
:
'dingding'
ddOrWeixin
:
ddOrWeixin
==
'dingding'
?
''
:
'dingding'
},()
=>
{
},()
=>
{
Cookies
.
set
(
'loginMode'
,
'dingding'
,
{
path
:
'/'
,
});
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
action
.
loginByDD
()
action
.
loginByDD
()
})
})
...
@@ -47,11 +51,15 @@ changeQrCode=(item)=>{
...
@@ -47,11 +51,15 @@ changeQrCode=(item)=>{
this
.
setState
({
this
.
setState
({
ddOrWeixin
:
item
ddOrWeixin
:
item
},()
=>
{
},()
=>
{
Cookies
.
set
(
'loginMode'
,
item
,
{
path
:
'/'
,
});
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
if
(
item
==
'dingding'
){
if
(
item
==
'dingding'
){
action
.
loginByDD
()
action
.
loginByDD
()
}
else
if
(
item
==
'
weixin
'
){
}
else
if
(
item
==
'
qywx
'
){
action
.
loginByWx
()
action
.
loginByWx
()
}
}
})
})
...
@@ -114,10 +122,10 @@ changeQrCode=(item)=>{
...
@@ -114,10 +122,10 @@ changeQrCode=(item)=>{
<
img
role
=
"logo"
src
=
{
TitleImg
}
alt
=
"gis"
className
=
{
styles
.
titleImg
}
/
>
<
img
role
=
"logo"
src
=
{
TitleImg
}
alt
=
"gis"
className
=
{
styles
.
titleImg
}
/
>
{
/* 登录主题 */
}
{
/* 登录主题 */
}
<
div
className
=
{
styles
.
login_container
}
id
=
'login_container'
style
=
{{
display
:
ddOrWeixin
==
'dingding'
?
''
:
'none'
}}
><
/div
>
<
div
className
=
{
styles
.
login_container
}
id
=
'login_container'
style
=
{{
display
:
ddOrWeixin
==
'dingding'
?
''
:
'none'
}}
><
/div
>
<
div
className
=
{
styles
.
wxlogin_container
}
id
=
'wxlogin_container'
style
=
{{
display
:
ddOrWeixin
==
'
weixin
'
?
''
:
'none'
}}
><
/div
>
<
div
className
=
{
styles
.
wxlogin_container
}
id
=
'wxlogin_container'
style
=
{{
display
:
ddOrWeixin
==
'
qywx
'
?
''
:
'none'
}}
><
/div
>
<
div
className
=
{
styles
.
changeCode
}
style
=
{{
display
:
ddOrWeixin
?
''
:
'none'
}}
>
<
div
className
=
{
styles
.
changeCode
}
style
=
{{
display
:
ddOrWeixin
?
''
:
'none'
}}
>
<
div
style
=
{{
margin
:
'10px'
,
cursor
:
'pointer'
,
color
:
ddOrWeixin
==
'dingding'
?
'#25bc9e'
:
''
}}
onClick
=
{()
=>
this
.
changeQrCode
(
'dingding'
)}
className
=
{
styles
.
ddLoginBtn
}
>
钉钉登录
<
/div
>
<
div
style
=
{{
margin
:
'10px'
,
cursor
:
'pointer'
,
color
:
ddOrWeixin
==
'dingding'
?
'#25bc9e'
:
''
}}
onClick
=
{()
=>
this
.
changeQrCode
(
'dingding'
)}
className
=
{
styles
.
ddLoginBtn
}
>
钉钉登录
<
/div
>
<
div
style
=
{{
margin
:
'10px'
,
cursor
:
'pointer'
,
color
:
ddOrWeixin
==
'
weixin'
?
'#25bc9e'
:
''
}}
onClick
=
{()
=>
this
.
changeQrCode
(
'weixin
'
)}
className
=
{
styles
.
wxLoginBtn
}
>
企业微信登录
<
/div
>
<
div
style
=
{{
margin
:
'10px'
,
cursor
:
'pointer'
,
color
:
ddOrWeixin
==
'
qywx'
?
'#25bc9e'
:
''
}}
onClick
=
{()
=>
this
.
changeQrCode
(
'qywx
'
)}
className
=
{
styles
.
wxLoginBtn
}
>
企业微信登录
<
/div
>
<
/div
>
<
/div
>
<
form
className
=
{
styles
.
loginForm
}
style
=
{{
display
:
loginStyle
?
'none'
:
''
}}
>
<
form
className
=
{
styles
.
loginForm
}
style
=
{{
display
:
loginStyle
?
'none'
:
''
}}
>
<
div
className
=
{
styles
.
formgroup
}
>
<
div
className
=
{
styles
.
formgroup
}
>
...
...
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