diff --git a/package.json b/package.json index 25f481b..1301f28 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", + "@types/qrcode": "^1.5.5", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", "immer": "^10.0.4", @@ -24,6 +25,7 @@ "lucide-react": "^0.367.0", "next": "14.1.3", "nookies": "^2.5.2", + "qrcode": "^1.5.3", "qs": "^6.12.0", "react": "^18", "react-dom": "^18", diff --git a/src/components/Footer/DownLoadItem.tsx b/src/components/Footer/DownLoadItem.tsx index b571844..05e54a9 100644 --- a/src/components/Footer/DownLoadItem.tsx +++ b/src/components/Footer/DownLoadItem.tsx @@ -1,19 +1,3 @@ -import QRCodeDialog from './QRCodeDialog'; - -import { apiAppVersionCheck } from '@/services'; - -const getData = async (platform: AppPlatform) => { - const res = await apiAppVersionCheck(platform); - if (res.code === 200) { - return res.data; - } else { - return { - version: '1.0.0', - url: '', - }; - } -}; - const IconIos = ({ className }: { className?: string }) => { return ( @@ -21,9 +20,9 @@ export default async function FooterPlatform({ className }: { className?: string - + {/* - + */} diff --git a/src/components/Footer/QRCodeDialog.tsx b/src/components/Footer/QRCodeDialog.tsx index d1f596f..c185c7b 100644 --- a/src/components/Footer/QRCodeDialog.tsx +++ b/src/components/Footer/QRCodeDialog.tsx @@ -2,10 +2,9 @@ import { useState, useEffect } from 'react'; -import Image from 'next/image'; - import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogTrigger } from '@/components/ui/alert-dialog'; +import { QRCode } from '@/components'; import { apiAppVersionCheck } from '@/services'; export default function QRCodeDialog({ @@ -25,8 +24,8 @@ export default function QRCodeDialog({ const getData = async () => { const res = await apiAppVersionCheck(platform); if (res.code === 200) { - setVersion(res.data.version); - setUrl(res.data.url); + setVersion(res.data?.version || '1.0.0'); + setUrl(res.data?.url || '1.0.0'); } }; @@ -42,13 +41,11 @@ export default function QRCodeDialog({

{headerText}

{`最新版V${version}`}

- qrcode + +
+ {!!url && } +
+