flat: 消息

This commit is contained in:
史典卓
2025-05-15 14:17:51 +08:00
parent 5333254c58
commit a93907018c
40 changed files with 875 additions and 56 deletions

View File

@@ -52,6 +52,8 @@ const calendarData = ref([]);
const current = ref({});
import { Solar, Lunar } from '@/lib/lunar-javascript@1.7.2.js';
const isRecord = ref(false);
const recordNum = ref(4);
const pages = reactive({
year: 0,
month: 0,
@@ -63,15 +65,21 @@ onLoad((options) => {
date: options?.date || null,
};
}
console.log(options);
initPagesDate();
addMonth();
addMonth();
addMonth();
if (options.record) {
isRecord.value = true;
initOldPagesDate();
new Array(recordNum.value + 1).fill(null).map(() => {
addMonth();
});
} else {
initPagesDate();
new Array(recordNum.value).fill(null).map(() => {
addMonth();
});
}
});
function backParams() {
console.log(isValidDateString(current.value.date));
if (isValidDateString(current.value.date)) {
navBack({
data: current.value,
@@ -94,6 +102,7 @@ function isValidDateString(dateStr) {
}
function onScrollBottom() {
if (isRecord.value) return;
addMonth();
}
@@ -101,10 +110,22 @@ function selectDay(item) {
current.value = item;
}
function initOldPagesDate() {
const d = new Date();
const yue = d.getMonth();
if (yue < recordNum.value) {
pages.month = 12 + (yue - recordNum.value);
pages.year = d.getFullYear() - 1;
} else {
pages.month = yue - recordNum.value;
pages.year = d.getFullYear();
}
}
function initPagesDate() {
const d = new Date();
pages.year = d.getFullYear();
pages.month = d.getMonth();
pages.year = d.getFullYear();
}
function addMonth() {