feat: 更新 API 类型和组件,重命名市场为交易,添加操作包装器组件

This commit is contained in:
2025-12-15 00:25:03 +07:00
parent a2ca00243e
commit 8d0ba768a9
9 changed files with 104 additions and 23 deletions

4
components.d.ts vendored
View File

@@ -19,6 +19,7 @@ declare module 'vue' {
IonApp: typeof import('@ionic/vue')['IonApp'] IonApp: typeof import('@ionic/vue')['IonApp']
IonAvatar: typeof import('@ionic/vue')['IonAvatar'] IonAvatar: typeof import('@ionic/vue')['IonAvatar']
IonBackButton: typeof import('@ionic/vue')['IonBackButton'] IonBackButton: typeof import('@ionic/vue')['IonBackButton']
IonBackdrop: typeof import('@ionic/vue')['IonBackdrop']
IonButton: typeof import('@ionic/vue')['IonButton'] IonButton: typeof import('@ionic/vue')['IonButton']
IonButtons: typeof import('@ionic/vue')['IonButtons'] IonButtons: typeof import('@ionic/vue')['IonButtons']
IonCard: typeof import('@ionic/vue')['IonCard'] IonCard: typeof import('@ionic/vue')['IonCard']
@@ -26,6 +27,7 @@ declare module 'vue' {
IonCardHeader: typeof import('@ionic/vue')['IonCardHeader'] IonCardHeader: typeof import('@ionic/vue')['IonCardHeader']
IonCardSubtitle: typeof import('@ionic/vue')['IonCardSubtitle'] IonCardSubtitle: typeof import('@ionic/vue')['IonCardSubtitle']
IonCardTitle: typeof import('@ionic/vue')['IonCardTitle'] IonCardTitle: typeof import('@ionic/vue')['IonCardTitle']
IonCheckbox: typeof import('@ionic/vue')['IonCheckbox']
IonContent: typeof import('@ionic/vue')['IonContent'] IonContent: typeof import('@ionic/vue')['IonContent']
IonHeader: typeof import('@ionic/vue')['IonHeader'] IonHeader: typeof import('@ionic/vue')['IonHeader']
IonIcon: typeof import('@ionic/vue')['IonIcon'] IonIcon: typeof import('@ionic/vue')['IonIcon']
@@ -70,6 +72,7 @@ declare global {
const IonApp: typeof import('@ionic/vue')['IonApp'] const IonApp: typeof import('@ionic/vue')['IonApp']
const IonAvatar: typeof import('@ionic/vue')['IonAvatar'] const IonAvatar: typeof import('@ionic/vue')['IonAvatar']
const IonBackButton: typeof import('@ionic/vue')['IonBackButton'] const IonBackButton: typeof import('@ionic/vue')['IonBackButton']
const IonBackdrop: typeof import('@ionic/vue')['IonBackdrop']
const IonButton: typeof import('@ionic/vue')['IonButton'] const IonButton: typeof import('@ionic/vue')['IonButton']
const IonButtons: typeof import('@ionic/vue')['IonButtons'] const IonButtons: typeof import('@ionic/vue')['IonButtons']
const IonCard: typeof import('@ionic/vue')['IonCard'] const IonCard: typeof import('@ionic/vue')['IonCard']
@@ -77,6 +80,7 @@ declare global {
const IonCardHeader: typeof import('@ionic/vue')['IonCardHeader'] const IonCardHeader: typeof import('@ionic/vue')['IonCardHeader']
const IonCardSubtitle: typeof import('@ionic/vue')['IonCardSubtitle'] const IonCardSubtitle: typeof import('@ionic/vue')['IonCardSubtitle']
const IonCardTitle: typeof import('@ionic/vue')['IonCardTitle'] const IonCardTitle: typeof import('@ionic/vue')['IonCardTitle']
const IonCheckbox: typeof import('@ionic/vue')['IonCheckbox']
const IonContent: typeof import('@ionic/vue')['IonContent'] const IonContent: typeof import('@ionic/vue')['IonContent']
const IonHeader: typeof import('@ionic/vue')['IonHeader'] const IonHeader: typeof import('@ionic/vue')['IonHeader']
const IonIcon: typeof import('@ionic/vue')['IonIcon'] const IonIcon: typeof import('@ionic/vue')['IonIcon']

View File

@@ -23,7 +23,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.36:9527/api/riwa-api-types-0.0.6.tgz", "@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.12.tgz",
"@tailwindcss/vite": "^4.1.18", "@tailwindcss/vite": "^4.1.18",
"@vueuse/core": "^14.1.0", "@vueuse/core": "^14.1.0",
"better-auth": "^1.4.6", "better-auth": "^1.4.6",

12
pnpm-lock.yaml generated
View File

@@ -36,8 +36,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.36:9527/api/riwa-api-types-0.0.6.tgz specifier: http://192.168.1.36:9527/api/riwa-api-types-0.0.12.tgz
version: http://192.168.1.36:9527/api/riwa-api-types-0.0.6.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.36:9527/api/riwa-api-types-0.0.12.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))
@@ -1251,9 +1251,9 @@ packages:
'@quansync/fs@1.0.0': '@quansync/fs@1.0.0':
resolution: {integrity: sha512-4TJ3DFtlf1L5LDMaM6CanJ/0lckGNtJcMjQ1NAV6zDmA0tEHKZtxNKin8EgPaVX1YzljbxckyT2tJrpQKAtngQ==} resolution: {integrity: sha512-4TJ3DFtlf1L5LDMaM6CanJ/0lckGNtJcMjQ1NAV6zDmA0tEHKZtxNKin8EgPaVX1YzljbxckyT2tJrpQKAtngQ==}
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.6.tgz': '@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.12.tgz':
resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.6.tgz} resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.12.tgz}
version: 0.0.6 version: 0.0.12
peerDependencies: peerDependencies:
'@elysiajs/eden': ^1.4.5 '@elysiajs/eden': ^1.4.5
@@ -6053,7 +6053,7 @@ snapshots:
dependencies: dependencies:
quansync: 1.0.0 quansync: 1.0.0
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.6.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.12.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))

View File

@@ -11,11 +11,11 @@ export type DepositFiatData = Treaty.Data<typeof client.api.deposit.fiat.post>;
export type BalancesData = Treaty.Data<typeof client.api.asset.balances.get>; export type BalancesData = Treaty.Data<typeof client.api.asset.balances.get>;
export type WithdrawBody = Omit<Parameters<typeof client.api.asset.withdraw.post>[0], "assetCode" | "withdrawMethod"> & { export type WithdrawBody = Omit<Parameters<typeof client.api.withdraw.post>[0], "assetCode" | "withdrawMethod"> & {
assetCode: AssetCodeEnum; assetCode: AssetCodeEnum;
withdrawMethod: WithdrawMethodEnum; withdrawMethod: WithdrawMethodEnum;
}; };
export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>; export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>["userProfile"];
export type UpdateUserProfileBody = Parameters<typeof client.api.user.profile.put>[0]; export type UpdateUserProfileBody = Parameters<typeof client.api.user.profile.put>[0];

View File

@@ -5,14 +5,14 @@
<IonPage> <IonPage>
<IonHeader> <IonHeader>
<IonToolbar> <IonToolbar>
<IonTitle>Market</IonTitle> <IonTitle>Trade</IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonHeader collapse="condense"> <IonHeader collapse="condense">
<IonToolbar> <IonToolbar>
<IonTitle size="large"> <IonTitle size="large">
Market Trade
</IonTitle> </IonTitle>
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>

View File

@@ -0,0 +1,76 @@
<script lang='ts' setup>
import { cartOutline } from "ionicons/icons";
const model = defineModel<"sale" | "buy" | null>();
</script>
<template>
<div v-if="model === null" class="operation-container">
<div class="wrapper" />
<div class="box">
<div class="card sale" @click="model = 'sale'">
<ion-icon :icon="cartOutline" />
<text>My Sale</text>
</div>
<div class="card buy" @click="model = 'buy'">
<ion-icon :icon="cartOutline" />
<text>My Purchase</text>
</div>
</div>
</div>
</template>
<style lang='css' scoped>
.operation-container {
position: relative;
width: 100%;
height: 100%;
}
.wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--ion-color-dark);
opacity: 0.3;
}
.box {
position: absolute;
bottom: 0;
left: 50%;
transform: translateY(-30%) translateX(-50%);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100px;
}
.card {
width: 94px;
height: 97px;
border-radius: 18px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);
}
.card ion-icon {
font-size: 1.7rem;
}
.card text {
margin-top: 10px;
font-size: 0.8rem;
font-weight: 500;
}
.card.sale {
background: linear-gradient(231deg, #8b6bff 6%, #49eeff 104%);
}
.card.buy {
background: linear-gradient(231deg, #ff6b6b 6%, #ffcc00 104%);
margin-left: 20px;
}
</style>

View File

@@ -1,4 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { cartOutline } from "ionicons/icons";
import OperationWrapper from "./components/operation-wrapper.vue";
const current = ref<"sale" | "buy" | null>(null);
</script> </script>
<template> <template>
@@ -9,13 +13,10 @@
</IonToolbar> </IonToolbar>
</IonHeader> </IonHeader>
<IonContent :fullscreen="true"> <IonContent :fullscreen="true">
<IonHeader collapse="condense"> <OperationWrapper v-model="current" />
<IonToolbar>
<IonTitle size="large">
Market
</IonTitle>
</IonToolbar>
</IonHeader>
</IonContent> </IonContent>
</IonPage> </IonPage>
</template> </template>
<style scoped>
</style>

View File

@@ -11,7 +11,7 @@ const userProfile = ref<UserProfileData | null>(null);
async function getUserProfile() { async function getUserProfile() {
const { data } = await client.api.user.profile.get(); const { data } = await client.api.user.profile.get();
if (data) { if (data) {
userProfile.value = data; userProfile.value = data.userProfile;
} }
} }
@@ -116,19 +116,19 @@ onMounted(() => {
<ui-avatar class="size-25" /> <ui-avatar class="size-25" />
</div> </div>
<div class="mt-4 text-lg font-semibold"> <div class="mt-4 text-lg font-semibold">
{{ userProfile?.fullName || 'User Name' }} {{ userProfile?.nickname || 'User Name' }}
</div> </div>
</div> </div>
<!-- User Info List --> <!-- User Info List -->
<ion-list class="mt-5"> <ion-list class="mt-5">
<ion-item button @click="handleEditField('fullName', 'Full Name')"> <ion-item button @click="handleEditField('nickname', 'Nickname')">
<ion-label> <ion-label>
<p class="text-xs text-text-400"> <p class="text-xs text-text-400">
Full Name Full Name
</p> </p>
<h2 class="mt-1"> <h2 class="mt-1">
{{ userProfile?.fullName || 'Not set' }} {{ userProfile?.nickname || 'Not set' }}
</h2> </h2>
</ion-label> </ion-label>
</ion-item> </ion-item>

View File

@@ -40,7 +40,7 @@ function handleCurrentChange() {
} }
async function onSubmit() { async function onSubmit() {
const { data } = await safeClient(client.api.asset.withdraw.post(form.value)); const { data } = await safeClient(client.api.withdraw.post(form.value));
} }
</script> </script>