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
3b631478
Commit
3b631478
authored
Nov 09, 2022
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 企业微信跳转修复
parent
b6706791
Pipeline
#63498
passed with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
31 deletions
+47
-31
index.js
src/components/Container/ValidDefaultPWD/index.js
+16
-3
actions.js
src/containers/App/store/actions.js
+4
-3
notice.js
src/layouts/AppLayout/notifier/notice.js
+2
-4
login.js
src/pages/user/login/login.js
+19
-12
WeComLogin.js
src/pages/user/login/template/cloud/WeComLogin.js
+6
-9
No files found.
src/components/Container/ValidDefaultPWD/index.js
View file @
3b631478
...
@@ -20,8 +20,8 @@ const ValidContainer = props => {
...
@@ -20,8 +20,8 @@ const ValidContainer = props => {
const
[
needChangePassword
,
setNeedChangePassword
]
=
useState
(
false
);
const
[
needChangePassword
,
setNeedChangePassword
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
// eslint-disable-next-line react/no-this-in-sfc
// eslint-disable-next-line react/no-this-in-sfc
const
password
=
localStorage
.
getItem
(
'password_token'
);
let
rules
=
localStorage
.
getItem
(
'password_pwdRegex'
)
?
localStorage
.
getItem
(
'password_pwdRegex'
)
:
''
;
let
rules
=
localStorage
.
getItem
(
'password_pwdRegex'
)
?
localStorage
.
getItem
(
'password_pwdRegex'
)
:
''
;
const
check
=
localStorage
.
getItem
(
'password_token'
);
const
rulesTip
=
localStorage
.
getItem
(
'password_pwdRegexTip'
)
?
localStorage
.
getItem
(
'password_pwdRegexTip'
)
:
''
;
const
rulesTip
=
localStorage
.
getItem
(
'password_pwdRegexTip'
)
?
localStorage
.
getItem
(
'password_pwdRegexTip'
)
:
''
;
let
reg
;
let
reg
;
try
{
try
{
...
@@ -36,7 +36,7 @@ const ValidContainer = props => {
...
@@ -36,7 +36,7 @@ const ValidContainer = props => {
const
tk
=
global
.
token
;
const
tk
=
global
.
token
;
// eslint-disable-next-line no-eval
// eslint-disable-next-line no-eval
if
(
tk
)
{
if
(
tk
)
{
if
(
rules
&&
rules
!==
''
&&
!
reg
.
test
(
password
)
)
{
if
(
check
)
{
setNeedChangePassword
(
true
);
setNeedChangePassword
(
true
);
}
}
}
}
...
@@ -48,7 +48,7 @@ const ValidContainer = props => {
...
@@ -48,7 +48,7 @@ const ValidContainer = props => {
.
validateFields
()
.
validateFields
()
.
then
(
res
=>
{
.
then
(
res
=>
{
const
params
=
{
const
params
=
{
password
,
// 拼接默认密码
password
:
res
.
oldPwd
,
// 拼接默认密码
newpassword
:
res
.
newPwd
,
newpassword
:
res
.
newPwd
,
token
:
window
.
globalConfig
.
token
,
token
:
window
.
globalConfig
.
token
,
ignoreSite
:
true
,
ignoreSite
:
true
,
...
@@ -95,6 +95,19 @@ const ValidContainer = props => {
...
@@ -95,6 +95,19 @@ const ValidContainer = props => {
<
span
>
用户首次登录之前必须修改密码
<
/span
>
<
span
>
用户首次登录之前必须修改密码
<
/span
>
<
/div
>
<
/div
>
<
Form
labelAlign
=
"left"
{...
formItemLayout
}
form
=
{
form
}
>
<
Form
labelAlign
=
"left"
{...
formItemLayout
}
form
=
{
form
}
>
<
Form
.
Item
name
=
"oldPwd"
label
=
"原密码"
rules
=
{[
{
required
:
true
,
message
:
'请输入原始密码'
,
},
]}
hasFeedback
>
<
Input
.
Password
/>
<
/Form.Item
>
<
Form
.
Item
<
Form
.
Item
name
=
"newPwd"
name
=
"newPwd"
label
=
"新密码"
label
=
"新密码"
...
...
src/containers/App/store/actions.js
View file @
3b631478
...
@@ -216,6 +216,7 @@ export function logout(data) {
...
@@ -216,6 +216,7 @@ export function logout(data) {
path
:
'/'
,
path
:
'/'
,
});
});
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'password_token'
);
// eslint-disable-next-line no-undef,no-restricted-globals
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
// eslint-disable-next-line no-undef,no-restricted-globals
// eslint-disable-next-line no-undef,no-restricted-globals
...
@@ -233,9 +234,9 @@ export function logout(data) {
...
@@ -233,9 +234,9 @@ export function logout(data) {
if
(
products
)
{
if
(
products
)
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
});
window
[
products
[
item
]].
unmount
({
store
});
});
});
}
}
...
...
src/layouts/AppLayout/notifier/notice.js
View file @
3b631478
...
@@ -3,7 +3,7 @@ import _, { isEmpty, isString } from 'lodash';
...
@@ -3,7 +3,7 @@ import _, { isEmpty, isString } from 'lodash';
import
MqttClient
from
'mqtt-client'
;
import
MqttClient
from
'mqtt-client'
;
import
{
isJSON
}
from
'@wisdom-utils/components/lib/AppLayout/helpers/index'
;
import
{
isJSON
}
from
'@wisdom-utils/components/lib/AppLayout/helpers/index'
;
import
{
api
}
from
'./api'
;
import
{
api
}
from
'./api'
;
import
{
replaceSpeak
,
generatedId
,
parseContentToJSON
}
from
'./utils'
;
import
{
replaceSpeak
,
generatedId
}
from
'./utils'
;
import
{
postInformationStatus
}
from
'./api/service'
;
import
{
postInformationStatus
}
from
'./api/service'
;
import
{
import
{
DEFAULT_KEEPLIVE
,
DEFAULT_KEEPLIVE
,
...
@@ -248,9 +248,7 @@ class Notifier {
...
@@ -248,9 +248,7 @@ class Notifier {
mqttConfig
.
NginxStart
=
self
.
_siteConfig
.
NginxStart
=
data
.
NginxStart
;
mqttConfig
.
NginxStart
=
self
.
_siteConfig
.
NginxStart
=
data
.
NginxStart
;
mqttConfig
.
mqtt_mess
.
TcpIP
=
self
.
_siteConfig
.
TcpIP
=
self
.
_siteConfig
.
mqtt_mess
.
TcpIP
=
mqttConfig
.
mqtt_mess
.
TcpIP
=
self
.
_siteConfig
.
TcpIP
=
self
.
_siteConfig
.
mqtt_mess
.
TcpIP
=
window
.
location
.
hostname
;
window
.
location
.
hostname
;
mqttConfig
.
mqtt_mess
.
TcpPort
=
self
.
_siteConfig
.
TcpPort
=
self
.
_siteConfig
.
mqtt_mess
.
TcpPort
=
parseInt
(
mqttConfig
.
mqtt_mess
.
TcpPort
=
self
.
_siteConfig
.
TcpPort
=
self
.
_siteConfig
.
mqtt_mess
.
TcpPort
=
parseInt
(
window
.
location
.
port
)
||
443
;
window
.
location
.
port
,
);
mqttConfig
.
mqtt_path
=
self
.
_siteConfig
.
mqtt_path
=
'/ws/'
;
mqttConfig
.
mqtt_path
=
self
.
_siteConfig
.
mqtt_path
=
'/ws/'
;
}
else
{
}
else
{
mqttConfig
.
nginxStart
=
data
.
NginxStart
;
mqttConfig
.
nginxStart
=
data
.
NginxStart
;
...
...
src/pages/user/login/login.js
View file @
3b631478
...
@@ -164,7 +164,6 @@ class Login {
...
@@ -164,7 +164,6 @@ class Login {
}
}
});
});
}
}
if
(
if
(
!
flag
&&
!
flag
&&
this
.
isSignIn
&&
this
.
isSignIn
&&
...
@@ -490,7 +489,7 @@ class Login {
...
@@ -490,7 +489,7 @@ class Login {
id
:
'wxlogin_container'
,
id
:
'wxlogin_container'
,
appid
:
'wxec56ca668e7f9155'
,
appid
:
'wxec56ca668e7f9155'
,
agentid
:
'1000083'
,
agentid
:
'1000083'
,
redirect_uri
:
encodeURIComponent
(
window
.
location
.
href
),
redirect_uri
:
encodeURIComponent
(
window
.
location
.
href
.
replace
(
'#/'
,
''
)
),
href
:
'https://mis.panda-water.cn/web4/styles/wx.css'
,
href
:
'https://mis.panda-water.cn/web4/styles/wx.css'
,
});
});
}
}
...
@@ -763,7 +762,6 @@ class Login {
...
@@ -763,7 +762,6 @@ class Login {
};
};
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
}
}
if
(
self
.
isSignIn
||
!!
industry
)
{
if
(
self
.
isSignIn
||
!!
industry
)
{
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
getUserInfo
({
getUserInfo
({
...
@@ -831,7 +829,7 @@ class Login {
...
@@ -831,7 +829,7 @@ class Login {
}
}
}
}
transformLoginHander
(
response
,
isRememberPWD
)
{
transformLoginHander
(
response
,
isRememberPWD
,
pwd
)
{
const
self
=
this
;
const
self
=
this
;
const
token
=
const
token
=
response
&&
response
&&
...
@@ -843,10 +841,20 @@ class Login {
...
@@ -843,10 +841,20 @@ class Login {
if
(
token
)
{
if
(
token
)
{
const
exp
=
86400000
;
const
exp
=
86400000
;
self
.
globalConfig
.
token
=
token
;
self
.
globalConfig
.
token
=
token
;
if
(
response
.
access_token
!==
''
)
{
if
(
response
.
token
!==
''
)
{
self
.
globalConfig
.
access_token
=
response
.
access_token
;
self
.
globalConfig
.
access_token
=
response
.
token
;
localStorage
.
setItem
(
'access_token'
,
response
.
access_token
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
localStorage
.
setItem
(
'password_token'
,
self
.
globalConfig
.
password
);
let
rules
=
localStorage
.
getItem
(
'password_pwdRegex'
)
?
localStorage
.
getItem
(
'password_pwdRegex'
)
:
''
;
let
reg
;
try
{
reg
=
new
RegExp
(
rules
);
}
catch
(
error
)
{
rules
=
''
;
reg
=
new
RegExp
(
rules
);
}
const
check
=
rules
&&
rules
!==
''
&&
!
reg
.
test
(
pwd
)
localStorage
.
setItem
(
'access_token'
,
response
.
token
);
localStorage
.
setItem
(
'password_token'
,
check
);
Cookies
.
set
(
'client'
,
self
.
globalConfig
.
client
,
{
Cookies
.
set
(
'client'
,
self
.
globalConfig
.
client
,
{
expires
:
exp
/
(
24
*
60
*
60
*
1000
),
expires
:
exp
/
(
24
*
60
*
60
*
1000
),
path
:
'/'
,
path
:
'/'
,
...
@@ -878,7 +886,6 @@ class Login {
...
@@ -878,7 +886,6 @@ class Login {
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
)
{
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
)
{
this
.
globalConfig
=
getGlobalConfig
();
this
.
globalConfig
=
getGlobalConfig
();
const
self
=
this
;
const
self
=
this
;
self
.
globalConfig
.
password
=
pwd
;
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
usr
=
userPhone
?
userPhone
:
usr
;
usr
=
userPhone
?
userPhone
:
usr
;
appService
appService
...
@@ -895,7 +902,7 @@ class Login {
...
@@ -895,7 +902,7 @@ class Login {
self
.
updateConfig
(
self
.
updateConfig
(
Object
.
assign
({},
self
.
globalConfig
,
{
Object
.
assign
({},
self
.
globalConfig
,
{
access_token
:
data
.
access_token
,
access_token
:
data
.
access_token
,
token
:
data
.
user_token
,
token
:
data
.
user_token
}),
}),
);
);
return
data
;
return
data
;
...
@@ -909,7 +916,7 @@ class Login {
...
@@ -909,7 +916,7 @@ class Login {
}
}
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
self
.
transformLoginHander
(
res
,
isRememberPWD
);
self
.
transformLoginHander
(
res
,
isRememberPWD
,
pwd
);
});
});
}
else
{
}
else
{
appService
appService
...
@@ -928,7 +935,7 @@ class Login {
...
@@ -928,7 +935,7 @@ class Login {
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
self
.
transformLoginHander
(
response
,
isRememberPWD
);
self
.
transformLoginHander
(
response
,
isRememberPWD
,
pwd
);
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
self
.
hasTry
=
true
;
self
.
hasTry
=
true
;
...
...
src/pages/user/login/template/cloud/WeComLogin.js
View file @
3b631478
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
encode
}
from
'js-base64'
;
import
{
encode
}
from
'js-base64'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
{
LOGIN_WAY
}
from
'@/constants'
;
import
{
LOGIN_WAY
,
WECOM_APPID
,
AGENTID_CLOUD
}
from
'@/constants'
;
import
{
WECOM_APPID
,
AGENTID_CLOUD
}
from
'@/constants'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
const
useWeCom
=
props
=>
{
const
useWeCom
=
props
=>
{
...
@@ -11,7 +10,7 @@ const useWeCom = props => {
...
@@ -11,7 +10,7 @@ const useWeCom = props => {
id
:
props
.
container
||
'wxlogin_container'
,
id
:
props
.
container
||
'wxlogin_container'
,
appid
:
props
.
appid
||
WECOM_APPID
,
appid
:
props
.
appid
||
WECOM_APPID
,
agentid
:
props
.
agentid
||
AGENTID_CLOUD
,
agentid
:
props
.
agentid
||
AGENTID_CLOUD
,
redirect_uri
:
props
.
redirect_uri
||
encodeURIComponent
(
window
.
location
.
href
),
redirect_uri
:
props
.
redirect_uri
||
encodeURIComponent
(
window
.
location
.
href
.
replace
(
'#/'
,
''
)
),
href
:
props
.
href
||
'https://panda-water.cn/web4/styles/wx.css'
,
href
:
props
.
href
||
'https://panda-water.cn/web4/styles/wx.css'
,
self_redirect
:
false
,
self_redirect
:
false
,
state
:
props
.
state
||
'STATE'
,
state
:
props
.
state
||
'STATE'
,
...
@@ -32,11 +31,11 @@ const useIOTQRCode = () => {
...
@@ -32,11 +31,11 @@ const useIOTQRCode = () => {
const
redirectURI
=
function
()
{
const
redirectURI
=
function
()
{
let
redirectUri
=
window
.
location
.
href
;
let
redirectUri
=
window
.
location
.
href
;
if
(
redirectUri
.
indexOf
(
'loginWay'
)
>
-
1
)
return
redirectUri
;
if
(
redirectUri
.
indexOf
(
'loginWay'
)
>
-
1
)
return
redirectUri
;
if
(
redirectUri
.
indexOf
(
'?'
)
>
-
1
)
redirectUri
+=
`&loginWay=
${
LOGIN_WAY
.
WeCom
}
`
;
if
(
redirectUri
.
indexOf
(
'?'
)
>
-
1
)
redirectUri
+=
`&loginWay=
${
LOGIN_WAY
.
WeCom
}
`
;
else
redirectUri
+=
`?loginWay=
${
LOGIN_WAY
.
WeCom
}
`
;
else
redirectUri
+=
`?loginWay=
${
LOGIN_WAY
.
WeCom
}
`
;
return
redirectUri
;
return
redirectUri
;
}
}
;
const
props
=
Object
.
assign
(
const
props
=
Object
.
assign
(
{},
{},
{
{
...
@@ -49,9 +48,7 @@ const useIOTQRCode = () => {
...
@@ -49,9 +48,7 @@ const useIOTQRCode = () => {
},
},
);
);
useWeCom
(
props
);
useWeCom
(
props
);
return
(
return
<
div
id
=
"wxlogin_container"
className
=
{
styles
.
wxlogin_container
}
/>
;
<
div
id
=
"wxlogin_container"
className
=
{
styles
.
wxlogin_container
}
><
/div
>
);
};
};
export
default
useIOTQRCode
;
export
default
useIOTQRCode
;
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