diff --git a/html/appdown.html b/html/appdown.html index d5f4188..577cc04 100644 --- a/html/appdown.html +++ b/html/appdown.html @@ -228,7 +228,66 @@ colorLight: "#ffffff", }); + var DEFAULT_DOWNLOAD_INFO = { + appName: "彩先知", + version: "1.0.0", + intro: "随时随地查看预测分析,不错过任何精彩推荐", + downloadUrl: downloadUrl, + }; + + function normalizeDownloadInfo(response) { + var data = response && (response.data || response.result || response); + if (!data || typeof data !== "object") return DEFAULT_DOWNLOAD_INFO; + return { + appName: data.appName || data.name || DEFAULT_DOWNLOAD_INFO.appName, + version: data.version || data.versionName || DEFAULT_DOWNLOAD_INFO.version, + intro: + data.intro || + data.description || + data.remark || + DEFAULT_DOWNLOAD_INFO.intro, + downloadUrl: + data.downloadUrl || + data.apkUrl || + data.androidUrl || + data.url || + DEFAULT_DOWNLOAD_INFO.downloadUrl, + iosUrl: data.iosUrl || data.iphoneUrl || data.appStoreUrl || "", + }; + } + + function applyDownloadInfo(info) { + var nextInfo = $.extend({}, DEFAULT_DOWNLOAD_INFO, info || {}); + if (nextInfo.appName) { + $(".hero-text h1").html("下载" + CommonUtil.escapeHtml(nextInfo.appName) + "APP"); + } + if (nextInfo.intro) { + $(".hero-text p").first().text(nextInfo.intro); + } + if (nextInfo.downloadUrl) { + $("#androidBtn").attr("href", nextInfo.downloadUrl); + CommonUtil.generateQRCode(nextInfo.downloadUrl, "downloadQrImg", { + width: 180, + height: 180, + colorDark: "#102b6a", + colorLight: "#ffffff", + }); + } + if (nextInfo.iosUrl) $("#iosBtn").attr("href", nextInfo.iosUrl); + } + + function loadDownloadInfo() { + return ApiClient.post(ApiClient.API.appDownloadInfo, {}, { publicRequest: true }) + .then(function (response) { + if (ApiClient.isSuccess(response) || response.data || response.result) { + applyDownloadInfo(normalizeDownloadInfo(response)); + } + }) + .catch(function () {}); + } + // Load download links from page config + loadDownloadInfo(); ApiClient.post("/api/web/index", {}) .then(function (result) { if (result.data && result.data.webConfigs) { diff --git a/html/chongzhi.html b/html/chongzhi.html index 07c1009..8cf4b35 100644 --- a/html/chongzhi.html +++ b/html/chongzhi.html @@ -13,6 +13,7 @@ + @@ -33,7 +34,7 @@ >免费注册 -