Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
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
Administrator
bkunyun
Commits
66018d30
Commit
66018d30
authored
Jul 05, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 任务名称为空校验,气泡确认组件点击空白取消
parent
45239ce4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
MyPopconfirm.tsx
src/components/mui/MyPopconfirm.tsx
+8
-2
index.tsx
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
+7
-1
No files found.
src/components/mui/MyPopconfirm.tsx
View file @
66018d30
import
*
as
React
from
"react"
;
import
*
as
React
from
"react"
;
import
{
ReactNode
}
from
"react"
;
import
{
ReactNode
,
useEffect
}
from
"react"
;
import
Box
from
"@mui/material/Box"
;
import
Box
from
"@mui/material/Box"
;
import
ButtonComponent
from
"./Button"
;
import
ButtonComponent
from
"./Button"
;
import
tipsIcon
from
"@/assets/project/information-outline.svg"
;
import
tipsIcon
from
"@/assets/project/information-outline.svg"
;
...
@@ -28,7 +28,7 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
...
@@ -28,7 +28,7 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
<
null
|
HTMLElement
>
(
null
);
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
<
null
|
HTMLElement
>
(
null
);
const
handleClick
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
const
handleClick
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
console
.
log
(
123
);
event
.
nativeEvent
.
stopImmediatePropagation
(
);
setAnchorEl
(
anchorEl
?
null
:
event
.
currentTarget
);
setAnchorEl
(
anchorEl
?
null
:
event
.
currentTarget
);
};
};
...
@@ -45,6 +45,12 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
...
@@ -45,6 +45,12 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
onConfirm
&&
onConfirm
();
onConfirm
&&
onConfirm
();
};
};
useEffect
(()
=>
{
document
.
addEventListener
(
"click"
,
(
e
)
=>
{
setAnchorEl
(
null
);
});
},
[]);
return
(
return
(
<
div
>
<
div
>
<
div
aria
-
describedby=
{
id
}
onClick=
{
handleClick
}
>
<
div
aria
-
describedby=
{
id
}
onClick=
{
handleClick
}
>
...
...
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
View file @
66018d30
...
@@ -97,7 +97,13 @@ const ConfigForm = (props: ConfigFormProps) => {
...
@@ -97,7 +97,13 @@ const ConfigForm = (props: ConfigFormProps) => {
const
checkName
=
(
name
:
string
=
""
)
=>
{
const
checkName
=
(
name
:
string
=
""
)
=>
{
const
reg
=
new
RegExp
(
/^
[
a-zA-Z0-9
\u
4e00-
\u
9fa5-_
]{3,30}
$/
);
const
reg
=
new
RegExp
(
/^
[
a-zA-Z0-9
\u
4e00-
\u
9fa5-_
]{3,30}
$/
);
if
(
reg
.
test
(
name
))
{
if
(
!
name
)
{
setNameHelp
({
error
:
true
,
helperText
:
"任务名称不能为空"
,
});
return
true
;
}
else
if
(
reg
.
test
(
name
))
{
setNameHelp
({
setNameHelp
({
error
:
false
,
error
:
false
,
helperText
:
""
,
helperText
:
""
,
...
...
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