stock / templates /layout.html
gitdeem's picture
Upload 32 files
f5d52f6 verified
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}智能分析系统{% endblock %}</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<!-- ApexCharts -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/apexcharts.min.css" rel="stylesheet">
<!-- Custom CSS -->
<style>
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
background-color: #f8f9fa;
}
.navbar-brand {
font-weight: bold;
}
.nav-item {
margin-left: 10px;
}
.sidebar {
background-color: #343a40;
color: white;
min-height: calc(100vh - 56px);
}
.sidebar .nav-link {
color: #ced4da;
padding: 0.75rem 1rem;
}
.sidebar .nav-link:hover {
color: #fff;
background-color: rgba(255, 255, 255, 0.1);
}
.sidebar .nav-link.active {
color: #fff;
background-color: rgba(255, 255, 255, 0.2);
}
.sidebar .nav-link i {
margin-right: 10px;
width: 20px;
text-align: center;
}
.main-content {
padding: 20px;
}
.card {
margin-bottom: 20px;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
overflow: hidden; /* Prevent content from stretching container */
}
.card-header {
padding: 0.5rem 1rem;
height: auto !important;
max-height: 50px;
}
.form-control, .form-select, .input-group-text {
font-size: 0.875rem;
}
.input-group-sm .input-group-text {
padding: 0.25rem 0.5rem;
}
.card-body.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
.card-body {
padding: 1.25rem;
overflow: hidden; /* Prevent content from stretching container */
}
.loading {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
}
.spinner-border {
width: 3rem;
height: 3rem;
}
.badge-success {
background-color: #28a745;
}
.badge-danger {
background-color: #dc3545;
}
.badge-warning {
background-color: #ffc107;
color: #212529;
}
.score-pill {
font-size: 1.2rem;
padding: 0.5rem 1rem;
}
#loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 9999;
}
.text-strong {
font-weight: bold;
}
.text-larger {
font-size: 1.1em;
}
.trend-up {
color: #28a745;
}
.trend-down {
color: #dc3545;
}
.analysis-section {
margin-bottom: 1.5rem;
}
/* Fix for chart container heights */
#price-chart {
height: 400px !important;
max-height: 400px;
}
/* Fix for indicators chart container */
#indicators-chart {
height: 350px !important;
max-height: 350px;
}
/* Fix chart containers */
.apexcharts-canvas {
overflow: visible !important;
}
/* Fix for radar chart */
#radar-chart {
height: 200px !important;
max-height: 200px;
}
/* Fix for score chart */
#score-chart {
height: 200px !important;
max-height: 200px;
}
/* Fix header alignment */
.card-header h5 {
margin-bottom: 0;
display: flex;
align-items: center;
}
.apexcharts-tooltip {
background: #fff !important;
border: 1px solid #e3e3e3 !important;
box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
border-radius: 4px !important;
padding: 8px !important;
font-size: 13px !important;
}
.apexcharts-tooltip-title {
background: #f8f9fa !important;
border-bottom: 1px solid #e3e3e3 !important;
padding: 6px 8px !important;
margin-bottom: 4px !important;
font-weight: 600 !important;
}
.apexcharts-tooltip-y-group {
padding: 3px 0 !important;
}
.apexcharts-tooltip-candlestick {
padding: 5px 8px !important;
}
.apexcharts-tooltip-candlestick div {
margin: 3px 0 !important;
}
.apexcharts-tooltip-candlestick span {
font-weight: 600 !important;
}
.apexcharts-crosshairs {
stroke-width: 1px !important;
stroke: #90A4AE !important;
stroke-dasharray: 0 !important;
opacity: 0.8 !important;
}
.apexcharts-tooltip-marker {
width: 10px !important;
height: 10px !important;
display: inline-block !important;
margin-right: 5px !important;
border-radius: 50% !important;
}
.apexcharts-tooltip-series-group {
padding: 4px 8px !important;
border-bottom: 1px solid #eee !important;
}
.apexcharts-tooltip-series-group:last-child {
border-bottom: none !important;
}
.apexcharts-tooltip-text-y-value {
font-weight: 600 !important;
}
.apexcharts-xaxistooltip {
background: #fff !important;
border: 1px solid #e3e3e3 !important;
border-radius: 2px !important;
box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
padding: 4px 8px !important;
font-size: 12px !important;
color: #333 !important;
}
.apexcharts-yaxistooltip {
background: #fff !important;
border: 1px solid #e3e3e3 !important;
border-radius: 2px !important;
box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
padding: 4px 8px !important;
font-size: 12px !important;
color: #333 !important;
}
/* AI分析样式 */
.analysis-para {
line-height: 1.8;
margin-bottom: 1.2rem;
color: #333;
}
.keyword {
color: #2c7be5;
font-weight: 600;
}
.term {
color: #d6336c;
font-weight: 500;
padding: 0 2px;
}
.price {
color: #00a47c;
font-family: 'Roboto Mono', monospace;
background: #f3faf8;
padding: 2px 4px;
border-radius: 3px;
}
.date {
color: #6c757d;
font-family: 'Roboto Mono', monospace;
}
strong.keyword {
border-bottom: 2px solid #2c7be5;
}
.table-info {
position: relative;
}
.table-info:after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 123, 255, 0.1);
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { opacity: 0.5; }
50% { opacity: 0.3; }
100% { opacity: 0.5; }
}
</style>
{% block head %}{% endblock %}
</head>
<body>
<!-- Loading Overlay -->
<div id="loading-overlay">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<!-- Top Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="/">智能分析系统</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- 在layout.html的导航栏部分修改 -->
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link {% if request.path == '/' %}active{% endif %}" href="/"><i class="fas fa-home"></i> 主页</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path == '/dashboard' %}active{% endif %}" href="/dashboard"><i class="fas fa-chart-line"></i> 智能仪表盘</a>
</li>
<!-- 新增菜单项 - 基本面分析 -->
<li class="nav-item">
<a class="nav-link {% if request.path.startswith('/fundamental') %}active{% endif %}" href="/fundamental"><i class="fas fa-file-invoice-dollar"></i> 基本面分析</a>
</li>
<!-- 新增菜单项 - 资金流向 -->
<li class="nav-item">
<a class="nav-link {% if request.path.startswith('/capital_flow') %}active{% endif %}" href="/capital_flow"><i class="fas fa-money-bill-wave"></i> 资金流向</a>
</li>
<!-- 新增菜单项 - 情景预测 -->
<li class="nav-item">
<a class="nav-link {% if request.path.startswith('/scenario') %}active{% endif %}" href="/scenario_predict"><i class="fas fa-lightbulb"></i> 情景预测</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path == '/market_scan' %}active{% endif %}" href="/market_scan"><i class="fas fa-search"></i> 市场扫描</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.path == '/portfolio' %}active{% endif %}" href="/portfolio"><i class="fas fa-briefcase"></i> 投资组合</a>
</li>
<!-- 新增菜单项 - 风险监控 -->
<li class="nav-item">
<a class="nav-link {% if request.path.startswith('/risk') %}active{% endif %}" href="/risk_monitor"><i class="fas fa-exclamation-triangle"></i> 风险监控</a>
</li>
<!-- 新增菜单项 - 智能问答 -->
<li class="nav-item">
<a class="nav-link {% if request.path == '/qa' %}active{% endif %}" href="/qa"><i class="fas fa-question-circle"></i> 智能问答</a>
</li>
</ul>
<div class="d-flex">
<div class="input-group">
<input type="text" id="search-stock" class="form-control" placeholder="搜索股票代码/名称" aria-label="搜索股票">
<button class="btn btn-light" type="button" id="search-button">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
{% block sidebar %}{% endblock %}
<main class="{% if self.sidebar()|trim %}col-md-9 ms-sm-auto col-lg-10 px-md-4{% else %}col-12{% endif %} main-content">
{% block content %}{% endblock %}
</main>
</div>
</div>
<!-- Bootstrap JS with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- ApexCharts -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/apexcharts.min.js"></script>
<!-- Common JS -->
<script>
// 显示加载中覆盖层
function showLoading() {
$('#loading-overlay').css('display', 'flex');
}
// 隐藏加载中覆盖层
function hideLoading() {
$('#loading-overlay').css('display', 'none');
}
// 显示错误提示
function showError(message) {
const alertHtml = `
<div class="alert alert-danger alert-dismissible fade show" role="alert">
${message}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
`;
$('#alerts-container').html(alertHtml);
}
// 显示信息提示
function showInfo(message) {
const alertHtml = `
<div class="alert alert-info alert-dismissible fade show" role="alert">
<i class="fas fa-info-circle me-2"></i>${message}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
`;
$('#alerts-container').html(alertHtml);
}
// 显示成功提示
function showSuccess(message) {
const alertHtml = `
<div class="alert alert-success alert-dismissible fade show" role="alert">
${message}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
`;
$('#alerts-container').html(alertHtml);
}
// 搜索股票并跳转到详情页
$('#search-button').click(function() {
const stockCode = $('#search-stock').val().trim();
if (stockCode) {
window.location.href = `/stock_detail/${stockCode}`;
}
});
// 回车键搜索
$('#search-stock').keypress(function(e) {
if (e.which === 13) {
$('#search-button').click();
}
});
// 格式化数字 - 增强版
function formatNumber(num, digits = 2) {
if (num === null || num === undefined) return '-';
return parseFloat(num).toFixed(digits);
}
// 格式化技术指标 - 新增函数
function formatIndicator(value, indicatorType) {
if (value === null || value === undefined) return '-';
// 根据指标类型使用不同的小数位数
if (indicatorType === 'MACD' || indicatorType === 'Signal' || indicatorType === 'Histogram') {
return parseFloat(value).toFixed(3); // MACD相关指标使用3位小数
} else if (indicatorType === 'RSI') {
return parseFloat(value).toFixed(2); // RSI使用2位小数
} else {
return parseFloat(value).toFixed(2); // 默认使用2位小数
}
}
// 格式化百分比
function formatPercent(num, digits = 2) {
if (num === null || num === undefined) return '-';
return parseFloat(num).toFixed(digits) + '%';
}
// 根据评分获取颜色类
function getScoreColorClass(score) {
if (score >= 80) return 'bg-success';
if (score >= 60) return 'bg-primary';
if (score >= 40) return 'bg-warning';
return 'bg-danger';
}
// 根据趋势获取颜色类
function getTrendColorClass(trend) {
return trend === 'UP' ? 'trend-up' : 'trend-down';
}
// 根据趋势获取图标
function getTrendIcon(trend) {
return trend === 'UP' ? '<i class="fas fa-arrow-up"></i>' : '<i class="fas fa-arrow-down"></i>';
}
</script>
{% block scripts %}{% endblock %}
</body>
</html>