feat: 更新 @riwa/api-types 依赖至 0.0.23,添加用户管理功能及相关界面
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
"@better-scroll/core": "2.5.1",
|
||||
"@elysiajs/eden": "^1.4.5",
|
||||
"@iconify/vue": "5.0.0",
|
||||
"@riwa/api-types": "http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz",
|
||||
"@riwa/api-types": "http://192.168.1.2:9538/api/capp-eden-0.0.23.tgz",
|
||||
"@sa/axios": "workspace:*",
|
||||
"@sa/color": "workspace:*",
|
||||
"@sa/hooks": "workspace:*",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -18,8 +18,8 @@ importers:
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
|
||||
'@riwa/api-types':
|
||||
specifier: http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz
|
||||
version: '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@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.2:9538/api/capp-eden-0.0.23.tgz
|
||||
version: '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.23.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@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)))'
|
||||
'@sa/axios':
|
||||
specifier: workspace:*
|
||||
version: link:packages/axios
|
||||
@@ -496,9 +496,9 @@ packages:
|
||||
'@borewit/text-codec@0.1.1':
|
||||
resolution: {integrity: sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==}
|
||||
|
||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz':
|
||||
resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz}
|
||||
version: 0.0.9
|
||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.23.tgz':
|
||||
resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.23.tgz}
|
||||
version: 0.0.23
|
||||
peerDependencies:
|
||||
'@elysiajs/eden': ^1.4.6
|
||||
|
||||
@@ -4871,7 +4871,7 @@ snapshots:
|
||||
|
||||
'@borewit/text-codec@0.1.1': {}
|
||||
|
||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.9.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@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)))':
|
||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.23.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@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.19(@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))
|
||||
|
||||
|
||||
@@ -229,7 +229,8 @@ const local: App.I18n.Schema = {
|
||||
500: 'Server Error',
|
||||
'iframe-page': 'Iframe',
|
||||
home: 'Home',
|
||||
product: 'Product'
|
||||
product: 'Product',
|
||||
user: ' User'
|
||||
},
|
||||
page: {
|
||||
login: {
|
||||
|
||||
@@ -225,7 +225,8 @@ const local: App.I18n.Schema = {
|
||||
500: '服务器错误',
|
||||
'iframe-page': '外链页面',
|
||||
home: '首页',
|
||||
product: '产品管理'
|
||||
product: '产品管理',
|
||||
user: '用户管理'
|
||||
},
|
||||
page: {
|
||||
login: {
|
||||
|
||||
@@ -22,4 +22,5 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
||||
login: () => import("@/views/_builtin/login/index.vue"),
|
||||
home: () => import("@/views/home/index.vue"),
|
||||
product: () => import("@/views/product/index.vue"),
|
||||
user: () => import("@/views/user/index.vue"),
|
||||
};
|
||||
|
||||
@@ -81,5 +81,14 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
title: 'product',
|
||||
i18nKey: 'route.product'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'user',
|
||||
path: '/user',
|
||||
component: 'layout.base$view.user',
|
||||
meta: {
|
||||
title: 'user',
|
||||
i18nKey: 'route.user'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -169,7 +169,8 @@ const routeMap: RouteMap = {
|
||||
"home": "/home",
|
||||
"iframe-page": "/iframe-page/:url",
|
||||
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?",
|
||||
"product": "/product"
|
||||
"product": "/product",
|
||||
"user": "/user"
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
3
src/typings/elegant-router.d.ts
vendored
3
src/typings/elegant-router.d.ts
vendored
@@ -24,6 +24,7 @@ declare module "@elegant-router/types" {
|
||||
"iframe-page": "/iframe-page/:url";
|
||||
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
|
||||
"product": "/product";
|
||||
"user": "/user";
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -62,6 +63,7 @@ declare module "@elegant-router/types" {
|
||||
| "iframe-page"
|
||||
| "login"
|
||||
| "product"
|
||||
| "user"
|
||||
>;
|
||||
|
||||
/**
|
||||
@@ -85,6 +87,7 @@ declare module "@elegant-router/types" {
|
||||
| "login"
|
||||
| "home"
|
||||
| "product"
|
||||
| "user"
|
||||
>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,8 @@ export async function uploadToS3(file: File, options: UploadOptions) {
|
||||
|
||||
const { data } = await safeClient(
|
||||
client.api.file_storage.upload_url.post({
|
||||
...fetchOptions
|
||||
...fetchOptions,
|
||||
accessControl: 'public'
|
||||
})
|
||||
);
|
||||
|
||||
@@ -22,7 +23,7 @@ export async function uploadToS3(file: File, options: UploadOptions) {
|
||||
throw new Error('获取上传 URL 失败');
|
||||
}
|
||||
|
||||
const { fileId, uploadUrl, method, headers } = toRefs(data.value);
|
||||
const { fileId, uploadUrl, method, headers, publicUrl } = toRefs(data.value);
|
||||
|
||||
// 2. 上传文件到 S3
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
|
||||
31
src/views/user/components/wallet.vue
Normal file
31
src/views/user/components/wallet.vue
Normal 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
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