feat: 更新 @riwa/api-types 依赖至 0.0.23,添加用户管理功能及相关界面
This commit is contained in:
85
src/views/user/index.vue
Normal file
85
src/views/user/index.vue
Normal 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>
|
||||
Reference in New Issue
Block a user