fix: 修复 getBasic.inc.php 多余括号 & 重构研究报告卡片
- 删除 getBasic.inc.php 中残留的多余 `}` 导致部署后解析错误 - index-2.php: 删除 PDF报告卡片;研究报告卡片改为按日期子目录动态加载 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+62
-99
@@ -196,112 +196,67 @@
|
||||
</div>
|
||||
<!-- 研究报告数据卡片 -->
|
||||
<div class="bg-white rounded-xl shadow-md p-6 card-hover">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="flex items-center mb-4">
|
||||
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
|
||||
<i class="fa-solid fa-file-text text-indigo-600"></i>
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold">研究报告</h3>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 text-gray-600">
|
||||
<p>以下是最新的市场研究报告,点击可查看详情。</p>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<?php
|
||||
// 扫描research目录下的HTML文件并提取标题
|
||||
$researchDir = __DIR__ . '/research';
|
||||
$htmlFiles = glob($researchDir . '/*.html');
|
||||
|
||||
// 新增:扫描子目录中的index.html文件
|
||||
$subDirs = glob($researchDir . '/*', GLOB_ONLYDIR);
|
||||
foreach ($subDirs as $dir) {
|
||||
$indexFile = $dir . '/index.html';
|
||||
if (file_exists($indexFile)) {
|
||||
$htmlFiles[] = $indexFile;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($htmlFiles)) {
|
||||
foreach ($htmlFiles as $file) {
|
||||
$fileName = basename($file);
|
||||
$filePath = str_replace(__DIR__ . '/', '', $file);
|
||||
|
||||
// 读取文件内容
|
||||
$content = file_get_contents($file);
|
||||
|
||||
// 提取title标签内容
|
||||
preg_match('/<title>(.*?)<\/title>/i', $content, $matches);
|
||||
$title = !empty($matches[1]) ? $matches[1] : $fileName;
|
||||
|
||||
// 输出链接
|
||||
echo '<a href="' . $filePath . '" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>' . htmlspecialchars($title) . '</span>
|
||||
</a>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<div class="p-3 border border-gray-200 rounded-lg text-gray-500">
|
||||
<i class="fa-solid fa-info-circle mr-2"></i>暂无研究报告
|
||||
</div>';
|
||||
<p class="text-gray-600 text-sm mb-4">按日期查看研究报告。</p>
|
||||
<?php
|
||||
$researchDir = __DIR__ . '/research';
|
||||
$dateDirs = [];
|
||||
foreach (glob($researchDir . '/*', GLOB_ONLYDIR) as $d) {
|
||||
$bn = basename($d);
|
||||
if (preg_match('/^\d{8}$/', $bn)) {
|
||||
$dateDirs[] = $bn;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl shadow-md p-6 card-hover">
|
||||
<div class="flex items-center mb-6">
|
||||
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
|
||||
<i class="fa-solid fa-file-text text-indigo-600"></i>
|
||||
}
|
||||
rsort($dateDirs);
|
||||
if (empty($dateDirs)): ?>
|
||||
<div class="p-4 border border-gray-200 rounded-lg text-gray-500 text-center">
|
||||
<i class="fa-solid fa-inbox mr-2"></i>暂无日期归档的研究报告
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold">PDF报告</h3>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 text-gray-600">
|
||||
<p>以下是最新的市场研究报告,点击可查看详情。</p>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
|
||||
<a href="/research/ai_industry_report_kimi.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>中国AI产业链深度研究报告</span>
|
||||
</a>
|
||||
<a href="/research/ai_supply_chain_companys.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>AI产业链上市公司护城河深度分析</span>
|
||||
</a>
|
||||
<a href="/research/rongbai_vs_dangsheng.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>容百科技VS当升科技-三季报(豆包)</span>
|
||||
</a>
|
||||
<a href="/research/rongbai_vs_dangsheng_qwen.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>容百科技与当升科技 2025 年三季报投资价值深度对比分析(千问)</span>
|
||||
</a>
|
||||
<a href="/research/li_ore_2501_2511.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>2025 年 1-11 月全球锂电行业供求关系深度研究报告(豆包)</span>
|
||||
</a>
|
||||
<a href="/research/歌尔股份经营与AR行业分析.pdf" target="_blank"
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all">
|
||||
<i class="fa-solid fa-file-pdf text-red-500 w-6"></i>
|
||||
<span>歌尔股份经营与AR行业分析(千问)</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php else: ?>
|
||||
<div class="mb-4">
|
||||
<select id="reportDate" name="reportDate"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50"
|
||||
onchange="showReportGroup(this.value)">
|
||||
<option value="">-- 选择日期 --</option>
|
||||
<?php foreach ($dateDirs as $d): ?>
|
||||
<option value="<?= $d ?>"><?= substr($d,0,4).'-'.substr($d,4,2).'-'.substr($d,6,2) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php foreach ($dateDirs as $d):
|
||||
$htmls = glob("$researchDir/$d/*.html");
|
||||
if (empty($htmls)) continue;
|
||||
?>
|
||||
<div class="report-group" id="report-<?= $d ?>" style="display:none;">
|
||||
<div class="text-xs text-gray-400 mb-2 font-medium"><?= substr($d,0,4).'-'.substr($d,4,2).'-'.substr($d,6,2) ?></div>
|
||||
<div class="space-y-2">
|
||||
<?php foreach ($htmls as $f):
|
||||
$content = file_get_contents($f);
|
||||
preg_match('/<title>(.*?)<\/title>/i', $content, $m);
|
||||
$title = !empty($m[1]) ? $m[1] : basename($f);
|
||||
$relPath = ltrim(str_replace(__DIR__, '', $f), '/');
|
||||
?>
|
||||
<a href="/<?= $relPath ?>" target="_blank"
|
||||
class="flex items-center p-2 border border-gray-200 rounded-lg hover:bg-gray-50 transition-all text-sm">
|
||||
<i class="fa-solid fa-file-lines text-indigo-500 w-5 mr-2"></i>
|
||||
<span><?= htmlspecialchars($title) ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -329,7 +284,15 @@
|
||||
console.log(url);
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
|
||||
function showReportGroup(date) {
|
||||
document.querySelectorAll('.report-group').forEach(el => el.style.display = 'none');
|
||||
if (date) {
|
||||
const target = document.getElementById('report-' + date);
|
||||
if (target) target.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// 股票搜索功能
|
||||
document.getElementById('search-stock').addEventListener('click', function() {
|
||||
const stockCode = document.getElementById('ts_code').value.trim();
|
||||
|
||||
Reference in New Issue
Block a user