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
3 years ago
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 {
if
(
token
)
{
self
.
getToweb
(
token
);
// eslint-disable-next-line no-empty
}
else
if
(
ddCode
)
{
}
else
if
(
ddCode
&&
loginMode
!==
'qywx'
)
{
self
.
ddLoginIn
(
ddCode
);
}
else
if
(
ddCode
&&
loginMode
===
'qywx'
)
{
self
.
qywxLoginIn
(
ddCode
);
}
else
if
(
!!
loginName
&&
!!
password
)
{
self
.
otherLoginIn
(
loginName
,
password
);
}
else
if
(
...
...
@@ -397,38 +399,40 @@ class Login {
id
:
'wxlogin_container'
,
appid
:
'wxec56ca668e7f9155'
,
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'
,
});
}
qywxLoginIn
(
code
)
{
// eslint-disable-next-line no-undef
Http
.
getInfo
({
query
:
{
code
,
},
cacheBust
:
true
,
}).
then
(
response
=>
{
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
const
tk
=
response
.
data
.
getMe
[
0
].
Token
;
this
.
globalConfig
.
token
=
tk
;
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
// 判断是否存在参数
// eslint-disable-next-line no-useless-escape
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
window
.
history
.
pushState
({},
0
,
url
);
appService
.
getInfo
({
query
:
{
code
,
},
cacheBust
:
true
,
})
.
then
(
response
=>
{
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
const
tk
=
response
.
data
.
getMe
[
0
].
Token
;
this
.
globalConfig
.
token
=
tk
;
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
// 判断是否存在参数
// 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
()
{
...
...
@@ -466,31 +470,33 @@ class Login {
ddLoginIn
(
code
)
{
// eslint-disable-next-line no-undef
Http
.
getOA
({
query
:
{
TmpAuthCode
:
code
,
},
cacheBust
:
true
,
}).
then
(
response
=>
{
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
const
tk
=
response
.
data
.
getMe
[
0
].
token
;
this
.
globalConfig
.
token
=
tk
;
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
// 判断是否存在参数
// eslint-disable-next-line no-useless-escape
url
=
url
.
replace
(
/
(\&
code|#
)[^
'"
]
*/
,
''
);
// 去除参数
window
.
history
.
pushState
({},
0
,
url
);
appService
.
getOA
({
query
:
{
TmpAuthCode
:
code
,
},
cacheBust
:
true
,
})
.
then
(
response
=>
{
if
(
response
&&
response
.
data
&&
response
.
data
.
getMe
)
{
const
tk
=
response
.
data
.
getMe
[
0
].
token
;
this
.
globalConfig
.
token
=
tk
;
let
url
=
window
.
location
.
href
;
// 获取当前页面的url
if
(
url
.
indexOf
(
'&code'
)
!==
-
1
)
{
// 判断是否存在参数
// 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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/pages/user/login/template/infoLogin.js
View file @
8cafa855
...
...
@@ -2,7 +2,7 @@
/*
* @Author: shangshunli;
* @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
* @Description:信息化登录页;
*/
...
...
@@ -22,6 +22,7 @@ import Selected from '@/assets/oa/login/selected.jpg'
import
UnSelected
from
'@/assets/oa/login/unselected.jpg'
import
LoginAction
from
'../login'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
Cookies
from
'js-cookie'
;
const
Logger
=
logger
(
'login'
);
// 、登录页
class
InfoLogin
extends
React
.
Component
{
...
...
@@ -38,6 +39,9 @@ class InfoLogin extends React.Component{
loginStyle
:
!
this
.
state
.
loginStyle
,
ddOrWeixin
:
ddOrWeixin
==
'dingding'
?
''
:
'dingding'
},()
=>
{
Cookies
.
set
(
'loginMode'
,
'dingding'
,
{
path
:
'/'
,
});
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
action
.
loginByDD
()
})
...
...
@@ -47,11 +51,15 @@ changeQrCode=(item)=>{
this
.
setState
({
ddOrWeixin
:
item
},()
=>
{
Cookies
.
set
(
'loginMode'
,
item
,
{
path
:
'/'
,
});
let
action
=
new
LoginAction
(
this
.
props
,
false
,
true
)
if
(
item
==
'dingding'
){
action
.
loginByDD
()
}
else
if
(
item
==
'
weixin
'
){
}
else
if
(
item
==
'
qywx
'
){
action
.
loginByWx
()
}
})
...
...
@@ -114,10 +122,10 @@ changeQrCode=(item)=>{
<
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
.
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
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
>
<
form
className
=
{
styles
.
loginForm
}
style
=
{{
display
:
loginStyle
?
'none'
:
''
}}
>
<
div
className
=
{
styles
.
formgroup
}
>
...
...
This diff is collapsed.
Click to expand it.
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