Files
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

380 lines
7.8 KiB
Python

#!/usr/bin/env python3
"""
创建Material Design风格的占位页面
"""
import os
# 页面配置
PAGES = {
'wxarticle': {
'title': '公众号',
'icon': '📱',
'color': '#03DAC6',
'description': 'Material Design风格的公众号页面开发中',
'features': [
{'icon': '📰', 'title': '公众号列表', 'desc': '订阅优质技术公众号'},
{'icon': '🔍', 'title': '文章搜索', 'desc': '搜索公众号历史文章'},
{'icon': '⭐', 'title': '热门文章', 'desc': '发现最受欢迎的技术文章'}
]
},
'tree': {
'title': '体系',
'icon': '🌳',
'color': '#FF9800',
'description': 'Material Design风格的体系页面开发中',
'features': [
{'icon': '📚', 'title': '知识体系', 'desc': '完整的技术知识结构'},
{'icon': '🔗', 'title': '分类导航', 'desc': '按技术领域分类浏览'},
{'icon': '🎯', 'title': '学习路径', 'desc': '系统化的学习路线图'}
]
},
'mine': {
'title': '我的',
'icon': '👤',
'color': '#FF4081',
'description': 'Material Design风格的我的页面开发中',
'features': [
{'icon': '🔐', 'title': '登录注册', 'desc': '用户认证和个人中心'},
{'icon': '⭐', 'title': '我的收藏', 'desc': '收藏的文章和项目'},
{'icon': '⚙️', 'title': '设置', 'desc': '应用设置和个性化'}
]
}
}
def create_placeholder_page(name, config):
"""创建占位页面"""
template = f'''<template>
<view class="page-container">
<!-- 状态栏占位 -->
<view class="status-bar"></view>
<!-- 页面内容 -->
<view class="content">
<!-- 空状态 -->
<view class="empty-state">
<view class="empty-icon" :style="{{ color: '{config['color']}' }}">{config['icon']}</view>
<text class="empty-title">{config['title']}页面</text>
<text class="empty-desc">{config['description']}</text>
<!-- 功能预览 -->
<view class="feature-preview">
'''
# 添加功能卡片
for feature in config['features']:
template += f''' <view class="feature-card elevation-1" @click="previewFeature({config['features'].index(feature)})">
<view class="feature-icon">{feature['icon']}</view>
<text class="feature-title">{feature['title']}</text>
<text class="feature-desc">{feature['desc']}</text>
</view>
'''
template += f''' </view>
<!-- 开发进度 -->
<view class="progress-section">
<text class="progress-title">开发进度</text>
<view class="progress-bar">
<view class="progress-fill" :style="{{ width: '20%' }}"></view>
</view>
<text class="progress-text">20% - 设计阶段</text>
</view>
<!-- 返回按钮 -->
<view class="action-buttons">
<view class="btn btn-outline" @click="goBack">
<text class="btn-text">返回首页</text>
</view>
<view class="btn btn-primary" @click="checkUpdate" :style="{{ background: '{config['color']}' }}">
<text class="btn-text">了解更多</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {{
data() {{
return {{
features: {config['features']}
}}
}},
onLoad() {{
console.log('{config['title']}页面加载')
}},
methods: {{
// 返回首页
goBack() {{
uni.switchTab({{
url: '/pages/index/index'
}})
}},
// 检查更新
checkUpdate() {{
uni.showToast({{
title: '功能开发中,敬请期待',
icon: 'none',
duration: 2000
}})
}},
// 预览功能
previewFeature(index) {{
const feature = this.features[index]
uni.showModal({{
title: feature.title,
content: feature.desc,
showCancel: false,
confirmText: '知道了'
}})
}}
}}
}}
</script>
<style scoped>
.page-container {{
min-height: 100vh;
background: #F5F5F5;
}}
.status-bar {{
height: var(--status-bar-height);
background: #6200EE;
}}
.content {{
padding: 32px 24px;
}}
.empty-state {{
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}}
.empty-icon {{
font-size: 80px;
margin-bottom: 24px;
animation: bounce 2s infinite;
}}
@keyframes bounce {{
0%, 100% {{
transform: translateY(0);
}}
50% {{
transform: translateY(-10px);
}}
}}
.empty-title {{
font-size: 28px;
font-weight: 500;
color: #212121;
margin-bottom: 12px;
}}
.empty-desc {{
font-size: 16px;
color: #757575;
margin-bottom: 40px;
line-height: 1.6;
}}
.feature-preview {{
width: 100%;
max-width: 400px;
margin-bottom: 40px;
}}
.feature-card {{
background: white;
border-radius: 16px;
padding: 24px;
margin-bottom: 16px;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
transition: all 0.3s;
}}
.feature-card:active {{
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}}
.feature-icon {{
font-size: 40px;
margin-bottom: 16px;
color: {config['color']};
}}
.feature-title {{
font-size: 18px;
font-weight: 500;
color: #212121;
margin-bottom: 8px;
}}
.feature-desc {{
font-size: 14px;
color: #757575;
line-height: 1.5;
}}
.progress-section {{
width: 100%;
max-width: 400px;
margin-bottom: 40px;
}}
.progress-title {{
display: block;
font-size: 16px;
font-weight: 500;
color: #212121;
margin-bottom: 12px;
text-align: left;
}}
.progress-bar {{
height: 8px;
background: #E0E0E0;
border-radius: 4px;
overflow: hidden;
margin-bottom: 8px;
}}
.progress-fill {{
height: 100%;
background: {config['color']};
border-radius: 4px;
transition: width 0.3s;
}}
.progress-text {{
display: block;
font-size: 14px;
color: #757575;
text-align: left;
}}
.action-buttons {{
display: flex;
gap: 16px;
width: 100%;
max-width: 400px;
}}
.btn {{
flex: 1;
height: 48px;
border-radius: 24px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: 500;
transition: all 0.3s;
}}
.btn:active {{
transform: scale(0.95);
}}
.btn-primary {{
color: white;
}}
.btn-primary:active {{
opacity: 0.8;
}}
.btn-outline {{
background: transparent;
color: #6200EE;
border: 2px solid #6200EE;
}}
.btn-outline:active {{
background: rgba(98, 0, 238, 0.08);
}}
.btn-text {{
font-size: 16px;
font-weight: 500;
}}
/* 深色模式支持 */
@media (prefers-color-scheme: dark) {{
.page-container {{
background: #121212;
}}
.empty-title {{
color: #FFFFFF;
}}
.empty-desc {{
color: #B0B0B0;
}}
.feature-card {{
background: #1E1E1E;
}}
.feature-title {{
color: #FFFFFF;
}}
.feature-desc {{
color: #B0B0B0;
}}
.progress-bar {{
background: #333333;
}}
.btn-outline {{
border-color: #BB86FC;
color: #BB86FC;
}}
.btn-outline:active {{
background: rgba(187, 134, 252, 0.08);
}}
}}
</style>'''
return template
def main():
"""主函数"""
print("创建Material Design占位页面...")
for name, config in PAGES.items():
page_path = f'pages/{name}/{name}.vue'
# 创建目录
os.makedirs(os.path.dirname(page_path), exist_ok=True)
# 创建页面文件
content = create_placeholder_page(name, config)
with open(page_path, 'w', encoding='utf-8') as f:
f.write(content)
print(f"✅ 创建: {page_path}")
print("\n🎉 所有占位页面创建完成!")
if __name__ == '__main__':
main()