Refactor(StoreCard): Optimize android qr-code url

This commit is contained in:
2024-05-11 16:37:31 +08:00
parent 30ec21a71e
commit 8f22084d10
3 changed files with 9 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ import Icon from '@ant-design/icons'
import '@/assets/css/components/tools/local-card.scss'
import { COLOR_BACKGROUND, COLOR_MAIN } from '@/constants/common.constants'
import { checkDesktop, omitText } from '@/util/common'
import { navigateToStore, navigateToView } from '@/util/navigation'
import { getAndroidUrl, navigateToStore, navigateToView } from '@/util/navigation'
import Card from '@/components/common/Card'
import FlexBox from '@/components/common/FlexBox'
import DragHandle from '@/components/dnd/DragHandle'
@@ -21,7 +21,6 @@ interface StoreCardProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement
ver: string
platform: Platform
supportPlatform: Platform[]
favorite: boolean
}
const StoreCard = ({
@@ -44,7 +43,6 @@ const StoreCard = ({
ver,
platform,
supportPlatform,
favorite,
...props
}: StoreCardProps) => {
const navigate = useNavigate()
@@ -67,10 +65,7 @@ const StoreCard = ({
title: 'Android 端',
content: (
<FlexBox className={'android-qrcode'}>
<AntdQRCode
value={`oxygen://openurl/view/${author.username}/${toolId}`}
size={300}
/>
<AntdQRCode value={getAndroidUrl(author.username, toolId)} size={300} />
<AntdTag className={'tag'}>使</AntdTag>
</FlexBox>
),
@@ -98,10 +93,7 @@ const StoreCard = ({
title: 'Android 端',
content: (
<FlexBox className={'android-qrcode'}>
<AntdQRCode
value={`oxygen://openurl/view/${author.username}/${toolId}`}
size={300}
/>
<AntdQRCode value={getAndroidUrl(author.username, toolId)} size={300} />
<AntdTag className={'tag'}>使</AntdTag>
</FlexBox>
),

View File

@@ -12,6 +12,7 @@ import {
import { checkDesktop, omitText } from '@/util/common'
import { getLoginStatus, getUserId } from '@/util/auth'
import {
getAndroidUrl,
navigateToLogin,
navigateToSource,
navigateToStore,
@@ -96,10 +97,7 @@ const StoreCard = ({
title: 'Android 端',
content: (
<FlexBox className={'android-qrcode'}>
<AntdQRCode
value={`oxygen://openurl/view/${author.username}/${toolId}`}
size={300}
/>
<AntdQRCode value={getAndroidUrl(author.username, toolId)} size={300} />
<AntdTag className={'tag'}>使</AntdTag>
</FlexBox>
),
@@ -220,10 +218,7 @@ const StoreCard = ({
title: 'Android 端',
content: (
<FlexBox className={'android-qrcode'}>
<AntdQRCode
value={`oxygen://openurl/view/${author.username}/${toolId}`}
size={300}
/>
<AntdQRCode value={getAndroidUrl(author.username, toolId)} size={300} />
<AntdTag className={'tag'}>使</AntdTag>
</FlexBox>
),

View File

@@ -153,3 +153,6 @@ export const getViewPath = (
return `${url.pathname}${url.search}`
}
export const getAndroidUrl = (username: string, toolId: string) =>
`oxygen://opentool/${username}/${toolId}`