From 7a1710214165c9e01bacb9dccbf83d297504c2f4 Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 18 Jan 2026 18:07:38 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=82=80=E8=AF=B7=E7=A0=81=E8=BE=93=E5=85=A5=E5=92=8C?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E4=BA=BA=E5=91=98=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 5 + src/views/invite/bind.vue | 502 +++++++++++++++++++++++++++++++++++++ src/views/invite/index.vue | 43 ++-- 3 files changed, 527 insertions(+), 23 deletions(-) create mode 100644 src/views/invite/bind.vue diff --git a/src/router/index.ts b/src/router/index.ts index fdadc42..f6962c8 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -49,6 +49,11 @@ const routes: Array = [ component: () => import("@/views/invite/index.vue"), meta: { requiresAuth: true }, }, + { + path: "/bind_invite", + component: () => import("@/views/invite/bind.vue"), + meta: { requiresAuth: true }, + }, { path: "/settings", component: () => import("@/views/settings/index.vue"), diff --git a/src/views/invite/bind.vue b/src/views/invite/bind.vue new file mode 100644 index 0000000..2b58708 --- /dev/null +++ b/src/views/invite/bind.vue @@ -0,0 +1,502 @@ + + + + + diff --git a/src/views/invite/index.vue b/src/views/invite/index.vue index 3937e3f..02e774b 100644 --- a/src/views/invite/index.vue +++ b/src/views/invite/index.vue @@ -4,22 +4,15 @@ import { checkmarkCircleOutline, copyOutline, downloadOutline, - linkOutline, peopleOutline, - qrCodeOutline, shareOutline, ticketOutline, } from "ionicons/icons"; +import { client, safeClient } from "@/api"; -// 邀请信息 -const inviteInfo = ref({ - inviteCode: "ABCD1234", - inviteLink: "https://example.com/invite?code=ABCD1234", - downloadLink: "https://example.com/download", - qrCodeUrl: "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://example.com/invite?code=ABCD1234", - totalInvites: 28, - todayInvites: 3, -}); +const userStore = useUserStore(); +const { userProfile } = storeToRefs(userStore); +const { data } = safeClient(client.api.referrals.summary.get()); // 复制状态 const copyStatus = ref({ @@ -28,7 +21,11 @@ const copyStatus = ref({ download: false, }); -async function handleCopy(text: string, type: "link" | "code" | "download") { +async function handleCopy(text?: string, type: "link" | "code" | "download" = "link") { + if (!text) { + console.warn("没有可复制的文本"); + return; + } try { await Clipboard.write({ string: text, @@ -94,7 +91,7 @@ function handleDownloadQR() { 累计邀请
- {{ inviteInfo.totalInvites }} + {{ data?.totalCount }}
人 @@ -105,7 +102,7 @@ function handleDownloadQR() { 今日邀请
- {{ inviteInfo.todayInvites }} + {{ data?.totalCount }}
人 @@ -143,14 +140,14 @@ function handleDownloadQR() { 邀请码
- {{ inviteInfo.inviteCode }} + {{ userProfile?.referralCode?.slice(0, 6) }}
-
+ -
+ @@ -237,7 +234,7 @@ function handleDownloadQR() {
邀请二维码