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
d698ac3f
Commit
d698ac3f
authored
Dec 17, 2024
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改登录验证码
parent
0e5eecd5
Pipeline
#94701
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
9 deletions
+64
-9
base.js
src/api/service/base.js
+13
-0
reducer.js
src/containers/App/store/reducer.js
+6
-3
LoginItem.js
src/pages/user/login/components/Login/LoginItem.js
+45
-6
No files found.
src/api/service/base.js
View file @
d698ac3f
...
...
@@ -21,6 +21,9 @@ export const API = {
SEND_MESSAGE_CODE
:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
,
// 获取验证码 前端校验
GetAliyunSMSVerificationCodeHasWay
:
'/PandaCore/Identity/GetAliyunSMSVerificationCode'
,
// 获取验证码 走网关
GetAliyunSMSVerificationCode
:
'PandaCore/GCK/BussinessAuth/GetAliyunSMSVerificationCode'
,
// 获取验证码 不走网关
GetSMSVerificationCodeHasWay
:
'/PandaCore/Identity/GetSMSVerificationCode'
,
// 获取验证码 走网关 通用(client必传)
GetSMSVerificationCode
:
'PandaCore/GCK/BussinessAuth/GetSMSVerificationCode'
,
// 获取验证码 不走网关 通用(client必传)
CHANGE_PASSWORD
:
'cityinterface/rest/services.svc/changepassword'
,
CHANGE_PASSWORD_SAFE
:
'/PandaOMS/OMS/UserCenter/UpdateUserPassword'
,
HD_AUTH_LOGIN
:
'/PandaCore/GCK/BussinessAuth/HDAuthLogin'
,
...
...
@@ -189,6 +192,16 @@ const services = {
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
GetSMSVerificationCodeHasWay
:
{
url
:
API
.
GetSMSVerificationCodeHasWay
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
GetSMSVerificationCode
:
{
url
:
API
.
GetSMSVerificationCode
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
updateAvatar
:
{
url
:
API
.
UPDATE_AVATAR
,
method
:
constants
.
REQUEST_METHOD_GET
,
...
...
src/containers/App/store/reducer.js
View file @
d698ac3f
...
...
@@ -97,7 +97,10 @@ const appReducer = (state = initialState, action) => {
// 验证码配置 站点设置里配置 只针对该站点
temp
.
isVerificationCode
=
action
.
data
.
VerificationConfig
?.
IsVerificationCode
||
false
;
temp
.
verificationCodeTimeOut
=
action
.
data
.
VerificationConfig
?.
VerificationCodeTimeOut
||
1
;
temp
.
verificationCodeType
=
action
.
data
.
VerificationConfig
?.
VerificationCodeType
||
''
;
temp
.
verificationCodeType
=
temp
.
isVerificationCode
?
action
.
data
.
VerificationConfig
?.
VerificationCodeType
||
''
:
''
;
// temp.isVerificationCode 为false 时,不能用短信验证码
window
.
globalConfig
=
temp
;
// eslint-disable-next-line no-undef
...
...
@@ -279,9 +282,9 @@ const appReducer = (state = initialState, action) => {
pdView: action.data,
});
case CONFIG_INTEGRATED:
localStorage.setItem('integrationConfig',action.data ? JSON.stringify(action.data) : '');
localStorage.setItem('integrationConfig',
action.data ? JSON.stringify(action.data) : '');
return state.merge({
integratedConfig: fromJS(action.data || {})
integratedConfig: fromJS(action.data || {})
,
});
default:
return state;
...
...
src/pages/user/login/components/Login/LoginItem.js
View file @
d698ac3f
...
...
@@ -38,7 +38,7 @@ const ValidateCode = props => {
const
codeUrl
=
window
?.
globalConfig
?.
hasGateWay
?
'/PandaCore/Identity/GetVerificationCode'
:
'/PandaCore/GCK/BussinessAuth/GetVerificationCode'
;
const
client
=
window
?.
globalConfig
?.
client
||
'city'
;
const
verificationCodeTimeOut
=
(
window
?.
globalConfig
?.
verificationCodeTimeOut
||
1
)
*
60
;
const
onTimeOver
=
()
=>
{
console
.
log
(
'超时了'
);
...
...
@@ -108,7 +108,7 @@ const ValidateCode = props => {
<
img
className
=
{
styles
.
validate_invalid
}
src
=
{
invalidIcon
}
height
=
{
35
}
alt
=
""
/>
<
/
>
)
:
(
<
img
src
=
{
`
${
codeUrl
}
?time=
${
count
}
`
}
alt
=
""
/>
<
img
src
=
{
`
${
codeUrl
}
?time=
${
count
}
&client=
${
client
}
`
}
alt
=
""
/>
)}
<
div
className
=
{
styles
.
validate_refresh
}
onClick
=
{
handeRefresh
}
>
...
...
@@ -120,7 +120,7 @@ const ValidateCode = props => {
};
const
LoginItem
=
props
=>
{
const
{
isVerificationCode
,
verificationCodeType
,
verificationCodeTimeOut
}
=
window
.
globalConfig
;
const
{
client
,
isVerificationCode
,
verificationCodeType
,
verificationCodeTimeOut
}
=
window
.
globalConfig
;
const
[
count
,
setCount
]
=
useState
(
props
.
countDown
||
(
verificationCodeTimeOut
||
1
)
*
60
);
const
[
timing
,
setTiming
]
=
useState
(
false
);
const
[
ext
,
setExt
]
=
useState
(
''
);
...
...
@@ -179,7 +179,46 @@ const LoginItem = props => {
});
}
},
[]);
const
onGetPhoneCaptcha
=
useCallback
(
mobile
=>
{
// eslint-disable-next-line no-undef
if
(
window
.
globalConfig
?.
hasGateWay
)
{
// 开户网关
appService
.
GetSMSVerificationCodeHasWay
({
phoneNumber
:
mobile
,
ignoreSite
:
true
,
cacheBust
:
true
,
client
,
})
.
then
(
res
=>
{
if
(
res
)
{
setExt
(
res
.
ext
);
setTiming
(
true
);
}
})
.
catch
(
error
=>
{
message
.
error
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorCodeMessage'
}));
});
}
else
{
// 不开网关
appService
.
GetSMSVerificationCode
({
phoneNumber
:
mobile
,
ignoreSite
:
true
,
cacheBust
:
true
,
client
,
})
.
then
(
res
=>
{
if
(
res
)
{
setExt
(
res
.
ext
);
setTiming
(
true
);
}
})
.
catch
(
error
=>
{
message
.
error
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorCodeMessage'
}));
});
}
},
[]);
useEffect
(()
=>
{
let
interval
=
0
;
...
...
@@ -263,7 +302,7 @@ const LoginItem = props => {
if
(
type
===
'Validate'
)
{
// 短信验证码
if
(
verificationCodeType
===
'阿里云短信
验证码'
)
{
if
(
verificationCodeType
&&
verificationCodeType
!==
'图片
验证码'
)
{
const
inputProps
=
omit
(
otherProps
,
[
'onGetCaptcha'
,
'countDown'
]);
return
(
<>
...
...
@@ -284,7 +323,7 @@ const LoginItem = props => {
onClick
=
{()
=>
{
validateFields
([
'mobile'
])
.
then
(
values
=>
{
onGetCaptcha
(
values
.
mobile
);
onGet
Phone
Captcha
(
values
.
mobile
);
})
.
catch
(
error
=>
{
Logger
.
log
(
error
);
...
...
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