init 2
This commit is contained in:
37
index.html
37
index.html
@@ -2,7 +2,7 @@
|
|||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
<head>
|
<head>
|
||||||
<base target="_top">
|
<base target="_top">
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
|
||||||
<style>
|
<style>
|
||||||
/* --- 基础变量 --- */
|
/* --- 基础变量 --- */
|
||||||
:root {
|
:root {
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark-mode {
|
/* --- 暗黑模式变量 --- */
|
||||||
|
body.dark-mode {
|
||||||
--bg-color: #0f172a;
|
--bg-color: #0f172a;
|
||||||
--card-bg: #1e293b;
|
--card-bg: #1e293b;
|
||||||
--text-main: #f1f5f9;
|
--text-main: #f1f5f9;
|
||||||
@@ -109,6 +110,8 @@
|
|||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- 表格样式 --- */
|
/* --- 表格样式 --- */
|
||||||
@@ -123,7 +126,7 @@
|
|||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
table-layout: fixed; /* 固定布局确保宽度可控 */
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
@@ -145,7 +148,6 @@
|
|||||||
|
|
||||||
tr:hover { background: rgba(37, 99, 235, 0.02); }
|
tr:hover { background: rgba(37, 99, 235, 0.02); }
|
||||||
|
|
||||||
/* 项目信息列 */
|
|
||||||
.item-cell { display: flex; align-items: center; gap: 1rem; }
|
.item-cell { display: flex; align-items: center; gap: 1rem; }
|
||||||
|
|
||||||
.icon-box {
|
.icon-box {
|
||||||
@@ -184,7 +186,6 @@
|
|||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 标签与文本 */
|
|
||||||
.type-label {
|
.type-label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.25rem 0.75rem;
|
padding: 0.25rem 0.75rem;
|
||||||
@@ -196,7 +197,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.safety-text {
|
.safety-text {
|
||||||
font-weight: 400; /* 取消加粗 */
|
font-weight: 400;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
@@ -212,7 +213,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.date-val {
|
.date-val {
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
font-family: monospace;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
@@ -234,13 +235,12 @@
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移动端隐藏部分列 */
|
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
th:nth-child(3), td:nth-child(3), th:nth-child(5), td:nth-child(5) { display: none; }
|
th:nth-child(3), td:nth-child(3), th:nth-child(5), td:nth-child(5) { display: none; }
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body :class="{ 'dark-mode': isDark }">
|
<body>
|
||||||
|
|
||||||
<div id="app" v-cloak class="container">
|
<div id="app" v-cloak class="container">
|
||||||
|
|
||||||
@@ -311,6 +311,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div v-if="loading" style="padding: 5rem; text-align: center; color: var(--text-muted);">
|
||||||
|
{{ ui[lang].syncing }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -327,9 +330,9 @@ createApp({
|
|||||||
const defaultIcon = 'https://cdn-icons-png.flaticon.com/512/684/684831.png';
|
const defaultIcon = 'https://cdn-icons-png.flaticon.com/512/684/684831.png';
|
||||||
|
|
||||||
const ui = {
|
const ui = {
|
||||||
cn: { subtitle: '全球数据资源索引', searchPlaceholder: '搜索...', colName: '项目描述', colType: '类型', colPlat: '平台', colSafety: '安全性', colDate: '最近更新', colAction: '操作', linkBtn: '访问官网' },
|
cn: { subtitle: '全球数据资源索引', searchPlaceholder: '搜索...', colName: '项目描述', colType: '类型', colPlat: '平台', colSafety: '安全性', colDate: '最近更新', colAction: '操作', linkBtn: '访问官网', syncing: '同步云端数据中...' },
|
||||||
en: { subtitle: 'GLOBAL INDEX', searchPlaceholder: 'Search...', colName: 'Description', colType: 'Type', colPlat: 'Platform', colSafety: 'Security', colDate: 'Updated', colAction: 'Action', linkBtn: 'VISIT' },
|
en: { subtitle: 'GLOBAL INDEX', searchPlaceholder: 'Search...', colName: 'Description', colType: 'Type', colPlat: 'Platform', colSafety: 'Security', colDate: 'Updated', colAction: 'Action', linkBtn: 'VISIT', syncing: 'Syncing...' },
|
||||||
es: { subtitle: 'ÍNDICE GLOBAL', searchPlaceholder: 'Buscar...', colName: 'Descripción', colType: 'Tipo', colPlat: 'Plataforma', colSafety: 'Seguridad', colDate: 'Fecha', colAction: 'Acción', linkBtn: 'VISITAR' }
|
es: { subtitle: 'ÍNDICE GLOBAL', searchPlaceholder: 'Buscar...', colName: 'Descripción', colType: 'Tipo', colPlat: 'Plataforma', colSafety: 'Seguridad', colDate: 'Fecha', colAction: 'Acción', linkBtn: 'VISITAR', syncing: 'Sincronizando...' }
|
||||||
};
|
};
|
||||||
|
|
||||||
const staticMap = {
|
const staticMap = {
|
||||||
@@ -398,7 +401,15 @@ createApp({
|
|||||||
return d.toISOString().split('T')[0].replace(/-/g, '/');
|
return d.toISOString().split('T')[0].replace(/-/g, '/');
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleDark = () => isDark.value = !isDark.value;
|
// 修复切换逻辑:通过 JavaScript 直接操作 body 类名
|
||||||
|
const toggleDark = () => {
|
||||||
|
isDark.value = !isDark.value;
|
||||||
|
if (isDark.value) {
|
||||||
|
document.body.classList.add('dark-mode');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('dark-mode');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(fetchData);
|
onMounted(fetchData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user