This commit is contained in:
Mr.jiang 2024-08-30 17:04:20 +08:00
parent 7f70b7efdb
commit 82c6061dcd
2 changed files with 22 additions and 2 deletions

View File

@ -62,7 +62,8 @@
initData, initData,
initTime, initTime,
timeStamp, timeStamp,
currentTime currentTime,
dayAfterTomorrowD
} from '../../utils/date.js' } from '../../utils/date.js'
import times from '@/components/pretty-times/pretty-times.vue' import times from '@/components/pretty-times/pretty-times.vue'
export default { export default {
@ -478,7 +479,7 @@
selectDateEvent(index, item) { selectDateEvent(index, item) {
const today = new Date(); const today = new Date();
this.dateActive = index this.dateActive = index
this.selectDate = item.date this.selectDate = item.week
if(item.week=='明天'){ if(item.week=='明天'){
this.selected=[]; this.selected=[];
this.timeList=tomorrow().tomorrow; this.timeList=tomorrow().tomorrow;
@ -600,6 +601,11 @@
busyTime:time.toString(), busyTime:time.toString(),
artificerId:uni.getStorageSync('artificerId') artificerId:uni.getStorageSync('artificerId')
} }
if(this.selectDate=='明天'){
data.idleTime=(this.timeList+' '+this.starTime)+','+(dayAfterTomorrow().dayAfterTomorrow+' '+this.endTime);
}else if(this.selectDate=='后天'){
data.idleTime=(this.timeList+' '+this.starTime)+','+(dayAfterTomorrowD().dayAfterTomorrowD+' '+this.endTime);
}
this.$Request.postT('/app/artificerTime/setArtificerTime',data).then(res => { this.$Request.postT('/app/artificerTime/setArtificerTime',data).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$queue.showToast('设置成功!') this.$queue.showToast('设置成功!')

View File

@ -32,6 +32,20 @@ export function dayAfterTomorrow() {
todayD todayD
} }
} }
// 获取大后天日期
export function dayAfterTomorrowD() {
// 获取明天日期
const todayDd = new Date();
// 增加一天
todayDd.setDate(todayDd.getDate() + 3);
// 格式化日期为YYYY-MM-DD
const dayAfterTomorrowD = `${todayDd.getFullYear()}-${(todayDd.getMonth() + 1).toString().padStart(2, '0')}-${todayDd.getDate().toString().padStart(2, '0')}`;
return {
dayAfterTomorrowD,
}
}
// 获取当前时间 // 获取当前时间
export function currentTime() { export function currentTime() {
const myDate = new Date(); const myDate = new Date();