Files
nanocode/wanandroid/uniapp_android/pages/system/system.vue
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

277 lines
5.9 KiB
Vue

<template>
<view class="system-page">
<!-- 状态栏 -->
<view class="status-bar"></view>
<!-- 标题栏 -->
<view class="title-bar">
<text class="title">知识体系</text>
</view>
<!-- 内容区域 -->
<view class="content">
<!-- 搜索栏 -->
<view class="search-container">
<view class="search-icon">🔍</view>
<input class="search-input" placeholder="搜索技术分类..." />
</view>
<!-- 体系分类 -->
<view class="system-categories">
<view class="category-card" v-for="category in categories" :key="category.id">
<view class="category-header">
<text class="category-name">{{ category.name }}</text>
<text class="category-count">{{ category.count }}个分类</text>
</view>
<view class="subcategory-list">
<view class="subcategory-item" v-for="sub in category.children" :key="sub.id">
<text class="subcategory-name">{{ sub.name }}</text>
<text class="subcategory-article-count">{{ sub.articleCount }}篇文章</text>
</view>
</view>
<view class="expand-btn" @click="toggleCategory(category.id)">
{{ category.expanded ? '收起' : '展开全部' }}
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="categories.length === 0">
<view class="empty-icon">🌳</view>
<text class="empty-text">暂无分类数据</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
categories: [
{
id: 1,
name: 'Android',
count: 8,
expanded: true,
children: [
{ id: 101, name: '基础组件', articleCount: 256 },
{ id: 102, name: '自定义View', articleCount: 128 },
{ id: 103, name: '动画', articleCount: 96 },
{ id: 104, name: '性能优化', articleCount: 72 }
]
},
{
id: 2,
name: 'Java',
count: 6,
expanded: false,
children: [
{ id: 201, name: '基础语法', articleCount: 180 },
{ id: 202, name: '集合框架', articleCount: 64 },
{ id: 203, name: '多线程', articleCount: 48 },
{ id: 204, name: 'JVM', articleCount: 32 }
]
},
{
id: 3,
name: 'Kotlin',
count: 5,
expanded: false,
children: [
{ id: 301, name: '基础语法', articleCount: 120 },
{ id: 302, name: '协程', articleCount: 56 },
{ id: 303, name: 'DSL', articleCount: 24 },
{ id: 304, name: '与Java互操作', articleCount: 18 }
]
},
{
id: 4,
name: '前端',
count: 7,
expanded: false,
children: [
{ id: 401, name: 'JavaScript', articleCount: 96 },
{ id: 402, name: 'Vue.js', articleCount: 64 },
{ id: 403, name: 'React', articleCount: 48 },
{ id: 404, name: 'CSS', articleCount: 32 }
]
},
{
id: 5,
name: '后端',
count: 6,
expanded: false,
children: [
{ id: 501, name: 'Spring Boot', articleCount: 84 },
{ id: 502, name: '数据库', articleCount: 72 },
{ id: 503, name: '微服务', articleCount: 36 },
{ id: 504, name: '分布式', articleCount: 24 }
]
}
]
}
},
methods: {
toggleCategory(categoryId) {
const category = this.categories.find(c => c.id === categoryId)
if (category) {
category.expanded = !category.expanded
}
}
},
onLoad() {
console.log('知识体系页面加载')
}
}
</script>
<style>
.system-page {
background: #F5F5F5;
min-height: 100vh;
}
.status-bar {
height: 40px;
background: #6200EE;
}
.title-bar {
background: #6200EE;
padding: 16px 20px;
}
.title {
font-size: 20px;
font-weight: 500;
color: white;
}
.content {
padding: 20px;
}
.search-container {
background: white;
border-radius: 24px;
padding: 12px 20px;
display: flex;
align-items: center;
margin-bottom: 24px;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.search-icon {
font-size: 20px;
margin-right: 12px;
color: #6200EE;
}
.search-input {
flex: 1;
font-size: 16px;
color: #212121;
}
.search-input::placeholder {
color: #757575;
}
.system-categories {
margin-bottom: 20px;
}
.category-card {
background: white;
border-radius: 16px;
padding: 20px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.category-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #F0F0F0;
}
.category-name {
font-size: 18px;
font-weight: 500;
color: #212121;
}
.category-count {
font-size: 14px;
color: #6200EE;
background: rgba(98, 0, 238, 0.1);
padding: 4px 12px;
border-radius: 12px;
}
.subcategory-list {
margin-bottom: 16px;
}
.subcategory-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #F8F8F8;
}
.subcategory-item:last-child {
border-bottom: none;
}
.subcategory-name {
font-size: 16px;
color: #424242;
}
.subcategory-article-count {
font-size: 14px;
color: #757575;
}
.expand-btn {
text-align: center;
color: #6200EE;
font-size: 14px;
font-weight: 500;
padding: 8px;
border-radius: 8px;
background: rgba(98, 0, 238, 0.05);
cursor: pointer;
transition: all 0.3s;
}
.expand-btn:active {
background: rgba(98, 0, 238, 0.1);
}
.empty-state {
text-align: center;
padding: 60px 20px;
}
.empty-icon {
font-size: 60px;
margin-bottom: 16px;
color: #6200EE;
}
.empty-text {
font-size: 16px;
color: #757575;
}
</style>