Refactor:3 #52
@@ -32,6 +32,7 @@
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
|
z-index: 100;
|
||||||
|
|
||||||
> *:hover {
|
> *:hover {
|
||||||
color: constants.$font-secondary-color;
|
color: constants.$font-secondary-color;
|
||||||
|
|||||||
@@ -75,10 +75,9 @@ const StoreCard = ({
|
|||||||
}
|
}
|
||||||
if (platform === 'ANDROID') {
|
if (platform === 'ANDROID') {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
|
centered: true,
|
||||||
icon: <Icon style={{ color: COLOR_MAIN }} component={IconOxygenInfo} />,
|
icon: <Icon style={{ color: COLOR_MAIN }} component={IconOxygenInfo} />,
|
||||||
title: 'Android 端',
|
title: 'Android 端',
|
||||||
centered: true,
|
|
||||||
maskClosable: true,
|
|
||||||
content: (
|
content: (
|
||||||
<FlexBox className={'android-qrcode'}>
|
<FlexBox className={'android-qrcode'}>
|
||||||
<AntdQRCode
|
<AntdQRCode
|
||||||
@@ -147,10 +146,9 @@ const StoreCard = ({
|
|||||||
const handleOnAndroidBtnClick = (e: MouseEvent<HTMLDivElement>) => {
|
const handleOnAndroidBtnClick = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
|
centered: true,
|
||||||
icon: <Icon style={{ color: COLOR_MAIN }} component={IconOxygenInfo} />,
|
icon: <Icon style={{ color: COLOR_MAIN }} component={IconOxygenInfo} />,
|
||||||
title: 'Android 端',
|
title: 'Android 端',
|
||||||
centered: true,
|
|
||||||
maskClosable: true,
|
|
||||||
content: (
|
content: (
|
||||||
<FlexBox className={'android-qrcode'}>
|
<FlexBox className={'android-qrcode'}>
|
||||||
<AntdQRCode
|
<AntdQRCode
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ service.interceptors.response.use(
|
|||||||
(error.code === 'ECONNABORTED' && error.message.includes('timeout'))
|
(error.code === 'ECONNABORTED' && error.message.includes('timeout'))
|
||||||
) {
|
) {
|
||||||
void message.error({ content: '请求超时,请稍后重试', key: 'TIMEOUT' })
|
void message.error({ content: '请求超时,请稍后重试', key: 'TIMEOUT' })
|
||||||
|
} else if (error.code === 'ERR_NETWORK') {
|
||||||
|
void message.error({
|
||||||
|
content: (
|
||||||
|
<>
|
||||||
|
<strong>网络错误</strong>,请检查网络后重试
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
key: 'NETWORK_ERROR'
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
void message.error({
|
void message.error({
|
||||||
content: (
|
content: (
|
||||||
|
|||||||
@@ -37,10 +37,15 @@ export const navigateToView = (
|
|||||||
version?: string,
|
version?: string,
|
||||||
options?: NavigateOptions
|
options?: NavigateOptions
|
||||||
) => {
|
) => {
|
||||||
navigate(
|
const url = new URL(
|
||||||
`/view/${username}/${toolId}${version ? `/${version}` : ''}${platform !== import.meta.env.VITE_PLATFORM ? `?platform=${platform}` : ''}`,
|
`/view/${username}/${toolId}${version ? `/${version}` : ''}`,
|
||||||
options
|
window.location.href
|
||||||
)
|
)
|
||||||
|
if (platform !== import.meta.env.VITE_PLATFORM) {
|
||||||
|
url.searchParams.append('platform', platform)
|
||||||
|
}
|
||||||
|
|
||||||
|
navigate(`${url.pathname}${url.search}`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const navigateToSource = (
|
export const navigateToSource = (
|
||||||
@@ -51,10 +56,14 @@ export const navigateToSource = (
|
|||||||
version?: string,
|
version?: string,
|
||||||
options?: NavigateOptions
|
options?: NavigateOptions
|
||||||
) => {
|
) => {
|
||||||
navigate(
|
const url = new URL(
|
||||||
`/source/${username}/${toolId}${version ? `/${version}` : ''}${platform !== import.meta.env.VITE_PLATFORM ? `?platform=${platform}` : ''}`,
|
`/source/${username}/${toolId}${version ? `/${version}` : ''}`,
|
||||||
options
|
window.location.href
|
||||||
)
|
)
|
||||||
|
if (platform !== import.meta.env.VITE_PLATFORM) {
|
||||||
|
url.searchParams.append('platform', platform)
|
||||||
|
}
|
||||||
|
navigate(`${url.pathname}${url.search}`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const navigateToRedirect = (
|
export const navigateToRedirect = (
|
||||||
@@ -104,10 +113,12 @@ export const navigateToEdit = (
|
|||||||
platform: Platform,
|
platform: Platform,
|
||||||
options?: NavigateOptions
|
options?: NavigateOptions
|
||||||
) => {
|
) => {
|
||||||
navigate(
|
const url = new URL(`/edit/${toolId}`, window.location.href)
|
||||||
`/edit/${toolId}${platform !== import.meta.env.VITE_PLATFORM ? `?platform=${platform}` : ''}`,
|
if (platform !== import.meta.env.VITE_PLATFORM) {
|
||||||
options
|
url.searchParams.append('platform', platform)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
navigate(`${url.pathname}${url.search}`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const navigateToUser = (navigate: NavigateFunction, options?: NavigateOptions) => {
|
export const navigateToUser = (navigate: NavigateFunction, options?: NavigateOptions) => {
|
||||||
@@ -123,5 +134,14 @@ export const getViewPath = (
|
|||||||
toolId: string,
|
toolId: string,
|
||||||
platform: Platform,
|
platform: Platform,
|
||||||
version?: string
|
version?: string
|
||||||
) =>
|
) => {
|
||||||
`/view/${username}/${toolId}${version ? `/${version}` : ''}${platform !== import.meta.env.VITE_PLATFORM ? `?platform=${platform}` : ''}`
|
const url = new URL(
|
||||||
|
`/view/${username}/${toolId}${version ? `/${version}` : ''}`,
|
||||||
|
window.location.href
|
||||||
|
)
|
||||||
|
if (platform !== import.meta.env.VITE_PLATFORM) {
|
||||||
|
url.searchParams.append('platform', platform)
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${url.pathname}${url.search}`
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user