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
Show 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 }) {
...
@@ -7,7 +7,7 @@ function PageModal({ visible, onCancel, onPublish }) {
const
[
publish
,
setPublish
]
=
useState
(
false
)
const
[
publish
,
setPublish
]
=
useState
(
false
)
const
[
pageData
,
setpageData
]
=
useState
(
''
)
const
[
pageData
,
setpageData
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
const
onChangePage
=
(
values
)
=>
{
const
onChangePage
=
(
values
)
=>
{
console
.
log
(
values
);
console
.
log
(
values
);
...
@@ -64,7 +64,6 @@ function PageModal({ visible, onCancel, onPublish }) {
...
@@ -64,7 +64,6 @@ function PageModal({ visible, onCancel, onPublish }) {
console
.
log
(
dataCenter
);
console
.
log
(
dataCenter
);
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
})
})
},
[])
},
[])
...
...
src/modal/PublishModal.jsx
View file @
d74941fa
...
@@ -25,7 +25,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
...
@@ -25,7 +25,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
const
[
code
,
setcode
]
=
useState
(
''
)
const
[
code
,
setcode
]
=
useState
(
''
)
const
[
pageName
,
setPageName
]
=
useState
(
''
)
const
[
pageName
,
setPageName
]
=
useState
(
''
)
const
[
oldCode
,
setoldCode
]
=
useState
(
''
)
const
[
oldCode
,
setoldCode
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
console
.
log
(
data
);
console
.
log
(
data
);
const
onCreate
=
(
values
)
=>
{
const
onCreate
=
(
values
)
=>
{
console
.
log
(
code
);
console
.
log
(
code
);
...
@@ -53,7 +53,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
...
@@ -53,7 +53,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
message
.
success
(
'发布成功!'
)
message
.
success
(
'发布成功!'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
})
})
}
else
{
}
else
{
message
.
error
(
data
.
error
||
'发布失败'
)
message
.
error
(
data
.
error
||
'发布失败'
)
...
@@ -77,7 +77,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
...
@@ -77,7 +77,7 @@ const PublishModal = ({ visible, onCancel, data }) => {
message
.
success
(
'发布成功!'
)
message
.
success
(
'发布成功!'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
})
})
}
else
{
}
else
{
message
.
error
(
data
.
error
||
'发布失败'
)
message
.
error
(
data
.
error
||
'发布失败'
)
...
...
src/modal/RemoveType.jsx
View file @
d74941fa
...
@@ -14,7 +14,7 @@ function RemoveType({ visible, onCancel }) {
...
@@ -14,7 +14,7 @@ function RemoveType({ visible, onCancel }) {
const
[
typeModal
,
setTypeModal
]
=
useState
(
false
)
const
[
typeModal
,
setTypeModal
]
=
useState
(
false
)
const
[
oldData
,
setoldData
]
=
useState
(
''
)
const
[
oldData
,
setoldData
]
=
useState
(
''
)
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
const
changType
=
(
data
)
=>
{
const
changType
=
(
data
)
=>
{
setoldData
(
data
)
setoldData
(
data
)
...
@@ -26,9 +26,9 @@ function RemoveType({ visible, onCancel }) {
...
@@ -26,9 +26,9 @@ function RemoveType({ visible, onCancel }) {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
dataCenter
?.
type
&&
fetchData
(
'/
query/queryChildType'
,
{
typeId
:
dataCenter
?.
type
[
0
]?.
typeId
},
'childType
'
)
dataCenter
?.
type
&&
fetchData
(
'/
typeManage/queryTypeForManage'
,
{},
'childTypeData
'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
console
.
log
(
res
);
})
})
},
[])
},
[])
...
...
src/modal/ToolModal.jsx
View file @
d74941fa
import
React
,
{
useContext
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'react'
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
Form
,
Input
,
message
,
Modal
,
Select
}
from
'antd'
;
import
{
Button
,
Modal
,
Form
,
Input
,
Radio
,
Select
,
message
}
from
'antd'
;
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
ToolModal
=
({
visible
,
onCancel
,
data
})
=>
{
const
ToolModal
=
({
visible
,
onCancel
,
data
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
{
fetchData
,
updateIndex
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
formItemLayout
=
{
const
formItemLayout
=
{
labelCol
:
{
span
:
4
},
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
wrapperCol
:
{
span
:
18
},
...
@@ -28,7 +28,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
...
@@ -28,7 +28,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
message
.
success
(
'新建成功'
)
message
.
success
(
'新建成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
onCancel
()
}
}
})
})
...
@@ -38,7 +38,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
...
@@ -38,7 +38,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
message
.
success
(
'修改成功'
)
message
.
success
(
'修改成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
onCancel
()
}
}
})
})
...
@@ -51,7 +51,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
...
@@ -51,7 +51,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
});
});
fetchData
(
'/query/queryChildType'
,
{
typeId
:
value
},
'childType'
)
fetchData
(
'/query/queryChildType'
,
{
typeId
:
value
},
'childType'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
console
.
log
(
res
);
})
})
console
.
log
(
dataCenter
);
console
.
log
(
dataCenter
);
...
@@ -65,7 +65,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
...
@@ -65,7 +65,7 @@ const ToolModal = ({ visible, onCancel, data }) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
dataCenter
?.
type
&&
fetchData
(
'/query/queryChildType'
,
{
typeId
:
dataCenter
?.
type
[
0
]?.
typeId
},
'childType'
)
dataCenter
?.
type
&&
fetchData
(
'/query/queryChildType'
,
{
typeId
:
dataCenter
?.
type
[
0
]?.
typeId
},
'childType'
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
updateIndex
()
console
.
log
(
res
);
console
.
log
(
res
);
})
})
},
[])
},
[])
...
...
src/modal/TypeModal.jsx
View file @
d74941fa
import
React
,
{
useContext
}
from
'react'
;
import
React
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
,
Tabs
}
from
'antd'
;
import
{
Button
,
Modal
,
Form
,
Input
,
Radio
,
Select
,
message
,
Tabs
}
from
'antd'
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
useContext
,
useEffect
,
useState
}
from
"react"
;
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
{
TabPane
}
=
Tabs
;
const
{
TabPane
}
=
Tabs
;
const
TypeModal
=
({
visible
,
onCancel
,
data
})
=>
{
const
TypeModal
=
({
visible
,
onCancel
,
data
})
=>
{
...
@@ -13,27 +14,27 @@ const TypeModal = ({ visible, onCancel, data }) => {
...
@@ -13,27 +14,27 @@ const TypeModal = ({ visible, onCancel, data }) => {
wrapperCol
:
{
span
:
18
},
wrapperCol
:
{
span
:
18
},
};
};
const
{
fetchData
,
updateIndex
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
[
value
,
setValue
]
=
React
.
useState
(
1
);
const
[
value
,
setValue
]
=
React
.
useState
(
1
);
const
onCreate
=
(
values
)
=>
{
const
onCreate
=
(
values
)
=>
{
console
.
log
(
values
);
if
(
data
)
{
if
(
data
)
{
}
else
{
}
else
{
console
.
log
(
values
);
fetchData
(
'/add/addType'
,
values
)
fetchData
(
'/add/addType'
,
values
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
message
.
success
(
'新建成功'
)
message
.
success
(
'新建成功'
)
updateIndex
(
)
dispatch
(
NEED_UPDATE_INDEX
()
)
onCancel
()
onCancel
()
}
}
})
})
}
}
};
};
// function callback(key) {
// function callback(key) {
// console.log(key);
// console.log(key);
// }
// }
...
@@ -43,6 +44,12 @@ const TypeModal = ({ visible, onCancel, data }) => {
...
@@ -43,6 +44,12 @@ const TypeModal = ({ visible, onCancel, data }) => {
setValue
(
e
.
target
.
value
);
setValue
(
e
.
target
.
value
);
};
};
const
onGenderChange
=
(
value
)
=>
{
form
.
setFieldsValue
({
typeId
:
value
,
});
};
return
(
return
(
<
Modal
<
Modal
visible=
{
visible
}
visible=
{
visible
}
...
@@ -93,18 +100,28 @@ const TypeModal = ({ visible, onCancel, data }) => {
...
@@ -93,18 +100,28 @@ const TypeModal = ({ visible, onCancel, data }) => {
</
Form
.
Item
>
:
</
Form
.
Item
>
:
<>
<>
<
Form
.
Item
<
Form
.
Item
name=
"
select
"
name=
"
typeId
"
label=
"父类型"
label=
"父类型"
hasFeedback
hasFeedback
rules=
{
[{
required
:
true
,
message
:
'请选择父类型!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请选择父类型!'
}]
}
>
>
<
Select
placeholder=
"请选择父类型"
>
<
Select
<
Option
value=
"china"
>
China
</
Option
>
placeholder=
"请选择父类型"
<
Option
value=
"usa"
>
U.S.A
</
Option
>
onChange=
{
onGenderChange
}
// allowClear
>
{
dataCenter
?.
type
?.
length
&&
dataCenter
?.
type
.
map
(
v
=>
{
return
(
<
Option
key=
{
v
.
typeId
}
value=
{
v
.
typeId
}
>
{
v
.
typeName
}
</
Option
>
)
})
}
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"
t
ypeName"
name=
"
childT
ypeName"
label=
"子类型"
label=
"子类型"
rules=
{
[
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