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
a426fddc
Commit
a426fddc
authored
Aug 02, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 当前项目高亮通过ID判断, 新增项目增加loading
parent
df2eeacb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
index.tsx
src/views/Project/components/AddProject/index.tsx
+8
-1
index.tsx
src/views/Project/components/ProjectListPopper/index.tsx
+2
-2
No files found.
src/views/Project/components/AddProject/index.tsx
View file @
a426fddc
...
@@ -42,6 +42,7 @@ const AddProject = (props: IAddProjectProps) => {
...
@@ -42,6 +42,7 @@ const AddProject = (props: IAddProjectProps) => {
});
});
const
[
zoneId
,
setZoneId
]
=
useState
(
""
);
const
[
zoneId
,
setZoneId
]
=
useState
(
""
);
const
[
zoneIdOptions
,
setZoneIdOptions
]
=
useState
<
Array
<
zoneIdOption
>>
([]);
const
[
zoneIdOptions
,
setZoneIdOptions
]
=
useState
<
Array
<
zoneIdOption
>>
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
// 设置计算区
// 设置计算区
const
{
run
}
=
useMyRequest
(
hpczone
,
{
const
{
run
}
=
useMyRequest
(
hpczone
,
{
...
@@ -51,9 +52,13 @@ const AddProject = (props: IAddProjectProps) => {
...
@@ -51,9 +52,13 @@ const AddProject = (props: IAddProjectProps) => {
},
},
});
});
const
{
run
:
addProjectRun
}
=
useMyRequest
(
addProject
,
{
const
{
run
:
addProjectRun
}
=
useMyRequest
(
addProject
,
{
onBefore
:
()
=>
{
setLoading
(
true
);
},
onSuccess
:
async
(
result
:
any
)
=>
{
onSuccess
:
async
(
result
:
any
)
=>
{
if
(
result
.
data
)
{
if
(
result
.
data
)
{
setAddOpen
(
false
);
setAddOpen
(
false
);
setLoading
(
false
);
message
.
success
(
"新建项目成功"
);
message
.
success
(
"新建项目成功"
);
const
projectList
=
await
getProjectList
();
const
projectList
=
await
getProjectList
();
currentProjectStore
.
setProjectList
(
projectList
);
currentProjectStore
.
setProjectList
(
projectList
);
...
@@ -72,7 +77,7 @@ const AddProject = (props: IAddProjectProps) => {
...
@@ -72,7 +77,7 @@ const AddProject = (props: IAddProjectProps) => {
}
}
},
},
onError
:
()
=>
{
onError
:
()
=>
{
set
AddOpen
(
false
);
set
Loading
(
false
);
},
},
});
});
...
@@ -84,6 +89,7 @@ const AddProject = (props: IAddProjectProps) => {
...
@@ -84,6 +89,7 @@ const AddProject = (props: IAddProjectProps) => {
if
(
addOpen
)
{
if
(
addOpen
)
{
setName
(
""
);
setName
(
""
);
setDesc
(
""
);
setDesc
(
""
);
setLoading
(
false
);
if
(
zoneIdOptions
.
length
>
0
)
{
if
(
zoneIdOptions
.
length
>
0
)
{
setZoneId
(
zoneIdOptions
[
0
].
id
);
setZoneId
(
zoneIdOptions
[
0
].
id
);
}
}
...
@@ -166,6 +172,7 @@ const AddProject = (props: IAddProjectProps) => {
...
@@ -166,6 +172,7 @@ const AddProject = (props: IAddProjectProps) => {
onConfirm=
{
handleSubmit
}
onConfirm=
{
handleSubmit
}
onClose=
{
()
=>
setAddOpen
(
false
)
}
onClose=
{
()
=>
setAddOpen
(
false
)
}
title=
"新建项目"
title=
"新建项目"
loading=
{
loading
}
>
>
<
div
className=
{
style
.
formBox
}
onClick=
{
handleFromBox
}
>
<
div
className=
{
style
.
formBox
}
onClick=
{
handleFromBox
}
>
<
MyInput
<
MyInput
...
...
src/views/Project/components/ProjectListPopper/index.tsx
View file @
a426fddc
...
@@ -14,7 +14,7 @@ const ProjectListPopper = observer((props: any) => {
...
@@ -14,7 +14,7 @@ const ProjectListPopper = observer((props: any) => {
const
{
handleChangeCurrentProject
,
handleClickOpen
}
=
props
;
const
{
handleChangeCurrentProject
,
handleClickOpen
}
=
props
;
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
projectList
=
toJS
(
currentProjectStore
.
projectList
);
const
projectList
=
toJS
(
currentProjectStore
.
projectList
);
const
currentProject
Name
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
name
);
const
currentProject
Id
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
// 通过名称本地搜索
// 通过名称本地搜索
const
[
name
,
setName
]
=
useState
(
""
);
const
[
name
,
setName
]
=
useState
(
""
);
const
nameChange
=
(
e
:
any
)
=>
{
const
nameChange
=
(
e
:
any
)
=>
{
...
@@ -66,7 +66,7 @@ const ProjectListPopper = observer((props: any) => {
...
@@ -66,7 +66,7 @@ const ProjectListPopper = observer((props: any) => {
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
style
.
projectli
]:
true
,
[
style
.
projectli
]:
true
,
[
style
.
projectliActive
]:
item
.
name
===
currentProjectName
,
[
style
.
projectliActive
]:
item
.
id
===
currentProjectId
,
})
}
})
}
key=
{
item
.
id
}
key=
{
item
.
id
}
onClick=
{
()
=>
handleChangeCurrentProject
(
item
)
}
onClick=
{
()
=>
handleChangeCurrentProject
(
item
)
}
...
...
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