From c76933a62a197a1336461e2813a69213b9c5a8a3 Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 21 Dec 2025 05:00:00 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=89=AA=E8=B4=B4?= =?UTF-8?q?=E6=9D=BF=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=A8=E6=88=B7=E8=AE=BE=E7=BD=AE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 4 ++-- package.json | 3 ++- pnpm-lock.yaml | 24 ++++++++++++++++++------ src/composables/useColipboard.ts | 16 ++++++++++++++++ src/store/user.ts | 1 - src/views/auth/login/index.vue | 2 ++ src/views/user-settings/index.vue | 21 ++++++++++++++++++--- src/views/user/components/user-info.vue | 4 ++-- 8 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 src/composables/useColipboard.ts diff --git a/auto-imports.d.ts b/auto-imports.d.ts index e821eca..82507d6 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -164,7 +164,7 @@ declare global { const useBrowserLocation: typeof import('@vueuse/core').useBrowserLocation const useCacheSize: typeof import('./src/composables/useCacheSize').useCacheSize const useCached: typeof import('@vueuse/core').useCached - const useClipboard: typeof import('@vueuse/core').useClipboard + const useClipboard: typeof import('./src/composables/useColipboard').useClipboard const useClipboardItems: typeof import('@vueuse/core').useClipboardItems const useCloned: typeof import('@vueuse/core').useCloned const useColorMode: typeof import('@vueuse/core').useColorMode @@ -524,7 +524,7 @@ declare module 'vue' { readonly useBrowserLocation: UnwrapRef readonly useCacheSize: UnwrapRef readonly useCached: UnwrapRef - readonly useClipboard: UnwrapRef + readonly useClipboard: UnwrapRef readonly useClipboardItems: UnwrapRef readonly useCloned: UnwrapRef readonly useColorMode: UnwrapRef diff --git a/package.json b/package.json index 9de5644..d32cf08 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@capacitor-mlkit/barcode-scanning": "^8.0.0", "@capacitor/app": "8.0.0", "@capacitor/camera": "^8.0.0", + "@capacitor/clipboard": "^8.0.0", "@capacitor/core": "8.0.0", "@capacitor/haptics": "8.0.0", "@capacitor/ios": "^8.0.0", @@ -29,7 +30,7 @@ "@elysiajs/eden": "^1.4.5", "@ionic/vue": "^8.7.11", "@ionic/vue-router": "^8.7.11", - "@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz", + "@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz", "@tailwindcss/vite": "^4.1.18", "@vee-validate/yup": "^4.15.1", "@vueuse/core": "^14.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b3eb5c..e67a5a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@capacitor/camera': specifier: ^8.0.0 version: 8.0.0(@capacitor/core@8.0.0) + '@capacitor/clipboard': + specifier: ^8.0.0 + version: 8.0.0(@capacitor/core@8.0.0) '@capacitor/core': specifier: 8.0.0 version: 8.0.0 @@ -45,8 +48,8 @@ importers: specifier: ^8.7.11 version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) '@riwa/api-types': - specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz - version: http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))) + specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz + version: http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))) '@tailwindcss/vite': specifier: ^4.1.18 version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2)) @@ -826,6 +829,11 @@ packages: engines: {node: '>=22.0.0'} hasBin: true + '@capacitor/clipboard@8.0.0': + resolution: {integrity: sha512-nRgx07ThaoxOaTObZo/G39se9wA3oVgP0ooNO539P1TOZzWObwuXWObZgvaRJNpJfHVYcNe45Ylb8nlYl7VleA==} + peerDependencies: + '@capacitor/core': '>=8.0.0' + '@capacitor/core@8.0.0': resolution: {integrity: sha512-250HTVd/W/KdMygoqaedisvNbHbpbQTN2Hy/8ZYGm1nAqE0Fx7sGss4l0nDg33STxEdDhtVRoL2fIaaiukKseA==} @@ -1327,9 +1335,9 @@ packages: resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz': - resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz} - version: 0.0.39 + '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz': + resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz} + version: 0.0.40 peerDependencies: '@elysiajs/eden': ^1.4.5 @@ -5826,6 +5834,10 @@ snapshots: transitivePeerDependencies: - supports-color + '@capacitor/clipboard@8.0.0(@capacitor/core@8.0.0)': + dependencies: + '@capacitor/core': 8.0.0 + '@capacitor/core@8.0.0': dependencies: tslib: 2.8.1 @@ -6410,7 +6422,7 @@ snapshots: '@pkgr/core@0.2.9': {} - '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.39.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': + '@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.40.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': dependencies: '@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)) diff --git a/src/composables/useColipboard.ts b/src/composables/useColipboard.ts new file mode 100644 index 0000000..60e83b8 --- /dev/null +++ b/src/composables/useColipboard.ts @@ -0,0 +1,16 @@ +import { Clipboard } from "@capacitor/clipboard"; + +export function useClipboard() { + function writeText(text: string): Promise { + return Clipboard.write({ string: text }); + } + + function readText() { + return Clipboard.read().then(result => result); + } + + return { + writeText, + readText, + }; +} diff --git a/src/store/user.ts b/src/store/user.ts index b691497..edd7135 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,6 +1,5 @@ import type { UserData, UserProfileData } from "@/api/types"; import { client, safeClient } from "@/api"; -import { authClient } from "@/auth"; interface State { user: UserData | null; diff --git a/src/views/auth/login/index.vue b/src/views/auth/login/index.vue index d2c9c67..235f1dd 100644 --- a/src/views/auth/login/index.vue +++ b/src/views/auth/login/index.vue @@ -17,6 +17,7 @@ async function handleSignInEmail(value: EmailVerifyClient) { }); if (data?.token) { userStore.setToken(data.token); + userStore.updateProfile(); useNavigateToRedirect(route.query.redirect as string); } } @@ -29,6 +30,7 @@ async function handleSignInPhoneNumber(value: PhoneNumberVerifyClient) { }); if (data?.token) { userStore.setToken(data.token); + userStore.updateProfile(); useNavigateToRedirect(route.query.redirect as string); } } diff --git a/src/views/user-settings/index.vue b/src/views/user-settings/index.vue index fbfa99f..649bc76 100644 --- a/src/views/user-settings/index.vue +++ b/src/views/user-settings/index.vue @@ -1,5 +1,5 @@