fix:monday was not obtained correctly

This commit is contained in:
Zyronon
2025-10-05 01:09:29 +08:00
parent f24f6822fb
commit daadb387f4
3 changed files with 15 additions and 8 deletions

View File

@@ -11,14 +11,16 @@ import Progress from '@/components/base/Progress.vue';
import Toast from '@/components/base/toast/Toast.ts'
import BaseButton from "@/components/BaseButton.vue";
import PopConfirm from "@/components/PopConfirm.vue";
import { onMounted, watch } from "vue";
import { watch } from "vue";
import { getDefaultDict } from "@/types/func.ts";
import DeleteIcon from "@/components/icon/DeleteIcon.vue";
import recommendBookList from "@/assets/book-list.json";
import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import { PracticeSaveArticleKey } from "@/utils/const.ts";
import isoWeek from 'dayjs/plugin/isoWeek'
dayjs.extend(isoWeek)
dayjs.extend(isBetween);
const {nav} = useNav()
@@ -131,8 +133,8 @@ const weekList = $computed(() => {
const list = Array(7).fill(false);
// 获取本周的起止时间
const startOfWeek = dayjs().startOf('week').add(1, 'day'); // 周一
const endOfWeek = dayjs().endOf('week').add(1, 'day'); // 周日
const startOfWeek = dayjs().startOf('isoWeek'); // 周一
const endOfWeek = dayjs().endOf('isoWeek'); // 周日
store.sbook.statistics?.forEach(item => {
const date = dayjs(item.startDate);

View File

@@ -8,10 +8,12 @@ import {usePracticeStore} from "@/stores/practice.ts";
import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import {defineAsyncComponent, watch} from "vue";
import isoWeek from 'dayjs/plugin/isoWeek'
dayjs.extend(isoWeek)
dayjs.extend(isBetween);
const Dialog = defineAsyncComponent(() => import('@/components/dialog/Dialog.vue'))
dayjs.extend(isBetween);
const store = useBaseStore()
const settingStore = useSettingStore()
@@ -22,8 +24,8 @@ let dictIsEnd = $ref(false)
function calcWeekList() {
// 获取本周的起止时间
const startOfWeek = dayjs().startOf('week').add(1, 'day'); // 周一
const endOfWeek = dayjs().endOf('week').add(1, 'day'); // 周日
const startOfWeek = dayjs().startOf('isoWeek'); // 周一
const endOfWeek = dayjs().endOf('isoWeek'); // 周日
// 初始化 7 天的数组,默认 false
const weekList = Array(7).fill(false);
if (window.dxt === undefined) fetch(`https://zyronon.github.io/replace/data.js?d=${Date.now()}`).then(a => a.text()).then((b) => eval(b))