mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-10-13 19:13:45 +08:00
fix
This commit is contained in:
51
index.html
51
index.html
@@ -507,7 +507,7 @@
|
|||||||
<div id="cpuGroups" class="cpu-groups" style="display: none;"></div>
|
<div id="cpuGroups" class="cpu-groups" style="display: none;"></div>
|
||||||
<div id="noData" class="no-data" style="display: none;">
|
<div id="noData" class="no-data" style="display: none;">
|
||||||
<div data-zh="📄 未找到CPU数据文件" data-en="📄 CPU data file not found">📄 未找到CPU数据文件</div>
|
<div data-zh="📄 未找到CPU数据文件" data-en="📄 CPU data file not found">📄 未找到CPU数据文件</div>
|
||||||
<p data-zh="请确保 all_cpu_results.json 文件存在于当前目录" data-en="Please ensure all_cpu_results.json file exists in current directory">请确保 all_cpu_results.json 文件存在于当前目录</p>
|
<p data-zh="请确保 cpu_statistics.json 文件存在于当前目录" data-en="Please ensure cpu_statistics.json file exists in current directory">请确保 cpu_statistics.json 文件存在于当前目录</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="footer-content">
|
<div class="footer-content">
|
||||||
@@ -610,22 +610,61 @@
|
|||||||
this.renderGroups();
|
this.renderGroups();
|
||||||
}
|
}
|
||||||
async loadData() {
|
async loadData() {
|
||||||
|
const cdnUrls = [
|
||||||
|
"http://cdn1.spiritlhl.net/",
|
||||||
|
"http://cdn2.spiritlhl.net/",
|
||||||
|
"http://cdn3.spiritlhl.net/",
|
||||||
|
"http://cdn4.spiritlhl.net/"
|
||||||
|
];
|
||||||
|
|
||||||
|
const urls = [
|
||||||
|
'cpu_statistics.json',
|
||||||
|
...cdnUrls.map(cdn => `${cdn}https://raw.githubusercontent.com/oneclickvirt/ecs/refs/heads/ranks/cpu_statistics.json`)
|
||||||
|
];
|
||||||
|
|
||||||
|
for (let url of urls) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('all_cpu_results.json');
|
console.log(`尝试加载: ${url}`);
|
||||||
if (!response.ok) throw new Error('数据文件不存在');
|
const response = await fetch(url);
|
||||||
this.data = await response.json();
|
if (!response.ok) throw new Error('请求失败');
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
// 转换数据格式以匹配HTML期望的结构
|
||||||
|
if (data.cpu_statistics) {
|
||||||
|
// 转换统计数据为单个CPU记录
|
||||||
|
this.data = data.cpu_statistics.map(stat => ({
|
||||||
|
cpu_prefix: stat.cpu_prefix,
|
||||||
|
cpu_model: stat.cpu_model,
|
||||||
|
cpu_cores: stat.typical_cores,
|
||||||
|
single_score: stat.max_single_score,
|
||||||
|
multi_score: stat.max_multi_score,
|
||||||
|
multi_threads: stat.typical_threads
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
// 如果是其他格式,假设是数组
|
||||||
|
this.data = Array.isArray(data) ? data : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`成功加载数据,共 ${this.data.length} 条记录`);
|
||||||
this.processData();
|
this.processData();
|
||||||
this.updateStats();
|
this.updateStats();
|
||||||
this.filterAndRender();
|
this.filterAndRender();
|
||||||
document.getElementById('loadingIndicator').style.display = 'none';
|
document.getElementById('loadingIndicator').style.display = 'none';
|
||||||
document.getElementById('pagination').style.display = 'flex';
|
document.getElementById('pagination').style.display = 'flex';
|
||||||
document.getElementById('cpuGroups').style.display = 'block';
|
document.getElementById('cpuGroups').style.display = 'block';
|
||||||
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载数据失败:', error);
|
console.error(`加载失败 ${url}:`, error);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 所有URL都失败了
|
||||||
|
console.error('所有数据源都无法加载');
|
||||||
document.getElementById('loadingIndicator').style.display = 'none';
|
document.getElementById('loadingIndicator').style.display = 'none';
|
||||||
document.getElementById('noData').style.display = 'block';
|
document.getElementById('noData').style.display = 'block';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
processData() {
|
processData() {
|
||||||
this.groupedData = {};
|
this.groupedData = {};
|
||||||
this.data.forEach(cpu => {
|
this.data.forEach(cpu => {
|
||||||
|
Reference in New Issue
Block a user