mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
fix
This commit is contained in:
parent
84b919bb88
commit
4352bbe9b2
|
|
@ -86,7 +86,7 @@ const ActivityAdModal = () => {
|
|||
}
|
||||
}, [data?.activityAdLink, handleClose, router]);
|
||||
|
||||
if (!data?.activityAdImage) {
|
||||
if (!data?.activityAdImage || !userInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,27 @@ const QRCodePayModal = ({
|
|||
const isWxConfigured = feConfigs.payConfig?.wx;
|
||||
const isBankConfigured = feConfigs.payConfig?.bank;
|
||||
|
||||
const MIN_QR_SIZE = 150;
|
||||
const [dynamicQRSize, setDynamicQRSize] = useState(QR_CODE_SIZE);
|
||||
|
||||
useEffect(() => {
|
||||
const calculateQRSize = () => {
|
||||
const windowHeight = window.innerHeight;
|
||||
const reservedSpace = 470 + (tip ? 60 : 0) + (discountCouponName ? 30 : 0);
|
||||
const availableHeight = windowHeight - reservedSpace;
|
||||
|
||||
const newSize = Math.min(QR_CODE_SIZE, Math.max(MIN_QR_SIZE, availableHeight));
|
||||
|
||||
setDynamicQRSize(newSize);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', calculateQRSize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', calculateQRSize);
|
||||
};
|
||||
}, [tip, discountCouponName]);
|
||||
|
||||
const [payWayRenderData, setPayWayRenderData] = useState<{
|
||||
qrCode?: string;
|
||||
iframeCode?: string;
|
||||
|
|
@ -99,7 +120,7 @@ const QRCodePayModal = ({
|
|||
const canvas = document.createElement('canvas');
|
||||
|
||||
QRCode.toCanvas(canvas, payWayRenderData.qrCode, {
|
||||
width: QR_CODE_SIZE,
|
||||
width: dynamicQRSize,
|
||||
margin: 0,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
|
|
@ -113,7 +134,7 @@ const QRCodePayModal = ({
|
|||
}
|
||||
})
|
||||
.catch(console.error);
|
||||
}, [payWayRenderData.qrCode]);
|
||||
}, [payWayRenderData.qrCode, dynamicQRSize]);
|
||||
useEffect(() => {
|
||||
drawCode();
|
||||
}, [drawCode]);
|
||||
|
|
@ -140,15 +161,15 @@ const QRCodePayModal = ({
|
|||
});
|
||||
const renderPaymentContent = () => {
|
||||
if (payWayRenderData.qrCode) {
|
||||
return <Box ref={canvasRef} display={'inline-block'} h={`${QR_CODE_SIZE}px`} />;
|
||||
return <Box ref={canvasRef} display={'inline-block'} h={`${dynamicQRSize}px`} />;
|
||||
}
|
||||
if (payWayRenderData.iframeCode) {
|
||||
return (
|
||||
<iframe
|
||||
srcDoc={payWayRenderData.iframeCode}
|
||||
style={{
|
||||
width: QR_CODE_SIZE + 5,
|
||||
height: QR_CODE_SIZE + 5,
|
||||
width: dynamicQRSize + 5,
|
||||
height: dynamicQRSize + 5,
|
||||
border: 'none',
|
||||
display: 'inline-block'
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ const Standard = ({
|
|||
>
|
||||
{standardSubList.map((item) => {
|
||||
const isCurrentPlan = item.level === myStandardPlan?.currentSubLevel;
|
||||
const isActivityPlan =
|
||||
item.level === StandardSubLevelEnum.advanced ||
|
||||
item.level === StandardSubLevelEnum.basic;
|
||||
|
||||
const isHigherLevel =
|
||||
standardSubLevelMap[item.level].weight >
|
||||
|
|
@ -208,7 +211,8 @@ const Standard = ({
|
|||
overflow={'hidden'}
|
||||
{...(isCurrentPlan
|
||||
? {
|
||||
borderColor: hasActivityExpiration ? '#BB182C' : 'primary.600'
|
||||
borderColor:
|
||||
hasActivityExpiration && isActivityPlan ? '#BB182C' : 'primary.600'
|
||||
}
|
||||
: {
|
||||
borderColor: 'myGray.150'
|
||||
|
|
@ -303,7 +307,7 @@ const Standard = ({
|
|||
>
|
||||
{t(item.label as any)}
|
||||
</Box>
|
||||
<Flex alignItems={'center'} gap={2.5}>
|
||||
<Flex alignItems={'center'}>
|
||||
{item.level === StandardSubLevelEnum.custom ? (
|
||||
<Box
|
||||
fontSize={['32px', '36px']}
|
||||
|
|
@ -315,34 +319,40 @@ const Standard = ({
|
|||
</Box>
|
||||
) : (
|
||||
<Box
|
||||
pr={8}
|
||||
py={1}
|
||||
borderRadius={'sm'}
|
||||
borderRadius={20}
|
||||
display={'inline-block'}
|
||||
zIndex={10}
|
||||
pr={8}
|
||||
bgGradient={'linear(to-r, #fff 90%, transparent)'}
|
||||
>
|
||||
<MyBox fontSize={['32px', '42px']} fontWeight={'bold'} color={'myGray.900'}>
|
||||
<Flex
|
||||
fontSize={['32px', '42px']}
|
||||
fontWeight={'bold'}
|
||||
color={'myGray.900'}
|
||||
alignItems={'end'}
|
||||
gap={1}
|
||||
>
|
||||
¥
|
||||
{matchedCoupon?.discount && item.price > 0
|
||||
? (matchedCoupon.discount * item.price).toFixed(1)
|
||||
? Number.isInteger(matchedCoupon.discount * item.price)
|
||||
? matchedCoupon.discount * item.price
|
||||
: (matchedCoupon.discount * item.price).toFixed(1)
|
||||
: item.price}
|
||||
</MyBox>
|
||||
{item.level !== StandardSubLevelEnum.free && matchedCoupon && (
|
||||
<Box
|
||||
h={[8, '38px']}
|
||||
color={'primary.600'}
|
||||
fontSize={'18px'}
|
||||
fontWeight={'500'}
|
||||
whiteSpace={'nowrap'}
|
||||
>
|
||||
{`${(matchedCoupon.discount * 10).toFixed(0)} 折`}
|
||||
</Box>
|
||||
)}
|
||||
</Flex>
|
||||
</Box>
|
||||
)}
|
||||
{item.level !== StandardSubLevelEnum.free &&
|
||||
item.level !== StandardSubLevelEnum.custom &&
|
||||
matchedCoupon && (
|
||||
<Box
|
||||
h={4}
|
||||
color={'primary.600'}
|
||||
fontSize={'18px'}
|
||||
fontWeight={'500'}
|
||||
whiteSpace={'nowrap'}
|
||||
>
|
||||
{`${(matchedCoupon.discount * 10).toFixed(0)} 折`}
|
||||
</Box>
|
||||
)}
|
||||
</Flex>
|
||||
<Box color={'myGray.500'} minH={'40px'} fontSize={'xs'}>
|
||||
{t(item.desc as any, { title: feConfigs?.systemTitle })}
|
||||
|
|
|
|||
Loading…
Reference in New Issue