This commit is contained in:
2026-07-03 10:57:14 +08:00
parent 4992191da9
commit 61d74fcc04
4 changed files with 33 additions and 9 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -28,7 +28,7 @@
} }
})(); })();
</script> </script>
<script type="module" crossorigin src="/assets/index-BpU4LxvO.js"></script> <script type="module" crossorigin src="/assets/index-875Agalq.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css"> <link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
</head> </head>
<body> <body>
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Button, Card, Space, Table, Tag, Typography, message, Modal, Form, Input, Select, InputNumber, Button, Card, Space, Table, Tag, Tooltip, Typography, message, Modal, Form, Input, Select, InputNumber,
} from 'antd'; } from 'antd';
import { import {
MenuOutlined, ReloadOutlined, PlusOutlined, EyeOutlined, EditOutlined, DeleteOutlined, MenuOutlined, ReloadOutlined, PlusOutlined, EyeOutlined, EditOutlined, DeleteOutlined,
@@ -143,8 +143,16 @@ const AdminOauthAppList: React.FC = () => {
{ title: '应用ID', dataIndex: 'app_id', { title: '应用ID', dataIndex: 'app_id',
render: (v: string) => <Typography.Text>{v}</Typography.Text>, render: (v: string) => <Typography.Text>{v}</Typography.Text>,
}, },
{ title: '应用密钥', dataIndex: 'secret', { title: '应用密钥', dataIndex: 'secret', width: 180,
render: (v: string) => <Typography.Text>{v}</Typography.Text>, render: (v: string) => {
if (!v) return '-';
const short = v.length > 12 ? `${v.slice(0, 6)}...${v.slice(-4)}` : v;
return (
<Tooltip title={v} placement="topLeft">
<Typography.Text style={{ fontSize: 12 }}>{short}</Typography.Text>
</Tooltip>
);
},
}, },
{ title: '开户方式', dataIndex: 'open_type', { title: '开户方式', dataIndex: 'open_type',
render: (v: number) => { render: (v: number) => {
@@ -164,8 +172,15 @@ const AdminOauthAppList: React.FC = () => {
{ title: '状态', dataIndex: 'status', { title: '状态', dataIndex: 'status',
render: (v: number) => <Tag color={v === 1 ? 'green' : 'red'}>{v === 1 ? '正常' : '禁用'}</Tag>, render: (v: number) => <Tag color={v === 1 ? 'green' : 'red'}>{v === 1 ? '正常' : '禁用'}</Tag>,
}, },
{ title: '授权URL', dataIndex: 'auth_url', { title: '授权URL', dataIndex: 'auth_url', width: 220,
render: (v: string) => <Typography.Text>{v}</Typography.Text>, render: (v: string) => {
if (!v) return '-';
return (
<Tooltip title={v} placement="topLeft">
<Typography.Text style={{ fontSize: 12 }} ellipsis>{v.length > 30 ? `${v.slice(0, 27)}...` : v}</Typography.Text>
</Tooltip>
);
},
}, },
{ title: '创建人', dataIndex: 'create_by', { title: '创建人', dataIndex: 'create_by',
render: (v: string) => <Typography.Text>{v}</Typography.Text>, render: (v: string) => <Typography.Text>{v}</Typography.Text>,
@@ -225,7 +240,7 @@ const AdminOauthAppList: React.FC = () => {
showTotal: (t) => `${t} 条记录`, showTotal: (t) => `${t} 条记录`,
onChange: (p) => { setPage(p); load(p); }, onChange: (p) => { setPage(p); load(p); },
}} }}
scroll={{ x: 800 }} scroll={{ x: 1400 }}
/> />
</Card> </Card>
@@ -28,7 +28,16 @@ async def list_user_oauth_apps(
if app_id is not None: if app_id is not None:
query = query.where(UserOAuthApp.app_id.like(f"%{app_id}%")) query = query.where(UserOAuthApp.app_id.like(f"%{app_id}%"))
total_result = await db.execute(select(func.count(UserOAuthApp.id)).where(UserOAuthApp.deleted_at.is_(None))) count_query = select(func.count(UserOAuthApp.id)).where(UserOAuthApp.deleted_at.is_(None))
if open_type is not None:
count_query = count_query.where(UserOAuthApp.open_type == open_type)
if status is not None:
count_query = count_query.where(UserOAuthApp.status == status)
if create_by is not None:
count_query = count_query.where(UserOAuthApp.create_by == create_by)
if app_id is not None:
count_query = count_query.where(UserOAuthApp.app_id.like(f"%{app_id}%"))
total_result = await db.execute(count_query)
total = total_result.scalar() or 0 total = total_result.scalar() or 0
result = await db.execute(query.offset((page - 1) * page_size).limit(page_size)) result = await db.execute(query.offset((page - 1) * page_size).limit(page_size))