29 changed files with 2045 additions and 51 deletions
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
|||
!function(e,_){"object"==typeof exports&&"undefined"!=typeof module?module.exports=_(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],_):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_bg=_(e.dayjs)}(this,(function(e){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"bg",weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekStart:1,ordinal:function(e){var _=e%100;if(_>10&&_<20)return e+"-ти";var t=e%10;return 1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},formats:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"}};return t.default.locale(d,null,!0),d})); |
|||
!function(e,_){"object"==typeof exports&&"undefined"!=typeof module?module.exports=_(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],_):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_bg=_(e.dayjs)}(this,(function(e){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=_(e),d={name:"bg",weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekStart:1,ordinal:function(e){var _=e%100;if(_>10&&_<20)return e+"-ти";var t=e%10;return 1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},formats:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"}};return t.default.locale(d,null,!0),d})); |
|||
@ -1 +1 @@ |
|||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_da=t(e.dayjs)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=t(e),n={name:"da",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn._man._tirs._ons._tors._fre._lør.".split("_"),weekdaysMin:"sø._ma._ti._on._to._fr._lø.".split("_"),months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj_juni_juli_aug._sept._okt._nov._dec.".split("_"),weekStart:1,ordinal:function(e){return e+"."},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"}};return d.default.locale(n,null,!0),n})); |
|||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_da=t(e.dayjs)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=t(e),a={name:"da",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn._man._tirs._ons._tors._fre._lør.".split("_"),weekdaysMin:"sø._ma._ti._on._to._fr._lø.".split("_"),months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj_juni_juli_aug._sept._okt._nov._dec.".split("_"),weekStart:1,yearStart:4,ordinal:function(e){return e+"."},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"}};return d.default.locale(a,null,!0),a})); |
|||
@ -1 +1 @@ |
|||
!function(_,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(_="undefined"!=typeof globalThis?globalThis:_||self).dayjs_locale_zh_hk=e(_.dayjs)}(this,(function(_){"use strict";function e(_){return _&&"object"==typeof _&&"default"in _?_:{default:_}}var t=e(_),d={name:"zh-hk",months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),ordinal:function(_,e){return"W"===e?_+"週":_+"日"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d 分鐘",h:"一小時",hh:"%d 小時",d:"一天",dd:"%d 天",M:"一個月",MM:"%d 個月",y:"一年",yy:"%d 年"}};return t.default.locale(d,null,!0),d})); |
|||
!function(_,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(_="undefined"!=typeof globalThis?globalThis:_||self).dayjs_locale_zh_hk=e(_.dayjs)}(this,(function(_){"use strict";function e(_){return _&&"object"==typeof _&&"default"in _?_:{default:_}}var d=e(_),t={name:"zh-hk",months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),ordinal:function(_,e){return"W"===e?_+"週":_+"日"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d 分鐘",h:"一小時",hh:"%d 小時",d:"一天",dd:"%d 天",M:"一個月",MM:"%d 個月",y:"一年",yy:"%d 年"},meridiem:function(_,e){var d=100*_+e;return d<600?"凌晨":d<900?"早上":d<1100?"上午":d<1300?"中午":d<1800?"下午":"晚上"}};return d.default.locale(t,null,!0),t})); |
|||
@ -0,0 +1,190 @@ |
|||
import constValue from '@/api/calendar/const'; |
|||
import constVal from '@/api/calendar/const'; |
|||
import DateClass from '@/api/calendar/DateClass'; |
|||
import { clockFactory } from '@/api/calendar/utils'; |
|||
|
|||
export interface dateBase { |
|||
isCurrent: boolean; |
|||
title: number; |
|||
isHolidays: boolean; |
|||
date: string; |
|||
lunars: string; |
|||
lunarsChina: string; |
|||
isNow: boolean; |
|||
term: string | false; |
|||
lunarsChinese: string; |
|||
solarDay: string | false; |
|||
animal: string; |
|||
astro: string; |
|||
lunarDay: string | false; |
|||
isWeek?: boolean; |
|||
} |
|||
/** |
|||
* 获得节气 |
|||
* @param y 农历年度 |
|||
* @param m 公立月份 |
|||
* @param d 公立日期 |
|||
* @returns |
|||
*/ |
|||
export function getTerm(y: number, m: number, d: number) { |
|||
let firstNode = DateClass.getTerm(y, m * 2 - 1), |
|||
secondNode = DateClass.getTerm(y, m * 2); |
|||
|
|||
let term: false | string = false; |
|||
|
|||
if (Number(firstNode) === d) term = constVal.solarTerm[m * 2 - 2]; |
|||
if (Number(secondNode) == d) term = constVal.solarTerm[m * 2 - 1]; |
|||
|
|||
return term; |
|||
} |
|||
|
|||
class Calendar { |
|||
title() { |
|||
const title: string[] = []; |
|||
for (let i = 0; i <= 6; i++) { |
|||
title.push(constValue.nStr1[i % 7]); |
|||
} |
|||
return title; |
|||
} |
|||
validateDate(date: number[]) { |
|||
if (date.length === 3 && String(date[0]).length === 4) { |
|||
return date; |
|||
} else { |
|||
return DateClass.getCurrent(); |
|||
} |
|||
} |
|||
getDateParams(day: dateBase[], date: number[]) { |
|||
return day.map((el, index) => { |
|||
return { |
|||
title: el.title, |
|||
isCurrent: el.isCurrent, |
|||
value: 'tCalendar' + new Date().getTime(), |
|||
isWeek: new Date(el.date).getDay() === 6 || new Date(el.date).getDay() === 0, |
|||
isHolidays: el.isHolidays, |
|||
date: el.date, |
|||
lunars: el.lunars, |
|||
lunarsChinese: el.lunarsChinese, |
|||
lunarsChina: el.lunarDay || el.solarDay || el.term || el.lunarsChina, |
|||
isNow: el.isNow, |
|||
animal: el.animal, |
|||
astro: el.astro, |
|||
term: el.term, |
|||
solarDay: el.solarDay, |
|||
lunarDay: el.lunarDay |
|||
}; |
|||
}); |
|||
} |
|||
/** |
|||
* 获取当月前面需补齐的数组 |
|||
*/ |
|||
beforDays(date: number[], last: number) { |
|||
const y = date[1] === 1 ? date[0] - 1 : date[0]; |
|||
const m = date[1] === 1 ? 12 : date[1] - 1; |
|||
let w = DateClass.solarMonth(y, m); |
|||
|
|||
const arr: dateBase[] = []; |
|||
for (let i = 0; i < last; i++) { |
|||
const lun = DateClass.getLunars(y, m, w - i); |
|||
const l = lun.split('-'); |
|||
arr.push({ |
|||
title: w - i, |
|||
isCurrent: false, |
|||
isHolidays: DateClass.getHolidays([y, m, w - i]), |
|||
date: `${y}-${clockFactory(m)}-${clockFactory(w - i)}`, |
|||
lunars: lun, |
|||
lunarsChinese: |
|||
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])), |
|||
lunarsChina: DateClass.toChinaDay(Number(l[2])), |
|||
isNow: false, |
|||
solarDay: DateClass.getSolarDay(m, w - i), |
|||
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])), |
|||
animal: DateClass.getAnimal(Number(l[0])), |
|||
astro: DateClass.toAstro(y, m, w - i), |
|||
term: getTerm(Number(l[0]), m, w - i) |
|||
}); |
|||
} |
|||
return arr; |
|||
} |
|||
/** |
|||
* 获取当月后面需补齐的数组 |
|||
*/ |
|||
afterDays(day: dateBase[], date: number[]) { |
|||
const arr: dateBase[] = []; |
|||
const y = date[1] === 12 ? date[0] + 1 : date[0]; |
|||
const m = date[1] === 12 ? 1 : date[1] + 1; |
|||
|
|||
for (let i = 1; i < 42 - day.length + 1; i++) { |
|||
const lun = DateClass.getLunars(y, m, i); |
|||
const l = lun.split('-'); |
|||
arr.push({ |
|||
title: i, |
|||
isCurrent: false, |
|||
isHolidays: DateClass.getHolidays([y, m, i]), |
|||
date: `${y}-${clockFactory(m)}-${clockFactory(i)}`, |
|||
lunars: lun, |
|||
lunarsChinese: |
|||
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])), |
|||
lunarsChina: DateClass.toChinaDay(Number(l[2])), |
|||
isNow: false, |
|||
solarDay: DateClass.getSolarDay(m, i), |
|||
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])), |
|||
animal: DateClass.getAnimal(Number(l[0])), |
|||
astro: DateClass.toAstro(y, m, i), |
|||
term: getTerm(Number(l[0]), m, i) |
|||
}); |
|||
} |
|||
return [...day, ...arr]; |
|||
} |
|||
getDay(date: number[], beforDays: dateBase[]) { |
|||
const dateArray: dateBase[] = []; |
|||
const currentDayNumber = DateClass.solarMonth(date[0], date[1], date[2]); |
|||
for (let i = 1; i <= currentDayNumber; i++) { |
|||
const lun = DateClass.getLunars(date[0], date[1], i); |
|||
const l = lun.split('-'); |
|||
dateArray.push({ |
|||
title: i, |
|||
isCurrent: true, |
|||
isHolidays: DateClass.getHolidays([date[0], date[1], i]), |
|||
date: `${date[0]}-${clockFactory(date[1])}-${clockFactory(i)}`, |
|||
lunars: lun, |
|||
lunarsChinese: |
|||
DateClass.toChinaMonth(Number(l[1])) + DateClass.toChinaDay(Number(l[2])), |
|||
lunarsChina: DateClass.toChinaDay(Number(l[2])), |
|||
isNow: i === date[2] ? true : false, |
|||
solarDay: DateClass.getSolarDay(date[1], i), |
|||
lunarDay: DateClass.getlunarDay(Number(l[0]), Number(l[1]), Number(l[2])), |
|||
animal: DateClass.getAnimal(Number(l[0])), |
|||
astro: DateClass.toAstro(date[0], date[1], i), |
|||
term: getTerm(Number(l[0]), date[1], i) |
|||
}); |
|||
} |
|||
return [...beforDays, ...dateArray]; |
|||
} |
|||
|
|||
table(date: number[]) { |
|||
const dateArray = []; |
|||
|
|||
const result = this.validateDate(date); |
|||
|
|||
const currentDay = DateClass.solarWeeks(result[0], result[1]); |
|||
|
|||
// 获取当月的完整数据
|
|||
const beforDays = this.beforDays(date, currentDay).reverse(); |
|||
|
|||
const m = this.getDay(date, beforDays); |
|||
const afterDays = this.afterDays(m, date); |
|||
|
|||
// 转化成参数
|
|||
const params = this.getDateParams(afterDays, date); |
|||
|
|||
// return [];
|
|||
if (params.length !== 42) return []; |
|||
|
|||
for (let row = 0; row < 6; row++) { |
|||
dateArray.push(params.splice(0, 7)); |
|||
} |
|||
return dateArray; |
|||
} |
|||
} |
|||
|
|||
export default new Calendar(); |
|||
@ -0,0 +1,401 @@ |
|||
import constValue from '@/api/calendar/const'; |
|||
import { clockFactory } from '@/api/calendar/utils'; |
|||
import config from '@/api/calendar/config'; |
|||
export const dayArr = ['日', '一', '二', '三', '四', '五', '六']; |
|||
|
|||
/** |
|||
* 日期信息的操作类 |
|||
*/ |
|||
class DateClass { |
|||
getWeek(week: number) { |
|||
return `星期${dayArr[week]}`; |
|||
} |
|||
getCurrent() { |
|||
const date = new Date(); |
|||
return [date.getFullYear(), date.getMonth() + 1, date.getDate()]; |
|||
} |
|||
changeTimeStr(time: string) { |
|||
return time.split('-').map((el) => Number(el)); |
|||
} |
|||
getCurrentStr(isZero: boolean = false) { |
|||
const date = new Date(); |
|||
return isZero |
|||
? date.getFullYear() + |
|||
'-' + |
|||
clockFactory(date.getMonth() + 1) + |
|||
'-' + |
|||
clockFactory(date.getDate()) |
|||
: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); |
|||
} |
|||
getHolidays(date: number[]) { |
|||
return ( |
|||
config.Holidays.indexOf(`${date[0]}${clockFactory(date[1])}${clockFactory(date[2])}`) > |
|||
-1 |
|||
); |
|||
} |
|||
/** |
|||
* 获取公历月份天数 |
|||
* @param {number} y 年 |
|||
* @param {number} m 月 |
|||
* @returns {number} 返回输入月份天数 |
|||
*/ |
|||
solarMonth(y: number, m: number, d?: number) { |
|||
if (m == 2) return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ? 29 : 28; |
|||
return constValue.solarMonth[m - 1]; |
|||
} |
|||
/** |
|||
* 获得当前月份第一天是星期几 |
|||
* @param {number} y 年 |
|||
* @param {number} m 月 |
|||
* @returns {number} 返回星期数字[0-6] |
|||
*/ |
|||
solarWeeks(y: number, m: number) { |
|||
return this.solarWeek(y, m, 1); |
|||
} |
|||
/** |
|||
* 获取公历某一天是星期几 |
|||
* @param {number} y 年 |
|||
* @param {number} m 月 |
|||
* @param {number} d 日 |
|||
* @returns {number} 返回星期数字[0-6] |
|||
*/ |
|||
solarWeek(y: number, m: number, d: number) { |
|||
let date = new Date(y, m - 1, d); |
|||
let week = date.getDay(); |
|||
return week; |
|||
} |
|||
/** |
|||
* 返回农历月份通俗表示法 |
|||
* @param {number} m 农历月 |
|||
* @returns {string} 返回农历月份通俗表示法:'正月' |
|||
*/ |
|||
toChinaMonth(m: number) { |
|||
let r = String(m).slice(0, 1) == '0'; |
|||
return r |
|||
? '\u95f0' + constValue.nStr3[m - 1] + '\u6708' |
|||
: constValue.nStr3[m - 1] + '\u6708'; // 加上"月"字
|
|||
} |
|||
/** |
|||
* 返回农历日期通俗表示法 |
|||
* @param {number} d 农历日 |
|||
* @returns {string} 返回农历日期通俗表示法:‘初一’ |
|||
*/ |
|||
toChinaDay(d: number) { |
|||
let str = d == 10 ? constValue.nStr2[0] : constValue.nStr2[Math.floor(d / 10)]; |
|||
return str + (d % 10 ? constValue.nStr1[d % 10] : constValue.nStr1[10]); |
|||
} |
|||
/** |
|||
* 农历年份转生肖 |
|||
* @param {number} y 农历年 |
|||
* @returns {string} 农历年份转生肖 |
|||
*/ |
|||
getAnimal(y: number) { |
|||
return constValue.Animals[(y - 4) % 12]; |
|||
} |
|||
/** |
|||
* 返回公历日期所属星座 |
|||
* @param {number} m 月 |
|||
* @param {number} d 日 |
|||
* @returns {string} 返回星座信息 |
|||
*/ |
|||
toAstro(y: number, m: number, d: number) { |
|||
let s = |
|||
'\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'; |
|||
let arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]; |
|||
let i = m * 2 - (d < arr[m - 1] ? 2 : 0); |
|||
return s.slice(i, i + 2) + '\u5ea7'; |
|||
} |
|||
/** |
|||
* 根据公历日期返回农历日期 |
|||
* @param {number} y 年 |
|||
* @param {number} m 月 |
|||
* @param {number} d 日 |
|||
* @returns {string} 返回农历日期,如果是闰月则月份前含0 |
|||
*/ |
|||
getLunars(y: number, m: number, d: number) { |
|||
let date = new Date(y, m - 1, d), |
|||
i, |
|||
leap = 0, |
|||
temp = 0; |
|||
let offset = (Date.UTC(y, m - 1, d) - Date.UTC(1900, 0, 31)) / 86400000; |
|||
for (i = 1900; i < 2101 && offset > 0; i++) { |
|||
temp = this.lYearDays(i); |
|||
offset -= temp; |
|||
} |
|||
if (offset < 0) { |
|||
offset += temp; |
|||
i--; |
|||
} |
|||
// 获取闰月
|
|||
let year = i; |
|||
leap = this.leapMonth(i); |
|||
let isLeap = false; |
|||
// 校验闰月
|
|||
for (i = 1; i < 13 && offset > 0; i++) { |
|||
if (leap > 0 && i == leap + 1 && !isLeap) { |
|||
--i; |
|||
isLeap = true; |
|||
temp = this.leapDays(year); // 闰月天数
|
|||
} else { |
|||
temp = this.monthDays(year, i); // 普通月天数
|
|||
} |
|||
if (isLeap && i == leap + 1) isLeap = false; |
|||
offset -= temp; |
|||
} |
|||
if (offset == 0 && leap > 0 && i == leap + 1) { |
|||
if (isLeap) { |
|||
isLeap = false; |
|||
} else { |
|||
isLeap = true; |
|||
--i; |
|||
} |
|||
} |
|||
if (offset < 0) { |
|||
offset += temp; |
|||
--i; |
|||
} |
|||
// 农历月
|
|||
let month = isLeap ? '0' + i : i; |
|||
// 农历日
|
|||
let day = ++offset; |
|||
return year + '-' + month + '-' + day; |
|||
} |
|||
/** |
|||
* 返回农历年闰月,没有闰月则返回0 |
|||
* @param {number} y 农历年 |
|||
* @returns {number} 农历年闰月月份数字,没有闰月则返回0 |
|||
*/ |
|||
leapMonth(y: number, m?: number, d?: number) { |
|||
return constValue.lunarInfo[y - 1900] & 0xf; |
|||
} |
|||
/** |
|||
* 返回农历年闰月的天数,没有闰月则返回0 |
|||
* @param {number} y 农历年 |
|||
* @returns {number} 闰月的天数,没有闰月则返回0 |
|||
*/ |
|||
leapDays(y: number, m?: number, d?: number) { |
|||
return this.leapMonth(y, m, d) ? (constValue.lunarInfo[y - 1900] & 0x10000 ? 30 : 29) : 0; |
|||
} |
|||
/** |
|||
* 查询公历日期节日 |
|||
* @param {number} m 月 |
|||
* @param {number} d 日 |
|||
* @returns {string | boolean} 返回节日信息,不是节日则返回false |
|||
*/ |
|||
getSolarDay(m: number, d: number) { |
|||
let solarDay: false | string = false; |
|||
for (let i = 0; i < constValue.sFtv.length; i++) { |
|||
if ( |
|||
parseInt(constValue.sFtv[i].slice(0, 2)) == m && |
|||
parseInt(constValue.sFtv[i].slice(2, 4)) == d |
|||
) { |
|||
solarDay = constValue.sFtv[i].slice(5); |
|||
} |
|||
} |
|||
return solarDay; |
|||
} |
|||
/** |
|||
* 通过农历日期获取农历节日 |
|||
* @param {number} y 农历年 |
|||
* @param {number|string} m 农历月,如果是闰月则为字符串‘07’ |
|||
* @param {number} d 农历日 |
|||
* @returns {string|false} 返回农历节日,没有节日则返回false |
|||
*/ |
|||
getlunarDay(y: number, m: number, d: number) { |
|||
if (String(m).slice(0, 1) == '0') return false; //如果是闰月则没有节日
|
|||
let lunarDay: false | string = false; |
|||
for (let i = 0; i < constValue.lFtv.length; i++) { |
|||
if ( |
|||
parseInt(constValue.lFtv[i].slice(0, 2)) == m && |
|||
parseInt(constValue.lFtv[i].slice(2, 4)) == d |
|||
) { |
|||
lunarDay = constValue.lFtv[i].slice(5); |
|||
} |
|||
} |
|||
// 判断是否为除夕
|
|||
if (m == 12 && this.monthDays(y, m, d) == d) lunarDay = '除夕'; |
|||
return lunarDay; |
|||
} |
|||
/** |
|||
* 返回农历一年的天数 |
|||
* @param {number} y 农历年份 |
|||
* @returns {number} 一年的天数 |
|||
*/ |
|||
lYearDays(y: number, m?: number, d?: number) { |
|||
let i, |
|||
sum = 348; |
|||
for (i = 0x8000; i > 0x8; i >>= 1) { |
|||
sum += constValue.lunarInfo[y - 1900] & i ? 1 : 0; |
|||
} |
|||
return sum + this.leapDays(y); |
|||
} |
|||
/** |
|||
* 获取农历非闰月的总天数 |
|||
* @param {number} y 农历年 |
|||
* @param {number} m 农历月 |
|||
* @returns {number} 返回农历非闰月的天数 |
|||
*/ |
|||
monthDays(y: number, m: number, d?: number) { |
|||
return constValue.lunarInfo[y - 1900] & (0x10000 >> m) ? 30 : 29; |
|||
} |
|||
/** |
|||
* 获取公历年第n个节气日期 |
|||
* @param {number} y 年 |
|||
* @param {number} n 第几个节气 |
|||
* @returns {string} 返回日期,0506 |
|||
*/ |
|||
getTerm(y: number, n: number) { |
|||
let _table = constValue.sTermInfo[y - 1900]; |
|||
let _info = [ |
|||
parseInt('0x' + _table.slice(0, 5)).toString(), |
|||
parseInt('0x' + _table.slice(5, 10)).toString(), |
|||
parseInt('0x' + _table.slice(10, 15)).toString(), |
|||
parseInt('0x' + _table.slice(15, 20)).toString(), |
|||
parseInt('0x' + _table.slice(20, 25)).toString(), |
|||
parseInt('0x' + _table.slice(25)).toString() |
|||
]; |
|||
let d = [ |
|||
_info[0].slice(0, 1), |
|||
_info[0].slice(1, 3), |
|||
_info[0].slice(3, 4), |
|||
_info[0].slice(4, 6), |
|||
|
|||
_info[1].slice(0, 1), |
|||
_info[1].slice(1, 3), |
|||
_info[1].slice(3, 4), |
|||
_info[1].slice(4, 6), |
|||
|
|||
_info[2].slice(0, 1), |
|||
_info[2].slice(1, 3), |
|||
_info[2].slice(3, 4), |
|||
_info[2].slice(4, 6), |
|||
|
|||
_info[3].slice(0, 1), |
|||
_info[3].slice(1, 3), |
|||
_info[3].slice(3, 4), |
|||
_info[3].slice(4, 6), |
|||
|
|||
_info[4].slice(0, 1), |
|||
_info[4].slice(1, 3), |
|||
_info[4].slice(3, 4), |
|||
_info[4].slice(4, 6), |
|||
|
|||
_info[5].slice(0, 1), |
|||
_info[5].slice(1, 3), |
|||
_info[5].slice(3, 4), |
|||
_info[5].slice(4, 6) |
|||
]; |
|||
return d[n - 1]; |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 13:11:32 |
|||
@ 功能: 判断公立是不是闰年 |
|||
*/ |
|||
|
|||
isLeapYear(year: number): boolean { |
|||
return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0); |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 11:50:37 |
|||
@ 功能: 处理年月日回退数据 |
|||
@ 1: 月;2:周;3:天 |
|||
*/ |
|||
gobackTime(y: number, m: number, d: number,t?:number){ |
|||
console.log("计算时间--0--》",y,m,d,t) |
|||
switch(t){ |
|||
case 2: |
|||
let startWeek = this.getMonday(y,m,d,'s',0) |
|||
let endWeek = this.getMonday(y,m,d,'e',0) |
|||
return { |
|||
start:startWeek, |
|||
end:endWeek |
|||
} |
|||
break; |
|||
case 3: |
|||
let day = d-1 |
|||
if(day <= 0){ |
|||
let month = m - 1 |
|||
if(month <= 0){ |
|||
y = y -1; |
|||
m = 12 |
|||
d = this.solarMonth(y,m) |
|||
}else{ |
|||
m = month |
|||
d = this.solarMonth(y,month) |
|||
} |
|||
}else{ |
|||
d = day |
|||
} |
|||
return [y,m,d] |
|||
break; |
|||
default: |
|||
let month = m - 1 |
|||
if(month <= 0){ |
|||
y = y -1; |
|||
m = 12 |
|||
d = this.solarMonth(y,m) |
|||
console.log("计算时间--1--》",y,m,d) |
|||
}else{ |
|||
m = month |
|||
let day = this.solarMonth(y,month) |
|||
if(d > day){ |
|||
d = day |
|||
} |
|||
|
|||
} |
|||
return [y,m,d] |
|||
break; |
|||
|
|||
} |
|||
|
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 13:48:55 |
|||
@ 功能: 获取周 |
|||
*/ |
|||
getMonday = (year: number, month: number, taday: number,type: any, dates: any) => { |
|||
// let now = new Date();
|
|||
// let nowTime = now.getTime();
|
|||
|
|||
let dateStr = year + "-" + month + "-" + taday; // 要转换的日期字符串
|
|||
// let nowTime = Date.parse(dateStr);
|
|||
|
|||
let now = new Date(dateStr); |
|||
let nowTime = now.getTime(); |
|||
|
|||
let day = now.getDay(); |
|||
let longTime = 24 * 60 * 60 * 1000; |
|||
let n = longTime * 7 * (dates || 0); |
|||
let date: any = '' |
|||
|
|||
|
|||
|
|||
console.log("now--->",now) |
|||
console.log("nowTime--->",nowTime) |
|||
console.log("day--->",day) |
|||
console.log("longTime--->",longTime) |
|||
console.log("n--->",n) |
|||
|
|||
|
|||
|
|||
if (type == "s") { |
|||
date = nowTime - (day - 1) * longTime + n; |
|||
}; |
|||
if (type == "e") { |
|||
date = nowTime + (7 - day) * longTime + n; |
|||
}; |
|||
date = new Date(date); |
|||
let y: any = date.getFullYear(); |
|||
let m: any = date.getMonth() + 1; |
|||
let d: any = date.getDate(); |
|||
// m = m < 10 ? "0" + m : m;
|
|||
// d = d < 10 ? "0" + d : d;
|
|||
let days = y + "-" + m + "-" + d; |
|||
return [y, m, d]; |
|||
} |
|||
} |
|||
|
|||
export default new DateClass(); |
|||
@ -0,0 +1,169 @@ |
|||
export default { |
|||
/** |
|||
* 假期日期 |
|||
*/ |
|||
Holidays: [ |
|||
'20181230', |
|||
'20181231', |
|||
'20190101', |
|||
'20190204', |
|||
'20190205', |
|||
'20190206', |
|||
'20190207', |
|||
'20190208', |
|||
'20190209', |
|||
'20190210', |
|||
'20190405', |
|||
'20190406', |
|||
'20190407', |
|||
'20190501', |
|||
'20190502', |
|||
'20190503', |
|||
'20190504', |
|||
'20190607', |
|||
'20190608', |
|||
'20190609', |
|||
'20190913', |
|||
'20190914', |
|||
'20190915', |
|||
'20191001', |
|||
'20191002', |
|||
'20191003', |
|||
'20191004', |
|||
'20191005', |
|||
'20191006', |
|||
'20191007', |
|||
'20200101', |
|||
'20200124', |
|||
'20200125', |
|||
'20200126', |
|||
'20200127', |
|||
'20200128', |
|||
'20200129', |
|||
'20200130', |
|||
'20200404', |
|||
'20200405', |
|||
'20200406', |
|||
'20200501', |
|||
'20200502', |
|||
'20200503', |
|||
'20200504', |
|||
'20200505', |
|||
'20200625', |
|||
'20200626', |
|||
'20200627', |
|||
'20201001', |
|||
'20201002', |
|||
'20201003', |
|||
'20201004', |
|||
'20201005', |
|||
'20201006', |
|||
'20201007', |
|||
'20201008', |
|||
'20210101', |
|||
'20210102', |
|||
'20210103', |
|||
'20210211', |
|||
'20210212', |
|||
'20210213', |
|||
'20210214', |
|||
'20210215', |
|||
'20210216', |
|||
'20210217', |
|||
'20210403', |
|||
'20210404', |
|||
'20210405', |
|||
'20210501', |
|||
'20210502', |
|||
'20210503', |
|||
'20210504', |
|||
'20210505', |
|||
'20210612', |
|||
'20210613', |
|||
'20210614', |
|||
'20210919', |
|||
'20210920', |
|||
'20210921', |
|||
'20211001', |
|||
'20211002', |
|||
'20211003', |
|||
'20211004', |
|||
'20211005', |
|||
'20211006', |
|||
'20211007', |
|||
'20220101', |
|||
'20220102', |
|||
'20220103', |
|||
'20220131', |
|||
'20220201', |
|||
'20220202', |
|||
'20220203', |
|||
'20220204', |
|||
'20220205', |
|||
'20220206', |
|||
'20220403', |
|||
'20220404', |
|||
'20220405', |
|||
'20220430', |
|||
'20220501', |
|||
'20220502', |
|||
'20220503', |
|||
'20220504', |
|||
'20220603', |
|||
'20220604', |
|||
'20220605', |
|||
'20220910', |
|||
'20220911', |
|||
'20220912', |
|||
'20221001', |
|||
'20221002', |
|||
'20221003', |
|||
'20221004', |
|||
'20221005', |
|||
'20221006', |
|||
'20221007', |
|||
'20221231', |
|||
'20230101', |
|||
'20230102', |
|||
'20230121', |
|||
'20230122', |
|||
'20230123', |
|||
'20230124', |
|||
'20230125', |
|||
'20230126', |
|||
'20230127', |
|||
], |
|||
/** |
|||
* 补休日期 |
|||
*/ |
|||
Works: [ |
|||
'20181229', |
|||
'20190202', |
|||
'20190203', |
|||
'20190428', |
|||
'20190505', |
|||
'20190929', |
|||
'20191012', |
|||
'20200119', |
|||
'20200201', |
|||
'20200426', |
|||
'20200509', |
|||
'20200628', |
|||
'20200927', |
|||
'20201010', |
|||
'20210207', |
|||
'20210220', |
|||
'20210425', |
|||
'20210508', |
|||
'20210918', |
|||
'20210926', |
|||
'20211009', |
|||
'20220129', |
|||
'20220130', |
|||
'20220402', |
|||
'20220424', |
|||
'20220507', |
|||
'20221008', |
|||
'20221009', |
|||
], |
|||
}; |
|||
@ -0,0 +1,596 @@ |
|||
export default { |
|||
/** |
|||
* 1900-2100各年的24节气日期速查表 |
|||
*/ |
|||
sTermInfo: [ |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c3598082c95f8c965cc920f', |
|||
'97bd0b06bdb0722c965ce1cfcc920f', |
|||
'b027097bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', |
|||
'97bd0b06bdb0722c965ce1cfcc920f', |
|||
'b027097bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', |
|||
'97bd0b06bdb0722c965ce1cfcc920f', |
|||
'b027097bd097c36b0b6fc9274c91aa', |
|||
'9778397bd19801ec9210c965cc920e', |
|||
'97b6b97bd19801ec95f8c965cc920f', |
|||
'97bd09801d98082c95f8e1cfcc920f', |
|||
'97bd097bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd197c36c9210c9274c91aa', |
|||
'97b6b97bd19801ec95f8c965cc920e', |
|||
'97bd09801d98082c95f8e1cfcc920f', |
|||
'97bd097bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c91aa', |
|||
'97b6b97bd19801ec95f8c965cc920e', |
|||
'97bcf97c3598082c95f8e1cfcc920f', |
|||
'97bd097bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c3598082c95f8c965cc920f', |
|||
'97bd097bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c3598082c95f8c965cc920f', |
|||
'97bd097bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', |
|||
'97bd097bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', |
|||
'97bd097bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', |
|||
'97bd097bd07f595b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd19801ec9210c9274c920e', |
|||
'97b6b97bd19801ec95f8c965cc920f', |
|||
'97bd07f5307f595b0b0bc920fb0722', |
|||
'7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c920e', |
|||
'97b6b97bd19801ec95f8c965cc920f', |
|||
'97bd07f5307f595b0b0bc920fb0722', |
|||
'7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bd07f1487f595b0b0bc920fb0722', |
|||
'7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c9274c920e', |
|||
'97bcf7f0e47f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c91aa', |
|||
'97b6b97bd197c36c9210c9274c920e', |
|||
'97bcf7f0e47f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c920e', |
|||
'97b6b7f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f5307f595b0b0bc920fb0722', |
|||
'7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36b0b70c9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e37f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc9210c8dc2', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0787b0721', |
|||
'7f0e27f0e47f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c91aa', |
|||
'97b6b7f0e47f149b0723b0787b0721', |
|||
'7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c8dc2', |
|||
'977837f0e37f149b0723b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f5307f595b0b0bc920fb0722', |
|||
'7f0e397bd097c35b0b6fc9210c8dc2', |
|||
'977837f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e37f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc9210c8dc2', |
|||
'977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', |
|||
'977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f149b0723b0787b0721', |
|||
'7f0e27f0e47f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'977837f0e37f14998082b0723b06bd', |
|||
'7f07e7f0e37f149b0723b0787b0721', |
|||
'7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', |
|||
'977837f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f1487f595b0b0bb0b6fb0722', |
|||
'7f0e37f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e37f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e37f14898082b072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e37f14898082b072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f149b0723b0787b0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', |
|||
'7ec967f0e37f14998082b0723b06bd', |
|||
'7f07e7f0e47f149b0723b0787b0721', |
|||
'7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', |
|||
'7ec967f0e37f14998082b0723b06bd', |
|||
'7f07e7f0e37f14998083b0787b0721', |
|||
'7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', |
|||
'7ec967f0e37f14898082b0723b02d5', |
|||
'7f07e7f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', |
|||
'7f0e36665b66aa89801e9808297c35', |
|||
'665f67f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', |
|||
'7f0e36665b66a449801e9808297c35', |
|||
'665f67f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e36665b66a449801e9808297c35', |
|||
'665f67f0e37f14898082b072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e26665b66a449801e9808297c35', |
|||
'665f67f0e37f1489801eb072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722' |
|||
], |
|||
/** |
|||
* 24节气速查表 |
|||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] |
|||
*/ |
|||
solarTerm: [ |
|||
'\u5c0f\u5bd2', |
|||
'\u5927\u5bd2', |
|||
'\u7acb\u6625', |
|||
'\u96e8\u6c34', |
|||
'\u60ca\u86f0', |
|||
'\u6625\u5206', |
|||
'\u6e05\u660e', |
|||
'\u8c37\u96e8', |
|||
'\u7acb\u590f', |
|||
'\u5c0f\u6ee1', |
|||
'\u8292\u79cd', |
|||
'\u590f\u81f3', |
|||
'\u5c0f\u6691', |
|||
'\u5927\u6691', |
|||
'\u7acb\u79cb', |
|||
'\u5904\u6691', |
|||
'\u767d\u9732', |
|||
'\u79cb\u5206', |
|||
'\u5bd2\u9732', |
|||
'\u971c\u964d', |
|||
'\u7acb\u51ac', |
|||
'\u5c0f\u96ea', |
|||
'\u5927\u96ea', |
|||
'\u51ac\u81f3' |
|||
], |
|||
/** |
|||
* 天干地支之地支速查表<=>生肖 |
|||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] |
|||
*/ |
|||
Animals: [ |
|||
'\u9f20', |
|||
'\u725b', |
|||
'\u864e', |
|||
'\u5154', |
|||
'\u9f99', |
|||
'\u86c7', |
|||
'\u9a6c', |
|||
'\u7f8a', |
|||
'\u7334', |
|||
'\u9e21', |
|||
'\u72d7', |
|||
'\u732a' |
|||
], |
|||
/** |
|||
* 天干地支之天干速查表 |
|||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] |
|||
*/ |
|||
Gan: [ |
|||
'\u7532', |
|||
'\u4e59', |
|||
'\u4e19', |
|||
'\u4e01', |
|||
'\u620a', |
|||
'\u5df1', |
|||
'\u5e9a', |
|||
'\u8f9b', |
|||
'\u58ec', |
|||
'\u7678' |
|||
], |
|||
/** |
|||
* 天干地支之地支速查表 |
|||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] |
|||
*/ |
|||
Zhi: [ |
|||
'\u5b50', |
|||
'\u4e11', |
|||
'\u5bc5', |
|||
'\u536f', |
|||
'\u8fb0', |
|||
'\u5df3', |
|||
'\u5348', |
|||
'\u672a', |
|||
'\u7533', |
|||
'\u9149', |
|||
'\u620c', |
|||
'\u4ea5' |
|||
], |
|||
/** |
|||
* 数字转中文速查表 |
|||
* @trans ['日','一','二','三','四','五','六','七','八','九','十'] |
|||
*/ |
|||
nStr1: [ |
|||
'\u65e5', |
|||
'\u4e00', |
|||
'\u4e8c', |
|||
'\u4e09', |
|||
'\u56db', |
|||
'\u4e94', |
|||
'\u516d', |
|||
'\u4e03', |
|||
'\u516b', |
|||
'\u4e5d', |
|||
'\u5341' |
|||
], |
|||
/** |
|||
* 日期转农历称呼速查表 |
|||
* @trans ['初','十','廿','卅'] |
|||
*/ |
|||
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], |
|||
/** |
|||
* 月份转农历称呼速查表 |
|||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] |
|||
*/ |
|||
nStr3: [ |
|||
'\u6b63', |
|||
'\u4e8c', |
|||
'\u4e09', |
|||
'\u56db', |
|||
'\u4e94', |
|||
'\u516d', |
|||
'\u4e03', |
|||
'\u516b', |
|||
'\u4e5d', |
|||
'\u5341', |
|||
'\u51ac', |
|||
'\u814a' |
|||
], |
|||
/** |
|||
* 公历节日 |
|||
**/ |
|||
sFtv: [ |
|||
'0101 元旦', |
|||
'0214 情人节', |
|||
'0308 妇女节', |
|||
'0312 植树节', |
|||
'0315 消费者权益日', |
|||
'0401 愚人节', |
|||
'0501 劳动节', |
|||
'0504 青年节', |
|||
'0512 护士节', |
|||
'0601 儿童节', |
|||
'0701 建党节', |
|||
'0801 建军节', |
|||
'0910 教师节', |
|||
'0928 孔子诞辰', |
|||
'1001 国庆节', |
|||
'1006 老人节', |
|||
'1024 联合国日', |
|||
'1224 平安夜', |
|||
'1225 圣诞节', |
|||
'1101 万圣节', |
|||
'1213 国家公祭日' |
|||
], |
|||
/** |
|||
* 农历节日 |
|||
**/ |
|||
lFtv: [ |
|||
'0101 春节', |
|||
'0115 元宵节', |
|||
'0505 端午节', |
|||
'0707 七夕情人节', |
|||
'0715 中元节', |
|||
'0815 中秋节', |
|||
'0909 重阳节', |
|||
'1208 腊八节', |
|||
'1224 小年' |
|||
], |
|||
/** |
|||
* 公历月份中文表 |
|||
**/ |
|||
monthStr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], |
|||
/** |
|||
* 农历1900-2100的润大小信息表 |
|||
* @Array Of Property |
|||
* @return Hex |
|||
*/ |
|||
lunarInfo: [ |
|||
0x04bd8, |
|||
0x04ae0, |
|||
0x0a570, |
|||
0x054d5, |
|||
0x0d260, |
|||
0x0d950, |
|||
0x16554, |
|||
0x056a0, |
|||
0x09ad0, |
|||
0x055d2, //1900-1909
|
|||
0x04ae0, |
|||
0x0a5b6, |
|||
0x0a4d0, |
|||
0x0d250, |
|||
0x1d255, |
|||
0x0b540, |
|||
0x0d6a0, |
|||
0x0ada2, |
|||
0x095b0, |
|||
0x14977, //1910-1919
|
|||
0x04970, |
|||
0x0a4b0, |
|||
0x0b4b5, |
|||
0x06a50, |
|||
0x06d40, |
|||
0x1ab54, |
|||
0x02b60, |
|||
0x09570, |
|||
0x052f2, |
|||
0x04970, //1920-1929
|
|||
0x06566, |
|||
0x0d4a0, |
|||
0x0ea50, |
|||
0x06e95, |
|||
0x05ad0, |
|||
0x02b60, |
|||
0x186e3, |
|||
0x092e0, |
|||
0x1c8d7, |
|||
0x0c950, //1930-1939
|
|||
0x0d4a0, |
|||
0x1d8a6, |
|||
0x0b550, |
|||
0x056a0, |
|||
0x1a5b4, |
|||
0x025d0, |
|||
0x092d0, |
|||
0x0d2b2, |
|||
0x0a950, |
|||
0x0b557, //1940-1949
|
|||
0x06ca0, |
|||
0x0b550, |
|||
0x15355, |
|||
0x04da0, |
|||
0x0a5b0, |
|||
0x14573, |
|||
0x052b0, |
|||
0x0a9a8, |
|||
0x0e950, |
|||
0x06aa0, //1950-1959
|
|||
0x0aea6, |
|||
0x0ab50, |
|||
0x04b60, |
|||
0x0aae4, |
|||
0x0a570, |
|||
0x05260, |
|||
0x0f263, |
|||
0x0d950, |
|||
0x05b57, |
|||
0x056a0, //1960-1969
|
|||
0x096d0, |
|||
0x04dd5, |
|||
0x04ad0, |
|||
0x0a4d0, |
|||
0x0d4d4, |
|||
0x0d250, |
|||
0x0d558, |
|||
0x0b540, |
|||
0x0b6a0, |
|||
0x195a6, //1970-1979
|
|||
0x095b0, |
|||
0x049b0, |
|||
0x0a974, |
|||
0x0a4b0, |
|||
0x0b27a, |
|||
0x06a50, |
|||
0x06d40, |
|||
0x0af46, |
|||
0x0ab60, |
|||
0x09570, //1980-1989
|
|||
0x04af5, |
|||
0x04970, |
|||
0x064b0, |
|||
0x074a3, |
|||
0x0ea50, |
|||
0x06b58, |
|||
0x055c0, |
|||
0x0ab60, |
|||
0x096d5, |
|||
0x092e0, //1990-1999
|
|||
0x0c960, |
|||
0x0d954, |
|||
0x0d4a0, |
|||
0x0da50, |
|||
0x07552, |
|||
0x056a0, |
|||
0x0abb7, |
|||
0x025d0, |
|||
0x092d0, |
|||
0x0cab5, //2000-2009
|
|||
0x0a950, |
|||
0x0b4a0, |
|||
0x0baa4, |
|||
0x0ad50, |
|||
0x055d9, |
|||
0x04ba0, |
|||
0x0a5b0, |
|||
0x15176, |
|||
0x052b0, |
|||
0x0a930, //2010-2019
|
|||
0x07954, |
|||
0x06aa0, |
|||
0x0ad50, |
|||
0x05b52, |
|||
0x04b60, |
|||
0x0a6e6, |
|||
0x0a4e0, |
|||
0x0d260, |
|||
0x0ea65, |
|||
0x0d530, //2020-2029
|
|||
0x05aa0, |
|||
0x076a3, |
|||
0x096d0, |
|||
0x04afb, |
|||
0x04ad0, |
|||
0x0a4d0, |
|||
0x1d0b6, |
|||
0x0d250, |
|||
0x0d520, |
|||
0x0dd45, //2030-2039
|
|||
0x0b5a0, |
|||
0x056d0, |
|||
0x055b2, |
|||
0x049b0, |
|||
0x0a577, |
|||
0x0a4b0, |
|||
0x0aa50, |
|||
0x1b255, |
|||
0x06d20, |
|||
0x0ada0, //2040-2049
|
|||
/**Add By JJonline@JJonline.Cn**/ |
|||
0x14b63, |
|||
0x09370, |
|||
0x049f8, |
|||
0x04970, |
|||
0x064b0, |
|||
0x168a6, |
|||
0x0ea50, |
|||
0x06b20, |
|||
0x1a6c4, |
|||
0x0aae0, //2050-2059
|
|||
0x0a2e0, |
|||
0x0d2e3, |
|||
0x0c960, |
|||
0x0d557, |
|||
0x0d4a0, |
|||
0x0da50, |
|||
0x05d55, |
|||
0x056a0, |
|||
0x0a6d0, |
|||
0x055d4, //2060-2069
|
|||
0x052d0, |
|||
0x0a9b8, |
|||
0x0a950, |
|||
0x0b4a0, |
|||
0x0b6a6, |
|||
0x0ad50, |
|||
0x055a0, |
|||
0x0aba4, |
|||
0x0a5b0, |
|||
0x052b0, //2070-2079
|
|||
0x0b273, |
|||
0x06930, |
|||
0x07337, |
|||
0x06aa0, |
|||
0x0ad50, |
|||
0x14b55, |
|||
0x04b60, |
|||
0x0a570, |
|||
0x054e4, |
|||
0x0d160, //2080-2089
|
|||
0x0e968, |
|||
0x0d520, |
|||
0x0daa0, |
|||
0x16aa6, |
|||
0x056d0, |
|||
0x04ae0, |
|||
0x0a9d4, |
|||
0x0a2d0, |
|||
0x0d150, |
|||
0x0f252, //2090-2099
|
|||
0x0d520 |
|||
], //2100
|
|||
/** |
|||
* 按星期过的节日信息 |
|||
*/ |
|||
weekDays: { |
|||
'060300': '父亲节', |
|||
'050200': '母亲节' |
|||
}, |
|||
/** |
|||
* 公历每个月份的天数普通表 |
|||
* @Array Of Property |
|||
* @return Number |
|||
*/ |
|||
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] |
|||
}; |
|||
@ -0,0 +1,7 @@ |
|||
/** |
|||
* 获得时间 |
|||
* @returns {String} 当前时间 |
|||
*/ |
|||
export function clockFactory(time: number): string { |
|||
return `${time >= 10 ? time : '0' + time}`; |
|||
} |
|||
@ -0,0 +1,108 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 09:27:42 |
|||
@ 备注: 日历 |
|||
--> |
|||
<script lang='ts' setup> |
|||
import DateClass from '@/api/calendar/DateClass'; |
|||
const props = defineProps({ |
|||
data: { |
|||
type: Object, |
|||
default() { |
|||
return {}; |
|||
}, |
|||
}, |
|||
bodyHight:Number, |
|||
}); |
|||
const taday = ref<any>([]); |
|||
const curtteDayType = ref(1) |
|||
const curtteDay = ref(1) |
|||
|
|||
|
|||
const curttWeek = computed(()=>{ |
|||
if(taday.value.length <= 0){ |
|||
taday.value = DateClass.getCurrent() |
|||
} |
|||
return DateClass.getWeek(DateClass.solarWeek(taday.value[0],taday.value[1],taday.value[2])) |
|||
}) |
|||
|
|||
|
|||
const curtteMonth = computed(()=>{ |
|||
if(taday.value.length <= 0){ |
|||
taday.value = DateClass.getCurrent() |
|||
} |
|||
if(taday.value.length >= 2){ |
|||
return taday.value[0]+"年"+taday.value[1]+"月" |
|||
} |
|||
}) |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 11:12:12 |
|||
@ 功能: 后退时间 |
|||
*/ |
|||
const backTime = () =>{ |
|||
if(taday.value.length <= 0){ |
|||
taday.value = DateClass.getCurrent() |
|||
} |
|||
taday.value = DateClass.gobackTime(taday.value[0],taday.value[1],taday.value[2],curtteDayType.value) |
|||
|
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-12 14:04:06 |
|||
@ 功能: 前进时间 |
|||
*/ |
|||
const forwardTime = () =>{ |
|||
if(taday.value.length <= 0){ |
|||
taday.value = DateClass.getCurrent() |
|||
} |
|||
} |
|||
</script> |
|||
<template> |
|||
<div class="calBox" :style="'height:calc(100vh - '+ props.bodyHight +'px)'"> |
|||
<!--日历头部--> |
|||
<div class="calHead"> |
|||
<div> |
|||
<i class="fa fa-calendar icont"></i> |
|||
<el-text class="day">{{curtteMonth}}</el-text> |
|||
<el-text class="week">{{curttWeek}}</el-text> |
|||
</div> |
|||
<div> |
|||
<el-button-group class="ml-4"> |
|||
<el-button size="small" >今天</el-button> |
|||
<el-button :color="curtteDayType==1?'#a0cfff':''" @click="curtteDayType=1" size="small" >月</el-button> |
|||
<el-button :color="curtteDayType==2?'#a0cfff':''" @click="curtteDayType=2" size="small" >周</el-button> |
|||
<el-button :color="curtteDayType==3?'#a0cfff':''" @click="curtteDayType=3" size="small" >日</el-button> |
|||
<el-button size="small" class="fa fa-angle-left" @click="backTime()"></el-button> |
|||
<el-button size="small" class="fa fa-angle-right" @click="forwardTime()"></el-button> |
|||
</el-button-group> |
|||
</div> |
|||
</div> |
|||
<div class="weekNumber"> |
|||
{{DateClass.getMonday(taday[0],taday[1],taday[2],'e',0) }} |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<style lang='scss' scoped> |
|||
.calBox{ |
|||
width: 100%; |
|||
.calHead{ |
|||
padding: 10px 0; |
|||
border-bottom: 1px solid #ccc; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
.icont{ |
|||
font-size:20px; |
|||
} |
|||
.day{ |
|||
font-size:20px; |
|||
padding: 0 10px; |
|||
font-weight: bold; |
|||
} |
|||
} |
|||
.weekNumber{ |
|||
|
|||
} |
|||
} |
|||
</style> |
|||
@ -0,0 +1,202 @@ |
|||
const getMonthFinalDay = (index: any) => { |
|||
let data: any = new Date(); |
|||
let year: any = data.getFullYear(); |
|||
let month: any = data.getMonth() + 1; |
|||
let day: any = data.getDate(); |
|||
let beginDate: any = '', |
|||
endDate: any = ''; |
|||
switch (index) { |
|||
//今天
|
|||
case '0': |
|||
beginDate = getDate(0) |
|||
endDate = getDate(0) + " 23:59:59"; |
|||
break; |
|||
//昨天
|
|||
case '1': |
|||
beginDate = getDate(-1) |
|||
endDate = getDate(-1) + " 23:59:59"; |
|||
break; |
|||
//明天
|
|||
case '2': |
|||
beginDate = getDate(1) |
|||
endDate = getDate(1) + " 23:59:59"; |
|||
break; |
|||
//本周
|
|||
case '3': |
|||
beginDate = getMonday('s', 0) |
|||
endDate = getMonday('e', 0); |
|||
break; |
|||
//上周
|
|||
case '4': |
|||
beginDate = getMonday('s', -1) |
|||
endDate = getMonday('e', -1); |
|||
break; |
|||
//下周
|
|||
case '5': |
|||
beginDate = getMonday('s', 1) |
|||
endDate = getMonday('e', 1); |
|||
break; |
|||
//本月
|
|||
case '6': |
|||
beginDate = getMonth('s', 0) |
|||
endDate = getMonth('e', 0); |
|||
break; |
|||
//上月
|
|||
case '7': |
|||
beginDate = getMonth('s', -1) |
|||
endDate = getMonth('e', -1); |
|||
break; |
|||
//下月
|
|||
case '8': |
|||
beginDate = getMonth('s', 1) |
|||
endDate = getMonth('e', 1); |
|||
break; |
|||
//本年
|
|||
case '9': |
|||
beginDate = getYear('s', 0) |
|||
endDate = year + '-' + month + '-' + day; |
|||
break; |
|||
//去年
|
|||
case '10': |
|||
beginDate = getYear('s', -1) |
|||
endDate = getYear('e', -1); |
|||
break; |
|||
//明年
|
|||
case '11': |
|||
beginDate = getYear('s', 1) |
|||
endDate = getYear('e', 1); |
|||
break; |
|||
//全年
|
|||
case '12': |
|||
beginDate = getYear('s', 0) |
|||
endDate = getYear('e', 0); |
|||
break; |
|||
default: |
|||
beginDate = "1970-01-01 00:00:01" |
|||
endDate = "3000-12-31 23:59:59"; |
|||
break; |
|||
} |
|||
return { |
|||
beginDate, |
|||
endDate |
|||
} |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-11 16:14:28 |
|||
@ 功能: 日期 |
|||
*/ |
|||
const getDate = (dates: any) => { |
|||
let date: any = new Date(); |
|||
let n: any = dates || 0; |
|||
date.setDate(date.getDate() + n); |
|||
let y: any = date.getFullYear(); |
|||
let m: any = date.getMonth() + 1; |
|||
let d: any = date.getDate(); |
|||
m = m < 10 ? "0" + m : m; |
|||
d = d < 10 ? "0" + d : d; |
|||
let day = y + "-" + m + "-" + d; |
|||
return day; |
|||
} |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-11 16:14:28 |
|||
@ 功能: 周 |
|||
*/ |
|||
const getMonday = (type: any, dates: any) => { |
|||
let now = new Date(); |
|||
let nowTime = now.getTime(); |
|||
let day = now.getDay(); |
|||
let longTime = 24 * 60 * 60 * 1000; |
|||
let n = longTime * 7 * (dates || 0); |
|||
let date: any = '' |
|||
if (type == "s") { |
|||
date = nowTime - (day - 1) * longTime + n; |
|||
}; |
|||
if (type == "e") { |
|||
date = nowTime + (7 - day) * longTime + n; |
|||
}; |
|||
date = new Date(date); |
|||
let y: any = date.getFullYear(); |
|||
let m: any = date.getMonth() + 1; |
|||
let d: any = date.getDate(); |
|||
m = m < 10 ? "0" + m : m; |
|||
d = d < 10 ? "0" + d : d; |
|||
let days = y + "-" + m + "-" + d; |
|||
return days; |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-11 16:16:01 |
|||
@ 功能: 月份 |
|||
*/ |
|||
const getMonth = (type: any, months: any) => { |
|||
let date: any = new Date(); |
|||
let year: any = date.getFullYear(); |
|||
let month: any = date.getMonth() + 1; |
|||
if (Math.abs(months) > 12) { |
|||
months = months % 12; |
|||
}; |
|||
if (months != 0) { |
|||
if (month + months > 12) { |
|||
year++; |
|||
month = (month + months) % 12; |
|||
} else if (month + months < 1) { |
|||
year--; |
|||
month = 12 + month + months; |
|||
} else { |
|||
month = month + months; |
|||
}; |
|||
}; |
|||
month = month < 10 ? "0" + month : month; |
|||
let firstday = year + "-" + month + "-" + "01"; |
|||
let lastday = ""; |
|||
if (month == "01" || month == "03" || month == "05" || month == "07" || month == "08" || month == "10" || month == "12") { |
|||
lastday = year + "-" + month + "-" + 31; |
|||
} else if (month == "02") { |
|||
if ((year % 4 == 0 && year % 100 != 0) || (year % 100 == 0 && year % 400 == 0)) { |
|||
lastday = year + "-" + month + "-" + 29; |
|||
} else { |
|||
lastday = year + "-" + month + "-" + 28; |
|||
}; |
|||
} else { |
|||
lastday = year + "-" + month + "-" + 30; |
|||
}; |
|||
let day = ""; |
|||
if (type == "s") { |
|||
day = firstday; |
|||
} else { |
|||
day = lastday; |
|||
}; |
|||
return day; |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-11 16:16:52 |
|||
@ 功能: 年 |
|||
*/ |
|||
const getYear = (type: any, dates: any) => { |
|||
let date: any = new Date(); |
|||
let n: any = dates || 0; |
|||
let year: any = date.getFullYear() + Number(n); |
|||
let day = '' |
|||
if (type == "s") { |
|||
day = year + "-01-01"; |
|||
}; |
|||
if (type == "e") { |
|||
day = year + "-12-31"; |
|||
}; |
|||
if (!type) { |
|||
day = year + "-01-01/" + year + "-12-31"; |
|||
}; |
|||
return day; |
|||
} |
|||
|
|||
export { |
|||
getMonthFinalDay, |
|||
getDate, |
|||
getMonday, |
|||
getMonth, |
|||
getYear |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-10 11:05:18 |
|||
@ 备注: 日历 |
|||
--> |
|||
<script lang="ts" setup> |
|||
import { ref } from 'vue' |
|||
import { |
|||
getMonthFinalDay, |
|||
getDate, |
|||
getMonday, |
|||
getMonth, |
|||
getYear |
|||
} from '@/components/DesignForm/app/calendar/calendar1/handle' |
|||
|
|||
//引入日历 |
|||
import CalendarPage from '@/components/DesignForm/app/calendar/calendar1/calendarPage.vue' |
|||
|
|||
|
|||
const value = ref(new Date()) |
|||
let timek = new Date() |
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
<template> |
|||
<CalendarPage :body-hight="345" /> |
|||
</template> |
|||
<style lang='scss' scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,68 @@ |
|||
location /systemapi { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/systemapi/(.*)$ /$1 break; |
|||
proxy_pass http://36.133.126.182:39250; #设置代理服务器的协义和地址 |
|||
#proxy_pass http://120.224.6.6:60001; |
|||
} |
|||
location /kpiapi { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/kpiapi/(.*)$ /$1 break; |
|||
proxy_pass http://36.133.126.182:6666; #设置代理服务器的协义和地址 |
|||
#proxy_pass http://120.224.6.6:60002; |
|||
} |
|||
location /hrapi { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/hrapi/(.*)$ /$1 break; |
|||
proxy_pass http://120.224.6.6:39168; #设置代理服务器的协义和地址 |
|||
} |
|||
location /api { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/api/(.*)$ /$1 break; |
|||
proxy_pass http://36.133.126.182:8888; #设置代理服务器的协义和地址 |
|||
} |
|||
location /javasys { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/javasys/(.*)$ /$1 break; |
|||
proxy_pass http://36.133.126.182:8111; #设置代理服务器的协义和地址 |
|||
} |
|||
location /javasys/lowCode { |
|||
#host修改为真实的域名和端口 |
|||
proxy_set_header Host $http_host; |
|||
#客户真实ip |
|||
proxy_set_header X-Real-IP $remote_addr; |
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|||
#客户端真实协议 |
|||
proxy_set_header X-Forwarded-Proto $scheme; |
|||
rewrite ^/javasys/(.*)$ /$1 break; |
|||
proxy_pass http://36.133.126.182:39999; #设置代理服务器的协义和地址 |
|||
} |
|||
Loading…
Reference in new issue