feat: 更新交易 RWA 路由,添加编辑功能和相关视图
This commit is contained in:
@@ -124,8 +124,21 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: "/trade-rwa/:id",
|
path: "/trade-rwa/:id",
|
||||||
props: true,
|
props: true,
|
||||||
component: () => import("@/views/trade-rwa/index.vue"),
|
component: () => import("@/views/trade-rwa/outlet.vue"),
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "",
|
||||||
|
component: () => import("@/views/trade-rwa/index.vue"),
|
||||||
|
meta: { requiresAuth: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "edit",
|
||||||
|
name: "trade-rwa-edit",
|
||||||
|
component: () => import("@/views/trade-rwa/edit.vue"),
|
||||||
|
meta: { requiresAuth: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
23
src/views/trade-rwa/edit.vue
Normal file
23
src/views/trade-rwa/edit.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script lang='ts' setup>
|
||||||
|
import type { RwaData } from "@/api/types";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: RwaData;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ion-page>
|
||||||
|
<ion-header>
|
||||||
|
<ion-toolbar class="ui-toolbar">
|
||||||
|
<ion-back-button slot="start" text="" />
|
||||||
|
<ion-title />
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content :fullscreen="true" class="ion-padding">
|
||||||
|
{{ data }}
|
||||||
|
</ion-content>
|
||||||
|
</ion-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='css' scoped></style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import type { RwaData } from "@/api/types";
|
||||||
import { toastController } from "@ionic/vue";
|
import { toastController } from "@ionic/vue";
|
||||||
import CryptocurrencyColorNuls from "~icons/cryptocurrency-color/nuls";
|
import CryptocurrencyColorNuls from "~icons/cryptocurrency-color/nuls";
|
||||||
import IcSharpEditNote from "~icons/ic/sharp-edit-note";
|
import IcSharpEditNote from "~icons/ic/sharp-edit-note";
|
||||||
@@ -7,17 +8,17 @@ import RwaAbout from "./components/about.vue";
|
|||||||
import RwaBase from "./components/base.vue";
|
import RwaBase from "./components/base.vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
id: string;
|
data: RwaData;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { data } = safeClient(client.api.rwa.subscription.available_editions({ editionId: props.id }).get());
|
|
||||||
const model = useTemplateRef<ModalInstance>("model");
|
const model = useTemplateRef<ModalInstance>("model");
|
||||||
|
|
||||||
async function handleSubscribe(val: number) {
|
async function handleSubscribe(val: number) {
|
||||||
await safeClient(client.api.rwa.subscription.apply.post({
|
await safeClient(client.api.rwa.subscription.apply.post({
|
||||||
editionId: props.id,
|
editionId: props.data.id,
|
||||||
quantity: String(val),
|
quantity: String(val),
|
||||||
}));
|
}));
|
||||||
const toast = await toastController.create({
|
const toast = await toastController.create({
|
||||||
@@ -30,6 +31,9 @@ async function handleSubscribe(val: number) {
|
|||||||
await toast.present();
|
await toast.present();
|
||||||
model.value?.$el.dismiss();
|
model.value?.$el.dismiss();
|
||||||
}
|
}
|
||||||
|
function gotoEdit() {
|
||||||
|
router.push({ name: "trade-rwa-edit" });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -56,7 +60,7 @@ async function handleSubscribe(val: number) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center my-3">
|
<div class="flex items-center my-3" @click="gotoEdit">
|
||||||
<IcSharpEditNote class="inline-block text-xl mr-1 text-text-500" />
|
<IcSharpEditNote class="inline-block text-xl mr-1 text-text-500" />
|
||||||
<div class="text-xs">
|
<div class="text-xs">
|
||||||
编辑资产
|
编辑资产
|
||||||
|
|||||||
27
src/views/trade-rwa/outlet.vue
Normal file
27
src/views/trade-rwa/outlet.vue
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<script lang='ts' setup>
|
||||||
|
import { client, safeClient } from "@/api";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
id: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const { data } = safeClient(client.api.rwa.subscription.available_editions({ editionId: props.id }).get());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ion-page>
|
||||||
|
<ion-header>
|
||||||
|
<ion-toolbar class="ui-toolbar">
|
||||||
|
<ion-back-button slot="start" text="" />
|
||||||
|
<ion-title>
|
||||||
|
{{ data?.product.code }}
|
||||||
|
</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content :fullscreen="true" class="ion-padding">
|
||||||
|
<RouterView :data="data" />
|
||||||
|
</ion-content>
|
||||||
|
</ion-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
Reference in New Issue
Block a user