138 lines
5.0 KiB
HTML
138 lines
5.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<title>TopFans — 下载</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff;
|
|
}
|
|
.container { text-align: center; padding: 40px 24px; max-width: 360px; width: 100%; }
|
|
.logo { font-size: 32px; font-weight: 800; letter-spacing: 2px; margin-bottom: 8px; }
|
|
.slogan { font-size: 14px; color: #888; margin-bottom: 32px; }
|
|
.version { font-size: 13px; color: #666; margin-bottom: 24px; min-height: 20px; }
|
|
.download-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 10px;
|
|
width: 100%;
|
|
padding: 16px 24px;
|
|
margin-bottom: 16px;
|
|
border-radius: 12px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
transition: transform 0.15s, opacity 0.15s;
|
|
}
|
|
.download-btn:active { transform: scale(0.97); }
|
|
.download-btn.android { background: #3ddc84; color: #000; }
|
|
.download-btn.ios { background: #fff; color: #000; }
|
|
.download-btn.disabled { opacity: 0.4; pointer-events: none; }
|
|
.footer { margin-top: 40px; font-size: 12px; color: #555; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="logo">TopFans</div>
|
|
<div class="slogan">粉丝共创平台</div>
|
|
<div class="version" id="version-info">加载中…</div>
|
|
|
|
<a id="btn-android" class="download-btn android disabled" href="javascript:void(0)">
|
|
🤖 Android 下载
|
|
</a>
|
|
<a id="btn-ios" class="download-btn ios disabled" href="javascript:void(0)">
|
|
iOS 下载
|
|
</a>
|
|
|
|
<div class="footer">TopFans © 2026</div>
|
|
</div>
|
|
|
|
<script>
|
|
(async function() {
|
|
// ★ 部署时修改为实际 API 地址
|
|
var API_URL = 'https://api.topfans.com/api/v1/app/download-urls';
|
|
|
|
var btnAndroid = document.getElementById('btn-android');
|
|
var btnIOS = document.getElementById('btn-ios');
|
|
var versionInfo = document.getElementById('version-info');
|
|
var versions = [];
|
|
|
|
function updateUI() {
|
|
var hasAndroid = false;
|
|
var hasIOS = false;
|
|
|
|
if (versions.length > 0) {
|
|
for (var i = 0; i < versions.length; i++) {
|
|
var v = versions[i];
|
|
if (v.platform === 'android') {
|
|
btnAndroid.href = v.url;
|
|
btnAndroid.classList.remove('disabled');
|
|
hasAndroid = true;
|
|
}
|
|
if (v.platform === 'ios') {
|
|
btnIOS.href = v.url;
|
|
btnIOS.classList.remove('disabled');
|
|
hasIOS = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (hasAndroid || hasIOS) {
|
|
var parts = [];
|
|
if (hasAndroid) parts.push('Android ' + getVersionText('android'));
|
|
if (hasIOS) parts.push('iOS ' + getVersionText('ios'));
|
|
versionInfo.textContent = '最新版本:' + parts.join(' | ');
|
|
} else {
|
|
versionInfo.textContent = '暂无可用下载';
|
|
}
|
|
}
|
|
|
|
function getVersionText(platform) {
|
|
for (var i = 0; i < versions.length; i++) {
|
|
if (versions[i].platform === platform) {
|
|
return versions[i].version || '';
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
try {
|
|
var res = await fetch(API_URL);
|
|
if (!res.ok) {
|
|
throw new Error('HTTP ' + res.status);
|
|
}
|
|
var json = await res.json();
|
|
|
|
if (json.code === 0 && json.data) {
|
|
['android', 'ios'].forEach(function(p) {
|
|
if (json.data[p]) {
|
|
versions.push({
|
|
platform: p,
|
|
url: json.data[p].url,
|
|
version: json.data[p].version,
|
|
type: json.data[p].type
|
|
});
|
|
}
|
|
});
|
|
updateUI();
|
|
} else {
|
|
versionInfo.textContent = '暂无可用下载';
|
|
}
|
|
} catch (err) {
|
|
console.error('获取下载地址失败', err);
|
|
versionInfo.textContent = '获取下载地址失败,请稍后重试';
|
|
}
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|