Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
dd4107f0
Commit
dd4107f0
authored
Mar 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update checkCardModalV3.tsx
parent
ff907ca4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
16 deletions
+38
-16
src/ui/Duel/checkCardModalV3.tsx
src/ui/Duel/checkCardModalV3.tsx
+38
-16
No files found.
src/ui/Duel/checkCardModalV3.tsx
View file @
dd4107f0
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
use
Ref
,
use
State
}
from
"
react
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
store
}
from
"
../../store
"
;
import
{
Modal
,
Button
,
Card
,
Row
,
Col
}
from
"
antd
"
;
import
{
Button
,
Card
,
Row
,
Col
}
from
"
antd
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
sendSelectCardResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
...
...
@@ -11,6 +11,7 @@ import {
}
from
"
../../reducers/duel/mod
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
selectCheckCardModalV3
}
from
"
../../reducers/duel/modal/checkCardModalV3Slice
"
;
import
DragModal
from
"
./dragModal
"
;
const
CheckCardModalV3
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -31,14 +32,24 @@ const CheckCardModalV3 = () => {
.
concat
(
selectedOptions
)
.
map
((
option
)
=>
option
.
level2
)
.
reduce
((
sum
,
current
)
=>
sum
+
current
,
0
);
// Draggable 相关
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onMouseOver
=
()
=>
{
if
(
draggable
)
{
setDraggable
(
false
);
}
};
const
onMouseOut
=
()
=>
{
setDraggable
(
true
);
};
const
responseable
=
(
overflow
?
Level1Sum
>=
LevelSum
||
Level2Sum
>=
LevelSum
:
Level1Sum
==
LevelSum
||
Level2Sum
==
LevelSum
)
&&
selectedOptions
.
length
<=
max
&&
selectedOptions
.
length
>=
min
;
const
onFinish
=
()
=>
{
sendSelectCardResponse
(
mustSelectOptions
.
concat
(
selectedOptions
).
map
((
option
)
=>
option
.
response
)
...
...
@@ -49,18 +60,27 @@ const CheckCardModalV3 = () => {
};
return
(
<
Modal
title=
{
`请选择卡片,最少${min}张,最多${max}张`
}
open=
{
isOpen
}
closable=
{
false
}
footer=
{
<>
<
Button
disabled=
{
!
responseable
}
onClick=
{
onFinish
}
>
finish
</
Button
>
</>
}
width=
{
800
}
<
DragModal
modalProps=
{
{
title
:
`请选择卡片,最少${min}张,最多${max}张`
,
open
:
isOpen
,
closable
:
false
,
footer
:
(
<>
<
Button
disabled=
{
!
responseable
}
onClick=
{
onFinish
}
onMouseOver=
{
onMouseOver
}
onMouseOut=
{
onMouseOut
}
>
finish
</
Button
>
</>
),
width
:
800
,
}
}
dragRef=
{
draggleRef
}
draggable=
{
draggable
}
>
<
CheckCard
.
Group
bordered
...
...
@@ -87,6 +107,8 @@ const CheckCardModalV3 = () => {
/>
}
value=
{
option
}
onMouseEnter=
{
onMouseOver
}
onMouseLeave=
{
onMouseOut
}
/>
</
Col
>
);
...
...
@@ -112,7 +134,7 @@ const CheckCardModalV3 = () => {
);
})
}
</
Row
>
</
Modal
>
</
Drag
Modal
>
);
};
...
...
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