mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
390 lines
8.9 KiB
HTML
390 lines
8.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>应用</title>
|
|
|
|
<style>
|
|
header {
|
|
display: flex;
|
|
justify-content: start;
|
|
align-items: center;
|
|
margin-bottom: 30px;
|
|
flex-wrap: wrap;
|
|
gap: 20px;
|
|
}
|
|
|
|
header h1 {
|
|
font-size: 2.5rem;
|
|
font-weight: 700;
|
|
color: var(--primary-color);
|
|
margin: 0;
|
|
}
|
|
|
|
.search-bar {
|
|
position: relative;
|
|
margin-left: auto;
|
|
max-width: 400px;
|
|
width: 100%;
|
|
}
|
|
|
|
.search-bar input {
|
|
width: 100%;
|
|
padding: 12px 20px;
|
|
padding-right: 40px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 30px;
|
|
font-size: 16px;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.search-bar input:focus {
|
|
outline: none;
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
|
|
}
|
|
|
|
.search-bar i {
|
|
position: absolute;
|
|
top: 50%;
|
|
right: 15px;
|
|
transform: translateY(-50%);
|
|
color: var(--secondary-color);
|
|
}
|
|
|
|
.filters {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-bottom: 25px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.filter-btn {
|
|
padding: 8px 16px;
|
|
background-color: var(--card-background);
|
|
border: 1px solid #ddd;
|
|
border-radius: 20px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.filter-btn:hover {
|
|
background-color: #f0f0f0;
|
|
}
|
|
|
|
.filter-btn.active {
|
|
background-color: var(--primary-color);
|
|
color: white;
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
.app-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
gap: 25px;
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.app-card {
|
|
background-color: var(--card-background);
|
|
border-radius: var(--border-radius);
|
|
overflow: hidden;
|
|
box-shadow: var(--box-shadow);
|
|
transition: var(--transition);
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.app-card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.app-card-header {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 20px;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.app-icon {
|
|
width: 50px;
|
|
height: 50px;
|
|
background-color: #f0f0f0;
|
|
border-radius: 12px;
|
|
margin-right: 15px;
|
|
overflow: hidden;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.app-icon img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.app-title h2 {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.app-status {
|
|
font-size: 12px;
|
|
border-radius: 20px;
|
|
padding: 3px 10px;
|
|
display: inline-block;
|
|
text-transform: capitalize;
|
|
}
|
|
|
|
.status-active {
|
|
background-color: rgba(40, 167, 69, 0.1);
|
|
color: var(--success-color);
|
|
}
|
|
|
|
.status-pending {
|
|
background-color: rgba(255, 193, 7, 0.1);
|
|
color: var(--warning-color);
|
|
}
|
|
|
|
.status-inactive {
|
|
background-color: rgba(220, 53, 69, 0.1);
|
|
color: var(--danger-color);
|
|
}
|
|
|
|
.app-card-body {
|
|
padding: 20px;
|
|
flex-grow: 1;
|
|
}
|
|
|
|
.app-description {
|
|
color: var(--secondary-color);
|
|
margin-bottom: 15px;
|
|
font-size: 14px;
|
|
min-height: 40px;
|
|
}
|
|
|
|
.app-meta {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 13px;
|
|
color: var(--secondary-color);
|
|
}
|
|
|
|
.app-card-footer {
|
|
padding: 15px 20px;
|
|
background-color: #f9f9f9;
|
|
border-top: 1px solid #eee;
|
|
}
|
|
|
|
.app-actions {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.btn {
|
|
padding: 8px 16px;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: var(--transition);
|
|
text-align: center;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--primary-color);
|
|
color: white;
|
|
border: none;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background-color: #3955d1;
|
|
}
|
|
|
|
.btn-outline {
|
|
background-color: transparent;
|
|
color: var(--primary-color);
|
|
border: 1px solid var(--primary-color);
|
|
}
|
|
|
|
.btn-outline:hover {
|
|
background-color: rgba(74, 108, 247, 0.1);
|
|
}
|
|
|
|
.loading {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 50px;
|
|
grid-column: 1 / -1;
|
|
}
|
|
|
|
.spinner {
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 4px solid rgba(74, 108, 247, 0.1);
|
|
border-left-color: var(--primary-color);
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
.no-apps {
|
|
grid-column: 1 / -1;
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: var(--secondary-color);
|
|
font-size: 18px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<h1>权限应用管理</h1>
|
|
<div class="search-bar">
|
|
<input type="text" !value="searchTerm" @input="searchTerm=$event.target.value" placeholder="搜索应用..." />
|
|
<i class="search-icon">🔍</i>
|
|
</div>
|
|
<div>
|
|
<button class="btn btn-primary" @click="show_create_app = true">创建应用</button>
|
|
</div>
|
|
</header>
|
|
<v-dialog v:show='show_create_app'>
|
|
<c-app-create :onsuccess='sync' style="width: 40vw;"></c-app-create>
|
|
</v-dialog>
|
|
|
|
<main>
|
|
<div class="filters">
|
|
<button v-for="filter in filters" :class="{ 'filter-btn': true, active: selectedFilter === filter.value }"
|
|
@click="selectFilter(filter.value)">
|
|
{{ filter.label }}
|
|
</button>
|
|
</div>
|
|
|
|
<div class="app-grid">
|
|
<div v-if="loading" class="loading">
|
|
<div class="spinner"></div>
|
|
<p>加载中...</p>
|
|
</div>
|
|
<div v-else-if="filteredApps().length === 0" class="no-apps">
|
|
没有找到任何应用
|
|
</div>
|
|
<div v-else v-for="app in filteredApps()" class="app-card">
|
|
<div class="app-card-header">
|
|
<div class="app-icon">
|
|
<img :src="app.icon || '/default-icon.png'" :alt="app.name" />
|
|
</div>
|
|
<div class="app-title">
|
|
<h2>{{ app.name }}{{app.cid}}</h2>
|
|
<span :class="['app-status', getStatusClass(app.status)]">
|
|
{{ app.status }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="app-card-body">
|
|
<p class="app-description">{{ app.des || '暂无描述信息' }}</p>
|
|
<div class="app-meta">
|
|
<span>类型: {{ app.typ || 'N/A' }}</span>
|
|
<span>用户数量: {{ app.user_count }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="app-card-footer">
|
|
<div class="app-actions">
|
|
<a :href="app.init_url || '#'" class="btn btn-primary">打开应用</a>
|
|
<a :href="`/app/main?id=${app.id}`">
|
|
<button class="btn btn-outline">详情</button>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
|
|
<script setup>
|
|
// 响应式数据
|
|
show_create_app = false
|
|
loading = true;
|
|
apps = [];
|
|
searchTerm = '';
|
|
selectedFilter = 'all';
|
|
|
|
filters = [
|
|
{label: '所有应用', value: 'all'},
|
|
{label: '最近更新', value: 'recent'},
|
|
{label: '最多用户', value: 'users'},
|
|
];
|
|
|
|
// 获取状态类名
|
|
getStatusClass = (status) => {
|
|
if (status === 'ok') return 'status-active';
|
|
if (status === 'pending') return 'status-pending';
|
|
return 'status-inactive';
|
|
};
|
|
|
|
// 过滤后的应用列表
|
|
filteredApps = () => {
|
|
let result = apps;
|
|
|
|
// 搜索过滤
|
|
if (searchTerm) {
|
|
const term = searchTerm.toLowerCase();
|
|
result = result.filter(
|
|
(app) =>
|
|
app.name.toLowerCase().includes(term) ||
|
|
(app.des && app.des.toLowerCase().includes(term)) ||
|
|
(app.typ && app.typ.toLowerCase().includes(term))
|
|
);
|
|
}
|
|
|
|
// 排序过滤
|
|
if (selectedFilter === 'recent') {
|
|
result.sort((a, b) => {
|
|
if (a.updated_at === '0001-01-01T00:00:00Z') return 1;
|
|
if (b.updated_at === '0001-01-01T00:00:00Z') return -1;
|
|
return new Date(b.updated_at) - new Date(a.updated_at);
|
|
});
|
|
} else if (selectedFilter === 'users') {
|
|
result.sort((a, b) => b.user_count - a.user_count);
|
|
}
|
|
result.forEach((app, id) => {
|
|
app.cid = id
|
|
})
|
|
return result;
|
|
};
|
|
|
|
// 选择过滤器
|
|
selectFilter = (filter) => {
|
|
selectedFilter = filter;
|
|
};
|
|
sync = () => {
|
|
show_create_app = false
|
|
$axios.get('/api/app').then((res) => {
|
|
apps = res;
|
|
loading = false;
|
|
});
|
|
}
|
|
sync()
|
|
</script>
|
|
|
|
</html>
|