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

View File

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

View File

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