初始化鸿蒙应用展示平台项目 - 前后端分离架构

This commit is contained in:
Nvex
2025-10-25 11:45:17 +08:00
commit c0f81dbbe2
92 changed files with 40210 additions and 0 deletions

502
templates/policy_base.html Executable file
View File

@@ -0,0 +1,502 @@
{% extends "base.html" %}
{% block content %}
<div class="policy-page">
<!-- Header 部分 -->
<div class="header">
<a href="javascript:void(0)" class="back-link" onclick="handleBackClick()" title="返回">
<i class="fas fa-arrow-left"></i>
</a>
<h1>{% block policy_header %}{% endblock %}</h1>
</div>
<!-- 内容区域 -->
<div class="policy-content">
<!-- 标题区域 -->
<div class="policy-title">
<i class="{% block policy_icon %}{% endblock %}"></i>
<h1>{% block policy_title %}{% endblock %}</h1>
</div>
<!-- 具体内容 -->
{% block policy_content %}{% endblock %}
</div>
</div>
<!-- 添加备案信息 -->
<div class="policy-footer">
{% if settings and settings.icp_number %}
<a href="https://beian.miit.gov.cn/" target="_blank" class="icp-link">
<i class="fas fa-shield-alt"></i>
{{ settings.icp_number }}
</a>
{% endif %}
</div>
<style>
.policy-update-date {
text-align: center;
margin-bottom: 30px;
color: #666;
font-size: 14px;
}
[data-theme="dark"] .policy-update-date {
color: #999;
}
/* 页面基本样式 */
.policy-page {
max-width: 1200px;
margin: 60px auto 20px;
padding: 0 15px;
}
/* Header 样式 */
.header {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 30px;
background: white;
padding: 10px 15px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.back-link {
color: #666;
text-decoration: none;
padding: 8px;
border-radius: 50%;
background: #f5f5f7;
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
transition: all 0.3s ease;
}
.back-link:hover {
background: #e5e5e7;
color: #333;
}
.header h1 {
margin: 0;
font-size: 20px;
color: #333;
font-weight: 500;
}
/* 内容区域样式 */
.policy-content {
background: white;
padding: 40px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* 标题区域样式 */
.policy-title {
text-align: center;
margin-bottom:10px;
padding-bottom: 30px;
border-bottom: 1px solid #eee;
position: relative;
}
.policy-title::after {
content: '';
position: absolute;
bottom: -1px;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 3px;
background: #007AFF;
border-radius: 2px;
}
.policy-title i {
font-size: 48px;
color: #007AFF;
margin-bottom: 20px;
display: block;
transition: transform 0.3s ease;
}
.policy-title:hover i {
transform: scale(1.1);
}
.policy-title h1 {
font-size: 28px;
color: #333;
margin: 0;
font-weight: 600;
}
/* 暗色模式适配 */
[data-theme="dark"] .header {
background: #242424;
}
[data-theme="dark"] .header h1 {
color: #fff;
}
[data-theme="dark"] .back-link {
color: #ccc;
background: #333;
}
[data-theme="dark"] .back-link:hover {
background: #444;
color: #fff;
}
[data-theme="dark"] .policy-content {
background: #242424;
}
[data-theme="dark"] .policy-title {
border-bottom-color: #333;
}
[data-theme="dark"] .policy-title i {
color: #3a9fff;
}
[data-theme="dark"] .policy-title h1 {
color: #fff;
}
/* 移动端适配 */
@media (max-width: 768px) {
.policy-page {
margin: 70px auto 20px;
}
.header {
padding: 8px 12px;
}
.back-link {
width: 28px;
height: 28px;
padding: 6px;
}
.header h1 {
font-size: 18px;
}
.policy-content {
padding: 25px;
}
.policy-title {
margin-bottom: 10px;
padding-bottom: 25px;
}
.policy-title i {
font-size: 36px;
margin-bottom: 15px;
}
.policy-title h1 {
font-size: 24px;
}
.policy-title::after {
width: 80px;
}
}
/* 超小屏幕适配 */
@media (max-width: 360px) {
.policy-page {
margin: 50px auto 15px;
}
.header {
padding: 8px 10px;
}
.policy-content {
padding: 15px;
}
}
/* 修改序号样式 */
.policy-content section {
counter-increment: section;
margin-bottom: 30px;
}
.policy-content section h2 {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 20px;
font-size: 20px;
color: #333;
position: relative;
padding-left: 28px;
}
.policy-content section h2::before {
content: counter(section) ".";
position: absolute;
left: 0;
color: #007AFF;
font-weight: 600;
}
.policy-content section h3 {
position: relative;
padding-left: 16px;
margin: 20px 0 12px;
font-size: 16px;
color: #555;
}
.policy-content section h3::before {
content: "•";
position: absolute;
left: 0;
color: #007AFF;
}
/* 暗色模式适配 */
[data-theme="dark"] .policy-content section h2 {
color: #fff;
}
[data-theme="dark"] .policy-content section h2::before {
color: #3a9fff;
}
[data-theme="dark"] .policy-content section h3 {
color: #ddd;
}
[data-theme="dark"] .policy-content section h3::before {
color: #3a9fff;
}
/* 移动端适配 */
@media (max-width: 768px) {
.policy-content section h2 {
font-size: 18px;
padding-left: 24px;
}
}
/* 优化表样式 */
section ul {
margin-left: 24px;
list-style: none;
}
section ul li {
position: relative;
padding-left: 8px;
}
section ul li::before {
content: "";
position: absolute;
left: -12px;
top: 10px;
width: 4px;
height: 4px;
border-radius: 50%;
background: #666;
}
[data-theme="dark"] section ul li::before {
background: #999;
}
/* 内容区域暗色模式适配 */
[data-theme="dark"] .policy-content {
background: #242424;
}
[data-theme="dark"] .policy-content section h2 {
color: #fff;
}
[data-theme="dark"] .policy-content section h3 {
color: #ddd;
}
[data-theme="dark"] .policy-content p {
color: #bbb;
}
[data-theme="dark"] .policy-content ul li {
color: #bbb;
}
/* 标题区域暗色模式适配 */
[data-theme="dark"] .policy-title {
border-bottom-color: #333;
}
[data-theme="dark"] .policy-title::after {
background: #3a9fff;
}
[data-theme="dark"] .policy-title i {
color: #3a9fff;
}
[data-theme="dark"] .policy-title h1 {
color: #fff;
}
/* 序号和圆点暗色模式适配 */
[data-theme="dark"] .policy-content section h2::before {
color: #3a9fff;
}
[data-theme="dark"] .policy-content section h3::before {
color: #3a9fff;
}
[data-theme="dark"] section ul li::before {
background: #666;
}
/* Header 暗色模式适配 */
[data-theme="dark"] .header {
background: #242424;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
[data-theme="dark"] .header h1 {
color: #fff;
}
[data-theme="dark"] .back-link {
color: #ccc;
background: #333;
}
[data-theme="dark"] .back-link:hover {
background: #444;
color: #fff;
}
/* 内容区域阴影调整 */
[data-theme="dark"] .policy-content {
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
/* 链接颜色适配 */
[data-theme="dark"] .policy-content a {
color: #3a9fff;
}
[data-theme="dark"] .policy-content a:hover {
color: #66b5ff;
}
/* 警告文本适配 */
[data-theme="dark"] .warning-text {
color: #ff9800;
}
/* 移动端暗色模式适配 */
@media (max-width: 768px) {
[data-theme="dark"] .policy-content {
background: #242424;
}
[data-theme="dark"] .header {
background: #242424;
}
}
/* 超小屏幕暗色模式适配 */
@media (max-width: 360px) {
[data-theme="dark"] .policy-content {
background: #242424;
}
}
/* 添加备案信息样式 */
.policy-footer {
text-align: center;
margin: 30px 0;
}
.policy-footer .icp-link {
color: #666;
text-decoration: none;
font-size: 14px;
display: inline-flex;
align-items: center;
gap: 6px;
transition: opacity 0.3s ease;
}
.policy-footer .icp-link:hover {
opacity: 0.8;
}
.policy-footer .icp-link i {
font-size: 14px;
}
/* 备案信息暗色模式适配 */
[data-theme="dark"] .policy-footer .icp-link {
color: #888;
}
/* 移动端适配 */
@media (max-width: 768px) {
.policy-footer {
margin: 20px 0;
}
.policy-footer .icp-link {
font-size: 12px;
}
.policy-footer .icp-link i {
font-size: 12px;
}
}
</style>
<script>
function handleBackClick() {
try {
// 先尝试浏览器的返回功能
if (window.history.length > 1) {
window.history.back();
// 设置一个超时检查如果3秒内没有成功返回则跳转到首页
setTimeout(function() {
if (document.location.pathname === '/terms' ||
document.location.pathname === '/cookie-policy') {
window.location.href = '/';
}
}, 300);
} else {
// 如果没有历史记录,直接跳转到首页
window.location.href = '/';
}
} catch (e) {
// 如果出现任何错误,直接跳转到首页
window.location.href = '/';
}
}
</script>
{% endblock %}