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

View File

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

12
pnpm-lock.yaml generated
View File

@@ -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.6.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)))
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.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':
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))
@@ -1251,9 +1251,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.6.tgz':
resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.6.tgz}
version: 0.0.6
'@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.12.tgz}
version: 0.0.12
peerDependencies:
'@elysiajs/eden': ^1.4.5
@@ -6053,7 +6053,7 @@ snapshots:
dependencies:
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:
'@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 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;
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];

View File

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

View File

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

View File

@@ -40,7 +40,7 @@ function handleCurrentChange() {
}
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>