信呼OA版本v2.3.8

This commit is contained in:
雨中磐石
2022-08-14 16:47:40 +08:00
parent 4640677d27
commit e3fcd913e3
1405 changed files with 133635 additions and 73 deletions

View File

@@ -0,0 +1,432 @@
(function ($) {
var jierixiuxi='',jierishangban='';
function calendarclass(element, options){
var obj = element;
var can = options;
var me = this,
rand= js.getrand();
jierixiuxi=can.jierixiuxi;jierishangban=can.jierishangban;
this.onclick = can.onclick;
this.mid = '';
this.week = ['日','一','二','三','四','五','六'];
this.obj = [];
this.Y = 2014;
this.m = 1;
this.nY = 2014;
this.nm = 1;
this.nd = 29;
this.marr = [31,28,31,30,31,30,31,31,30,31,30,31];
this.max = 0;
this.w = 0;
this.nobj = null;
this.sterma = {};
this.dayobj = [];
this.feastarr = {'0101':'元旦','0214':'情人节','一月初一':'春节','一月十五':'元宵节','七月初七':'七夕','五月初五':'端午节','0501':'劳动节','0601':'儿童节','1001':'国庆节','1111':'光棍日','八月十五':'中秋节','十二月三十':'除夕','十二月初八':'腊八','0801':'建军节','0701':'建党日','0401':'愚人节','0504':'五四青年节','0308':'妇女节','1225':'圣诞节','1224':'平安夜','1031':'万圣节','九月初九':'重阳节','0910':'教师节','0504':'青年节','0312':'植树节','0314':'白色情人节','0315':'消费者权益日','十二月廿三':'小年','0305':'学雷锋日','0422':'世界地球日','0920':'国际爱牙日','0918':'九一八事变','1213':'南京大屠杀日','1201':'世界艾滋病日','1203':'国际残疾人日','0815':'日本投降日'};
this.tsarr = {'1144':'感恩节','0520':'母亲节','0630':'父亲节'};
var tgString = '甲乙丙丁戊己庚辛壬癸';
var dzString = '子丑寅卯辰巳午未申酉戌亥';
var bool = false;
this.showYue=function(y,m)
{
var g1=4,g2=0;
var y1=1901,y2=1;
var jy = y-y1;
var jm = jy*12+m;
var a1 = (jm+g1)%10,a2 = (jm+g2)%12;
return tgString.charAt(a1)+dzString.charAt(a2);
}
this.showDay=function(y,m,d)
{
var g1=5,g2=3;
var y1=1901,y2=1;
var jm=0;
var jd1 = js.now('time','1901-01-01');
var jd2 = js.now('time',''+y+'-'+m+'-'+d+'');
jm = (jd2-jd1)/1000/24/3600;
var a1 = (jm+g1)%10,a2 = (jm+g2)%12;
return tgString.charAt(a1)+dzString.charAt(a2);
}
this.init = function(){
var id = obj.attr('id');
this.mid = id;
var s = '',bo1r='0';
if(can.bordercolor!='')bo1r='1';
s+='<div id="calmain_div'+this.mid+'" style="height:'+can.height+'px" class="jquery-calendar">';
s+='<table width="100%" border="'+bo1r+'" style="border-collapse:collapse;border-color:'+can.bordercolor+'" height="100%" cellspacing="0" cellpadding="0">';
s+='<tr>';
for(var i=0;i<7;i++){
s+='<td class="thtext" style="background-color:'+can.headerbgcolor+'" align="center">'+this.week[i]+'</td>';
}
s+='</tr>';
var x = 0,w = 100/7;
var h = can.height-26;
for(var j=1;j<=6;j++){
s+='<tr>';
for(var i=0;i<7;i++){
x++;
s+='<td align="'+can.align+'" height="'+(h/6)+'px" valign="'+can.valign+'" width="'+w+'%" class="tdtext" id="calcontabc'+x+'_'+id+'" temp="'+x+'"></td>';
}
s+='</tr>';
}
s+='</table></div>';
obj.html(s);
var me = this;
for(var i=1;i<=42;i++){
var no = get('calcontabc'+i+'_'+id+'');
this.obj[i]=no;
no.onclick=function(){me.click(this)}
}
this.nowmonth(can.month);//当月
}
this.nowmonth=function(nmot)
{
var dt = js.now().split('-');
this.Y = parseFloat(dt[0]);
this.m = parseFloat(dt[1]);
if(nmot){
var nmots = nmot.split('-');
this.Y = parseFloat(nmots[0]);
this.m = parseFloat(nmots[1]);
}
this.nd = parseFloat(dt[2]);
this.nY = this.Y;
this.nm = this.m;
this.setcalend();
return false;
}
this.jieqishow = function()
{
var sterma={};
for(var j=1900;j<=2099;j++){
var gY = j;
var str = '';
for(var i=1;i<=12;i++){
gm = i;
var tmp1=lunar.sTerm(gY, gm*2-2);
var tmp2=lunar.sTerm(gY, gm*2-1);
sterma[''+this.sa(gm)+''+this.sa(tmp1)+'']=lunar.solarTerm[gm*2-2];
sterma[''+this.sa(gm)+''+this.sa(tmp2)+'']=lunar.solarTerm[gm*2-1];
str+='@'+tmp1+','+tmp2+'';
}
str = str.substr(1);
str = "jieResel["+(j-1900)+"] = \""+str+"\";";
$('body').append(str);
}
}
this.setcalend=function()
{
can.changemonthbefore(this.Y, this.m, this);
var gY = this.Y,gm = this.m,j1=0;
this.max=this.marr[gm-1];
if(gY%4==0&&gm==2)this.max=29;
this.w = parseFloat(js.now('w',''+gY+'-'+gm+'-01'));
var mx = this.max+this.w;
var offstaa = $('#calmain_div'+this.mid+'').offset();
$("span[temp='showcaentt5eaee"+this.mid+"']").remove();
//当月24节气名称
var tmp1=lunar.sTerm(gY, gm*2-2);
var tmp2=lunar.sTerm(gY, gm*2-1);
this.sterma={};
//this.sterma[''+this.sa(gm)+''+this.sa(tmp1)+'']=lunar.solarTerm[gm*2-2];
//this.sterma[''+this.sa(gm)+''+this.sa(tmp2)+'']=lunar.solarTerm[gm*2-1];
this.nobj=null;
var xqarr=[0,0,0,0,0,0,0];
var oci = this.w;
var savt = '';
for(var i1=1+this.w;i1<=mx; i1++){
xqarr[oci]++;
j1++;
var col1='',col2='#aaaaaa';
var day = ''+gY+'-'+this.sa(gm)+'-'+this.sa(j1)+'';
var lun = lunar.iconv(gY,gm,j1);
var s2 = lun[2];
var sn = s2;
if(s2=='初一'){
s2 =lun[1];
col2 = '#419900';
}
var jie = '';
var jiec = this.getJie(gY,gm,j1,lun[1]+sn);
//var jiec1 = this.sterma[''+this.sa(gm)+''+this.sa(j1)+''];
var jiec1 = lun[3];
var jiec2 = this.tsarr[''+this.sa(gm)+''+xqarr[oci]+''+oci+''];//年第几个星期
if(j1==this.nd){
this.nobj=this.obj[i1];
this.obj[i1].style.backgroundColor=can.selbgcolor;
this.changetoday(j1);
}else{
this.obj[i1].style.backgroundColor='';
}
if(jiec!='')jie+=','+jiec+'';
//节气
if(jiec1){
if(jiec1!='清明'){
col2='#006699';
}
jie+=','+jiec1+'';
}
if(jiec2){
this.sterma[''+this.sa(gm)+''+this.sa(j1)+'']=jiec2;
jie+=','+jiec2+'';
}
if(jie!=''){
jie = jie.substr(1);
s2 = jie;
if(col2=='#aaaaaa')col2= '#ff0000';
savt+='|'+gY+'-'+gm+'-'+j1+':'+jie+'';
}
if(i1%7==0)col1='#ff6600';
if((i1-1)%7==0)col1='#ff6600';
this.obj[i1].innerHTML=this.getSpanAcc(j1,s2,col1,col2,day, i1, false);
//是不是休息的
var xiuval = '';
if(jierixiuxi.indexOf(day)>=0)xiuval='休';
if(jierishangban.indexOf(day)>=0)xiuval='班';
if(xiuval!=''){
var coac = '#419900';
if(xiuval=='班')coac='#888888';
var nest = '<span temp="showcaentt5eaee'+this.mid+'" style="font-size:12px;left:1px;top:1px;background-color:'+coac+';filter:Alpha(Opacity=100);opacity:1;padding:2px;color:#ffffff;position:absolute">'+xiuval+'</span>';
$(this.obj[i1]).append(nest);
}
oci++;
if(oci==7)oci=0;
};
if(!can.fillot){
can.changemonth(this.Y, this.m, this);
return;
}
//填充其余的
var lY = gY,lm = gm-1,lx=0,lxu=0;
if(lm==0){
lY = lY-1;
lm = 12;
}
lx = this.marr[lm-1];
if(lY%4==0 && lm==2)lx++;//闰年2月29天
for(var i=this.w;i>=1;i--){
var day = ''+lY+'-'+this.sa(lm)+'-'+this.sa(lx)+'';
var lun = lunar.iconv(lY,lm,lx);
var s2 = lun[2];
this.obj[i].innerHTML=this.getSpanAcc(lx,s2,'#cccccc','#cccccc', day,i, true);
this.obj[i].style.backgroundColor='';
//是不是休息的
var xiuval = '';
if(jierixiuxi.indexOf(day)>=0)xiuval='休';
if(jierishangban.indexOf(day)>=0)xiuval='班';
if(xiuval!=''){
var coac = '#419900';
if(xiuval=='班')coac='#888888';
var nest = '<span temp="showcaentt5eaee'+this.mid+'" style="font-size:12px;left:1px;top:1px;background-color:'+coac+';filter:Alpha(Opacity=50);opacity:0.5;padding:2px;color:#ffffff;position:absolute">'+xiuval+'</span>';
$(this.obj[i]).append(nest);
}
lx--;
}
lm = gm+1;lY = gY;
if(lm==13){
lY = lY+1;
lm = 1;
}
for(var i=j1+1+this.w;i<=42; i++){
lxu++;
var day = ''+lY+'-'+this.sa(lm)+'-'+this.sa(lxu)+'';
var lun = lunar.iconv(lY,lm,lxu);
var s2 = lun[2];
this.obj[i].innerHTML=this.getSpanAcc(lxu,s2,'#cccccc','#cccccc', day,i, true);
this.obj[i].style.backgroundColor='';
//是不是休息的
var xiuval = '';
if(jierixiuxi.indexOf(day)>=0)xiuval='休';
if(jierishangban.indexOf(day)>=0)xiuval='班';
if(xiuval!=''){
var coac = '#419900';
if(xiuval=='班')coac='#888888';
var nest = '<span temp="showcaentt5eaee'+this.mid+'" style="font-size:12px;position:absolute;left:1px;top:1px;background-color:'+coac+';filter:Alpha(Opacity=50);opacity:0.5;padding:2px;color:#ffffff;">'+xiuval+'</span>';
$(this.obj[i]).append(nest);
}
}
can.changemonth(this.Y, this.m, this);
}
this.changetoday=function(d)
{
var gY = this.Y,gm = this.m;
var day = js.now('Y年m月d日 星期W',''+gY+'-'+gm+'-'+d+'');
var lun = lunar.iconv(gY, gm, d);
//alert(day);
$('#leftday').html(this.sa(d));
$('#changedate').html(''+day+'');
$('#lunanday').html(''+gY+'年 农历 '+lun[1]+''+lun[2]+'');
//什么月
var yue1 = this.showYue(gY,gm);
//什么日
var day1 = this.showDay(gY,gm,d);
$('#lunanday1').html(''+lun[0]+' '+yue1+'月 '+day1+'日');
var jie = '';
var jiec = this.getJie(gY,gm,d,lun[1]+lun[2]);
var jiec1 = this.sterma[''+this.sa(gm)+''+this.sa(d)+''];
if(jiec!='')jie+=','+jiec+'';
if(jiec1)jie+=','+jiec1+'';
if(jie!=''){
jie = jie.substr(1);
}else{jie='&nbsp;'}
this.onclick(gY,gm,d, day, lun, jie);
};
this.click=function(o1)
{
var d = parseFloat($(o1).attr('temp'));
var dc = d-this.w;
var da = $(this.obj[d]).find('span[dt]:eq(0)').html();
if(!da)return;
da = da.split(',');
this.nd = parseFloat(da[0]);
if(dc<=0){
if(can.boofan)this.fanmonth(-1);
return ;
}
if(dc>this.max){
if(can.boofan)this.fanmonth(1);
return;
}
if(this.nobj!=null)this.nobj.style.backgroundColor='';
this.obj[d].style.backgroundColor=can.selbgcolor;
this.nobj = this.obj[d];
this.changetoday(dc);
};
this.getSpanAcc=function(s1,s2,col1,col2, day, oi, lbo)
{
if(s2.indexOf('国际')==0 || s2.indexOf('世界')==0)col2='#419900';
var s = '<div><font color='+col1+'>'+s1+'</font><font style="font-size:11px" color='+col2+'>,'+s2+'</font></div>';
var sq = can.renderer(day, s, s1,s2,col1,col2, oi,this);
if(sq)s = sq;
s+= '<span style="display:none" dt="'+s1+'">'+s1+','+day+'</span>';
this.dayobj[oi]={day:day,d:s1};
if(!can.overShow && lbo)return '';
return s;
};
this.getFistdt = function(){
var d = this.dayobj[1];
return d.day;
};
this.getLastdt = function(){
var d = this.dayobj[42];
return d.day;
};
this.fanyear = function(oi)
{
this.Y=this.Y+oi;
this.setcalend();
return false;
};
this.showjie = function(o,yeas)
{
var val = o.value;
if(val=='')return;
this.m = parseFloat(val);
this.Y = yeas;
this.setcalend();
};
this.fanmonth = function(oi)
{
oi = parseFloat(oi);
this.m = this.m+oi;
if(this.m==0){
this.m = 12;
this.Y = this.Y-1;
}
if(this.m==13){
this.m = 1;
this.Y = this.Y+1;
}
this.setcalend();
return false;
};
this.nextMonth = function(){
this.fanmonth(1);
};
this.lastMonth = function(){
this.fanmonth(-11);
};
this.getJie = function(y,m,d,nr)
{
var s1 = this.sa(m)+this.sa(d),s2 = nr;
var a = this.feastarr;
var s = '';
if(a[s1]){
var s3 = a[s1];
if(y<1949&&m==10&&d==1)s3='';
if(s3)s+=','+s3+'';
}
if(a[s2]){
s+=','+a[s2]+'';
}
if(s!='')s=s.substr(1);
return s;
};
this.sa = function(s)
{
s = ''+s+'';
if(s.length<=1)s='0'+s+'';
return s;
};
this.changemonth = function(y1,m1)
{
this.Y = parseFloat(y1);
this.m = parseFloat(m1);
this.setcalend();
return false;
};
this.setbgcolor = function(oi, col){
if(!col)col='';
this.obj[oi].style.backgroundColor=col;
};
this.setMonth = function(mon)
{
var a = mon.split('-');
this.changemonth(a[0], a[1]);
}
}
$.fn.rockcalendar = function(options){
var defaultVal = {
height:400,selbgcolor:'#D3FFF6',month:'',
fillot:true,renderer:function(){return ''},align:'left',valign:'top',
changemonth:function(){},boofan:true,onclick:function(){},jierixiuxi:'',jierishangban:'',headerbgcolor:'',
bordercolor:'',
overShow:true,
changemonthbefore:function(){}
};
var can = $.extend({}, defaultVal, options);
var clsa = new calendarclass($(this), can);
clsa.init();
return clsa;
};
})(jQuery);

View File

@@ -0,0 +1,287 @@
/**
阳历转化为农历函数类
create:Chenxihu
createdt:2013-11-05 11:05:00
*/
function rockoaclasstolunar_new(_y,_m,_d){
const calendar = {
gregorianYear: null, //公历年
gregorianMonth: null, //公历月
gregorianDay: null, //公历日
weekday: null, //星期
hours: null,
minutes: null,
seconds: null,
lunarYear: null, //农历年
lunarMonth: null, //农历月
lunarDay: null, //农历日
lunarYearCn: '', //农历天干地支纪年
lunarMonthCn: '', //农历中文月
lunarDayCn: '', //农历中文日
zodiacYear: '', //农历生肖年
solarTerm: '', //节气
gregorianFestival: '', //公历节日
lunarFestival: '' //农历节日
}
let lunarInfo = [
0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557,
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0,
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0,
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6,
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570,
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5,
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,
0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0]
let zodiacs = ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪']
let Gan = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸']
let Zhi = ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥']
let weekday = ['星期日','星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
let now = new Date(parseFloat(_y),parseFloat(_m)-1,parseFloat(_d))
//用于计算农历年月日的数据
let GY = now.getFullYear()
let GM = now.getMonth()
let GD = now.getDate()
let year = now.getFullYear()
let month = now.getMonth() + 1
let date = now.getDate()
let hours = 0
let minutes = 0
let seconds = 0
month = xy10(month)
date = xy10(date)
hours = xy10(hours)
minutes = xy10(minutes)
seconds = xy10(seconds)
//==== 传入 offset 传回干支, 0=甲子
function cyclical(num) {
return(Gan[num % 10] + Zhi[num % 12])
}
//==== 传回农历 year年的总天数
function lYearDays(year) {
let i, sum = 348
for(i = 0x8000; i > 0x8; i >>= 1) {
sum += (lunarInfo[year - 1900] & i) ? 1: 0
}
return(sum + leapDays(year))
}
//==== 传回农历 year年闰月的天数
function leapDays(year) {
if(leapMonth(year)) {
return((lunarInfo[year-1900] & 0x10000)? 30: 29)
}
else {
return 0
}
}
//==== 传回农历 year年闰哪个月 1-12 , 没闰传回 0
function leapMonth(year) {
return(lunarInfo[year - 1900] & 0xf)
}
//==== 传回农历 year年month月的总天数
function monthDays(year, month) {
return( (lunarInfo[year - 1900] & (0x10000 >> month))? 30: 29 )
}
//==== 算出农历, 传入日期对象, 传回农历日期对象
// 该对象属性有 农历年year 农历月month 农历日day 是否闰年isLeap yearCyl dayCyl monCyl
function Lunar(objDate) {
let i, temp = 0
let baseDate = new Date(1900,0,31)
let offset = Math.floor((objDate - baseDate)/86400000)
let dayCyl = offset + 40
let monCyl = 14
for(i = 1900; i < 2050 && offset > 0; i++) {
temp = lYearDays(i)
offset -= temp
monCyl += 12
}
if(offset < 0) {
offset += temp;
i--;
monCyl -= 12
}
//农历年
let year = i
let yearCyl = i-1864
let leap = leapMonth(i) //闰哪个月
let isLeap = false //是否闰年
for(i=1; i<13 && offset>0; i++) {
//闰月
if(leap>0 && i === (leap+1) && isLeap === false) {
--i; isLeap = true; temp = leapDays(year);
}
else {
temp = monthDays(year, i);
}
//解除闰月
if(isLeap === true && i === (leap + 1)) {
isLeap = false
}
offset -= temp
if(isLeap === false) {
monCyl ++
}
}
if(offset === 0 && leap>0 && i===leap+1)
if(isLeap) {
isLeap = false
}
else {
isLeap = true
--i
--monCyl
}
if(offset<0){
offset += temp
--i
--monCyl
}
//农历月
let month = i
//农历日
let day = offset + 1
return {
year: year,
month: month,
day: day,
isLeap: isLeap,
leap: leap,
yearCyl: yearCyl,
dayCyl: dayCyl,
monCyl: monCyl
}
}
//==== 中文日期 m为传入月份d为传入日期
function cDay(m, d){
let nStr1 = ['日', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
let nStr2 = ['初', '十', '廿', '卅', '']
//农历中文月
let lunarMonthCn
//农历中文日
let lunarDayCn
if (m > 10){
lunarMonthCn = '十' + nStr1[m - 10]
} else {
lunarMonthCn = nStr1[m]
}
lunarMonthCn += '月'
switch (d) {
case 10: lunarDayCn = '初十'; break;
case 20: lunarDayCn = '二十'; break;
case 30: lunarDayCn = '三十'; break;
default: lunarDayCn = nStr2[Math.floor(d/10)] + nStr1[d % 10]
}
return {
lunarMonthCn: lunarMonthCn,
lunarDayCn: lunarDayCn
}
}
//节气
function getSolarTerm() {
let sTermInfo = [
0, 21208, 42467, 63836, 85337, 107014,
128867, 150921, 173149, 195551, 218072, 240693,
263343, 285989, 308563, 331033, 353350, 375494,
397447, 419210, 440795, 462224, 483532, 504758
]
let solarTerm = [
'小寒', '大寒', '立春', '雨水', '惊蛰', '春分',
'清明', '谷雨', '立夏', '小满', '芒种', '夏至',
'小暑', '大暑', '立秋', '处暑', '白露', '秋分',
'寒露', '霜降', '立冬', '小雪', '大雪', '冬至'
]
let solarTerms = ''
let tmp1 = new Date(
(31556925974.7 * (GY - 1900) + sTermInfo[GM * 2 + 1] * 60000) + Date.UTC(1900,0,6,2,5)
)
let tmp2 = tmp1.getUTCDate()
if (tmp2 === GD) solarTerms = solarTerm[GM * 2 + 1]
tmp1 = new Date(
(31556925974.7 * (GY - 1900) + sTermInfo[GM * 2] * 60000) + Date.UTC(1900,0,6,2,5)
)
tmp2= tmp1.getUTCDate()
if (tmp2 === GD) solarTerms = solarTerm[GM * 2]
return solarTerms
}
//公历年月日、星期、时分秒
calendar.gregorianYear = year
calendar.gregorianMonth = month
calendar.gregorianDay = date
calendar.weekday = weekday[now.getDay()]
calendar.hours = hours
calendar.minutes = minutes
calendar.seconds = seconds
//去掉时分秒的日期
let sDObj = new Date(GY, GM, GD);
let lDObj = new Lunar(sDObj);
//农历年月日、生肖年
calendar.lunarYear = lDObj.year
calendar.lunarMonth = lDObj.month
calendar.lunarDay = lDObj.day
calendar.zodiacYear = zodiacs[(GY - 4) % 12]
//农历中文年月日
calendar.lunarYearCn = cyclical( GY - 1900 + 36)
calendar.lunarMonthCn = cDay(lDObj.month,lDObj.day).lunarMonthCn
calendar.lunarDayCn = cDay(lDObj.month,lDObj.day).lunarDayCn
//节气
calendar.solarTerm = getSolarTerm()
return calendar;
}
function rockoaclasstolunar(){
this.solarTerm={};
this.sTerm = function (y,n) {
return '';
}
this.iconv=function(y,m,d)
{
var jre = rockoaclasstolunar_new(y,m,d);
var arr = [jre.lunarYearCn+'('+jre.zodiacYear+')',jre.lunarMonthCn, jre.lunarDayCn, jre.solarTerm];
return arr;
}
}
var lunar = new rockoaclasstolunar();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
.rockmenu{ position:absolute;display:none; z-index:9999}
.rockmenuli{border:1px #eeeeee solid;
background-color:#ffffff; left:0px; top:0px; background:rgba(255,255,255,0.9);
box-shadow:0px 0px 5px rgba(0,0,0,0.3);color:#555555
}
.rockmenulijt{ padding:0px; text-align:center}
.rockmenu ul{padding:0px;margin:0px}
.rockmenu li{ list-style-type:none; padding:8px 12px; cursor:pointer; text-align:left; border-bottom:1px #eeeeee dotted;}
.rockmenu li.li01{ background-color:#eeeeee;}
.rockmenu li span{ font-size:10px; }
.rockmenu li.li01 span{}
.rockmenuli li img.iconsa{ vertical-align:middle; width:16px; height:16px; margin-right:8px}
.rockmenu .arrow-up{
width: 0;
height: 0;
border-left: 10px solid transparent; /* 左边框的宽 */
border-right: 10px solid transparent; /* 右边框的宽 */
border-bottom: 10px solid #cccccc; /* 下边框的长度|高,以及背景色 */
font-size: 0;
line-height: 0;
}

176
web/res/mode/menu/jquery-rockmenu.js vendored Normal file
View File

@@ -0,0 +1,176 @@
/**
rockmenu 菜单选择插件
caratenamechenxihu
caratetime214-04-06 21:40:00
email:qqqq2900@126.com
homepage:www.xh829.com
*/
var rockmenuobj = null;
(function ($) {
function rockmenu(element, options){
var obj = element;
var can = options;
var json = can.data;
var rand = js.getrand();
var me = this;
this.obj = obj;
//初始化
this.init = function(){
if(!obj)return;
obj[can.trigger](function(){
me.setcontent();
return false;
});
};
this.hide = function(){
var o = this.mdivobj;
if(!o)return;
o.hide();
if(can.bgcolor!='')obj.css('background','');
if(can.autoremove)o.remove();
};
this.setcontent = function(){
$('.rockmenu').remove();
rockmenuobj = this;
can.beforeshow(this);
if(json.length<=0)return false;
if(can.bgcolor!='')obj.css('background',can.bgcolor);
if(can.autoremove)$('#rockmenu_'+rand+'').remove();
if(document.getElementById('rockmenu_'+rand+'')){
this.setweizhi();
return false;
}
var len = json.length;
var str = '<div class="rockmenu" id="rockmenu_'+rand+'">';
if(can.arrowup)str+='<div class="arrow-up"></div>';
str+='<div style="background:'+can.background+';" id="rockmenuli_'+rand+'" class="rockmenuli '+can.maincls+'"><ul>';
var s = '',ys='',col,va;
for(var i=0; i<len; i++){
ys= '',
va= json[i][can.display];
if(i==len-1)ys+='border:none;';
col = '';
if(json[i].color)ys+='color:'+json[i].color+';';
if(va==can.value)col='#e1e1e1';
if(json[i].background)col=json[i].background;
if(col)ys+='background:'+col+';';
s = '<li temp="'+i+'" style="'+ys+'">';
var s1 = can.resultbody(json[i], this, i);
if(!s1){
if(json[i].icons)s+='<img src="'+json[i].icons+'" width="'+can.iconswh+'" height="'+can.iconswh+'" align="absmiddle">&nbsp;';
s+=va;
}else{
s+=s1;
}
s+='</li>';
str+=s;
}
str+='</ul></div></div>';
$('body').prepend(str);
var oac = $('#rockmenu_'+rand+'');
can.aftershow(this);
oac.find('li').mouseover(function(){this.className=can.overcls;});
oac.find('li').mouseout(function(){this.className='';});
oac.find('li').click(function(){me.itemsclick(this);});
if(can.width!=0){
$('#rockmenuli_'+rand+'').css('width',''+can.width+'px');
};
js.addbody(rand, 'remove', 'rockmenu_'+rand+'');
this.mdivobj = oac;
this.setweizhi();
};
this.showAt = function(l, t, w){
this.setcontent();
var oac = this.mdivobj;
if(!oac)return;
if(w)this.setWidth(w);
this._reshewhere(l,t);
};
this.offset=function(l,t){
this._reshewhere(l,t);
};
this.getHeight = function(){
return get('rockmenu_'+rand+'').scrollHeight;
};
this._reshewhere=function(l,t){
var oac = this.mdivobj;
var jg = (l+oac.width()+5 - winWb()),jg1=0;
if(jg>0)l=l-jg;
jg1 = t+get('rockmenu_'+rand+'').scrollHeight+10-winHb();
if(jg1>0)t=t-jg1;
if(t<5)t=5;
oac.css({'left':''+l+'px','top':''+t+'px'});
};
this.setValue = function(v){
can.value = v;
};
this.removeItems = function(oi){
$('#rockmenu_'+rand+'').find("li[temp='"+oi+"']").remove();
};
this.setWidth = function(w){
var oac = this.mdivobj;
if(!oac)return;
oac.css({'width':''+w+'px'});
};
this.setweizhi = function(){
var oac = this.mdivobj;
if(can.donghua)oac.slideDown(100);
oac.show();
if(!obj)return;
var off = obj.offset(),
l = off.left+ can.left,
t = off.top+can.top;
this._reshewhere(l,t);
};
//项目单击
this.itemsclick = function(o){
var oi = parseInt($(o).attr('temp'));
can.itemsclick(json[oi],oi,me);
if(can.autohide)this.hide();
};
this.setData = function(da){
can.data= da;
json = da;
can.autoremove = true;
};
this.remove = function(){
this.hide();
}
};
$.rockmenu = function(options, dxo){
var defaultVal = {
data:[],
display:'name',//显示的名称
left:0,
overcls:'li01',
maincls:'',
top:0,
width:0,value:'',
iconswh:16,
itemsclick:function(){},
beforeshow:function(){},
aftershow:function(){},
autoremove:true,
trigger:'click',
autohide:true,
arrowup:false, //是否有箭头
background:'#ffffff',//背景颜色
bgcolor:'',
resultbody:function(){
return '';
},
donghua:false
};
var can = $.extend({}, defaultVal, options);
var menu = new rockmenu(dxo, can);
menu.init();
return menu;
}
$.fn.rockmenu = function(options){
return $.rockmenu(options, $(this));
};
})(jQuery);