feat: 更新 @riwa/api-types 依赖版本至 0.0.130,并修正转账用户ID引用及表单验证逻辑
This commit is contained in:
@@ -35,7 +35,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.7:9527/api/riwa-eden-0.0.128.tgz",
|
"@riwa/api-types": "http://192.168.1.7:9527/api/riwa-eden-0.0.130.tgz",
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@vee-validate/zod": "^4.15.1",
|
"@vee-validate/zod": "^4.15.1",
|
||||||
"@vueuse/core": "^14.1.0",
|
"@vueuse/core": "^14.1.0",
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -69,8 +69,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.7:9527/api/riwa-eden-0.0.128.tgz
|
specifier: http://192.168.1.7:9527/api/riwa-eden-0.0.130.tgz
|
||||||
version: '@riwa/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.128.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: '@riwa/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.130.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))
|
||||||
@@ -2804,9 +2804,9 @@ packages:
|
|||||||
'@remirror/core-constants@3.0.0':
|
'@remirror/core-constants@3.0.0':
|
||||||
resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==}
|
resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==}
|
||||||
|
|
||||||
'@riwa/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.128.tgz':
|
'@riwa/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.130.tgz':
|
||||||
resolution: {tarball: http://192.168.1.7:9527/api/riwa-eden-0.0.128.tgz}
|
resolution: {tarball: http://192.168.1.7:9527/api/riwa-eden-0.0.130.tgz}
|
||||||
version: 0.0.128
|
version: 0.0.130
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@elysiajs/eden': ^1.4.5
|
'@elysiajs/eden': ^1.4.5
|
||||||
|
|
||||||
@@ -12161,7 +12161,7 @@ snapshots:
|
|||||||
|
|
||||||
'@remirror/core-constants@3.0.0': {}
|
'@remirror/core-constants@3.0.0': {}
|
||||||
|
|
||||||
'@riwa/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.128.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/eden@http://192.168.1.7:9527/api/riwa-eden-0.0.130.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))
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import MaterialSymbolsUpload from "~icons/material-symbols/upload";
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { userProfile } = storeToRefs(userStore);
|
const { userProfile } = storeToRefs(userStore);
|
||||||
const url = computed(() => {
|
const url = computed(() => {
|
||||||
return `/transfer_to_user/${userProfile.value?.uid}`;
|
return `/transfer_to_user/${userProfile.value?.userId}`;
|
||||||
});
|
});
|
||||||
const qrcode = useQRCode(url, {
|
const qrcode = useQRCode(url, {
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import type { GenericObject } from "vee-validate";
|
import type { GenericObject } from "vee-validate";
|
||||||
import type { FormInstance } from "@/utils";
|
import type { FormInstance } from "@/utils";
|
||||||
import { loadingController, modalController, toastController } from "@ionic/vue";
|
import { loadingController, modalController, toastController } from "@ionic/vue";
|
||||||
|
import { toTypedSchema } from "@vee-validate/zod";
|
||||||
import { ErrorMessage, Field, Form } from "vee-validate";
|
import { ErrorMessage, Field, Form } from "vee-validate";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { client, safeClient } from "@/api";
|
import { client, safeClient } from "@/api";
|
||||||
@@ -23,7 +24,7 @@ const targetUser = ref<any>(null);
|
|||||||
// 表单初始值
|
// 表单初始值
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
assetCode: "USDT",
|
assetCode: "USDT",
|
||||||
amount: "",
|
amount: undefined,
|
||||||
memo: "",
|
memo: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38,15 +39,14 @@ const availableBalance = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 验证规则
|
// 验证规则
|
||||||
const schema = computed(() => z.object({
|
const schema = computed(() => toTypedSchema(z.object({
|
||||||
assetCode: z.string().min(1, "请选择币种"),
|
assetCode: z.string().min(1, "请选择币种"),
|
||||||
amount: z
|
amount: z
|
||||||
.string()
|
.number({ required_error: "请输入转账金额", invalid_type_error: "请输入有效的数字" })
|
||||||
.min(1, "请输入转账金额")
|
.positive("转账金额必须大于0")
|
||||||
.refine(value => Number(value) > 0, "转账金额必须大于0")
|
.refine(value => value <= Number(availableBalance.value), `可用余额不足,当前余额:${availableBalance.value}`),
|
||||||
.refine(value => Number(value) <= Number(availableBalance.value), `可用余额不足,当前余额:${availableBalance.value}`),
|
|
||||||
memo: z.string().optional(),
|
memo: z.string().optional(),
|
||||||
}));
|
})));
|
||||||
|
|
||||||
// 打开币种选择
|
// 打开币种选择
|
||||||
async function openSelectCurrency() {
|
async function openSelectCurrency() {
|
||||||
@@ -66,7 +66,7 @@ async function openSelectCurrency() {
|
|||||||
|
|
||||||
// 设置全部金额
|
// 设置全部金额
|
||||||
function setMaxAmount() {
|
function setMaxAmount() {
|
||||||
formInst.value?.setFieldValue("amount", availableBalance.value);
|
formInst.value?.setFieldValue("amount", Number(availableBalance.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取目标用户信息
|
// 获取目标用户信息
|
||||||
@@ -76,7 +76,7 @@ async function fetchTargetUser() {
|
|||||||
});
|
});
|
||||||
await loading.present();
|
await loading.present();
|
||||||
|
|
||||||
const { data, error } = await safeClient(() => client.api.user({ uid: props.id }).get());
|
const { data, error } = await safeClient(() => client.api.transfer.payee({ userId: props.id }).verify.get());
|
||||||
|
|
||||||
await loading.dismiss();
|
await loading.dismiss();
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ async function onSubmit(values: GenericObject) {
|
|||||||
|
|
||||||
const { error } = await safeClient(() => client.api.transfer.post({
|
const { error } = await safeClient(() => client.api.transfer.post({
|
||||||
assetCode: values.assetCode as string,
|
assetCode: values.assetCode as string,
|
||||||
amount: values.amount as string,
|
amount: String(values.amount),
|
||||||
toUserId: props.id,
|
toUserId: props.id,
|
||||||
memo: values.memo as string,
|
memo: values.memo as string,
|
||||||
}));
|
}));
|
||||||
@@ -153,10 +153,10 @@ onMounted(() => {
|
|||||||
<ui-avatar :src="targetUser.avatar" class="size-14" />
|
<ui-avatar :src="targetUser.avatar" class="size-14" />
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<div class="text-base font-semibold">
|
<div class="text-base font-semibold">
|
||||||
{{ targetUser.nickname || targetUser.username }}
|
{{ targetUser.toUserDisplayName }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-text-400 mt-1">
|
<div class="text-sm text-text-400 mt-1">
|
||||||
ID: {{ targetUser.uid }}
|
ID: {{ id }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user