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
ff907ca4
Commit
ff907ca4
authored
Mar 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update checkCardModalV2.tsx
parent
a05bea12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
21 deletions
+47
-21
src/ui/Duel/checkCardModal.tsx
src/ui/Duel/checkCardModal.tsx
+1
-2
src/ui/Duel/checkCardModalV2.tsx
src/ui/Duel/checkCardModalV2.tsx
+46
-19
No files found.
src/ui/Duel/checkCardModal.tsx
View file @
ff907ca4
...
@@ -32,10 +32,10 @@ const CheckCardModal = () => {
...
@@ -32,10 +32,10 @@ const CheckCardModal = () => {
const
cancelResponse
=
useAppSelector
(
selectCheckCardModalCacnelResponse
);
const
cancelResponse
=
useAppSelector
(
selectCheckCardModalCacnelResponse
);
const
[
response
,
setResponse
]
=
useState
<
number
[]
>
([]);
const
[
response
,
setResponse
]
=
useState
<
number
[]
>
([]);
const
defaultValue
:
number
[]
=
[];
const
defaultValue
:
number
[]
=
[];
// Draggable 相关
// Draggable 相关
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onMouseOver
=
()
=>
{
const
onMouseOver
=
()
=>
{
if
(
draggable
)
{
if
(
draggable
)
{
setDraggable
(
false
);
setDraggable
(
false
);
...
@@ -44,7 +44,6 @@ const CheckCardModal = () => {
...
@@ -44,7 +44,6 @@ const CheckCardModal = () => {
const
onMouseOut
=
()
=>
{
const
onMouseOut
=
()
=>
{
setDraggable
(
true
);
setDraggable
(
true
);
};
};
// TODO: 这里可以考虑更好地封装
// TODO: 这里可以考虑更好地封装
const
sendResponseHandler
=
(
const
sendResponseHandler
=
(
handlerName
:
string
|
undefined
,
handlerName
:
string
|
undefined
,
...
...
src/ui/Duel/checkCardModalV2.tsx
View file @
ff907ca4
import
React
from
"
react
"
;
import
React
,
{
useRef
,
useState
}
from
"
react
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
store
}
from
"
../../store
"
;
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
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
import
{
selectCheckCardModalV2CancelAble
,
selectCheckCardModalV2CancelAble
,
...
@@ -19,6 +19,7 @@ import {
...
@@ -19,6 +19,7 @@ import {
setCheckCardModalV2ResponseAble
,
setCheckCardModalV2ResponseAble
,
}
from
"
../../reducers/duel/mod
"
;
}
from
"
../../reducers/duel/mod
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
DragModal
from
"
./dragModal
"
;
const
CheckCardModalV2
=
()
=>
{
const
CheckCardModalV2
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
...
@@ -31,35 +32,59 @@ const CheckCardModalV2 = () => {
...
@@ -31,35 +32,59 @@ const CheckCardModalV2 = () => {
);
);
const
selectedOptions
=
useAppSelector
(
selectCheckCardModalV2SelectedOptions
);
const
selectedOptions
=
useAppSelector
(
selectCheckCardModalV2SelectedOptions
);
const
responseable
=
useAppSelector
(
selectCheckCardModalV2ResponseAble
);
const
responseable
=
useAppSelector
(
selectCheckCardModalV2ResponseAble
);
// Draggable 相关
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onMouseOver
=
()
=>
{
if
(
draggable
)
{
setDraggable
(
false
);
}
};
const
onMouseOut
=
()
=>
{
setDraggable
(
true
);
};
const
onFinish
=
()
=>
{
const
onFinish
=
()
=>
{
sendSelectUnselectCardResponse
({
cancel_or_finish
:
true
});
sendSelectUnselectCardResponse
({
cancel_or_finish
:
true
});
dispatch
(
setCheckCardModalV2IsOpen
(
false
));
dispatch
(
setCheckCardModalV2IsOpen
(
false
));
dispatch
(
resetCheckCardModalV2
());
dispatch
(
resetCheckCardModalV2
());
dispatch
(
setCheckCardModalV2ResponseAble
(
false
));
dispatch
(
setCheckCardModalV2ResponseAble
(
false
));
};
};
const
onCancel
=
()
=>
{
const
onCancel
=
()
=>
{
sendSelectUnselectCardResponse
({
cancel_or_finish
:
true
});
sendSelectUnselectCardResponse
({
cancel_or_finish
:
true
});
dispatch
(
setCheckCardModalV2ResponseAble
(
false
));
dispatch
(
setCheckCardModalV2ResponseAble
(
false
));
};
};
return
(
return
(
<
Modal
<
DragModal
title=
{
`请选择未选择的卡片,最少${min}张,最多${max}张`
}
modalProps=
{
{
open=
{
isOpen
}
title
:
`请选择未选择的卡片,最少${min}张,最多${max}张`
,
closable=
{
false
}
open
:
isOpen
,
footer=
{
closable
:
false
,
<>
footer
:
(
<
Button
disabled=
{
!
finishable
||
!
responseable
}
onClick=
{
onFinish
}
>
<>
finish
<
Button
</
Button
>
disabled=
{
!
finishable
||
!
responseable
}
<
Button
disabled=
{
!
cancelable
||
!
responseable
}
onClick=
{
onCancel
}
>
onClick=
{
onFinish
}
cancel
onMouseOver=
{
onMouseOver
}
</
Button
>
onMouseOut=
{
onMouseOut
}
</>
>
}
finish
width=
{
800
}
</
Button
>
<
Button
disabled=
{
!
cancelable
||
!
responseable
}
onClick=
{
onCancel
}
onMouseOver=
{
onMouseOver
}
onMouseOut=
{
onMouseOut
}
>
cancel
</
Button
>
</>
),
width
:
800
,
}
}
dragRef=
{
draggleRef
}
draggable=
{
draggable
}
>
>
<
CheckCard
.
Group
<
CheckCard
.
Group
bordered
bordered
...
@@ -89,6 +114,8 @@ const CheckCardModalV2 = () => {
...
@@ -89,6 +114,8 @@ const CheckCardModalV2 = () => {
/>
/>
}
}
value=
{
option
.
response
}
value=
{
option
.
response
}
onMouseEnter=
{
onMouseOver
}
onMouseLeave=
{
onMouseOut
}
/>
/>
</
Col
>
</
Col
>
);
);
...
@@ -114,7 +141,7 @@ const CheckCardModalV2 = () => {
...
@@ -114,7 +141,7 @@ const CheckCardModalV2 = () => {
);
);
})
}
})
}
</
Row
>
</
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