feat: 更新 @riwa/api-types 依赖至 0.0.23,添加用户管理功能及相关界面

This commit is contained in:
2026-01-19 18:25:27 +07:00
parent 9b36a114b3
commit a2ef52be99
11 changed files with 145 additions and 12 deletions

View File

@@ -0,0 +1,31 @@
<script lang="ts" setup>
import { useTemplateRef } from 'vue';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
defineOptions({
name: 'WalletDialog'
});
const props = defineProps<{
userId: string;
}>();
const tableInst = useTemplateRef<TableInst>('tableInst');
const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() => client.api.admin.wallet.balances.get({ query: { userId: props.userId } }));
};
const columns: TableBaseColumns = [
{
key: 'id',
title: 'ID'
}
];
</script>
<template>
<TableBase ref="tableInst" :fetch-data="fetchData" :columns="columns" />
</template>
<style lang="css" scoped></style>

85
src/views/user/index.vue Normal file
View File

@@ -0,0 +1,85 @@
<script lang="ts" setup>
import { h, useTemplateRef } from 'vue';
import { useDialog } from 'naive-ui';
import dayjs from 'dayjs';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
import Wallet from './components/wallet.vue';
const dialog = useDialog();
const tableInst = useTemplateRef<TableInst>('tableInst');
const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() =>
client.api.admin.users.get({
query: {
...pagination,
...filter
}
})
);
};
const columns: TableBaseColumns = [
{
key: 'uid',
title: 'UID',
width: 120
},
{
key: 'user.name',
title: '姓名'
},
{
key: 'user.username',
title: '手机号'
},
{
key: 'referralCode',
title: '推荐码'
},
{
key: 'createdAt',
title: '创建时间',
render: (row: any) => {
return dayjs(row.createdAt).format('YYYY-MM-DD HH:mm');
}
},
{
key: 'operations',
title: '操作',
width: 120,
fixed: 'right',
operations: (row: any) => [
{
contentText: '钱包',
size: 'small',
onClick: () => {
dialog.create({
title: '用户钱包',
style: { width: '1000px' },
content: () => h(Wallet, { userId: row.userId })
});
}
}
]
}
];
</script>
<template>
<TableBase
ref="tableInst"
:fetch-data="fetchData"
:columns="columns"
:scroll-x="800"
:header-operations="{
add: false,
refresh: true,
columns: true
}"
/>
</template>
<style lang="css" scoped></style>