2026-02-02 23:17:44 +08:00
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<!-- 头部区域 -->
|
|
|
|
|
<!-- <header class="app-header">
|
|
|
|
|
<h1 class="title">
|
|
|
|
|
<i class="el-icon-menu"></i>
|
|
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
|
</header> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 搜索区域 -->
|
|
|
|
|
<!-- <div class="search-container">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="searchQuery"
|
|
|
|
|
placeholder="搜索应用..."
|
|
|
|
|
clearable
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
class="search-input"
|
|
|
|
|
></el-input>
|
|
|
|
|
</div> -->
|
|
|
|
|
|
|
|
|
|
<!-- 空状态 -->
|
|
|
|
|
<div v-if="Object.keys(filteredCategories).length === 0" class="empty-state">
|
|
|
|
|
<i class="el-icon-warning empty-icon"></i>
|
|
|
|
|
<h3>未找到匹配的应用</h3>
|
|
|
|
|
<p>请尝试调整搜索关键词</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 分类应用展示 -->
|
|
|
|
|
<div
|
|
|
|
|
v-for="(category, categoryName) in filteredCategories"
|
|
|
|
|
:key="categoryName"
|
|
|
|
|
class="category-section">
|
|
|
|
|
<div class="category-header">
|
|
|
|
|
<h2 class="category-title">{{ categoryName }}</h2>
|
|
|
|
|
<el-tag size="small" class="app-count">{{ category.apps.length }} 个应用</el-tag>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="apps-grid">
|
|
|
|
|
<div
|
|
|
|
|
v-for="app in category.apps"
|
|
|
|
|
:key="app.id"
|
|
|
|
|
class="app-card"
|
|
|
|
|
@click="handleAppClick(app)">
|
|
|
|
|
<div class="app-icon-wrapper">
|
2026-02-10 09:30:20 +08:00
|
|
|
<img :src="app.logo" class="app-icon-img" />
|
2026-02-09 11:34:46 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="app-name">{{ app.name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 应用详情对话框 -->
|
|
|
|
|
<el-dialog
|
|
|
|
|
v-model:visible="dialogVisible"
|
|
|
|
|
title="应用详情"
|
|
|
|
|
width="30%"
|
|
|
|
|
custom-class="app-dialog">
|
|
|
|
|
<div v-if="selectedApp" class="dialog-content">
|
|
|
|
|
<div class="dialog-icon-wrapper">
|
2026-02-10 09:30:20 +08:00
|
|
|
<img :src="selectedApp.logo" class="dialog-app-icon-img" />
|
2026-02-09 11:34:46 +08:00
|
|
|
</div>
|
|
|
|
|
<h3 class="dialog-app-name">{{ selectedApp.name }}</h3>
|
|
|
|
|
<p class="dialog-app-id">ID: {{ selectedApp.id }}</p>
|
|
|
|
|
<p class="dialog-app-category" v-if="selectedApp.category">分类: {{ selectedApp.category }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmLaunch">启动</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
2026-02-02 23:17:44 +08:00
|
|
|
</template>
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
<script>
|
2026-02-10 09:30:20 +08:00
|
|
|
import * as ClientApi from '@/api/system/oauth2/client'
|
|
|
|
|
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
2026-02-09 11:34:46 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'AppManager',
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
searchQuery: '',
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
selectedApp: null,
|
2026-02-10 09:30:20 +08:00
|
|
|
appsData: []
|
2026-02-09 11:34:46 +08:00
|
|
|
};
|
|
|
|
|
},
|
2026-02-10 09:30:20 +08:00
|
|
|
mounted() {
|
|
|
|
|
this.fetchApps()
|
|
|
|
|
},
|
2026-02-09 11:34:46 +08:00
|
|
|
computed: {
|
|
|
|
|
categorizedApps() {
|
|
|
|
|
const result = {};
|
2026-02-10 09:30:20 +08:00
|
|
|
this.appsData.forEach(app => {
|
|
|
|
|
const categoryLabel = app.categoryLabel || '未分类'
|
|
|
|
|
if (!result[categoryLabel]) {
|
|
|
|
|
result[categoryLabel] = { apps: [] }
|
|
|
|
|
}
|
|
|
|
|
result[categoryLabel].apps.push(app)
|
|
|
|
|
})
|
2026-02-09 11:34:46 +08:00
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
filteredCategories() {
|
|
|
|
|
if (!this.searchQuery.trim()) {
|
|
|
|
|
return this.categorizedApps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const query = this.searchQuery.toLowerCase();
|
|
|
|
|
const result = {};
|
|
|
|
|
|
|
|
|
|
for (const [categoryName, categoryData] of Object.entries(this.categorizedApps)) {
|
|
|
|
|
const filteredApps = categoryData.apps.filter(app =>
|
|
|
|
|
app.name.toLowerCase().includes(query) ||
|
2026-02-10 09:30:20 +08:00
|
|
|
String(app.categoryLabel || '').toLowerCase().includes(query)
|
2026-02-09 11:34:46 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (filteredApps.length > 0) {
|
|
|
|
|
result[categoryName] = {...categoryData, apps: filteredApps};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
totalApps() {
|
2026-02-10 09:30:20 +08:00
|
|
|
return this.appsData.length;
|
2026-02-09 11:34:46 +08:00
|
|
|
},
|
|
|
|
|
categoriesCount() {
|
2026-02-10 09:30:20 +08:00
|
|
|
return Object.keys(this.categorizedApps).length;
|
2026-02-09 11:34:46 +08:00
|
|
|
},
|
|
|
|
|
visibleCategories() {
|
|
|
|
|
return Object.keys(this.filteredCategories).length;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
2026-02-09 11:34:46 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-02-10 09:30:20 +08:00
|
|
|
async fetchApps() {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ClientApi.getOAuth2ClientPage({ pageNo: 1, pageSize: 1000 })
|
|
|
|
|
const list = data?.list || []
|
|
|
|
|
this.appsData = list.map(item => ({
|
|
|
|
|
id: item.id,
|
|
|
|
|
name: item.name,
|
|
|
|
|
logo: item.logo,
|
|
|
|
|
category: item.category,
|
|
|
|
|
categoryLabel: getDictLabel(DICT_TYPE.APP_CATEGORY, item.category),
|
|
|
|
|
redirectUris: item.redirectUris
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$message.error('应用数据加载失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-02-09 11:34:46 +08:00
|
|
|
handleAppClick(app) {
|
2026-02-10 09:30:20 +08:00
|
|
|
const uri = Array.isArray(app.redirectUris) ? app.redirectUris[0] : app.redirectUris
|
|
|
|
|
if (uri) {
|
|
|
|
|
window.location.href = uri
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.warning('未配置重定向地址')
|
|
|
|
|
}
|
2026-02-09 11:34:46 +08:00
|
|
|
},
|
|
|
|
|
confirmLaunch() {
|
|
|
|
|
this.$message.success(`正在启动 ${this.selectedApp.name}...`);
|
|
|
|
|
this.dialogVisible = false;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-02-09 11:34:46 +08:00
|
|
|
};
|
|
|
|
|
</script>
|
2026-02-02 23:17:44 +08:00
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
<style scoped>
|
2026-02-02 23:17:44 +08:00
|
|
|
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 头部样式 */
|
|
|
|
|
.app-header {
|
|
|
|
|
padding: 30px 0;
|
|
|
|
|
color: white;
|
|
|
|
|
text-align: center;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.title {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
font-size: 2.5rem;
|
|
|
|
|
text-shadow: 0 2px 4px rgb(0 0 0 / 10%);
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.subtitle {
|
|
|
|
|
font-size: 1.1rem;
|
|
|
|
|
opacity: 0.9;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 统计信息样式 */
|
|
|
|
|
.stats-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
margin-bottom: 30px;
|
|
|
|
|
background: rgb(255 255 255 / 20%);
|
|
|
|
|
border-radius: 15px;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
backdrop-filter: blur(10px);
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.stat-card {
|
|
|
|
|
color: white;
|
|
|
|
|
text-align: center;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.stat-value {
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
font-size: 2rem;
|
|
|
|
|
font-weight: bold;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.stat-label {
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
opacity: 0.9;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 搜索区域样式 */
|
|
|
|
|
.search-container {
|
|
|
|
|
max-width: 500px;
|
|
|
|
|
margin: 0 auto 30px;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.search-input ::v-deep .el-input__inner {
|
|
|
|
|
padding-left: 40px;
|
|
|
|
|
border-radius: 25px;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 空状态样式 */
|
|
|
|
|
.empty-state {
|
|
|
|
|
padding: 60px 20px;
|
|
|
|
|
margin-bottom: 30px;
|
|
|
|
|
color: rgb(255 255 255 / 80%);
|
|
|
|
|
text-align: center;
|
|
|
|
|
background: rgb(255 255 255 / 10%);
|
|
|
|
|
border-radius: 15px;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.empty-icon {
|
|
|
|
|
display: block;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
font-size: 3rem;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 分类区域样式 */
|
|
|
|
|
.category-section {
|
|
|
|
|
padding: 25px;
|
|
|
|
|
margin-bottom: 30px;
|
2026-02-02 23:17:44 +08:00
|
|
|
background: white;
|
2026-02-09 11:34:46 +08:00
|
|
|
border-radius: 15px;
|
|
|
|
|
box-shadow: 0 10px 30px rgb(0 0 0 / 10%);
|
|
|
|
|
animation: fadeIn 0.5s ease-out;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.category-header {
|
2026-02-02 23:17:44 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2026-02-09 11:34:46 +08:00
|
|
|
justify-content: space-between;
|
2026-02-02 23:17:44 +08:00
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.category-title {
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
color: #303133;
|
|
|
|
|
border-left: 5px solid #409EFF;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.app-count {
|
|
|
|
|
color: #409eff;
|
|
|
|
|
background: #ecf5ff;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 应用网格样式 */
|
|
|
|
|
.apps-grid {
|
2026-02-02 23:17:44 +08:00
|
|
|
display: grid;
|
2026-02-09 11:34:46 +08:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
|
|
|
gap: 25px;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.app-card {
|
|
|
|
|
padding: 20px 15px;
|
2026-02-02 23:17:44 +08:00
|
|
|
text-align: center;
|
|
|
|
|
cursor: pointer;
|
2026-02-09 11:34:46 +08:00
|
|
|
background: #f8f9fa;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
box-shadow: 0 2px 10px rgb(0 0 0 / 5%);
|
|
|
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.app-card:hover {
|
|
|
|
|
color: white;
|
|
|
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
|
|
transform: translateY(-5px);
|
|
|
|
|
box-shadow: 0 10px 25px rgb(64 158 255 / 20%);
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.app-icon-wrapper {
|
2026-02-02 23:17:44 +08:00
|
|
|
display: flex;
|
2026-02-09 11:34:46 +08:00
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
|
|
|
|
margin: 0 auto 12px;
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
line-height: 60px;
|
|
|
|
|
color: white;
|
|
|
|
|
border-radius: 50%;
|
2026-02-02 23:17:44 +08:00
|
|
|
align-items: center;
|
2026-02-09 11:34:46 +08:00
|
|
|
justify-content: center;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-10 09:30:20 +08:00
|
|
|
.app-icon-img {
|
|
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.app-name {
|
|
|
|
|
overflow: hidden;
|
2026-02-02 23:17:44 +08:00
|
|
|
font-size: 14px;
|
2026-02-09 11:34:46 +08:00
|
|
|
font-weight: 500;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
/* 对话框样式 */
|
|
|
|
|
::v-deep .app-dialog .el-dialog__body {
|
|
|
|
|
padding: 30px 20px;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.dialog-content {
|
|
|
|
|
text-align: center;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.dialog-icon-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 80px;
|
|
|
|
|
margin: 0 auto 20px;
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
line-height: 80px;
|
|
|
|
|
color: white;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-10 09:30:20 +08:00
|
|
|
.dialog-app-icon-img {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 80px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.dialog-app-name {
|
|
|
|
|
margin: 0 0 10px;
|
|
|
|
|
font-size: 1.5rem;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.dialog-app-id,
|
|
|
|
|
.dialog-app-category {
|
|
|
|
|
margin: 5px 0;
|
2026-02-02 23:17:44 +08:00
|
|
|
color: #909399;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-09 11:34:46 +08:00
|
|
|
.dialog-footer {
|
|
|
|
|
text-align: right;
|
2026-02-02 23:17:44 +08:00
|
|
|
}
|
2026-02-09 11:34:46 +08:00
|
|
|
</style>
|