Commit 5a6f4933 authored by Chunchi Che's avatar Chunchi Che

fix small

parent 0776484e
...@@ -16,6 +16,7 @@ export default ({ ...@@ -16,6 +16,7 @@ export default ({
messageStore.selectCardActions.cancelAble = cancelable; messageStore.selectCardActions.cancelAble = cancelable;
messageStore.selectCardActions.min = min; messageStore.selectCardActions.min = min;
messageStore.selectCardActions.max = max; messageStore.selectCardActions.max = max;
messageStore.selectCardActions.single = true;
for (const option of selectableCards) { for (const option of selectableCards) {
fetchCheckCardMeta(option); fetchCheckCardMeta(option);
......
...@@ -36,6 +36,8 @@ export interface ModalState { ...@@ -36,6 +36,8 @@ export interface ModalState {
isChain?: boolean; isChain?: boolean;
min?: number; min?: number;
max?: number; max?: number;
// 是否只能选择单个
single?: boolean;
cancelAble: boolean; cancelAble: boolean;
finishAble: boolean; finishAble: boolean;
// 上级/同调/超量/链接召唤的总cost // 上级/同调/超量/链接召唤的总cost
......
import { ThunderboltOutlined } from "@ant-design/icons"; import { ThunderboltOutlined } from "@ant-design/icons";
import { CheckCard, CheckCardProps } from "@ant-design/pro-components"; import { CheckCard, CheckCardProps } from "@ant-design/pro-components";
import { Button, Col, Popover, Row } from "antd"; import { Button, Card, Col, Popover, Row } from "antd";
import React, { useState } from "react"; import React, { useState } from "react";
import { useSnapshot } from "valtio"; import { useSnapshot } from "valtio";
...@@ -26,6 +26,7 @@ export const CheckCardModal = () => { ...@@ -26,6 +26,7 @@ export const CheckCardModal = () => {
const isChain = snap.isChain; 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 single = snap.single ?? false;
const selecteds = snap.selecteds; const selecteds = snap.selecteds;
const selectables = snap.selectables; const selectables = snap.selectables;
const mustSelects = snap.mustSelects; const mustSelects = snap.mustSelects;
...@@ -37,7 +38,7 @@ export const CheckCardModal = () => { ...@@ -37,7 +38,7 @@ export const CheckCardModal = () => {
const cancelable = snap.cancelAble; const cancelable = snap.cancelAble;
const finishable = snap.finishAble; const finishable = snap.finishAble;
const totalLevels = snap.totalLevels || 0; const totalLevels = snap.totalLevels ?? 0;
const overflow = snap.overflow || false; const overflow = snap.overflow || false;
const LevelSum1 = mustSelects const LevelSum1 = mustSelects
.concat(response) .concat(response)
...@@ -50,8 +51,9 @@ export const CheckCardModal = () => { ...@@ -50,8 +51,9 @@ export const CheckCardModal = () => {
const levelMatched = overflow const levelMatched = overflow
? LevelSum1 >= totalLevels || LevelSum2 >= totalLevels ? LevelSum1 >= totalLevels || LevelSum2 >= totalLevels
: LevelSum1 == totalLevels || LevelSum2 == totalLevels; : LevelSum1 == totalLevels || LevelSum2 == totalLevels;
const submitable = const submitable = single
response.length >= min && response.length <= max && levelMatched; ? response.length == 1
: response.length >= min && response.length <= max && levelMatched;
const resetCheckCardModal = () => { const resetCheckCardModal = () => {
selectCardActions.isOpen = false; selectCardActions.isOpen = false;
...@@ -68,7 +70,9 @@ export const CheckCardModal = () => { ...@@ -68,7 +70,9 @@ export const CheckCardModal = () => {
return ( return (
<DragModal <DragModal
title={`${preHintMsg} ${selectHintMsg} ${min}-${max}`} title={`${preHintMsg} ${selectHintMsg} ${min}-${max} ${
single ? "每次选择一张" : ""
}`}
open={isOpen} open={isOpen}
closable={false} closable={false}
footer={ footer={
...@@ -157,7 +161,7 @@ export const CheckCardModal = () => { ...@@ -157,7 +161,7 @@ export const CheckCardModal = () => {
{selecteds.concat(mustSelects).map((option, idx) => { {selecteds.concat(mustSelects).map((option, idx) => {
return ( return (
<Col span={4} key={idx}> <Col span={4} key={idx}>
<CheckCard <Card
style={{ width: 120 }} style={{ width: 120 }}
cover={ cover={
<img <img
......
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