Commit 0776484e authored by Chunchi Che's avatar Chunchi Che

fix small

parent c854a99e
Pipeline #21522 passed with stages
in 11 minutes and 45 seconds
...@@ -57,6 +57,7 @@ export default (selectChain: MsgSelectChain) => { ...@@ -57,6 +57,7 @@ export default (selectChain: MsgSelectChain) => {
case 3: { case 3: {
// 处理强制发动的卡 // 处理强制发动的卡
messageStore.selectCardActions.isChain = true;
messageStore.selectCardActions.min = 1; messageStore.selectCardActions.min = 1;
messageStore.selectCardActions.max = 1; messageStore.selectCardActions.max = 1;
messageStore.selectCardActions.cancelAble = !forced; messageStore.selectCardActions.cancelAble = !forced;
......
...@@ -32,6 +32,8 @@ export interface ModalState { ...@@ -32,6 +32,8 @@ export interface ModalState {
// 卡牌选择状态 // 卡牌选择状态
selectCardActions: { selectCardActions: {
isOpen: boolean; isOpen: boolean;
// 如果是连锁,发response给后端的方式稍微有点不同,这里标记下
isChain?: boolean;
min?: number; min?: number;
max?: number; max?: number;
cancelAble: boolean; cancelAble: boolean;
......
...@@ -4,7 +4,11 @@ import { Button, Col, Popover, Row } from "antd"; ...@@ -4,7 +4,11 @@ import { Button, Col, Popover, Row } from "antd";
import React, { useState } from "react"; import React, { useState } from "react";
import { useSnapshot } from "valtio"; import { useSnapshot } from "valtio";
import { fetchStrings, sendSelectCardResponse } from "@/api"; import {
fetchStrings,
sendSelectCardResponse,
sendSelectChainResponse,
} from "@/api";
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { matStore, messageStore } from "@/stores"; import { matStore, messageStore } from "@/stores";
...@@ -19,6 +23,7 @@ const { selectCardActions } = messageStore; ...@@ -19,6 +23,7 @@ const { selectCardActions } = messageStore;
export const CheckCardModal = () => { export const CheckCardModal = () => {
const snap = useSnapshot(selectCardActions); const snap = useSnapshot(selectCardActions);
const isOpen = snap.isOpen; const isOpen = snap.isOpen;
const isChain = snap.isChain;
const min = snap.min ?? 0; const min = snap.min ?? 0;
const max = snap.max ?? 10; const max = snap.max ?? 10;
const selecteds = snap.selecteds; const selecteds = snap.selecteds;
...@@ -50,6 +55,7 @@ export const CheckCardModal = () => { ...@@ -50,6 +55,7 @@ export const CheckCardModal = () => {
const resetCheckCardModal = () => { const resetCheckCardModal = () => {
selectCardActions.isOpen = false; selectCardActions.isOpen = false;
selectCardActions.isChain = undefined;
selectCardActions.min = undefined; selectCardActions.min = undefined;
selectCardActions.max = undefined; selectCardActions.max = undefined;
selectCardActions.cancelAble = false; selectCardActions.cancelAble = false;
...@@ -73,7 +79,12 @@ export const CheckCardModal = () => { ...@@ -73,7 +79,12 @@ export const CheckCardModal = () => {
const values = mustSelects const values = mustSelects
.concat(response) .concat(response)
.map((option) => option.response); .map((option) => option.response);
sendSelectCardResponse(values);
if (isChain) {
sendSelectChainResponse(values[0]);
} else {
sendSelectCardResponse(values);
}
resetCheckCardModal(); resetCheckCardModal();
}} }}
onFocus={() => {}} onFocus={() => {}}
...@@ -96,7 +107,7 @@ export const CheckCardModal = () => { ...@@ -96,7 +107,7 @@ export const CheckCardModal = () => {
<Button <Button
disabled={!cancelable} disabled={!cancelable}
onClick={() => { onClick={() => {
sendSelectCardResponse([CANCEL_RESPONSE]); sendSelectChainResponse(CANCEL_RESPONSE);
resetCheckCardModal(); resetCheckCardModal();
}} }}
onFocus={() => {}} onFocus={() => {}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment