feat(admin): migrate admin UI to Vue3
This commit is contained in:
30
app.py
30
app.py
@@ -1217,18 +1217,30 @@ def admin_login_page():
|
||||
@admin_required
|
||||
def admin_page():
|
||||
"""后台管理页面"""
|
||||
return render_template('admin.html')
|
||||
manifest_path = os.path.join(app.root_path, 'static', 'admin', '.vite', 'manifest.json')
|
||||
try:
|
||||
with open(manifest_path, 'r', encoding='utf-8') as f:
|
||||
manifest = json.load(f)
|
||||
|
||||
entry = manifest.get('index.html') or {}
|
||||
js_file = entry.get('file')
|
||||
css_files = entry.get('css') or []
|
||||
|
||||
if not js_file:
|
||||
logger.warning(f"[admin_spa] manifest缺少入口文件: {manifest_path}")
|
||||
return render_template('admin_legacy.html')
|
||||
|
||||
|
||||
@app.route('/yuyx/vip')
|
||||
@admin_required
|
||||
def vip_admin_page():
|
||||
"""VIP管理页面"""
|
||||
return render_template('vip_admin.html')
|
||||
|
||||
|
||||
return render_template(
|
||||
'admin.html',
|
||||
admin_spa_js_file=f'admin/{js_file}',
|
||||
admin_spa_css_files=[f'admin/{p}' for p in css_files],
|
||||
)
|
||||
except FileNotFoundError:
|
||||
logger.warning(f"[admin_spa] 未找到manifest: {manifest_path},回退旧版后台模板")
|
||||
return render_template('admin_legacy.html')
|
||||
except Exception as e:
|
||||
logger.error(f"[admin_spa] 加载manifest失败: {e}")
|
||||
return render_template('admin_legacy.html')
|
||||
# ==================== 用户认证API ====================
|
||||
|
||||
@app.route('/api/register', methods=['POST'])
|
||||
|
||||
Reference in New Issue
Block a user