From 3cdb71effcefdc7ce53d17c277dde2e8ada29d32 Mon Sep 17 00:00:00 2001 From: Seven Date: Wed, 17 Dec 2025 01:31:17 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E5=8D=A1=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=93=B6=E8=A1=8C=E5=8D=A1=E5=92=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=93=B6=E8=A1=8C=E5=8D=A1=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96API=E8=AF=B7=E6=B1=82=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pnpm-lock.yaml | 12 +- src/App.vue | 5 +- src/api/index.ts | 40 ++- src/api/types.ts | 6 + src/router/index.ts | 8 + src/views/issue/issuing-apply/base.vue | 1 - src/views/issue/issuing-apply/index.vue | 4 +- .../trade-settings/bank-management/add.vue | 192 ++++++++++++ .../trade-settings/bank-management/index.vue | 287 ++++++++++++++++++ src/views/user/components/trade-settings.vue | 28 ++ src/views/user/components/wallet-card.vue | 2 +- src/views/user/index.vue | 4 +- src/views/withdraw/index.vue | 2 +- 14 files changed, 564 insertions(+), 29 deletions(-) create mode 100644 src/views/trade-settings/bank-management/add.vue create mode 100644 src/views/trade-settings/bank-management/index.vue create mode 100644 src/views/user/components/trade-settings.vue diff --git a/package.json b/package.json index 49e9193..ef9ee5f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@elysiajs/eden": "^1.4.5", "@ionic/vue": "^8.7.11", "@ionic/vue-router": "^8.7.11", - "@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.16.tgz", + "@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.21.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 d6fb3d7..e69c442 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,8 +36,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.36:9527/api/riwa-api-types-0.0.16.tgz - version: http://192.168.1.36:9527/api/riwa-api-types-0.0.16.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.36:9527/api/riwa-api-types-0.0.21.tgz + version: http://192.168.1.36:9527/api/riwa-api-types-0.0.21.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)) @@ -1263,9 +1263,9 @@ packages: '@quansync/fs@1.0.0': resolution: {integrity: sha512-4TJ3DFtlf1L5LDMaM6CanJ/0lckGNtJcMjQ1NAV6zDmA0tEHKZtxNKin8EgPaVX1YzljbxckyT2tJrpQKAtngQ==} - '@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.16.tgz': - resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.16.tgz} - version: 0.0.16 + '@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.21.tgz': + resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.21.tgz} + version: 0.0.21 peerDependencies: '@elysiajs/eden': ^1.4.5 @@ -6101,7 +6101,7 @@ snapshots: dependencies: quansync: 1.0.0 - '@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.16.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.36:9527/api/riwa-api-types-0.0.21.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/App.vue b/src/App.vue index e1bce68..a01567a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,8 +4,9 @@ import { client, safeClient } from "./api"; const walletStore = useWalletStore(); onMounted(async () => { - const { data } = await safeClient(client.api.asset.balances.get()); - walletStore.state.balances = data; + const { data } = await safeClient(() => client.api.asset.balances.get(), { silent: true }); + walletStore.state.balances = data.value; + client.api.rwa.issuance.products.get(); console.log("App mounted successfully"); }); diff --git a/src/api/index.ts b/src/api/index.ts index 2694693..aa2b482 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -9,26 +9,38 @@ const client = treaty(window.location.origin, { }); export async function safeClient( - requestPromise: Promise<{ data: T; error: E }>, - options: { silent?: boolean } = {}, + requestPromise: () => Promise<{ data: T; error: E }>, + options: { silent?: boolean; immediate?: boolean } = {}, ) { - const { data, error } = await requestPromise; + const { immediate = true } = options; + const data = ref(null); + const error = ref(null); - if (error) { - if (!options.silent) { - const toast = await toastController.create({ - message: typeof error === "string" ? error : "Request failed. Please try again.", - duration: 3000, - position: "bottom", - color: "danger", - }); - await toast.present(); + const executeRequest = async () => { + const res = await requestPromise(); + + if (res.error) { + if (!options.silent) { + const toast = await toastController.create({ + message: typeof error === "string" ? error : "Request failed. Please try again.", + duration: 3000, + position: "bottom", + color: "danger", + }); + await toast.present(); + } + + throw res.error; } + data.value = res.data; + error.value = res.error; + }; - throw error; + if (immediate) { + await executeRequest(); } - return { data, error }; + return { data, error, refresh: executeRequest }; } export { client }; diff --git a/src/api/types.ts b/src/api/types.ts index ab90219..e873c1c 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -25,3 +25,9 @@ export type RwaIssuanceProductsData = Treaty.Data[0]>; export type RwaIssuanceCategoriesData = Treaty.Data; + +export type BankAccountsData = Treaty.Data; + +export type BankAccountBody = Parameters[0]; + +export type BankAccountData = Treaty.Data; diff --git a/src/router/index.ts b/src/router/index.ts index 4c5c612..5b3ba53 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -58,6 +58,14 @@ const routes: Array = [ props: ({ query, params }) => ({ query, params }), component: () => import("@/views/issue/issuing-apply/index.vue"), }, + { + path: "/trade-settings/bank-management", + component: () => import("@/views/trade-settings/bank-management/index.vue"), + }, + { + path: "/trade-settings/bank-management/add", + component: () => import("@/views/trade-settings/bank-management/add.vue"), + }, ]; const router = createRouter({ diff --git a/src/views/issue/issuing-apply/base.vue b/src/views/issue/issuing-apply/base.vue index 75561c7..33d6de6 100644 --- a/src/views/issue/issuing-apply/base.vue +++ b/src/views/issue/issuing-apply/base.vue @@ -5,7 +5,6 @@ import { toTypedSchema } from "@vee-validate/yup"; import { ErrorMessage, Field, FieldArray, Form } from "vee-validate"; import { useI18n } from "vue-i18n"; import * as yup from "yup"; -import { client, safeClient } from "@/api"; const props = defineProps<{ initialData: RwaIssuanceProductBody["product"]; diff --git a/src/views/issue/issuing-apply/index.vue b/src/views/issue/issuing-apply/index.vue index c9ce99e..6713765 100644 --- a/src/views/issue/issuing-apply/index.vue +++ b/src/views/issue/issuing-apply/index.vue @@ -10,14 +10,14 @@ import IssuePeriod from "./issue-period.vue"; const { t } = useI18n(); const now = useNow(); -const { data: categories = [] } = await safeClient(client.api.rwa.issuance.categories.get()); +const { data: categories } = await safeClient(() => client.api.rwa.issuance.categories.get()); const step = useRouteQuery("step", 1, { transform: v => Number(v), mode: "push" }); const initialData: RwaIssuanceProductBody = { product: { name: "", code: "", - categoryId: categories!.length > 0 ? categories![0].id : "", + categoryId: categories.value!.length > 0 ? categories.value![0].id : "", }, editions: [ { diff --git a/src/views/trade-settings/bank-management/add.vue b/src/views/trade-settings/bank-management/add.vue new file mode 100644 index 0000000..6db7dee --- /dev/null +++ b/src/views/trade-settings/bank-management/add.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/src/views/trade-settings/bank-management/index.vue b/src/views/trade-settings/bank-management/index.vue new file mode 100644 index 0000000..7181f04 --- /dev/null +++ b/src/views/trade-settings/bank-management/index.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/views/user/components/trade-settings.vue b/src/views/user/components/trade-settings.vue new file mode 100644 index 0000000..f39e5ce --- /dev/null +++ b/src/views/user/components/trade-settings.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/user/components/wallet-card.vue b/src/views/user/components/wallet-card.vue index 9961344..293f771 100644 --- a/src/views/user/components/wallet-card.vue +++ b/src/views/user/components/wallet-card.vue @@ -16,7 +16,7 @@ function handleWithdraw() { diff --git a/src/views/withdraw/index.vue b/src/views/withdraw/index.vue index 093809f..8b993b2 100644 --- a/src/views/withdraw/index.vue +++ b/src/views/withdraw/index.vue @@ -42,7 +42,7 @@ function handleCurrentChange() { } async function onSubmit() { - const { data } = await safeClient(client.api.withdraw.post(form.value)); + const { data } = await safeClient(() => client.api.withdraw.post(form.value)); }