From 20c6c202d229e808f60b019cb327454be509175c Mon Sep 17 00:00:00 2001 From: heheer Date: Fri, 3 Jan 2025 13:46:04 +0800 Subject: [PATCH] fix qrcode script (#3520) * fix qrcode script * i18n --- packages/web/i18n/en/common.json | 10 +- packages/web/i18n/en/user.json | 2 - packages/web/i18n/zh-CN/common.json | 14 +-- packages/web/i18n/zh-CN/user.json | 2 - packages/web/i18n/zh-Hant/common.json | 14 +-- packages/web/i18n/zh-Hant/user.json | 2 - .../wallet/NotSufficientModal/index.tsx | 10 +- .../support/wallet/QRCodePayModal.tsx | 24 +++-- .../src/pages/price/components/Standard.tsx | 10 +- projects/app/src/pages/price/index.tsx | 96 +++++++++---------- .../web/support/user/hooks/useSendCode.tsx | 6 +- 11 files changed, 99 insertions(+), 91 deletions(-) diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index b4552c29d..1dc0b0a58 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -1037,13 +1037,15 @@ "support.user.Price": "Pricing", "support.user.User self info": "Profile", "support.user.auth.Sending Code": "Sending Code", + "support.user.auth.get_code": "Get Verification Code", + "support.user.auth.get_code_again": "s Get Again", "support.user.captcha_placeholder": "Please enter the verification code", - "support.user.info.notification_receiving_hint": "Notification reception", - "support.user.info.bind_notification_hint": "Please bind the notification receiving account to ensure that you can receive notifications such as package expiration reminders, etc., to ensure the normal operation of your service.", - "support.user.info.verification_code": "Verification Code", - "support.user.info.code_required": "Verification code cannot be empty", "support.user.info.bind_notification_error": "Abnormal binding notification account", + "support.user.info.bind_notification_hint": "Please bind the notification receiving account to ensure that you can receive notifications such as package expiration reminders, etc., to ensure the normal operation of your service.", "support.user.info.bind_notification_success": "Binding notification account successful", + "support.user.info.code_required": "Verification code cannot be empty", + "support.user.info.notification_receiving_hint": "Notification reception", + "support.user.info.verification_code": "Verification Code", "support.user.inform.System message": "System Message", "support.user.login.Email": "Email", "support.user.login.Github": "GitHub Login", diff --git a/packages/web/i18n/en/user.json b/packages/web/i18n/en/user.json index 3f929a8ec..7600a9c27 100644 --- a/packages/web/i18n/en/user.json +++ b/packages/web/i18n/en/user.json @@ -37,8 +37,6 @@ "password.confirm": "Confirm Password", "password.email_phone_error": "Invalid Email/Phone Number Format", "password.email_phone_void": "Email/Phone Number Cannot Be Empty", - "password.get_code": "Get Verification Code", - "password.get_code_again": "Get Again in s", "password.not_match": "Passwords Do Not Match", "password.password_condition": "Password must be between 4 and 20 characters", "password.password_required": "Password Cannot Be Empty", diff --git a/packages/web/i18n/zh-CN/common.json b/packages/web/i18n/zh-CN/common.json index 21bd955f2..2c8526087 100644 --- a/packages/web/i18n/zh-CN/common.json +++ b/packages/web/i18n/zh-CN/common.json @@ -1040,14 +1040,16 @@ "support.user.Price": "计费标准", "support.user.User self info": "个人信息", "support.user.auth.Sending Code": "正在发送", + "support.user.auth.get_code": "获取验证码", + "support.user.auth.get_code_again": "s后重新获取", "support.user.captcha_placeholder": "请输入验证码", - "support.user.inform.System message": "系统消息", - "support.user.info.notification_receiving_hint": "通知接收", - "support.user.info.bind_notification_hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。", - "support.user.info.verification_code": "验证码", - "support.user.info.code_required": "验证码不能为空", - "support.user.info.bind_notification_success": "绑定通知账号成功", "support.user.info.bind_notification_error": "绑定通知账号异常", + "support.user.info.bind_notification_hint": "请绑定通知接收账号,以确保您能正常接收套餐过期提醒等通知,保障您的服务正常运行。", + "support.user.info.bind_notification_success": "绑定通知账号成功", + "support.user.info.code_required": "验证码不能为空", + "support.user.info.notification_receiving_hint": "通知接收", + "support.user.info.verification_code": "验证码", + "support.user.inform.System message": "系统消息", "support.user.login.Email": "邮箱", "support.user.login.Github": "GitHub 登录", "support.user.login.Google": "Google 登录", diff --git a/packages/web/i18n/zh-CN/user.json b/packages/web/i18n/zh-CN/user.json index 99f63e043..62c7acd15 100644 --- a/packages/web/i18n/zh-CN/user.json +++ b/packages/web/i18n/zh-CN/user.json @@ -37,8 +37,6 @@ "password.confirm": "确认密码", "password.email_phone_error": "邮箱/手机号格式错误", "password.email_phone_void": "邮箱/手机号不能为空", - "password.get_code": "获取验证码", - "password.get_code_again": "s后重新获取", "password.not_match": "两次密码不一致", "password.password_condition": "密码最少 4 位最多 20 位", "password.password_required": "密码不能为空", diff --git a/packages/web/i18n/zh-Hant/common.json b/packages/web/i18n/zh-Hant/common.json index 44c3943ab..a28aabc59 100644 --- a/packages/web/i18n/zh-Hant/common.json +++ b/packages/web/i18n/zh-Hant/common.json @@ -1037,14 +1037,16 @@ "support.user.Price": "計費標準", "support.user.User self info": "個人資訊", "support.user.auth.Sending Code": "正在傳送驗證碼", + "support.user.auth.get_code": "取得驗證碼", + "support.user.auth.get_code_again": "秒後重新取得", "support.user.captcha_placeholder": "請輸入驗證碼", - "support.user.inform.System message": "系統訊息", - "support.user.info.notification_receiving_hint": "通知接收", - "support.user.info.bind_notification_hint": "請綁定通知接收帳號,確保您能正常接收套餐過期提醒等通知,保障您的服務正常運作。", - "support.user.info.verification_code": "驗證碼", - "support.user.info.code_required": "驗證碼不能為空", - "support.user.info.bind_notification_success": "綁定通知帳號成功", "support.user.info.bind_notification_error": "綁定通知帳號異常", + "support.user.info.bind_notification_hint": "請綁定通知接收帳號,確保您能正常接收套餐過期提醒等通知,保障您的服務正常運作。", + "support.user.info.bind_notification_success": "綁定通知帳號成功", + "support.user.info.code_required": "驗證碼不能為空", + "support.user.info.notification_receiving_hint": "通知接收", + "support.user.info.verification_code": "驗證碼", + "support.user.inform.System message": "系統訊息", "support.user.login.Email": "電子郵件", "support.user.login.Github": "GitHub 登入", "support.user.login.Google": "Google 登入", diff --git a/packages/web/i18n/zh-Hant/user.json b/packages/web/i18n/zh-Hant/user.json index 9b4e64b30..9bd8e3576 100644 --- a/packages/web/i18n/zh-Hant/user.json +++ b/packages/web/i18n/zh-Hant/user.json @@ -37,8 +37,6 @@ "password.confirm": "確認密碼", "password.email_phone_error": "電子郵件/手機號碼格式錯誤", "password.email_phone_void": "電子郵件/手機號碼不能空白", - "password.get_code": "取得驗證碼", - "password.get_code_again": "秒後重新取得", "password.not_match": "兩次輸入的密碼不相符", "password.password_condition": "密碼長度需介於 4 至 20 字元之間", "password.password_required": "密碼不能空白", diff --git a/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx b/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx index 3f413c4d3..12d49f04c 100644 --- a/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx +++ b/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import MyModal from '@fastgpt/web/components/common/MyModal'; import { useTranslation } from 'next-i18next'; import { Box, Button, Flex, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react'; @@ -71,7 +71,13 @@ const RechargeModal = ({ onPaySuccess: () => void; }) => { const { t } = useTranslation(); - const { teamPlanStatus } = useUserStore(); + const { teamPlanStatus, initTeamPlanStatus } = useUserStore(); + + useEffect(() => { + (async () => { + await initTeamPlanStatus(); + })(); + }, [initTeamPlanStatus]); const planName = useMemo(() => { if (!teamPlanStatus?.standard?.currentSubLevel) return ''; diff --git a/projects/app/src/components/support/wallet/QRCodePayModal.tsx b/projects/app/src/components/support/wallet/QRCodePayModal.tsx index 013a91b93..379f7d135 100644 --- a/projects/app/src/components/support/wallet/QRCodePayModal.tsx +++ b/projects/app/src/components/support/wallet/QRCodePayModal.tsx @@ -7,6 +7,8 @@ import { useToast } from '@fastgpt/web/hooks/useToast'; import { useRouter } from 'next/router'; import { getErrText } from '@fastgpt/global/common/error/utils'; import LightTip from '@fastgpt/web/components/common/LightTip'; +import Script from 'next/script'; +import { getWebReqUrl } from '@fastgpt/web/common/system/utils'; export type QRPayProps = { readPrice: number; @@ -76,15 +78,19 @@ const QRCodePayModal = ({ }, [billId, onSuccess, toast]); return ( - - - {tip && } - - - {t('common:pay.wechat', { price: readPrice })} - - - + <> + + + + + {tip && } + + + {t('common:pay.wechat', { price: readPrice })} + + + + ); }; diff --git a/projects/app/src/pages/price/components/Standard.tsx b/projects/app/src/pages/price/components/Standard.tsx index ea3d0dc99..9f6ee8f67 100644 --- a/projects/app/src/pages/price/components/Standard.tsx +++ b/projects/app/src/pages/price/components/Standard.tsx @@ -88,8 +88,14 @@ const Standard = ({ { label: ( - {t('common:support.wallet.subscription.mode.Year')} - + + {t('common:support.wallet.subscription.mode.Year')} + + ({t('common:support.wallet.subscription.mode.Year sale')}) diff --git a/projects/app/src/pages/price/index.tsx b/projects/app/src/pages/price/index.tsx index c15bd4ea0..c454c0dac 100644 --- a/projects/app/src/pages/price/index.tsx +++ b/projects/app/src/pages/price/index.tsx @@ -10,8 +10,6 @@ import ExtraPlan from './components/ExtraPlan'; import PointsCard from './components/Points'; import FAQ from './components/FAQ'; import { getToken } from '@/web/support/user/auth'; -import Script from 'next/script'; -import { getWebReqUrl } from '@fastgpt/web/common/system/utils'; import { useTranslation } from 'next-i18next'; import MyIcon from '@fastgpt/web/components/common/Icon'; import { useSystemStore } from '@/web/common/system/useSystemStore'; @@ -26,61 +24,53 @@ const PriceBox = () => { }); return ( - <> - - - {/* standard sub */} - - - {t('common:support.wallet.subscription.Sub plan')} + + {/* standard sub */} + + + {t('common:support.wallet.subscription.Sub plan')} + + + {t('common:support.wallet.subscription.Sub plan tip', { + title: feConfigs?.systemTitle + })} + + + + + + {t('user:bill.standard_valid_tip')} - - {t('common:support.wallet.subscription.Sub plan tip', { - title: feConfigs?.systemTitle - })} - - - - - - {t('user:bill.standard_valid_tip')} - - - + + - {/* extra plan */} - - - {t('common:support.wallet.subscription.Extra plan')} - - - {t('common:support.wallet.subscription.Extra plan tip')} - - - + {/* extra plan */} + + + {t('common:support.wallet.subscription.Extra plan')} + + + {t('common:support.wallet.subscription.Extra plan tip')} + + + - {/* points */} - + {/* points */} + - {/* question */} - - - + {/* question */} + + ); }; diff --git a/projects/app/src/web/support/user/hooks/useSendCode.tsx b/projects/app/src/web/support/user/hooks/useSendCode.tsx index 8c248ad93..642d15c38 100644 --- a/projects/app/src/web/support/user/hooks/useSendCode.tsx +++ b/projects/app/src/web/support/user/hooks/useSendCode.tsx @@ -43,12 +43,12 @@ export const useSendCode = ({ type }: { type: `${UserAuthTypeEnum}` }) => { const sendCodeText = useMemo(() => { if (codeSending) return t('common:support.user.auth.Sending Code'); if (codeCountDown >= 10) { - return `${codeCountDown}${t('user:password.get_code_again')}`; + return `${codeCountDown}${t('common:support.user.auth.get_code_again')}`; } if (codeCountDown > 0) { - return `0${codeCountDown}${t('user:password.get_code_again')}`; + return `0${codeCountDown}${t('common:support.user.auth.get_code_again')}`; } - return t('user:password.get_code'); + return t('common:support.user.auth.get_code'); }, [codeCountDown, codeSending, t]); const {