重构课外书;更新侧边栏;修复模态框、分享海报异常
This commit is contained in:
@@ -51,12 +51,12 @@
|
||||
// --------------------------
|
||||
const BANNER_CONFIG = {
|
||||
seasonal: {
|
||||
'春季': '/upload/dingbu-chun.png', // 春季 Banner
|
||||
'夏季': '/upload/dingbu-xia.png', // 夏季 Banner
|
||||
'秋季': '/upload/dingbu-qiu.png', // 秋季 Banner
|
||||
'冬季': '/upload/dingbu-dong.png' // 冬季 Banner
|
||||
'春': '/upload/chun.jpg',
|
||||
'夏': '/upload/xia.jpg',
|
||||
'秋': '/upload/qiu.jpg',
|
||||
'冬': '/upload/dong.jpg'
|
||||
},
|
||||
fallback: '/upload/dingbu-siji.png' // 兜底图
|
||||
fallback: '/upload/dingbu-siji.png'
|
||||
};
|
||||
|
||||
// --------------------------
|
||||
@@ -66,7 +66,7 @@ function anian_setDailyCookie(name, value) {
|
||||
const now = new Date();
|
||||
const china = new Date(now.getTime() + 8 * 3600 * 1000);
|
||||
const expires = new Date(Date.UTC(china.getUTCFullYear(), china.getUTCMonth(), china.getUTCDate(), 15, 59, 59));
|
||||
document.cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; expires=${expires.toUTCString()}; path=/; domain=anian.cc`;
|
||||
document.cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; expires=${expires.toUTCString()}; path=/`;
|
||||
}
|
||||
|
||||
function anian_getCookie(name) {
|
||||
@@ -102,7 +102,7 @@ function setBanner(lunarInfo) {
|
||||
// 初始化逻辑(优化版)
|
||||
// --------------------------
|
||||
(function() {
|
||||
const apiUrl = 'https://cn.apihz.cn/api/time/getday.php?id=10011724&key=0bdd2d8b3d97c0d476c98a41f108a96f';
|
||||
const apiUrl = 'https://api.anian.cc/lunar';
|
||||
const cookieName = 'anian_lunar_info';
|
||||
|
||||
// 1. 优先尝试从 Cookie 读取
|
||||
@@ -118,16 +118,15 @@ function setBanner(lunarInfo) {
|
||||
fetch(apiUrl)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.code !== 200) throw new Error('API Error');
|
||||
|
||||
// 组装农历信息(保留原有逻辑)
|
||||
// 组装农历信息,保持 cookie 字段名不变
|
||||
const lunarInfo = {
|
||||
ganzhiYear: data.ganzhinian || '',
|
||||
lunarMonth: data.nyue || '',
|
||||
lunarDay: data.nri || '',
|
||||
jieqi: (data.JIEQICN || '').includes('第1天') ? data.jieqi : '',
|
||||
ganzhiYear: data.nian || '',
|
||||
lunarMonth: data.yue || '',
|
||||
lunarDay: data.ri || '',
|
||||
jieqi: data.jieqi || '',
|
||||
jijie: data.jijie || '',
|
||||
traditionalFestival: data.YIFESTIVAL || ''
|
||||
shengxiao: data.shengxiao || '',
|
||||
traditionalFestival: data.jieri || ''
|
||||
};
|
||||
|
||||
// 存 Cookie 并设置 Banner
|
||||
|
||||
Reference in New Issue
Block a user