feat: 添加 useRouterBack 组合函数,更新相关组件以支持返回功能,优化 API 类型定义,更新依赖版本
This commit is contained in:
3
auto-imports.d.ts
vendored
3
auto-imports.d.ts
vendored
@@ -156,6 +156,7 @@ declare global {
|
|||||||
const useAsyncState: typeof import('@vueuse/core').useAsyncState
|
const useAsyncState: typeof import('@vueuse/core').useAsyncState
|
||||||
const useAttrs: typeof import('vue').useAttrs
|
const useAttrs: typeof import('vue').useAttrs
|
||||||
const useAuth: typeof import('./src/composables/useAuth').useAuth
|
const useAuth: typeof import('./src/composables/useAuth').useAuth
|
||||||
|
const useBack: typeof import('./src/composables/useBack').useBack
|
||||||
const useBase64: typeof import('@vueuse/core').useBase64
|
const useBase64: typeof import('@vueuse/core').useBase64
|
||||||
const useBattery: typeof import('@vueuse/core').useBattery
|
const useBattery: typeof import('@vueuse/core').useBattery
|
||||||
const useBluetooth: typeof import('@vueuse/core').useBluetooth
|
const useBluetooth: typeof import('@vueuse/core').useBluetooth
|
||||||
@@ -263,6 +264,7 @@ declare global {
|
|||||||
const useResizeObserver: typeof import('@vueuse/core').useResizeObserver
|
const useResizeObserver: typeof import('@vueuse/core').useResizeObserver
|
||||||
const useRoute: typeof import('vue-router').useRoute
|
const useRoute: typeof import('vue-router').useRoute
|
||||||
const useRouter: typeof import('vue-router').useRouter
|
const useRouter: typeof import('vue-router').useRouter
|
||||||
|
const useRouterBack: typeof import('./src/composables/useRouterBack').useRouterBack
|
||||||
const useSSRWidth: typeof import('@vueuse/core').useSSRWidth
|
const useSSRWidth: typeof import('@vueuse/core').useSSRWidth
|
||||||
const useScreenOrientation: typeof import('@vueuse/core').useScreenOrientation
|
const useScreenOrientation: typeof import('@vueuse/core').useScreenOrientation
|
||||||
const useScreenSafeArea: typeof import('@vueuse/core').useScreenSafeArea
|
const useScreenSafeArea: typeof import('@vueuse/core').useScreenSafeArea
|
||||||
@@ -623,6 +625,7 @@ declare module 'vue' {
|
|||||||
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
|
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
|
||||||
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
|
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
|
||||||
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
|
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
|
||||||
|
readonly useRouterBack: UnwrapRef<typeof import('./src/composables/useRouterBack')['useRouterBack']>
|
||||||
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
|
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
|
||||||
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
|
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
|
||||||
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
|
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
|
||||||
|
|||||||
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -51,7 +51,6 @@ declare module 'vue' {
|
|||||||
IonTabButton: typeof import('@ionic/vue')['IonTabButton']
|
IonTabButton: typeof import('@ionic/vue')['IonTabButton']
|
||||||
IonTabs: typeof import('@ionic/vue')['IonTabs']
|
IonTabs: typeof import('@ionic/vue')['IonTabs']
|
||||||
IonText: typeof import('@ionic/vue')['IonText']
|
IonText: typeof import('@ionic/vue')['IonText']
|
||||||
IonTextarea: typeof import('@ionic/vue')['IonTextarea']
|
|
||||||
IonTitle: typeof import('@ionic/vue')['IonTitle']
|
IonTitle: typeof import('@ionic/vue')['IonTitle']
|
||||||
IonToolbar: typeof import('@ionic/vue')['IonToolbar']
|
IonToolbar: typeof import('@ionic/vue')['IonToolbar']
|
||||||
LayoutDefault: typeof import('./src/components/layout/default.vue')['default']
|
LayoutDefault: typeof import('./src/components/layout/default.vue')['default']
|
||||||
@@ -115,7 +114,6 @@ declare global {
|
|||||||
const IonTabButton: typeof import('@ionic/vue')['IonTabButton']
|
const IonTabButton: typeof import('@ionic/vue')['IonTabButton']
|
||||||
const IonTabs: typeof import('@ionic/vue')['IonTabs']
|
const IonTabs: typeof import('@ionic/vue')['IonTabs']
|
||||||
const IonText: typeof import('@ionic/vue')['IonText']
|
const IonText: typeof import('@ionic/vue')['IonText']
|
||||||
const IonTextarea: typeof import('@ionic/vue')['IonTextarea']
|
|
||||||
const IonTitle: typeof import('@ionic/vue')['IonTitle']
|
const IonTitle: typeof import('@ionic/vue')['IonTitle']
|
||||||
const IonToolbar: typeof import('@ionic/vue')['IonToolbar']
|
const IonToolbar: typeof import('@ionic/vue')['IonToolbar']
|
||||||
const LayoutDefault: typeof import('./src/components/layout/default.vue')['default']
|
const LayoutDefault: typeof import('./src/components/layout/default.vue')['default']
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"@elysiajs/eden": "^1.4.5",
|
"@elysiajs/eden": "^1.4.5",
|
||||||
"@ionic/vue": "^8.7.11",
|
"@ionic/vue": "^8.7.11",
|
||||||
"@ionic/vue-router": "^8.7.11",
|
"@ionic/vue-router": "^8.7.11",
|
||||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.41.tgz",
|
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz",
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@vee-validate/yup": "^4.15.1",
|
"@vee-validate/yup": "^4.15.1",
|
||||||
"@vueuse/core": "^14.1.0",
|
"@vueuse/core": "^14.1.0",
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -54,8 +54,8 @@ importers:
|
|||||||
specifier: ^8.7.11
|
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))
|
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':
|
'@riwa/api-types':
|
||||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.41.tgz
|
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz
|
||||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.41.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)))
|
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.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':
|
'@tailwindcss/vite':
|
||||||
specifier: ^4.1.18
|
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))
|
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))
|
||||||
@@ -1354,9 +1354,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
||||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
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.41.tgz':
|
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz':
|
||||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.41.tgz}
|
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz}
|
||||||
version: 0.0.41
|
version: 0.0.44
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@elysiajs/eden': ^1.4.5
|
'@elysiajs/eden': ^1.4.5
|
||||||
|
|
||||||
@@ -6453,7 +6453,7 @@ snapshots:
|
|||||||
|
|
||||||
'@pkgr/core@0.2.9': {}
|
'@pkgr/core@0.2.9': {}
|
||||||
|
|
||||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.41.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.44.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:
|
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))
|
'@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))
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export type RwaData = Treaty.Data<typeof client.api.rwa.subscription.available_e
|
|||||||
|
|
||||||
export type MyIssueRwaData = Treaty.Data<typeof client.api.rwa.issuance.products.get>["data"][number];
|
export type MyIssueRwaData = Treaty.Data<typeof client.api.rwa.issuance.products.get>["data"][number];
|
||||||
|
|
||||||
export type MySubscribeRwaData = Treaty.Data<typeof client.api.rwa.subscription.my_subscriptions.get>;
|
export type MySubscribeRwaData = Treaty.Data<typeof client.api.rwa.subscription.my_subscriptions.get>["data"][number];
|
||||||
|
|
||||||
export type MySubscribeRwaBody = TreatyQuery<typeof client.api.rwa.subscription.my_subscriptions.get>;
|
export type MySubscribeRwaBody = TreatyQuery<typeof client.api.rwa.subscription.my_subscriptions.get>;
|
||||||
|
|
||||||
|
|||||||
10
src/composables/useRouterBack.ts
Normal file
10
src/composables/useRouterBack.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { router } from "@/router";
|
||||||
|
|
||||||
|
export function useRouterBack() {
|
||||||
|
if (window.history.state.back) {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
router.replace("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,6 @@
|
|||||||
import type { RouteRecordRaw } from "vue-router";
|
import type { RouteRecordRaw } from "vue-router";
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
// {
|
|
||||||
// path: "/auth",
|
|
||||||
// component: () => import("@/views/auth/index.vue"),
|
|
||||||
// children: [
|
|
||||||
// {
|
|
||||||
// path: "/auth/login",
|
|
||||||
// component: () => import("@/views/auth/login/index.vue"),
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// path: "/auth/signup",
|
|
||||||
// component: () => import("@/views/auth/signup/index.vue"),
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: "/auth/login",
|
path: "/auth/login",
|
||||||
component: () => import("@/views/auth/login/index.vue"),
|
component: () => import("@/views/auth/login/index.vue"),
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ async function handleSignInPhoneNumber(value: PhoneNumberVerifyClient) {
|
|||||||
useNavigateToRedirect(route.query.redirect as string);
|
useNavigateToRedirect(route.query.redirect as string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function onClose() {
|
||||||
|
useRouterBack();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -41,7 +44,7 @@ async function handleSignInPhoneNumber(value: PhoneNumberVerifyClient) {
|
|||||||
<IonHeader class="ion-no-border">
|
<IonHeader class="ion-no-border">
|
||||||
<IonToolbar class="ui-toolbar">
|
<IonToolbar class="ui-toolbar">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-button @click="$router.back()">
|
<ion-button @click="onClose">
|
||||||
<ion-icon slot="icon-only" :icon="closeOutline" />
|
<ion-icon slot="icon-only" :icon="closeOutline" />
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import type { DepositFiatBody } from "@/api/types";
|
import type { DepositFiatBody } from "@/api/types";
|
||||||
import { toastController } from "@ionic/vue";
|
import { loadingController, toastController } from "@ionic/vue";
|
||||||
import { client } from "@/api";
|
import { client, safeClient } from "@/api";
|
||||||
import { AssetCodeEnum, PaymentChannelEnum } from "@/api/enum";
|
import { AssetCodeEnum, PaymentChannelEnum } from "@/api/enum";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -12,6 +12,7 @@ const form = ref<DepositFiatBody>({
|
|||||||
paymentChannel: PaymentChannelEnum.FIAT,
|
paymentChannel: PaymentChannelEnum.FIAT,
|
||||||
});
|
});
|
||||||
const inputInstance = useTemplateRef<InputInstance>("inputInstance");
|
const inputInstance = useTemplateRef<InputInstance>("inputInstance");
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
function markTouched() {
|
function markTouched() {
|
||||||
inputInstance.value?.$el.classList.add("ion-touched");
|
inputInstance.value?.$el.classList.add("ion-touched");
|
||||||
@@ -31,8 +32,11 @@ function validate(value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
const { data, status } = await client.api.deposit.fiat.post(form.value);
|
const loading = await loadingController.create({
|
||||||
if (status === 200) {
|
message: "提交中...",
|
||||||
|
});
|
||||||
|
await loading.present();
|
||||||
|
await safeClient(client.api.deposit.fiat.post(form.value)).finally(async () => {
|
||||||
const toast = await toastController.create({
|
const toast = await toastController.create({
|
||||||
message: t("recharge.fiat.submitSuccess"),
|
message: t("recharge.fiat.submitSuccess"),
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
@@ -40,7 +44,9 @@ async function onSubmit() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await toast.present();
|
await toast.present();
|
||||||
}
|
loading.dismiss();
|
||||||
|
router.back();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
import { ribbonOutline } from "ionicons/icons";
|
import { ribbonOutline } from "ionicons/icons";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
function gotoMyIssues() {
|
||||||
|
router.replace("/trade-settings/my-issues");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -12,11 +17,7 @@ const { t } = useI18n();
|
|||||||
:description="t('asset.issue.apply.done.description')"
|
:description="t('asset.issue.apply.done.description')"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<ion-button
|
<ion-button expand="block" color="primary" @click="gotoMyIssues">
|
||||||
expand="block"
|
|
||||||
color="primary"
|
|
||||||
router-link="/layout/market"
|
|
||||||
>
|
|
||||||
{{ t('asset.issue.apply.done.viewProducts') }}
|
{{ t('asset.issue.apply.done.viewProducts') }}
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<script lang='ts' setup>
|
||||||
|
import { client, safeClient } from "@/api";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const model = defineModel({ type: String, default: "" });
|
||||||
|
|
||||||
|
const { data: categories } = await safeClient(() => client.api.rwa.category.categories.get());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ion-content :scroll-x="true" :scroll-y="false" class="w-full h-6">
|
||||||
|
<div class="flex items-center whitespace-nowrap space-x-4">
|
||||||
|
<div class="item" :class="{ active: model === '' }" @click="model = ''">
|
||||||
|
{{ t('market.category.all') }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="item in categories?.data"
|
||||||
|
:key="item.id"
|
||||||
|
class="item"
|
||||||
|
:class="{ active: model === item.id }"
|
||||||
|
@click="model = item.id"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@reference "tailwindcss";
|
||||||
|
|
||||||
|
ion-content::part(scroll) {
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
@apply px-3 py-1 rounded-full text-xs transition-all;
|
||||||
|
}
|
||||||
|
.ion-palette-dark {
|
||||||
|
.item {
|
||||||
|
@apply bg-(--ion-color-step-800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item.active {
|
||||||
|
@apply bg-(--ion-color-success) text-white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<script lang='ts' setup>
|
||||||
|
import type { MySubscribeRwaData } from "@/api/types";
|
||||||
|
import CryptocurrencyColorNuls from "~icons/cryptocurrency-color/nuls";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: MySubscribeRwaData[];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="space-y-3 antialiased mt-5">
|
||||||
|
<ion-grid>
|
||||||
|
<ion-row class="ion-align-items-center text-xs text-text-500">
|
||||||
|
<ion-col size="6">
|
||||||
|
<div>名称/编号</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-right">
|
||||||
|
单价
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col size="2">
|
||||||
|
<div class="text-right">
|
||||||
|
状态
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col size="3">
|
||||||
|
<div class="text-right">
|
||||||
|
总金额
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
</ion-grid>
|
||||||
|
<div v-for="item in data" :key="item.id">
|
||||||
|
<ion-grid>
|
||||||
|
<ion-row class="ion-align-items-center my-5">
|
||||||
|
<ion-col size="6" class="flex items-center">
|
||||||
|
<div class="mr-3">
|
||||||
|
<CryptocurrencyColorNuls class="text-3xl" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-sm font-semibold mb-1 truncate">
|
||||||
|
<!-- {{ item.product?.name }} -->
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center space-x-2">
|
||||||
|
<div class="text-xs text-text-500">
|
||||||
|
<!-- {{ item.product?.code }} -->
|
||||||
|
</div>
|
||||||
|
<div class="text-xs rounded-md px-1 py-0.5 bg-text-800">
|
||||||
|
<!-- {{ item.product.category?.name }} -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-xs text-right">
|
||||||
|
${{ Number(item.unitPrice) }}
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col size="2">
|
||||||
|
<div class="text-xs text-right">
|
||||||
|
{{ item.status }}
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col size="3">
|
||||||
|
<div class="text-lg font-bold text-primary text-right">
|
||||||
|
${{ Number(item.totalAmount) }}
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
</ion-grid>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='css' scoped></style>
|
||||||
@@ -1,22 +1,55 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import type { InfiniteScrollCustomEvent, RefresherCustomEvent } from "@ionic/vue";
|
||||||
import type { MySubscribeRwaBody, MySubscribeRwaData } from "@/api/types";
|
import type { MySubscribeRwaBody, MySubscribeRwaData } from "@/api/types";
|
||||||
import { client, safeClient } from "@/api";
|
import { client, safeClient } from "@/api";
|
||||||
|
import Category from "./components/category.vue";
|
||||||
|
import MySubscribeList from "./components/my-subscribe-list.vue";
|
||||||
|
|
||||||
const [query] = useResetRef<MySubscribeRwaBody>({
|
const [query] = useResetRef<MySubscribeRwaBody>({
|
||||||
|
categoryId: "",
|
||||||
limit: 20,
|
limit: 20,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const subscribeData = ref<MySubscribeRwaData>([]);
|
const subscribeData = ref<MySubscribeRwaData[]>([]);
|
||||||
const isFinished = ref(false);
|
const isFinished = ref(false);
|
||||||
|
|
||||||
async function fetchRwaData() {
|
async function fetchRwaData() {
|
||||||
const { data } = await safeClient(() => client.api.rwa.subscription.my_subscriptions.get({
|
const { data } = await safeClient(() => client.api.rwa.subscription.my_subscriptions.get({
|
||||||
query: query.value,
|
query: query.value,
|
||||||
}));
|
}));
|
||||||
subscribeData.value.push(...(data.value || []));
|
subscribeData.value.push(...(data.value?.data || []));
|
||||||
isFinished.value = (data.value?.length || 0) < query.value.limit!;
|
isFinished.value = (data.value?.data?.length || 0) < query.value.limit!;
|
||||||
}
|
}
|
||||||
|
function resetData() {
|
||||||
|
query.value.offset = 0;
|
||||||
|
subscribeData.value = [];
|
||||||
|
isFinished.value = false;
|
||||||
|
}
|
||||||
|
async function handleRefresh(event: RefresherCustomEvent) {
|
||||||
|
resetData();
|
||||||
|
await fetchRwaData();
|
||||||
|
setTimeout(() => {
|
||||||
|
event.target.complete();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
async function handleInfinite(event: InfiniteScrollCustomEvent) {
|
||||||
|
if (isFinished.value) {
|
||||||
|
event.target.complete();
|
||||||
|
event.target.disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
query.value.offset! += query.value.limit!;
|
||||||
|
await fetchRwaData();
|
||||||
|
setTimeout(() => {
|
||||||
|
event.target.complete();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => query.value.categoryId, async () => {
|
||||||
|
resetData();
|
||||||
|
await fetchRwaData();
|
||||||
|
});
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
fetchRwaData();
|
fetchRwaData();
|
||||||
@@ -33,11 +66,19 @@ onBeforeMount(() => {
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content :fullscreen="true" class="ion-padding">
|
<ion-content :fullscreen="true" class="ion-padding">
|
||||||
<ion-refresher slot="fixed">
|
<ion-refresher slot="fixed" @ion-refresh="handleRefresh($event)">
|
||||||
<ion-refresher-content />
|
<ion-refresher-content />
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<div class="space-y-3 antialiased mt-5" />
|
<Category v-model="query!.categoryId" />
|
||||||
|
<MySubscribeList :data="subscribeData" />
|
||||||
|
|
||||||
|
<ion-infinite-scroll threshold="100px" @ion-infinite="handleInfinite">
|
||||||
|
<ion-infinite-scroll-content
|
||||||
|
loading-spinner="bubbles"
|
||||||
|
loading-text="加载中..."
|
||||||
|
/>
|
||||||
|
</ion-infinite-scroll>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-page>
|
</ion-page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import type { GenericObject } from "vee-validate";
|
import type { GenericObject } from "vee-validate";
|
||||||
import type { WithdrawBody } from "@/api/types";
|
import type { WithdrawBody } from "@/api/types";
|
||||||
import { toastController } from "@ionic/vue";
|
import { loadingController, toastController } from "@ionic/vue";
|
||||||
import { ErrorMessage, Field, Form } from "vee-validate";
|
import { ErrorMessage, Field, Form } from "vee-validate";
|
||||||
import { client, safeClient } from "@/api";
|
import { client, safeClient } from "@/api";
|
||||||
import { AssetCodeEnum, ChainEnum, WithdrawMethodEnum } from "@/api/enum";
|
import { AssetCodeEnum, ChainEnum, WithdrawMethodEnum } from "@/api/enum";
|
||||||
@@ -29,16 +29,23 @@ const maxAmount = computed(() => {
|
|||||||
const schema = computed(() => createWithdrawSchema(t, maxAmount.value));
|
const schema = computed(() => createWithdrawSchema(t, maxAmount.value));
|
||||||
|
|
||||||
async function onSubmit(values: GenericObject) {
|
async function onSubmit(values: GenericObject) {
|
||||||
await safeClient(() => client.api.withdraw.post(values as WithdrawBody));
|
const loading = await loadingController.create({
|
||||||
const toast = await toastController.create({
|
message: "提交中...",
|
||||||
message: t("withdraw.successMessage"),
|
|
||||||
duration: 2000,
|
|
||||||
position: "bottom",
|
|
||||||
color: "success",
|
|
||||||
});
|
});
|
||||||
|
await loading.present();
|
||||||
|
|
||||||
await toast.present();
|
await safeClient(() => client.api.withdraw.post(values as WithdrawBody)).finally(async () => {
|
||||||
router.back();
|
const toast = await toastController.create({
|
||||||
|
message: t("withdraw.successMessage"),
|
||||||
|
duration: 2000,
|
||||||
|
position: "bottom",
|
||||||
|
color: "success",
|
||||||
|
});
|
||||||
|
|
||||||
|
await toast.present();
|
||||||
|
loading.dismiss();
|
||||||
|
router.back();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user