baigl #393

Merged
baigl merged 10 commits from baigl into main 2024-11-08 09:58:38 +08:00
2 changed files with 54 additions and 16 deletions
Showing only changes of commit 2407e66e66 - Show all commits

View File

@ -167,9 +167,53 @@ export function getTomorrow() {
return tomorrow;
}
/**
* 当前日期的 前几天
* @param {*} index 天数
* @param {*} format true 返回中国标准时间Wed Oct 02 2024 08:00:00 GMT+0800 (中国标准时间) 格式 false 返回标准时间格式 YYYY-MM-DD
* @returns
*/
export function getTheOtherDay(index, format=true) {
let date = new Date();
var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate()- index < 10 ? '0' + (date.getDate()- index) : date.getDate()- index
// 前 index 天的时间
if(format){
let tomorrow = `${year}-${month}-${day}`;
return new Date(tomorrow);
}else{
let tomorrow = `${year}-${month}-${day}`;
return tomorrow;
}
}
/**
* 当前日期的 后几天
* @param {*} index 天数
* @param {*} format true 返回中国标准时间Wed Oct 02 2024 08:00:00 GMT+0800 (中国标准时间) 格式 false 返回标准时间格式 YYYY-MM-DD
* @returns
*/
export function getTheOtheNextDay(index, format=true) {
const date = new Date();
var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate()+ index < 10 ? '0' + (date.getDate()+ index) : date.getDate()+ index
// 前 index 天的时间
if(format){
const tomorrow = `${year}-${month}-${day}`;
return new Date(tomorrow);
}else{
const tomorrow = `${year}-${month}-${day}`;
return tomorrow;
}
}
/**
* date z转为日期格式
* Wed Oct 02 2024 08:00:00 GMT+0800 (中国标准时间) 转为日期格式: YYYY-MM-DD
*
* @param {*} format
* @returns
*/
@ -178,8 +222,6 @@ export const getDateFormatDate = (newDate)=> {
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
// const hours = now.getHours().toString().padStart(2, '0');
// const minutes = now.getMinutes().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
}

View File

@ -73,7 +73,7 @@ import { listByDeadDate, listClassworkdata } from '@/api/classTask'
import TaskItem from '@/views/classTask/container/classTask/task-item.vue'
// import ItemDialog from '@/views/classTask/container/item-dialog.vue'
import { useToolState } from '@/store/modules/tool'
import { getCurrentTime, getDateFormatDate } from '@/utils/date'
import { getCurrentTime, getDateFormatDate, getTheOtherDay, getTheOtheNextDay } from '@/utils/date'
import useUserStore from '@/store/modules/user'
import useClassTaskStore from "@/store/modules/classTask";
import {createWindow} from '@/utils/tool'
@ -90,16 +90,16 @@ const tabOptions = ref(['待批改', '已批改'])
const tabActive = ref('待批改')
const dataList = ref([])
const EndDate = ref(getCurrentTime('YYYY-MM-DD'))
// 23
const startEndDate = ref([
new Date(2024, 9, 1, 0, 0, 0),
new Date(2024, 11, 1, 23, 59, 59),
getTheOtherDay(3),
getTheOtheNextDay(3),
])
const defaultTime = ref<[Date, Date]>([
new Date(2024, 9, 1, 0, 0, 0),
new Date(2024, 11, 1, 23, 59, 59),
getTheOtherDay(3),
getTheOtheNextDay(3),
])
console.log(new Date(2000, 1, 1, 0, 0, 0),'-------------------' )
//
const classWorkList = ref([])
@ -131,11 +131,7 @@ const changeEndDate = (val) => {
getData() //
}
const changeStartEndDate = (val) => {
console.log('启止日期改变', val)
console.log('startEndDate', startEndDate.value)
console.log('startEndDate-0', getDateFormatDate(startEndDate.value[0]))
console.log('startEndDate-1', getDateFormatDate(startEndDate.value[1]))
console.log('起止日期改变', val)
getData() //
}
@ -180,7 +176,7 @@ const getClassWorkList = async () => {
pageSize: 100,
})
/**
/** 2024-11-02
* 2024-10-17 由于 后面截止时间加了 时分特加判断
* 1待批改以前是以明天判断现改为传当天的日期并根据当前日期的时分与截止日期进行判断
* 2已批改以前默认是以明天判断现依然以明天为判断并根据当前日期时分大于截止日期时分判断