Browse Source

fix:本周

zhangyong/feature-20250815160302-金币优化
lihui 2 months ago
parent
commit
b26dba446a
  1. 28
      src/views/workspace/index.vue

28
src/views/workspace/index.vue

@ -188,6 +188,7 @@ import API from '@/util/http'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs-plugin-utc' import utc from 'dayjs-plugin-utc'
import weekday from 'dayjs/plugin/weekday'
dayjs.extend(utc) dayjs.extend(utc)
import { ArrowUpBold, ArrowDownBold, SemiSelect } from '@element-plus/icons-vue' import { ArrowUpBold, ArrowDownBold, SemiSelect } from '@element-plus/icons-vue'
import { marketMapping } from "@/utils/marketMap.js"; import { marketMapping } from "@/utils/marketMap.js";
@ -306,16 +307,25 @@ const getToday = function () {
} }
// //
const getWeek = function () { const getWeek = function () {
const today = dayjs()
const startTime = ((today.startOf('week').add(1, 'day')).format('YYYY-MM-DD HH:mm:ss'))
const endTime = (today.endOf('week').add(1, 'day')).format('YYYY-MM-DD HH:mm:ss')
// const endTime = today.add(1, 'week').startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
dateRange.value = [startTime, endTime]
console.log('看看dateRange', dateRange.value)
activeTimeRange.value = 'week' //
const today = dayjs();
// 01...6
const day = today.day();
getChartData()
}
// 6
let monday = today.subtract(day === 0 ? 6 : day - 1, 'day');
// (7 - day)
let sunday = today.add(day === 0 ? 0 : 7 - day, 'day');
//
const startTime = monday.startOf('day').format('YYYY-MM-DD HH:mm:ss');
const endTime = sunday.endOf('day').format('YYYY-MM-DD HH:mm:ss');
dateRange.value = [startTime, endTime];
console.log('本周时间范围(周一到周日):', dateRange.value);
activeTimeRange.value = 'week';
getChartData();
};
// //
const getMonth = function () { const getMonth = function () {
const today = dayjs() const today = dayjs()

Loading…
Cancel
Save