feat: 修改代码结构
This commit is contained in:
parent
f9de5fcb4f
commit
77e246198f
@ -247,6 +247,7 @@ export default function Content() {
|
|||||||
{announcementData?.map((item) => {
|
{announcementData?.map((item) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
key={item.id}
|
||||||
className={`${item.pinned ? 'bg-[#B5C9E2]' : 'bg-white'} flex items-center rounded-[20px] px-4 py-2`}
|
className={`${item.pinned ? 'bg-[#B5C9E2]' : 'bg-white'} flex items-center rounded-[20px] px-4 py-2`}
|
||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
|
|||||||
@ -54,7 +54,7 @@ const OfferDialog = forwardRef<OfferDialogRef>((props, ref) => {
|
|||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
ref={dialogRef}
|
ref={dialogRef}
|
||||||
className='rounded-0 h-full gap-0 px-4 py-8 sm:max-h-[95%] sm:!rounded-[32px] sm:px-8 sm:py-12 md:max-w-full'
|
className='rounded-0 h-full gap-0 px-4 py-8 sm:max-h-[95%] sm:!rounded-[32px] sm:px-8 sm:py-12 md:max-w-[1280px]'
|
||||||
>
|
>
|
||||||
<DialogTitle className={'sr-only'}></DialogTitle>
|
<DialogTitle className={'sr-only'}></DialogTitle>
|
||||||
<div className={'ml-6 sm:ml-0'}>
|
<div className={'ml-6 sm:ml-0'}>
|
||||||
|
|||||||
@ -7,7 +7,18 @@ import { getAuthorization, Logout } from './common';
|
|||||||
|
|
||||||
async function handleError(response: any) {
|
async function handleError(response: any) {
|
||||||
const code = response.data?.code;
|
const code = response.data?.code;
|
||||||
if ([40002, 40003, 40004, 40005].includes(code)) return Logout();
|
console.log(1111111, code);
|
||||||
|
if ([40002, 40003, 40004, 40005].includes(code)) {
|
||||||
|
if (isBrowser()) {
|
||||||
|
const t = await getTranslations('common');
|
||||||
|
const message =
|
||||||
|
t(`request.${code}`) !== `request.${code}`
|
||||||
|
? t(`request.${code}`)
|
||||||
|
: response.data?.msg || response.message;
|
||||||
|
toast.error(message);
|
||||||
|
}
|
||||||
|
return Logout();
|
||||||
|
}
|
||||||
if (response?.config?.skipErrorHandler) return;
|
if (response?.config?.skipErrorHandler) return;
|
||||||
if (!isBrowser()) return;
|
if (!isBrowser()) return;
|
||||||
|
|
||||||
|
|||||||
@ -52,8 +52,14 @@ const SidebarContext = React.createContext<SidebarContext>(SAFE_SIDEBAR_CONTEXT)
|
|||||||
function useSidebar() {
|
function useSidebar() {
|
||||||
const context = React.useContext(SidebarContext);
|
const context = React.useContext(SidebarContext);
|
||||||
// Optionally warn in development when using the safe fallback
|
// Optionally warn in development when using the safe fallback
|
||||||
if (process.env.NODE_ENV !== 'production' && context === SAFE_SIDEBAR_CONTEXT) {
|
if (!context) {
|
||||||
console.warn('useSidebar is used outside of a SidebarProvider. Falling back to no-op context.');
|
return {
|
||||||
|
toggleSidebar: () => {
|
||||||
|
console.warn(
|
||||||
|
'useSidebar is used outside of a SidebarProvider. Falling back to no-op context.',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}; // 提供默認空函數,防止首頁報錯
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user