Fix can not autoload in production mode bug

This commit is contained in:
2024-01-15 15:57:48 +08:00
parent bcf29f74ef
commit 6d08e1a8e8
24 changed files with 36 additions and 57 deletions

View File

@@ -8,7 +8,6 @@ import {
PERMISSION_USER_NOT_FOUND,
SYSTEM_INVALID_CAPTCHA_CODE
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { r_auth_forget, r_auth_retrieve } from '@/services/auth'
import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox'
@@ -45,7 +44,7 @@ const Forget = () => {
const [captchaCode, setCaptchaCode] = useState('')
const [retrieveCaptchaCode, setRetrieveCaptchaCode] = useState('')
useUpdatedEffect(() => {
useEffect(() => {
if (!isSending) {
setCaptchaCode('')
turnstileRef.current?.reset()
@@ -53,7 +52,7 @@ const Forget = () => {
}
}, [isSending])
useUpdatedEffect(() => {
useEffect(() => {
if (!isChanging) {
setRetrieveCaptchaCode('')
retrieveTurnstileRef.current?.reset()

View File

@@ -8,7 +8,6 @@ import {
PERMISSION_USERNAME_NOT_FOUND,
SYSTEM_INVALID_CAPTCHA_CODE
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { getUserInfo, setToken } from '@/util/auth'
import { utcToLocalTime } from '@/util/datetime'
import { r_auth_login } from '@/services/auth'
@@ -33,7 +32,7 @@ const SignIn = () => {
const [isSigningIn, setIsSigningIn] = useState(false)
const [captchaCode, setCaptchaCode] = useState('')
useUpdatedEffect(() => {
useEffect(() => {
if (!isSigningIn) {
setCaptchaCode('')
turnstileRef.current?.reset()

View File

@@ -7,7 +7,6 @@ import {
SYSTEM_INVALID_CAPTCHA_CODE,
SYSTEM_MATCH_SENSITIVE_WORD
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { getLoginStatus, setToken } from '@/util/auth'
import { r_auth_register, r_auth_resend } from '@/services/auth'
import FitCenter from '@/components/common/FitCenter'
@@ -32,7 +31,7 @@ const SignUp = () => {
const [isSending, setIsSending] = useState(false)
const [captchaCode, setCaptchaCode] = useState('')
useUpdatedEffect(() => {
useEffect(() => {
if (!isSigningUp) {
setCaptchaCode('')
turnstileRef.current?.reset()
@@ -40,7 +39,7 @@ const SignUp = () => {
}
}, [isSigningUp])
useUpdatedEffect(() => {
useEffect(() => {
if (location.pathname !== '/register') {
return
}

View File

@@ -5,7 +5,6 @@ import {
PERMISSION_VERIFY_SUCCESS,
SYSTEM_MATCH_SENSITIVE_WORD
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { getLoginStatus, getUserInfo, requestUserInfo } from '@/util/auth'
import { getRedirectUrl } from '@/util/route'
import { r_auth_resend, r_auth_verify } from '@/services/auth'
@@ -26,7 +25,7 @@ const Verify = () => {
const [avatar, setAvatar] = useState('')
const [isVerifying, setIsVerifying] = useState(false)
useUpdatedEffect(() => {
useEffect(() => {
if (location.pathname !== '/verify') {
return
}

View File

@@ -1,5 +1,4 @@
import '@/assets/css/pages/sign.scss'
import { useUpdatedEffect } from '@/util/hooks'
import FitFullscreen from '@/components/common/FitFullscreen'
import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox'
@@ -16,7 +15,7 @@ const Sign = () => {
const leftPage = ['register', 'verify', 'forget']
useUpdatedEffect(() => {
useEffect(() => {
lastPage.current = currentPage.current
currentPage.current = match.id

View File

@@ -10,7 +10,6 @@ import {
DATABASE_SELECT_SUCCESS,
DATABASE_UPDATE_SUCCESS
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth'
import { utcToLocalTime } from '@/util/datetime'
import {
@@ -484,7 +483,7 @@ const Group = () => {
}
}, [formValues])
useUpdatedEffect(() => {
useEffect(() => {
getGroup()
}, [
JSON.stringify(tableParams.filters),

View File

@@ -1,7 +1,6 @@
import { ChangeEvent, KeyboardEvent } from 'react'
import dayjs from 'dayjs'
import { COLOR_FONT_SECONDARY, DATABASE_SELECT_SUCCESS } from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { dayjsToUtc, utcToLocalTime } from '@/util/datetime'
import { r_sys_log_get } from '@/services/system'
import FitFullscreen from '@/components/common/FitFullscreen'
@@ -223,7 +222,7 @@ const Log = () => {
})
}
useUpdatedEffect(() => {
useEffect(() => {
getLog()
}, [
JSON.stringify(tableParams.filters),

View File

@@ -10,7 +10,6 @@ import {
DATABASE_SELECT_SUCCESS,
DATABASE_UPDATE_SUCCESS
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { utcToLocalTime } from '@/util/datetime'
import { hasPermission, powerListToPowerTree } from '@/util/auth'
import {
@@ -493,7 +492,7 @@ const Role = () => {
}
}, [formValues])
useUpdatedEffect(() => {
useEffect(() => {
getRole()
}, [
JSON.stringify(tableParams.filters),

View File

@@ -1,4 +1,3 @@
import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth'
import { r_sys_settings_base_get, r_sys_settings_base_update } from '@/services/system'
import { SettingsCard } from '@/pages/System/Settings'
@@ -40,7 +39,7 @@ const Base = () => {
})
}
useUpdatedEffect(() => {
useEffect(() => {
getBaseSettings()
}, [])

View File

@@ -1,5 +1,4 @@
import Icon from '@ant-design/icons'
import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth'
import {
r_sys_settings_mail_get,
@@ -95,7 +94,7 @@ const Mail = () => {
})
}
useUpdatedEffect(() => {
useEffect(() => {
getMailSettings()
}, [])

View File

@@ -1,7 +1,6 @@
import { ChangeEvent } from 'react'
import Icon from '@ant-design/icons'
import { DATABASE_DUPLICATE_KEY, DATABASE_INSERT_SUCCESS } from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import {
r_sys_settings_sensitive_add,
r_sys_settings_sensitive_delete,
@@ -95,7 +94,7 @@ const SensitiveWord = () => {
})
}
useUpdatedEffect(() => {
useEffect(() => {
getSensitiveWordSettings()
}, [])

View File

@@ -1,6 +1,5 @@
import Icon from '@ant-design/icons'
import * as echarts from 'echarts/core'
import { useUpdatedEffect } from '@/util/hooks'
import { getTimesBetweenTwoTimes } from '@/util/datetime'
import { r_sys_statistics_active } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
@@ -13,7 +12,7 @@ const ActiveInfo = () => {
const [isLoading, setIsLoading] = useState(false)
const [scope, setScope] = useState('WEAK')
useUpdatedEffect(() => {
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
activeInfoEChartsRef.current?.resize()
})
@@ -25,7 +24,7 @@ const ActiveInfo = () => {
}
}, [isLoading])
useUpdatedEffect(() => {
useEffect(() => {
getActiveInfo()
}, [])

View File

@@ -1,6 +1,5 @@
import * as echarts from 'echarts/core'
import { BarSeriesOption } from 'echarts/charts'
import { useUpdatedEffect } from '@/util/hooks'
import { r_sys_statistics_cpu } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
import {
@@ -26,7 +25,7 @@ const CPUInfo = () => {
}
}
useUpdatedEffect(() => {
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
cpuInfoEChartsRef.current.forEach((value) => value.resize())
})
@@ -38,7 +37,7 @@ const CPUInfo = () => {
}
}, [cpuInfoDivRef.current])
useUpdatedEffect(() => {
useEffect(() => {
const intervalId = setInterval(getCpuInfo(), parseInt(refreshInterval) * 1000)
return () => {

View File

@@ -1,4 +1,3 @@
import { useUpdatedEffect } from '@/util/hooks'
import { r_sys_statistics_hardware } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
import { CommonCard } from '@/pages/System/Statistics'
@@ -6,7 +5,7 @@ import { CommonCard } from '@/pages/System/Statistics'
const HardwareInfo = () => {
const [hardwareInfoData, setHardwareInfoData] = useState<HardwareInfoVo>()
useUpdatedEffect(() => {
useEffect(() => {
void r_sys_statistics_hardware().then((res) => {
const response = res.data
if (response.success) {

View File

@@ -1,6 +1,5 @@
import Icon from '@ant-design/icons'
import * as echarts from 'echarts/core'
import { useUpdatedEffect } from '@/util/hooks'
import { getTimesBetweenTwoTimes } from '@/util/datetime'
import { r_sys_statistics_online } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
@@ -14,7 +13,7 @@ const OnlineInfo = () => {
const [currentOnlineCount, setCurrentOnlineCount] = useState(-1)
const [scope, setScope] = useState('WEAK')
useUpdatedEffect(() => {
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
onlineInfoEChartsRef.current?.resize()
})
@@ -26,7 +25,7 @@ const OnlineInfo = () => {
}
}, [isLoading])
useUpdatedEffect(() => {
useEffect(() => {
getOnlineInfo()
}, [])

View File

@@ -1,4 +1,3 @@
import { useUpdatedEffect } from '@/util/hooks'
import { utcToLocalTime } from '@/util/datetime'
import { r_sys_statistics_software } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
@@ -7,7 +6,7 @@ import { CommonCard } from '@/pages/System/Statistics'
const SoftwareInfo = () => {
const [softwareInfoData, setSoftwareInfoData] = useState<SoftwareInfoVo>()
useUpdatedEffect(() => {
useEffect(() => {
void r_sys_statistics_software().then((res) => {
const response = res.data
if (response.success) {

View File

@@ -1,7 +1,6 @@
import * as echarts from 'echarts/core'
import { BarSeriesOption } from 'echarts/charts'
import { formatByteSize } from '@/util/common'
import { useUpdatedEffect } from '@/util/hooks'
import { r_sys_statistics_storage } from '@/services/system'
import FlexBox from '@/components/common/FlexBox'
import {
@@ -25,7 +24,7 @@ const StorageInfo = () => {
tooltip: { valueFormatter: (value) => formatByteSize(value as number) }
}
useUpdatedEffect(() => {
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
storageInfoEChartsRef.current.forEach((value) => value.resize())
})
@@ -37,7 +36,7 @@ const StorageInfo = () => {
}
}, [storageInfoDivRef.current])
useUpdatedEffect(() => {
useEffect(() => {
const intervalId = setInterval(getStorageInfo(), parseInt(refreshInterval) * 1000)
return () => {

View File

@@ -11,7 +11,6 @@ import {
DATABASE_SELECT_SUCCESS,
DATABASE_UPDATE_SUCCESS
} from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth'
import { utcToLocalTime, isPastTime, localTimeToUtc, dayjsToUtc, getNowUtc } from '@/util/datetime'
import {
@@ -748,7 +747,7 @@ const User = () => {
}
}, [formValues])
useUpdatedEffect(() => {
useEffect(() => {
getUser()
}, [
JSON.stringify(tableParams.filters),

View File

@@ -5,7 +5,7 @@ import FitFullscreen from '@/components/common/FitFullscreen'
import Sidebar from '@/components/common/Sidebar'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
const ToolsFramework = () => {
const UserFramework = () => {
return (
<>
<FitFullscreen data-component={'user-framework'} className={'flex-horizontal'}>
@@ -62,4 +62,4 @@ const ToolsFramework = () => {
)
}
export default ToolsFramework
export default UserFramework