diff --git a/packages/web/i18n/en/account_bill.json b/packages/web/i18n/en/account_bill.json index 28dd5d8b0c52..b6b9205e638d 100644 --- a/packages/web/i18n/en/account_bill.json +++ b/packages/web/i18n/en/account_bill.json @@ -45,6 +45,7 @@ "support_wallet_bill_tag_invoice": "bill invoice", "support_wallet_invoicing": "Invoicing", "time": "time", + "total_amount": "lump sum", "type": "type", "unit_code": "unified credit code", "unit_code_void": "Unified credit code format error", diff --git a/packages/web/i18n/zh-CN/account_bill.json b/packages/web/i18n/zh-CN/account_bill.json index 3f8e56650157..9d0e80af8936 100644 --- a/packages/web/i18n/zh-CN/account_bill.json +++ b/packages/web/i18n/zh-CN/account_bill.json @@ -9,10 +9,10 @@ "company_phone": "公司电话", "completed": "已完成", "confirm": "确认", - "default_header": "默认抬头", - "detail": "详情", "contact_phone": "联系电话", "contact_phone_void": "联系电话格式错误", + "default_header": "默认抬头", + "detail": "详情", "email_address": "邮箱地址", "extra_ai_points": "额外 AI 积分", "extra_dataset_size": "额外知识库容量", @@ -45,6 +45,7 @@ "support_wallet_bill_tag_invoice": "账单发票", "support_wallet_invoicing": "开票", "time": "时间", + "total_amount": "总金额", "type": "类型", "unit_code": "统一信用代码", "unit_code_void": "统一信用代码格式错误", diff --git a/packages/web/i18n/zh-Hant/account_bill.json b/packages/web/i18n/zh-Hant/account_bill.json index 167a4311e93d..45314508ebf0 100644 --- a/packages/web/i18n/zh-Hant/account_bill.json +++ b/packages/web/i18n/zh-Hant/account_bill.json @@ -45,6 +45,7 @@ "support_wallet_bill_tag_invoice": "帳單發票", "support_wallet_invoicing": "開票", "time": "時間", + "total_amount": "總金額", "type": "類型", "unit_code": "統一信用代碼", "unit_code_void": "統一信用代碼格式錯誤", diff --git a/projects/app/src/pages/account/bill/components/ApplyInvoiceModal.tsx b/projects/app/src/pages/account/bill/components/ApplyInvoiceModal.tsx index e7cfcc7f7792..557dd227ace9 100644 --- a/projects/app/src/pages/account/bill/components/ApplyInvoiceModal.tsx +++ b/projects/app/src/pages/account/bill/components/ApplyInvoiceModal.tsx @@ -8,6 +8,8 @@ import { Button, Checkbox, Flex, + ModalBody, + ModalFooter, Table, TableContainer, Tbody, @@ -118,19 +120,69 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { isOpen={true} isCentered iconSrc="/imgs/modal/invoice.svg" - minHeight={isOpenSettleModal ? '46.4rem' : '42.25rem'} w={'43rem'} onClose={onClose} isLoading={isLoading} title={t('account_bill:support_wallet_apply_invoice')} > - {!isOpenSettleModal ? ( - - - {t('account_bill:support_wallet_apply_invoice')} - - - + {isOpenSettleModal ? ( + <> + + + + {t('account_bill:total_amount')} + {t('account_bill:yuan', { amount: formatStorePrice2Read(totalPrice) })} + + + + + + + + + + + + + + {t('account_bill:invoice_sending_info')} + + + + + + + + + ) : ( + <> + + + {t('account_bill:support_wallet_apply_invoice')} + + @@ -202,8 +254,8 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { )} - - + + - - - ) : ( - - - - {t('account_bill:support_wallet_amount')} - {t('account_bill:yuan', { amount: formatStorePrice2Read(totalPrice) })} - - - - - - - - - - - - - - {t('account_bill:invoice_sending_info')} - - - - - - - + + )} ); diff --git a/projects/app/src/pages/account/bill/components/InvoiceHeaderForm.tsx b/projects/app/src/pages/account/bill/components/InvoiceHeaderForm.tsx index f113c6cc4fb6..69c6658a6434 100644 --- a/projects/app/src/pages/account/bill/components/InvoiceHeaderForm.tsx +++ b/projects/app/src/pages/account/bill/components/InvoiceHeaderForm.tsx @@ -57,8 +57,7 @@ export const InvoiceHeaderSingleForm = ({ {...styles} placeholder={t('account_bill:unit_code')} {...register('unifiedCreditCode', { - required, - pattern: { value: /^[A-Z0-9]{18}$/, message: t('account_bill:unit_code_void') } + required })} /> @@ -157,8 +156,7 @@ export const InvoiceHeaderSingleForm = ({ {...register('contactPhone', { required, pattern: { - value: - /^(?:\+?\d{1,3}[- ]?)?(?:\(\d{1,4}\)|\d{1,4})?[- ]?\d{1,4}[- ]?\d{1,4}[- ]?\d{1,9}$/, + value: /^[1]{1}[0-9]{10}$/, message: t('account_bill:contact_phone_void') } })} diff --git a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx index d180c9067da0..a75af096ad0b 100644 --- a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx +++ b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx @@ -6,7 +6,7 @@ import { OAuthEnum } from '@fastgpt/global/support/user/constant'; import MyIcon from '@fastgpt/web/components/common/Icon'; import { customAlphabet } from 'nanoid'; import { useRouter } from 'next/router'; -import { Dispatch, useEffect, useMemo, useRef } from 'react'; +import { Dispatch, useCallback, useEffect, useMemo, useRef } from 'react'; import { useTranslation } from 'next-i18next'; import I18nLngSelector from '@/components/Select/I18nLngSelector'; import { useSystem } from '@fastgpt/web/hooks/useSystem'; @@ -23,7 +23,6 @@ interface Props { const FormLayout = ({ children, setPageType, pageType }: Props) => { const { t } = useTranslation(); const router = useRouter(); - const { toast } = useToast(); const { setLoginStore, feConfigs } = useSystemStore(); const { lastRoute = '/app/list' } = router.query as { lastRoute: string }; @@ -100,25 +99,23 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => { [feConfigs?.sso?.url, oAuthList.length] ); - const formatUrl = useMemo(() => { - if (feConfigs?.sso?.url) { - return `${feConfigs.sso.url}/login/oauth/authorize?redirect_uri=${encodeURIComponent(redirectUri)}&state=${state.current}`; - } - return ''; - }, [feConfigs.sso, redirectUri]); + const onClickSso = useCallback(() => { + if (!feConfigs?.sso?.url) return; + setLoginStore({ + provider: OAuthEnum.sso, + lastRoute, + state: state.current + }); + const url = `${feConfigs.sso.url}/login/oauth/authorize?redirect_uri=${encodeURIComponent(redirectUri)}&state=${state.current}`; - useEffect(() => { - if (formatUrl && feConfigs?.sso?.autoLogin) { - setLoginStore({ - provider: OAuthEnum.sso, - lastRoute, - state: state.current - }); + window.open(url, '_self'); + }, [feConfigs?.sso?.url, lastRoute, redirectUri, setLoginStore]); - window.open(formatUrl, '_self'); + useEffect(() => { + if (feConfigs?.sso?.autoLogin) { + onClickSso(); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [feConfigs.sso]); + }, [feConfigs?.sso?.autoLogin]); return ( @@ -186,22 +183,7 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => { h={'40px'} borderRadius={'sm'} leftIcon={} - onClick={() => { - if (!formatUrl) { - toast({ - title: 'SSO URL is not set', - status: 'error' - }); - return; - } - setLoginStore({ - provider: OAuthEnum.sso, - lastRoute, - state: state.current - }); - - window.open(formatUrl, '_self'); - }} + onClick={onClickSso} > {feConfigs.sso.title} diff --git a/projects/app/src/pages/login/index.tsx b/projects/app/src/pages/login/index.tsx index 7c02df304a3b..6a7d52b3747b 100644 --- a/projects/app/src/pages/login/index.tsx +++ b/projects/app/src/pages/login/index.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useState, useCallback, useEffect, useMemo } from 'react'; import { Box, Button, @@ -73,7 +73,7 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => { [lastRoute, router, setUserInfo] ); - function DynamicComponent({ type }: { type: `${LoginPageTypeEnum}` }) { + const DynamicComponent = useMemo(() => { const TypeMap = { [LoginPageTypeEnum.passwordLogin]: LoginForm, [LoginPageTypeEnum.register]: RegisterForm, @@ -81,10 +81,11 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => { [LoginPageTypeEnum.wechat]: WechatForm }; - const Component = TypeMap[type]; + // @ts-ignore + const Component = TypeMap[pageType]; return ; - } + }, [pageType, loginSuccess]); /* default login type */ useEffect(() => { @@ -99,7 +100,7 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => { // init store setLastChatAppId(''); - }, [feConfigs.oauth]); + }, [feConfigs?.oauth, setLastChatAppId]); const { isOpen: isOpenRedirect, @@ -171,7 +172,7 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => { > {pageType ? ( - + DynamicComponent ) : (
diff --git a/projects/app/src/web/context/useInitApp.ts b/projects/app/src/web/context/useInitApp.ts index d6b61436be0b..beb92357216a 100644 --- a/projects/app/src/web/context/useInitApp.ts +++ b/projects/app/src/web/context/useInitApp.ts @@ -71,7 +71,7 @@ export const useInitApp = () => { if (sourceDomain) return sourceDomain; return document.referrer; })(); - + console.log(formatSourceDomain, '-=-='); if (formatSourceDomain && !sessionStorage.getItem('sourceDomain')) { sessionStorage.setItem('sourceDomain', formatSourceDomain); }