细节优化

This commit is contained in:
2025-12-01 11:37:59 +08:00
parent f389397227
commit 675ecb536d
7 changed files with 101 additions and 68 deletions

View File

@@ -31,6 +31,7 @@ interface PickerProps {
onConfirm?: (options: PickerOption[], values: (string | number)[]) => void;
onChange?: (value: (string | number)[]) => void;
style?: React.CSSProperties;
ntrpTested?: boolean;
}
const PopupPicker = ({
@@ -48,16 +49,17 @@ const PopupPicker = ({
options = [],
type = null,
style,
ntrpTested,
}: PickerProps) => {
const [defaultValue, setDefaultValue] = useState<(string | number)[]>([]);
const [defaultOptions, setDefaultOptions] = useState<PickerOption[][]>([]);
const [pickerCurrentValue, setPickerCurrentValue] = useState<(string | number)[]>(value);
const [tested, setTested] = useState(false)
const [pickerCurrentValue, setPickerCurrentValue] =
useState<(string | number)[]>(value);
const changePicker = (options: any[], values: any, columnIndex: number) => {
// 更新 Picker 的当前值
setPickerCurrentValue(values);
if (onChange) {
console.log("picker onChange", columnIndex, values, options);
if (
@@ -84,7 +86,10 @@ const PopupPicker = ({
};
// 处理 Picker 的确认事件,获取当前选中的值
const handlePickerConfirm = (options: PickerOption[], values: (string | number)[]) => {
const handlePickerConfirm = (
options: PickerOption[],
values: (string | number)[]
) => {
setPickerCurrentValue(values);
setDefaultValue(values);
};
@@ -127,9 +132,6 @@ const PopupPicker = ({
}
}
}, [visible, value]);
const callback = (tested: boolean) => {
setTested(tested)
}
return (
<>
<CommonPopup
@@ -146,9 +148,9 @@ const PopupPicker = ({
zIndex={1000}
style={style}
>
{type === "ntrp" && !tested && (
{type === "ntrp" && !ntrpTested && (
<View className={styles.evaluateCardWrap}>
<NTRPTestEntryCard callback={(flag) => callback(flag)} type={EvaluateScene.userEdit} />
<NTRPTestEntryCard type={EvaluateScene.userEdit} />
</View>
// <View className={`${styles["examination-btn"]}}`}>
// <View className={`${styles["text-container"]}}`}>