Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Dui123
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王天宇
Dui123
Commits
d74941fa
Commit
d74941fa
authored
Sep 30, 2021
by
rzf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改
parent
82b30992
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
30 deletions
+46
-30
PageModal.jsx
src/modal/PageModal.jsx
+1
-2
PublishModal.jsx
src/modal/PublishModal.jsx
+3
-3
RemoveType.jsx
src/modal/RemoveType.jsx
+3
-3
ToolModal.jsx
src/modal/ToolModal.jsx
+9
-9
TypeModal.jsx
src/modal/TypeModal.jsx
+30
-13
No files found.
src/modal/PageModal.jsx
View file @
d74941fa
...
...
@@ -7,7 +7,7 @@ function PageModal({ visible, onCancel, onPublish }) {
const
[
publish
,
setPublish
]
=
useState
(
false
)
const
[
pageData
,
setpageData
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
const
onChangePage
=
(
values
)
=>
{
console
.
log
(
values
);
...
...
@@ -64,7 +64,6 @@ function PageModal({ visible, onCancel, onPublish }) {
console
.
log
(
dataCenter
);
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
updateIndex
()
})
},
[])
...
...
src/modal/PublishModal.jsx
View file @
d74941fa
...
...
@@ -25,7 +25,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
const
[
code
,
setcode
]
=
useState
(
''
)
const
[
pageName
,
setPageName
]
=
useState
(
''
)
const
[
oldCode
,
setoldCode
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
console
.
log
(
data
);
const
onCreate
=
(
values
)
=>
{
console
.
log
(
code
);
...
...
@@ -53,7 +53,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
message
.
success
(
'发布成功!'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
updateIndex
()
})
}
else
{
message
.
error
(
data
.
error
||
'发布失败'
)
...
...
@@ -77,7 +77,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
message
.
success
(
'发布成功!'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
updateIndex
()
})
}
else
{
message
.
error
(
data
.
error
||
'发布失败'
)
...
...
src/modal/RemoveType.jsx
View file @
d74941fa
...
...
@@ -14,7 +14,7 @@ function RemoveType({ visible, onCancel }) {
const
[
typeModal
,
setTypeModal
]
=
useState
(
false
)
const
[
oldData
,
setoldData
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
const
changType
=
(
data
)
=>
{
setoldData
(
data
)
...
...
@@ -26,9 +26,9 @@ function RemoveType({ visible, onCancel }) {
}
useEffect
(()
=>
{
dataCenter
?.
type
&&
fetchData
(
'/
query/queryChildType'
,
{
typeId
:
dataCenter
?.
type
[
0
]?.
typeId
},
'childType
'
)
dataCenter
?.
type
&&
fetchData
(
'/
typeManage/queryTypeForManage'
,
{},
'childTypeData
'
)
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
})
},
[])
...
...
src/modal/ToolModal.jsx
View file @
d74941fa
import
React
,
{
useContext
,
useEffect
}
from
'react'
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
Form
,
Input
,
message
,
Modal
,
Select
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'react'
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
Button
,
Modal
,
Form
,
Input
,
Radio
,
Select
,
message
}
from
'antd'
;
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
const
{
Option
}
=
Select
;
const
ToolModal
=
({
visible
,
onCancel
,
data
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
formItemLayout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
...
...
@@ -28,7 +28,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'新建成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
}
})
...
...
@@ -38,7 +38,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'修改成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
}
})
...
...
@@ -51,7 +51,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
});
fetchData
(
'/query/queryChildType'
,
{
typeId
:
value
},
'childType'
)
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
})
console
.
log
(
dataCenter
);
...
...
@@ -65,7 +65,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
useEffect
(()
=>
{
dataCenter
?.
type
&&
fetchData
(
'/query/queryChildType'
,
{
typeId
:
dataCenter
?.
type
[
0
]?.
typeId
},
'childType'
)
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
})
},
[])
...
...
src/modal/TypeModal.jsx
View file @
d74941fa
import
React
,
{
useContext
}
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
,
Tabs
}
from
'antd'
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
React
from
'react'
;
import
{
Button
,
Modal
,
Form
,
Input
,
Radio
,
Select
,
message
,
Tabs
}
from
'antd'
;
import
{
useContext
,
useEffect
,
useState
}
from
"react"
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
const
{
Option
}
=
Select
;
const
{
TabPane
}
=
Tabs
;
const
TypeModal
=
({
visible
,
onCancel
,
data
})
=>
{
...
...
@@ -13,27 +14,27 @@ const TypeModal = ({ visible, onCancel, data }) => {
wrapperCol
:
{
span
:
18
},
};
const
{
fetchData
,
updateIndex
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
[
value
,
setValue
]
=
React
.
useState
(
1
);
const
onCreate
=
(
values
)
=>
{
console
.
log
(
values
);
if
(
data
)
{
}
else
{
console
.
log
(
values
);
fetchData
(
'/add/addType'
,
values
)
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'新建成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
}
})
}
};
// function callback(key) {
// console.log(key);
// }
...
...
@@ -43,6 +44,12 @@ const TypeModal = ({ visible, onCancel, data }) => {
setValue
(
e
.
target
.
value
);
};
const
onGenderChange
=
(
value
)
=>
{
form
.
setFieldsValue
({
typeId
:
value
,
});
};
return
(
<
Modal
visible=
{
visible
}
...
...
@@ -93,18 +100,28 @@ const TypeModal = ({ visible, onCancel, data }) => {
</
Form
.
Item
>
:
<>
<
Form
.
Item
name=
"
select
"
name=
"
typeId
"
label=
"父类型"
hasFeedback
rules=
{
[{
required
:
true
,
message
:
'请选择父类型!'
}]
}
>
<
Select
placeholder=
"请选择父类型"
>
<
Option
value=
"china"
>
China
</
Option
>
<
Option
value=
"usa"
>
U.S.A
</
Option
>
<
Select
placeholder=
"请选择父类型"
onChange=
{
onGenderChange
}
// allowClear
>
{
dataCenter
?.
type
?.
length
&&
dataCenter
?.
type
.
map
(
v
=>
{
return
(
<
Option
key=
{
v
.
typeId
}
value=
{
v
.
typeId
}
>
{
v
.
typeName
}
</
Option
>
)
})
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
name=
"
t
ypeName"
name=
"
childT
ypeName"
label=
"子类型"
rules=
{
[
{
...
...
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