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.
OneAuth/ui/page/app/main.html

322 lines
6.9 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>项目主页</title>
</head>
<style>
body {
--primary-color: #3498db;
--secondary-color: #2ecc71;
--dark-color: #34495e;
--light-color: #ecf0f1;
--accent-color: #e74c3c;
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
--border-radius: 8px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100%;
width: 100%;
font-family: 'Nunito', sans-serif;
background-color: #f5f7fa;
color: var(--dark-color);
line-height: 1.6;
display: flex;
align-items: center;
justify-content: center;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
height: min-content;
}
header {
background: linear-gradient(135deg, var(--primary-color), #4a69bd);
color: white;
padding: 40px 0;
border-radius: var(--border-radius);
margin-bottom: 30px;
box-shadow: var(--shadow);
}
.header-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30px;
}
.project-info {
display: flex;
align-items: center;
}
.project-icon {
width: 100px;
height: 100px;
border-radius: 50%;
object-fit: cover;
border: 4px solid white;
box-shadow: var(--shadow);
margin-right: 20px;
}
.project-title h1 {
font-size: 2.5rem;
margin-bottom: 5px;
}
.project-type {
display: inline-block;
background-color: rgba(255, 255, 255, 0.2);
padding: 5px 15px;
border-radius: 30px;
font-size: 0.9rem;
font-weight: 600;
}
.project-status {
background-color: var(--secondary-color);
color: white;
padding: 8px 20px;
border-radius: 30px;
font-weight: bold;
display: inline-flex;
align-items: center;
box-shadow: var(--shadow);
}
.project-status i {
margin-right: 8px;
}
.main-content {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 30px;
}
.description-card,
.stats-card {
background-color: white;
border-radius: var(--border-radius);
padding: 30px;
box-shadow: var(--shadow);
}
.card-title {
font-size: 1.6rem;
margin-bottom: 20px;
color: var(--primary-color);
border-bottom: 2px solid var(--light-color);
padding-bottom: 10px;
}
.description-content {
font-size: 1.1rem;
line-height: 1.7;
}
.stat-item {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.stat-icon {
width: 50px;
height: 50px;
background-color: rgba(52, 152, 219, 0.1);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 15px;
color: var(--primary-color);
font-size: 1.4rem;
}
.stat-info h3 {
font-size: 1.3rem;
margin-bottom: 5px;
}
.stat-info p {
color: #7f8c8d;
}
.date-stat {
display: flex;
justify-content: space-between;
margin-top: 30px;
border-top: 1px solid var(--light-color);
padding-top: 20px;
}
.date-item {
text-align: center;
flex: 1;
}
.date-item:first-child {
border-right: 1px solid var(--light-color);
}
.date-label {
color: #7f8c8d;
font-size: 0.9rem;
}
.date-value {
font-size: 1.1rem;
font-weight: bold;
margin-top: 5px;
}
</style>
<body>
<c-app-menu slot="menu"></c-app-menu>
<div class="container">
<header>
<div class="header-content">
<div class="project-info">
<img :src="app.icon || 'http://public.veypi.com/img/avatar/0075.jpg'" alt="项目图标" class="project-icon">
<div class="project-title">
<h1>{{app.name || '未命名项目'}}</h1>
<span class="project-type"><i class="fas fa-globe"></i> {{app.typ || '公开项目'}}</span>
</div>
</div>
<div class="project-status">
<i class="fas fa-check-circle"></i> {{app.status || '状态良好'}}
</div>
</div>
</header>
<div class="main-content">
<div class="description-card">
<h2 class="card-title">项目描述</h2>
<div class="description-content">
<p v-if="app.des">{{app.des}}</p>
<p v-else>这是一个公开的项目,欢迎查看和参与。项目处于良好状态,您可以安全地使用和贡献。</p>
</div>
</div>
<div class="stats-card">
<h2 class="card-title">项目统计</h2>
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-users"></i>
</div>
<div class="stat-info">
<h3>{{app.user_count || 0}}</h3>
<p>参与用户</p>
</div>
</div>
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-key"></i>
</div>
<div class="stat-info">
<h3>{{app.id ? app.id.substring(0, 8) : 'N/A'}}</h3>
<p>项目ID (缩略)</p>
</div>
</div>
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-shield-alt"></i>
</div>
<div class="stat-info">
<h3>{{app.typ || '公开'}}</h3>
<p>项目类型</p>
</div>
</div>
<div class="date-stat">
<div class="date-item">
<div class="date-label">创建于</div>
<div class="date-value">{{formatDate(app.created_at) || 'N/A'}}</div>
</div>
<div class="date-item">
<div class="date-label">最后更新</div>
<div class="date-value">{{formatDate(app.updated_at) || 'N/A'}}</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script setup>
// 默认应用数据
app = {
id: '',
name: '',
icon: '',
des: '',
typ: '',
status: '',
created_at: '',
updated_at: '',
user_count: 0,
init_role: null,
init_url: ''
}
// 格式化日期函数
formatDate = (isoString) => {
if (!isoString) return null;
const date = new Date(isoString);
if (isNaN(date.getTime())) return isoString; // 如果解析失败返回原字符串
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}`;
}
// 同步应用数据
sync = () => {
const params = new URLSearchParams(window.location.search)
id = params.get('id')
if (!id) {
history.back()
return
}
$api.Get(`/api/app/${id}`)
.then((data) => {
Object.assign(app, data)
document.title = `${app.name} - 项目主页`
})
.catch((e) => {
console.log(e)
history.back()
})
}
sync()
</script>
</html>