Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84bd151431 | |||
| ad4f86b507 | |||
| f55f2027e5 | |||
| d338522692 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
instance/
|
||||
*.db
|
||||
__pycache__/
|
||||
uploads/
|
||||
outputs/
|
||||
cache/
|
||||
|
||||
37
app.py
37
app.py
@@ -120,12 +120,47 @@ def index():
|
||||
daily_remaining = limits['daily_translations'] - guest.daily_count
|
||||
max_pages = limits['max_pages']
|
||||
|
||||
# 获取用户的功能列表
|
||||
if user:
|
||||
user_features = limits.get('features', [])
|
||||
else:
|
||||
user_features = USER_LIMITS['guest']['features']
|
||||
|
||||
# 定义所有功能及其描述
|
||||
all_features = {
|
||||
'basic_translate': {'name': '自动翻译缓存,相同文件秒出结果', 'base': True},
|
||||
'custom_instruction': {'name': '自定义翻译要求', 'base': False},
|
||||
'compare_view': {'name': '原文译文对比查看', 'base': False},
|
||||
'history': {'name': '翻译历史记录', 'base': False},
|
||||
'retranslate': {'name': '不满意重新翻译', 'base': False},
|
||||
'export_pdf': {'name': '导出PDF格式', 'base': False},
|
||||
'batch_translate': {'name': '批量翻译', 'base': False},
|
||||
'custom_terms': {'name': '自定义术语库', 'base': False},
|
||||
'priority_queue': {'name': '优先队列处理', 'base': False},
|
||||
}
|
||||
|
||||
# 判断功能是否可用(vip_enterprise 的 features=["all"] 表示全部可用)
|
||||
if user_features == ['all']:
|
||||
user_features = list(all_features.keys())
|
||||
|
||||
# 构建功能展示列表
|
||||
feature_display = []
|
||||
for feat_key, feat_info in all_features.items():
|
||||
has_feature = feat_key in user_features
|
||||
# 基础功能(所有用户都有)不显示,只显示需要权限的功能
|
||||
if not feat_info['base']:
|
||||
feature_display.append({
|
||||
'name': feat_info['name'],
|
||||
'has': has_feature
|
||||
})
|
||||
|
||||
return render_template('index.html',
|
||||
user=user,
|
||||
limits=limits,
|
||||
daily_remaining=daily_remaining,
|
||||
max_pages=max_pages,
|
||||
plans=MEMBERSHIP_PLANS
|
||||
plans=MEMBERSHIP_PLANS,
|
||||
features=feature_display
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ USER_LIMITS = {
|
||||
"daily_translations": 10,
|
||||
"max_pages": 50,
|
||||
"max_file_size": 30 * 1024 * 1024, # 30MB
|
||||
"features": ["basic_translate", "compare_view", "retranslate", "history"],
|
||||
"features": ["basic_translate", "retranslate", "export_pdf", "history"],
|
||||
},
|
||||
"vip_basic": { # 基础会员 (月付 ¥29)
|
||||
"daily_translations": 50,
|
||||
|
||||
11
static/img/favicon.svg
Normal file
11
static/img/favicon.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<rect x="4" y="2" width="16" height="28" rx="2" fill="#4a90d9"/>
|
||||
<rect x="6" y="6" width="10" height="2" fill="#fff"/>
|
||||
<rect x="6" y="10" width="10" height="1" fill="#fff" opacity="0.7"/>
|
||||
<rect x="6" y="13" width="8" height="1" fill="#fff" opacity="0.7"/>
|
||||
<rect x="6" y="16" width="10" height="1" fill="#fff" opacity="0.7"/>
|
||||
<rect x="6" y="19" width="6" height="1" fill="#fff" opacity="0.7"/>
|
||||
<path d="M20 8 L28 16 L20 24 L20 20 L14 20 L14 12 L20 12 Z" fill="#28a745"/>
|
||||
<circle cx="26" cy="16" r="4" fill="#ffc107"/>
|
||||
<text x="24" y="18" font-size="6" fill="#333" font-weight="bold">中</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 678 B |
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>缓存管理 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>后台管理 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>大模型配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>操作日志 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>会员套餐配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% if plan %}编辑会员套餐{% else %}添加会员套餐{% endif %} - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>会员套餐配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% if package %}编辑套餐{% else %}添加套餐{% endif %} - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>数据包套餐 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>系统配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>统计报表 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>翻译详情 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>翻译记录 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>用户详情 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>用户权限配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% if user_type %}编辑用户类型{% else %}添加用户类型{% endif %} - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>用户类型配置 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>用户管理 - 后台管理</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>翻译历史 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PDF翻译助手 - 英文PDF翻译中文</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
@@ -36,6 +37,45 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- 会员状态栏 -->
|
||||
{% if user %}
|
||||
{% if user.user_type == 'vip_enterprise' %}
|
||||
<div class="alert alert-dark py-2 mb-0 text-center">
|
||||
<strong>👑 企业会员</strong> |
|
||||
无限翻译次数 | 到期:{{ user.membership_expire.strftime('%Y-%m-%d') if user.membership_expire else '永久' }}
|
||||
</div>
|
||||
{% elif user.user_type == 'vip_pro' %}
|
||||
<div class="alert alert-warning py-2 mb-0 text-center">
|
||||
<strong>⭐ 专业会员</strong> |
|
||||
每日200次 · 最多500页 | 到期:{{ user.membership_expire.strftime('%Y-%m-%d') if user.membership_expire else '永久' }}
|
||||
| <a href="/pricing" class="alert-link">升级企业会员享无限</a>
|
||||
</div>
|
||||
{% elif user.user_type == 'vip_basic' %}
|
||||
<div class="alert alert-success py-2 mb-0 text-center">
|
||||
<strong>💚 基础会员</strong> |
|
||||
每日50次 · 最多100页 | 到期:{{ user.membership_expire.strftime('%Y-%m-%d') if user.membership_expire else '永久' }}
|
||||
| <a href="/pricing" class="alert-link">升级享更多权益</a>
|
||||
</div>
|
||||
{% elif user.user_type == 'free' %}
|
||||
<div class="alert alert-info py-2 mb-0 text-center">
|
||||
<strong>👤 免费用户</strong> |
|
||||
每日10次 · 最多50页 | <a href="/pricing" class="alert-link">升级会员解锁更多功能</a>
|
||||
</div>
|
||||
{% elif user.user_type == 'admin' %}
|
||||
<div class="alert alert-danger py-2 mb-0 text-center">
|
||||
<strong>🔧 管理员</strong> |
|
||||
完整权限 | <a href="/admin" class="alert-link">进入后台管理</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="alert alert-secondary py-2 mb-0 text-center">
|
||||
<strong>👁 访客模式</strong> |
|
||||
每日仅3次 · 最多20页 · 功能受限 |
|
||||
<a href="/login" class="alert-link">登录获取更多权益</a> 或
|
||||
<a href="/register" class="alert-link">免费注册</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- 主内容 -->
|
||||
<main class="container my-5">
|
||||
<!-- 用户信息卡片 -->
|
||||
@@ -71,10 +111,13 @@
|
||||
<h5 class="card-title">✨ 功能特点</h5>
|
||||
<ul class="list-unstyled">
|
||||
<li>✅ 自动翻译缓存,相同文件秒出结果</li>
|
||||
<li>✅ 支持自定义翻译要求</li>
|
||||
<li>✅ 原文译文对比查看</li>
|
||||
<li>✅ 翻译历史记录</li>
|
||||
{% for feat in features %}
|
||||
<li>{% if feat.has %}✅{% else %}❌{% endif %} {{ feat.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if not user or user.user_type == 'free' %}
|
||||
<small class="text-muted">❌ 标记为会员专属功能,<a href="/pricing">升级会员</a>解锁</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>登录 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>会员套餐 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>注册 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>翻译详情 - PDF翻译助手</title>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/style.css" rel="stylesheet>
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||
|
||||
Reference in New Issue
Block a user