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
f213250b
Commit
f213250b
authored
Jun 15, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化基础信息修改提示
parent
cac0bab4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
13 deletions
+63
-13
index.module.css
src/views/Project/ProjectSetting/BaseInfo/index.module.css
+1
-1
index.tsx
src/views/Project/ProjectSetting/BaseInfo/index.tsx
+62
-12
No files found.
src/views/Project/ProjectSetting/BaseInfo/index.module.css
View file @
f213250b
...
...
@@ -34,7 +34,7 @@
outline
:
none
;
}
.projectInfoListLiValue
:focus
{
border
:
1
px
solid
#136efa
;
border
:
2
px
solid
#136efa
;
}
.projectInfoTextarea
{
line-height
:
22px
;
...
...
src/views/Project/ProjectSetting/BaseInfo/index.tsx
View file @
f213250b
...
...
@@ -21,7 +21,7 @@ import { toJS } from "mobx";
import
{
observer
}
from
"mobx-react-lite"
;
import
InformationDisplay
from
"@/components/InformationDisplay"
;
import
classnames
from
"classnames"
;
import
{
Button
}
from
"@mui/material"
;
import
{
Button
,
TextField
}
from
"@mui/material"
;
import
LoadingButton
from
"@mui/lab/LoadingButton"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
Loading
from
"@/views/Loading"
;
...
...
@@ -40,6 +40,10 @@ const BaseInfo = observer(() => {
const
{
currentProjectStore
}
=
useStores
();
const
[
projectInfo
,
setProjectInfo
]
=
useState
<
any
>
({});
const
[
deleteProjectName
,
setDeleteProjectName
]
=
useState
(
""
);
const
[
nameCheck
,
setNameCheck
]
=
useState
({
error
:
false
,
help
:
""
,
});
const
currentUserName
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)
||
"{}"
).
name
;
...
...
@@ -98,11 +102,50 @@ const BaseInfo = observer(() => {
];
},
[
projectInfo
,
zoneIdMap
]);
const
checkName
=
(
name
:
string
,
showMessage
=
false
)
=>
{
let
help
=
""
;
if
(
name
)
{
if
(
name
.
length
>
30
)
{
help
=
"格式不正确,必须在30字符以内,仅限大小写字母、数字、中文"
;
setNameCheck
({
error
:
true
,
help
,
});
showMessage
&&
message
.
error
(
help
);
return
false
;
}
else
if
(
checkIsNumberLetterChinese
(
name
))
{
setNameCheck
({
error
:
false
,
help
:
""
,
});
return
true
;
}
else
{
help
=
"格式不正确,必须在30字符以内,仅限大小写字母、数字、中文"
;
setNameCheck
({
error
:
true
,
help
,
});
showMessage
&&
message
.
error
(
help
);
return
false
;
}
}
else
{
help
=
"项目名称不能为空"
;
setNameCheck
({
error
:
true
,
help
,
});
showMessage
&&
message
.
error
(
help
);
return
false
;
}
};
const
nameChange
=
(
e
:
any
)
=>
{
setProjectInfo
({
...
projectInfo
,
name
:
e
.
target
.
value
,
});
checkName
(
e
.
target
.
value
);
// setNameCheck
};
const
descChange
=
(
e
:
any
)
=>
{
...
...
@@ -126,16 +169,10 @@ const BaseInfo = observer(() => {
// 修改项目
const
handleClickUpdate
=
()
=>
{
if
(
projectInfo
.
name
)
{
if
(
checkIsNumberLetterChinese
(
projectInfo
.
name
))
{
updateProjectRun
({
...
projectInfo
,
product
:
"CADD"
});
}
else
{
message
.
info
(
"格式不正确,必须在30字符以内,仅限大小写字母、数字、中文"
);
}
if
(
checkName
(
projectInfo
.
name
,
true
))
{
updateProjectRun
({
...
projectInfo
,
product
:
"CADD"
});
}
else
{
message
.
info
(
"项目名称不能为空"
)
;
return
;
}
};
...
...
@@ -195,13 +232,26 @@ const BaseInfo = observer(() => {
>
项目名称
</
div
>
<
input
<
TextField
required
error=
{
nameCheck
.
error
}
id=
"name"
variant=
"outlined"
value=
{
projectInfo
.
name
}
onChange=
{
nameChange
}
helperText=
{
nameCheck
.
help
}
size=
"small"
sx=
{
{
width
:
"560px"
,
}
}
/>
{
/* <input
value={projectInfo.name}
className={style.projectInfoListLiValue}
onChange={nameChange}
maxLength={30}
placeholder="请输入项目名称"
></
input
>
></input>
*/
}
</
div
>
<
div
className=
{
style
.
projectInfoListLi
}
>
<
div
className=
{
style
.
projectInfoListLiLabel
}
>
项目描述
</
div
>
...
...
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