boluo-app-main/src/components/agreement-popup/index.tsx
2025-06-15 01:09:30 +08:00

66 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Button } from '@tarojs/components';
import { Popup } from '@taroify/core';
import { useCallback } from 'react';
import { BindPhoneStatus } from '@/components/login-button';
import PhoneButton from '@/components/phone-button';
import { ProtocolPrivacy } from '@/components/protocol-privacy';
import SafeBottomPadding from '@/components/safe-bottom-padding';
import './index.less';
interface IProps {
open: boolean;
onCancel: () => void;
onConfirm: () => void;
needPhone?: boolean;
}
const PREFIX = 'agreement-popup';
export function AgreementPopup({ open, onCancel, onConfirm, needPhone }: IProps) {
const handleBindPhone = useCallback(
status => {
if (status === BindPhoneStatus.Success) {
onConfirm();
} else {
onCancel();
}
},
[onCancel, onConfirm]
);
if (!open) {
return null;
}
return (
<Popup rounded className={PREFIX} placement="bottom" open={open} onClose={onCancel}>
<div className={`${PREFIX}__content`}>
<div className={`${PREFIX}__title`}></div>
<div className={`${PREFIX}__body`}>
<div></div>
<div>使</div>
</div>
<ProtocolPrivacy divider />
<div className={`${PREFIX}__btn-group`}>
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
</Button>
{needPhone ? (
<PhoneButton className={`${PREFIX}__confirm-button`} needPhone onBindPhone={handleBindPhone}>
</PhoneButton>
) : (
<Button className={`${PREFIX}__confirm-button`} onClick={onConfirm}>
</Button>
)}
</div>
</div>
<SafeBottomPadding />
</Popup>
);
}