From afc806381e2367ba3c2689fe911cf692e4e38b54 Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 18 Jan 2026 20:48:02 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20'@capp/eden'=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E8=87=B3=200.0.9=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E4=B8=AD=E5=BF=83=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=92=B1=E5=8C=85=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 4 ++ pnpm-lock.yaml | 14 ++-- pnpm-workspace.yaml | 2 +- src/api/index.ts | 8 ++- src/router/index.ts | 5 ++ src/store/wallet.ts | 11 ++- src/theme/ionic.css | 68 +------------------ src/views/asset_center/index.vue | 107 ++++++++++++++++++++++++++++++ src/views/asset_details/index.vue | 4 +- src/views/check_in/index.vue | 9 +++ src/views/invite/index.vue | 9 +++ src/views/profile/index.vue | 19 ++++-- src/views/recharge/index.vue | 11 ++- src/views/team/index.vue | 2 +- 14 files changed, 174 insertions(+), 99 deletions(-) create mode 100644 src/views/asset_center/index.vue diff --git a/components.d.ts b/components.d.ts index 4d3bec8..0c2df39 100644 --- a/components.d.ts +++ b/components.d.ts @@ -34,6 +34,8 @@ declare module 'vue' { IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet'] IonSegment: typeof import('@ionic/vue')['IonSegment'] IonSegmentButton: typeof import('@ionic/vue')['IonSegmentButton'] + IonSelect: typeof import('@ionic/vue')['IonSelect'] + IonSelectOption: typeof import('@ionic/vue')['IonSelectOption'] IonSpinner: typeof import('@ionic/vue')['IonSpinner'] IonTabBar: typeof import('@ionic/vue')['IonTabBar'] IonTabButton: typeof import('@ionic/vue')['IonTabButton'] @@ -72,6 +74,8 @@ declare global { const IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet'] const IonSegment: typeof import('@ionic/vue')['IonSegment'] const IonSegmentButton: typeof import('@ionic/vue')['IonSegmentButton'] + const IonSelect: typeof import('@ionic/vue')['IonSelect'] + const IonSelectOption: typeof import('@ionic/vue')['IonSelectOption'] const IonSpinner: typeof import('@ionic/vue')['IonSpinner'] const IonTabBar: typeof import('@ionic/vue')['IonTabBar'] const IonTabButton: typeof import('@ionic/vue')['IonTabButton'] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33cee43..59c70d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,8 +52,8 @@ catalogs: specifier: 8.0.0 version: 8.0.0 '@capp/eden': - specifier: http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz - version: 0.0.8 + specifier: http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz + version: 0.0.9 '@cloudflare/workers-types': specifier: ^4.20260113.0 version: 4.20260116.0 @@ -298,7 +298,7 @@ importers: version: 8.0.0(@capacitor/core@8.0.0) '@capp/eden': specifier: 'catalog:' - version: http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz(@elysiajs/eden@1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3))) + version: http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz(@elysiajs/eden@1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3))) '@elysiajs/eden': specifier: 'catalog:' version: 1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3)) @@ -1182,9 +1182,9 @@ packages: '@capacitor/synapse@1.0.4': resolution: {integrity: sha512-/C1FUo8/OkKuAT4nCIu/34ny9siNHr9qtFezu4kxm6GY1wNFxrCFWjfYx5C1tUhVGz3fxBABegupkpjXvjCHrw==} - '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz': - resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz} - version: 0.0.8 + '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz': + resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz} + version: 0.0.9 peerDependencies: '@elysiajs/eden': ^1.4.6 @@ -6903,7 +6903,7 @@ snapshots: '@capacitor/synapse@1.0.4': {} - '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz(@elysiajs/eden@1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3)))': + '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz(@elysiajs/eden@1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3)))': dependencies: '@elysiajs/eden': 1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3)) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 70aa5d0..ba6a8a5 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -18,7 +18,7 @@ catalog: '@capacitor/keyboard': 8.0.0 '@capacitor/share': ^8.0.0 '@capacitor/status-bar': 8.0.0 - '@capp/eden': http://192.168.1.2:9538/api/capp-eden-0.0.8.tgz + '@capp/eden': http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz '@cloudflare/workers-types': ^4.20260113.0 '@elysiajs/eden': ^1.4.6 '@faker-js/faker': ^10.2.0 diff --git a/src/api/index.ts b/src/api/index.ts index 8482ae9..4cb2e4d 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -61,8 +61,8 @@ export function safeClient( isPending.value = false; }); - if (res.error && res.status === 418) { - if (!options.silent) { + if (res.error) { + if (!options.silent && res.status === 418) { const toast = await toastController.create({ message: i18n.global.t((res.error as any).value.code, { ...(res.error as any).value.context, @@ -73,6 +73,10 @@ export function safeClient( }); await toast.present(); } + else if (res.status === 401) { + localStorage.removeItem("user-token"); + window.location.reload(); + } throw res.error; } diff --git a/src/router/index.ts b/src/router/index.ts index f6962c8..8160552 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -119,6 +119,11 @@ const routes: Array = [ component: () => import("@/views/team/index.vue"), meta: { requiresAuth: true }, }, + { + path: "/asset_center", + component: () => import("@/views/asset_center/index.vue"), + meta: { requiresAuth: true }, + }, ]; const router = createRouter({ diff --git a/src/store/wallet.ts b/src/store/wallet.ts index c6c15da..3c65999 100644 --- a/src/store/wallet.ts +++ b/src/store/wallet.ts @@ -5,21 +5,20 @@ export type Wallet = Treaty.Data[number]; export const useWalletStore = defineStore("wallet", () => { const wallets = ref([]); - const balanceWallet = ref(null); async function syncWallets() { const { data } = await safeClient(client.api.wallet.wallets.get(), { silent: true }); wallets.value = data.value || []; } - async function syncBalanceWallet() { - const { data } = await safeClient(client.api.wallet.wallet_by_code({ walletTypeCode: "balance" }).get(), { silent: true }); - balanceWallet.value = data.value || null; + async function getWalletByType(type: Wallet["walletType"]["code"]) { + const { data } = await safeClient(client.api.wallet.wallet_by_code({ walletTypeCode: type }).get(), { silent: true }); + + return data; } return { wallets, - balanceWallet, syncWallets, - syncBalanceWallet, + getWalletByType, }; }); diff --git a/src/theme/ionic.css b/src/theme/ionic.css index a08826a..46492c1 100644 --- a/src/theme/ionic.css +++ b/src/theme/ionic.css @@ -63,75 +63,9 @@ --ion-color-dark-tint: #444444; } -/* -:root { - --ion-color-primary: #2065c3; - --ion-color-primary-rgb: 32,101,195; - --ion-color-primary-contrast: #ffffff; - --ion-color-primary-contrast-rgb: 255,255,255; - --ion-color-primary-shade: #1c59ac; - --ion-color-primary-tint: #3674c9; - - --ion-color-secondary: #0163aa; - --ion-color-secondary-rgb: 1,99,170; - --ion-color-secondary-contrast: #ffffff; - --ion-color-secondary-contrast-rgb: 255,255,255; - --ion-color-secondary-shade: #015796; - --ion-color-secondary-tint: #1a73b3; - - --ion-color-tertiary: #6030ff; - --ion-color-tertiary-rgb: 96,48,255; - --ion-color-tertiary-contrast: #ffffff; - --ion-color-tertiary-contrast-rgb: 255,255,255; - --ion-color-tertiary-shade: #542ae0; - --ion-color-tertiary-tint: #7045ff; - - --ion-color-success: #2dd55b; - --ion-color-success-rgb: 45,213,91; - --ion-color-success-contrast: #000000; - --ion-color-success-contrast-rgb: 0,0,0; - --ion-color-success-shade: #28bb50; - --ion-color-success-tint: #42d96b; - - --ion-color-warning: #ffc409; - --ion-color-warning-rgb: 255,196,9; - --ion-color-warning-contrast: #000000; - --ion-color-warning-contrast-rgb: 0,0,0; - --ion-color-warning-shade: #e0ac08; - --ion-color-warning-tint: #ffca22; - - --ion-color-danger: #c5000f; - --ion-color-danger-rgb: 197,0,15; - --ion-color-danger-contrast: #ffffff; - --ion-color-danger-contrast-rgb: 255,255,255; - --ion-color-danger-shade: #ad000d; - --ion-color-danger-tint: #cb1a27; - - --ion-color-light: #f6f8fc; - --ion-color-light-rgb: 246,248,252; - --ion-color-light-contrast: #000000; - --ion-color-light-contrast-rgb: 0,0,0; - --ion-color-light-shade: #d8dade; - --ion-color-light-tint: #f7f9fc; - - --ion-color-medium: #5f5f5f; - --ion-color-medium-rgb: 95,95,95; - --ion-color-medium-contrast: #ffffff; - --ion-color-medium-contrast-rgb: 255,255,255; - --ion-color-medium-shade: #545454; - --ion-color-medium-tint: #6f6f6f; - - --ion-color-dark: #2f2f2f; - --ion-color-dark-rgb: 47,47,47; - --ion-color-dark-contrast: #ffffff; - --ion-color-dark-contrast-rgb: 255,255,255; - --ion-color-dark-shade: #292929; - --ion-color-dark-tint: #444444; - -} */ .ion-toolbar { - --background: var(--ion-color-primary); + --background: #c32120; --min-height: 58px; --color: white; } \ No newline at end of file diff --git a/src/views/asset_center/index.vue b/src/views/asset_center/index.vue new file mode 100644 index 0000000..0068822 --- /dev/null +++ b/src/views/asset_center/index.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/views/asset_details/index.vue b/src/views/asset_details/index.vue index 52b0468..89f8cad 100644 --- a/src/views/asset_details/index.vue +++ b/src/views/asset_details/index.vue @@ -2,7 +2,7 @@ import { arrowDownCircleOutline, arrowUpCircleOutline, listOutline, walletOutline } from "ionicons/icons"; const walletStore = useWalletStore(); -const { balanceWallet } = storeToRefs(walletStore); +const balanceWallet = await walletStore.getWalletByType("balance"); // 当前选中的标签 const selectedTab = ref<"all" | "income" | "investment">("all"); @@ -137,8 +137,6 @@ function getTypeName(type: string) { function formatAmount(amount: number) { return amount >= 0 ? `+${amount.toFixed(2)}` : amount.toFixed(2); } - -walletStore.syncBalanceWallet();