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) => {
case 3: {
// 处理强制发动的卡
messageStore.selectCardActions.isChain = true;
messageStore.selectCardActions.min = 1;
messageStore.selectCardActions.max = 1;
messageStore.selectCardActions.cancelAble = !forced;
......
......@@ -32,6 +32,8 @@ export interface ModalState {
// 卡牌选择状态
selectCardActions: {
isOpen: boolean;
// 如果是连锁,发response给后端的方式稍微有点不同,这里标记下
isChain?: boolean;
min?: number;
max?: number;
cancelAble: boolean;
......
......@@ -4,7 +4,11 @@ import { Button, Col, Popover, Row } from "antd";
import React, { useState } from "react";
import { useSnapshot } from "valtio";
import { fetchStrings, sendSelectCardResponse } from "@/api";
import {
fetchStrings,
sendSelectCardResponse,
sendSelectChainResponse,
} from "@/api";
import { useConfig } from "@/config";
import { matStore, messageStore } from "@/stores";
......@@ -19,6 +23,7 @@ const { selectCardActions } = messageStore;
export const CheckCardModal = () => {
const snap = useSnapshot(selectCardActions);
const isOpen = snap.isOpen;
const isChain = snap.isChain;
const min = snap.min ?? 0;
const max = snap.max ?? 10;
const selecteds = snap.selecteds;
......@@ -50,6 +55,7 @@ export const CheckCardModal = () => {
const resetCheckCardModal = () => {
selectCardActions.isOpen = false;
selectCardActions.isChain = undefined;
selectCardActions.min = undefined;
selectCardActions.max = undefined;
selectCardActions.cancelAble = false;
......@@ -73,7 +79,12 @@ export const CheckCardModal = () => {
const values = mustSelects
.concat(response)
.map((option) => option.response);
sendSelectCardResponse(values);
if (isChain) {
sendSelectChainResponse(values[0]);
} else {
sendSelectCardResponse(values);
}
resetCheckCardModal();
}}
onFocus={() => {}}
......@@ -96,7 +107,7 @@ export const CheckCardModal = () => {
<Button
disabled={!cancelable}
onClick={() => {
sendSelectCardResponse([CANCEL_RESPONSE]);
sendSelectChainResponse(CANCEL_RESPONSE);
resetCheckCardModal();
}}
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