baigl #393
|
@ -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}`;
|
||||
}
|
||||
|
|
|
@ -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'))
|
||||
|
||||
// 默认起止时间:当前日期前2天后3天;默认查询一周的数据
|
||||
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、已批改、以前默认是以明天判断。现依然以明天为判断,并根据当前日期时分大于截止日期时分判断。
|
||||
|
|
Loading…
Reference in New Issue