|
|
@ -1,7 +1,8 @@ |
|
|
import constValue from '@/api/calendar/const'; |
|
|
import constValue from '@/api/calendar/const'; |
|
|
import { clockFactory } from '@/api/calendar/utils'; |
|
|
import { clockFactory } from '@/api/calendar/utils'; |
|
|
import config from '@/api/calendar/config'; |
|
|
import config from '@/api/calendar/config'; |
|
|
export const dayArr = ['日', '一', '二', '三', '四', '五', '六']; |
|
|
export const dayArr = [ '一', '二', '三', '四', '五', '六','日']; |
|
|
|
|
|
// export const dayArr = ['日', '一', '二', '三', '四', '五', '六'];
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 日期信息的操作类 |
|
|
* 日期信息的操作类 |
|
|
@ -34,12 +35,12 @@ class DateClass { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
getWorks(date: number[]) { |
|
|
getWorks(date: number[]) { |
|
|
console.log("日清杀杀杀",`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) |
|
|
// console.log("日清杀杀杀",`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`)
|
|
|
console.log("日清杀杀杀--》",config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`)) |
|
|
// console.log("日清杀杀杀--》",config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`))
|
|
|
console.log("日清杀杀杀--》",( |
|
|
// console.log("日清杀杀杀--》",(
|
|
|
config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) > |
|
|
// config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) >
|
|
|
-1 |
|
|
// -1
|
|
|
)) |
|
|
// ))
|
|
|
return ( |
|
|
return ( |
|
|
config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) > |
|
|
config.Works.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) > |
|
|
-1 |
|
|
-1 |
|
|
@ -73,7 +74,11 @@ class DateClass { |
|
|
*/ |
|
|
*/ |
|
|
solarWeek(y: number, m: number, d: number) { |
|
|
solarWeek(y: number, m: number, d: number) { |
|
|
let date = new Date(y, m - 1, d); |
|
|
let date = new Date(y, m - 1, d); |
|
|
let week = date.getDay(); |
|
|
let week = date.getDay()-1; |
|
|
|
|
|
if(week < 0){ |
|
|
|
|
|
week = 6 |
|
|
|
|
|
} |
|
|
|
|
|
// console.log("获取公历某一天是星期几",y, m ,date,week,week < 0)
|
|
|
return week; |
|
|
return week; |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ -94,7 +99,7 @@ class DateClass { |
|
|
*/ |
|
|
*/ |
|
|
toChinaDay(d: number) { |
|
|
toChinaDay(d: number) { |
|
|
let str = d == 10 ? constValue.nStr2[0] : constValue.nStr2[Math.floor(d / 10)]; |
|
|
let str = d == 10 ? constValue.nStr2[0] : constValue.nStr2[Math.floor(d / 10)]; |
|
|
return str + (d % 10 ? constValue.nStr1[d % 10] : constValue.nStr1[10]); |
|
|
return str + (d % 10 ? constValue.nStr5[d % 10] : constValue.nStr5[10]); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 农历年份转生肖 |
|
|
* 农历年份转生肖 |
|
|
@ -310,12 +315,41 @@ class DateClass { |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
@ 作者: 秦东 |
|
|
@ 作者: 秦东 |
|
|
|
|
|
@ 时间: 2024-07-15 09:00:20 |
|
|
|
|
|
@ 功能: 前进时间 |
|
|
|
|
|
@ 1: 月;2:周;3:天 |
|
|
|
|
|
*/ |
|
|
|
|
|
moveTime(y: number, m: number, d: number,t?:number){ |
|
|
|
|
|
switch(t){ |
|
|
|
|
|
case 2: |
|
|
|
|
|
break; |
|
|
|
|
|
case 3: |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
let month = m + 1 |
|
|
|
|
|
if(month > 12){ |
|
|
|
|
|
y = y + 1; |
|
|
|
|
|
m = 1 |
|
|
|
|
|
d = this.solarMonth(y,m) |
|
|
|
|
|
}else{ |
|
|
|
|
|
m = month |
|
|
|
|
|
let day = this.solarMonth(y,month) |
|
|
|
|
|
if(d > day){ |
|
|
|
|
|
d = day |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return [y,m,d] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
@ 作者: 秦东 |
|
|
@ 时间: 2024-07-12 11:50:37 |
|
|
@ 时间: 2024-07-12 11:50:37 |
|
|
@ 功能: 处理年月日回退数据 |
|
|
@ 功能: 处理年月日回退数据 |
|
|
@ 1: 月;2:周;3:天 |
|
|
@ 1: 月;2:周;3:天 |
|
|
*/ |
|
|
*/ |
|
|
gobackTime(y: number, m: number, d: number,t?:number){ |
|
|
gobackTime(y: number, m: number, d: number,t?:number){ |
|
|
console.log("计算时间--0--》",y,m,d,t) |
|
|
// console.log("计算时间--0--》",y,m,d,t)
|
|
|
switch(t){ |
|
|
switch(t){ |
|
|
case 2: |
|
|
case 2: |
|
|
let startWeek = this.getMonday(y,m,d,'s',-1) |
|
|
let startWeek = this.getMonday(y,m,d,'s',-1) |
|
|
@ -385,11 +419,11 @@ class DateClass { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("now--->",now) |
|
|
// console.log("now--->",now)
|
|
|
console.log("nowTime--->",nowTime) |
|
|
// console.log("nowTime--->",nowTime)
|
|
|
console.log("day--->",day) |
|
|
// console.log("day--->",day)
|
|
|
console.log("longTime--->",longTime) |
|
|
// console.log("longTime--->",longTime)
|
|
|
console.log("n--->",n) |
|
|
// console.log("n--->",n)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|