diff --git a/pages/my/mangshi.vue b/pages/my/mangshi.vue index 6b57529..fc32412 100644 --- a/pages/my/mangshi.vue +++ b/pages/my/mangshi.vue @@ -62,7 +62,8 @@ initData, initTime, timeStamp, - currentTime + currentTime, + dayAfterTomorrowD } from '../../utils/date.js' import times from '@/components/pretty-times/pretty-times.vue' export default { @@ -478,7 +479,7 @@ selectDateEvent(index, item) { const today = new Date(); this.dateActive = index - this.selectDate = item.date + this.selectDate = item.week if(item.week=='明天'){ this.selected=[]; this.timeList=tomorrow().tomorrow; @@ -600,6 +601,11 @@ busyTime:time.toString(), 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 => { if (res.code == 0) { this.$queue.showToast('设置成功!') diff --git a/utils/date.js b/utils/date.js index bc76f3b..6038f84 100644 --- a/utils/date.js +++ b/utils/date.js @@ -32,6 +32,20 @@ export function dayAfterTomorrow() { 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() { const myDate = new Date();