| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- $(function() {
- $('.headerTitle').click(function() {
- window.location.href = "index.html";
- })
- $('.headFour').click(function() {
- window.location.href = "RepairStatistic.html";
- })
- getNowFormatDate();
- setInterval('getNowFormatDate()', 1000);
- getlocation();
- setInterval(Ajax, huayi.config.indextime); //Ajax调用函数
- // setInterval(locat, huayi.config.cachetime);//缓存调用函数
- setInterval(getlocation, huayi.config.Weathertime); //天气调用函数
- // var calendar = ;
- })
- function getNowFormatDate() {
- var date = new Date();
- var month = date.getMonth() + 1,
- strDate = date.getDate(),
- strHours = date.getHours(),
- strMinutes = date.getMinutes();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- if (strHours >= 0 && strHours <= 9) {
- strHours = "0" + strHours;
- }
- if (strMinutes >= 0 && strMinutes <= 9) {
- strMinutes = "0" + strMinutes;
- }
- var currentdate = date.getFullYear() + "-" + month + "-" + strDate +
- " " + strHours + ":" + strMinutes;
- // + seperator2 + date.getSeconds();
- // return currentdate;
- $('.headerRightInCon_l').text(date.getFullYear() + "-" + month + "-" + strDate);
- $('.headerRightInCon_m').text(strHours + ":" + strMinutes);
- showCal(); //农历
- }
- //气温天气
- function getlocation() {
- //var bl = true;
- //var citylocation = new qq.maps.CityService({
- // complete: function (result) {
- // //if (bl) {
- // // citylocation.searchCityByName(result.detail.name);
- // // bl = false;
- // //}
- // //else {
- // // var cityProvice = result.detail.detail.split(",");
- // // getWeather(cityProvice[1], cityProvice[0]);
- // //}
- // GetWeatherByLatLng(result.detail.latLng.lat, result.detail.latLng.lng);
- // }
- //});
- //citylocation.searchLocalCity();
- getWeather("河南省", "郑州市")
- }
- function GetWeatherByLatLng(latitude, longitude) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'equipmentapi/api/RunningChart/getweatherbylatlng?latitude=' + latitude +
- '&longitude=' + longitude,
- async: true,
- dataType: 'json',
- success: function(data) {
- if (data.state == 'success') {
- $('.airQuality').text(data.data.data.air.aqi_name); //空气质量
- $('.windPower').text(data.data.data.observe.wind_power); //风力
- $('.humidity').text(data.data.data.observe.humidity + "%"); //湿度
- $('.temperature').text(data.data.data.observe.degree); //温度
- }
- }
- });
- }
- function getWeather(provinces, citys) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'equipmentapi/api/RunningChart/getweather?province=' + provinces + '&city=' +
- citys,
- async: true,
- dataType: 'json',
- success: function(data) {
- if (data.state == 'success') {
- $('.airQuality').text(data.data.data.air.aqi_name); //空气质量
- $('.windPower').text(data.data.data.observe.wind_power); //风力
- $('.humidity').text(data.data.data.observe.humidity + "%"); //湿度
- $('.temperature').text(data.data.data.observe.degree); //温度
- }
- }
- });
- }
- //滚动效果
- ;(function($) {
- function Scroll(obj, opt) {
- this.obj = obj;
- this.opt = $.extend(obj, opt);
- this.init = function() {
- clearInterval(obj.attr("timerID"));
- this.Scrolls(obj, opt);
- }
- }
- Scroll.prototype = {
- // timerID:null,
- Scrolls: function(obj, opt) {
- this.hovered(obj, opt)
- },
- scrollDown: function(obj, opt) {
- var _this = obj.eq(0).find("ul:first");
- var lineH = _this.find("li:first").height(); //获取行高
- _this.animate({
- marginTop: -lineH + "px"
- }, //动画展示css样式
- opt.speed,
- function() {
- _this.find("li:first").appendTo(_this);
- _this.css({
- marginTop: "0px"
- });
- }
- )
- },
- hovered: function(obj, opt) {
- var timerID, $thats = this,
- _thisH = obj.eq(0).find("ul:first").height(),
- thisH = obj.eq(0).height();
- obj.eq(0).find("ul:first").unbind();
- //鼠标事件绑定
- obj.eq(0).find("ul:first").hover(function() {
- clearInterval(obj.attr("timerID"));
- }, function() {
- if (_thisH > thisH) {
- timerID = setInterval(function() {
- $thats.scrollDown(obj, opt)
- }, opt.timer); //这里调用向下或者向上滚动函数
- obj.attr("timerID", timerID);
- }
- }).mouseout();
- }
- }
- $.fn.Scroll = function(obj) {
- var $that = this;
- //参数初始化
- if (!obj) var obj = {};
- var _this = $that.eq(0).find("ul:first");
- var lineH = _this.find("li:first").height(), //获取行高
- line = obj.line ? parseInt(obj.line, 10) : parseInt($that.height() / lineH, 10), //每次滚动的行数,默认为一屏,即父容器高度
- speed = obj.speed ? parseInt(obj.speed, 10) : 500, //卷动速度,数值越大,速度越慢(毫秒)
- timer = obj.timer ? parseInt(obj.timer, 10) : 2000; //滚动的时间间隔(毫秒)
- if (line == 0) line = 1;
- var rollNumObj = new Scroll($that, obj);
- rollNumObj.init();
- };
- //合同到期提醒
- function ContractScroll(obj, opt) {
- this.obj = obj;
- this.opt = $.extend(obj, opt);
- this.init = function() {
- clearInterval(obj.attr("timerID"));
- this.ContractScrolls(obj, opt);
- }
- }
- ContractScroll.prototype = {
- ContractScrolls: function(obj, opt) {
- this.hovereds(obj, opt)
- },
- scrollDowns: function(obj, opt) {
- var _this = obj.eq(0).find("ul:first");
- var lineH = _this.find("li:first").height(); //获取行高
- _this.animate({
- marginTop: -lineH + "px"
- }, //动画展示css样式
- opt.speed,
- function() {
- _this.find("li:first").siblings().removeClass('active').appendTo(_this);
- _this.find("li:first").removeClass('active').appendTo(_this);
- _this.css({
- marginTop: "0px"
- });
- _this.find("li:first").addClass('active');
- if (_this.find("li:first").attr('data-day') >= 0 && _this.find("li:first").attr('data-day') <= 30) {
- $('.lateTime').text(_this.find("li:first").attr('data-day'));
- $('.htWorld').text('距合同到期');
- $('.htWorld').removeClass('actzive');
- $('.htLate').addClass('active');
- } else if (_this.find("li:first").attr('data-day') > 30) {
- // $('.lateTime').text($(this).attr('data-day'));
- $('.lateTime').text(_this.find("li:first").attr('data-day'));
- $('.htWorld').text('距合同到期');
- $('.htWorld').removeClass('active');
- $('.htLate').removeClass('active');
- } else {
- $('.lateTime').text(_this.find("li:first").attr('data-day') * -1);
- $('.htWorld').text('合同已过期');
- $('.htWorld').addClass('active');
- $('.htLate').addClass('active');
- }
- }
- )
- },
- hovereds: function(obj, opt) {
- var timerID, $thats = this,
- _thisH = obj.eq(0).find("ul:first").height(),
- thisH = obj.eq(0).height();
- obj.eq(0).find("ul:first").unbind();
- //鼠标事件绑定
- obj.eq(0).find("ul:first").hover(function() {
- clearInterval(obj.attr("timerID"));
- }, function() {
- if (_thisH > thisH) {
- timerID = setInterval(function() {
- $thats.scrollDowns(obj, opt)
- }, opt.timer); //这里调用向下或者向上滚动函数
- obj.attr("timerID", timerID);
- }
- }).mouseout();
- }
- }
- $.fn.ContractScroll = function(obj) {
- var $thatt = this;
- //参数初始化
- if (!obj) var obj = {};
- var _this = $thatt.eq(0).find("ul:first");
- var lineH = _this.find("li:first").height(), //获取行高
- line = obj.line ? parseInt(obj.line, 10) : parseInt($thatt.height() / lineH, 10), //每次滚动的行数,默认为一屏,即父容器高度
- speed = obj.speed ? parseInt(obj.speed, 10) : 500, //卷动速度,数值越大,速度越慢(毫秒)
- timer = obj.timer ? parseInt(obj.timer, 10) : 2000; //滚动的时间间隔(毫秒)
- if (line == 0) line = 1;
- var rollNumObjs = new ContractScroll($thatt, obj);
- rollNumObjs.init();
- };
- })(jQuery);
- //以下获取农历日期
- function showCal() {
- var D = new Date();
- var yy = D.getFullYear();
- var mm = D.getMonth() + 1;
- var dd = D.getDate();
- var ww = D.getDay();
- var ss = parseInt(D.getTime() / 1000);
- if (yy < 100) yy = "19" + yy;
- // return GetLunarDay(yy, mm, dd);
- $('.headerRightInCon_r').html('农历:' + GetLunarDay(yy, mm, dd));
- }
- //定义全局变量
- var CalendarData = new Array(100);
- var madd = new Array(12);
- var tgString = "甲乙丙丁戊己庚辛壬癸";
- var dzString = "子丑寅卯辰巳午未申酉戌亥";
- var numString = "一二三四五六七八九十";
- var monString = "正二三四五六七八九十冬腊";
- var weekString = "日一二三四五六";
- var sx = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
- var cYear, cMonth, cDay, TheDate;
- CalendarData = new Array(0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A, 0xEA5,
- 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B, 0x25D, 0x92D, 0x2192B,
- 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6,
- 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54,
- 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B,
- 0x30D4A, 0xEA5, 0x80D65, 0x5AC, 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D,
- 0x92D, 0x5192B, 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95);
- madd[0] = 0;
- madd[1] = 31;
- madd[2] = 59;
- madd[3] = 90;
- madd[4] = 120;
- madd[5] = 151;
- madd[6] = 181;
- madd[7] = 212;
- madd[8] = 243;
- madd[9] = 273;
- madd[10] = 304;
- madd[11] = 334;
- function GetBit(m, n) {
- return (m >> n) & 1;
- }
- //农历转换
- function e2c() {
- TheDate = (arguments.length != 3) ? new Date() : new Date(arguments[0], arguments[1], arguments[2]);
- var total, m, n, k;
- var isEnd = false;
- var tmp = TheDate.getYear();
- if (tmp < 1900) {
- tmp += 1900;
- }
- total = (tmp - 1921) * 365 + Math.floor((tmp - 1921) / 4) + madd[TheDate.getMonth()] + TheDate.getDate() - 38;
- if (TheDate.getYear() % 4 == 0 && TheDate.getMonth() > 1) {
- total++;
- }
- for (m = 0;; m++) {
- k = (CalendarData[m] < 0xfff) ? 11 : 12;
- for (n = k; n >= 0; n--) {
- if (total <= 29 + GetBit(CalendarData[m], n)) {
- isEnd = true;
- break;
- }
- total = total - 29 - GetBit(CalendarData[m], n);
- }
- if (isEnd) break;
- }
- cYear = 1921 + m;
- cMonth = k - n + 1;
- cDay = total;
- if (k == 12) {
- if (cMonth == Math.floor(CalendarData[m] / 0x10000) + 1) {
- cMonth = 1 - cMonth;
- }
- if (cMonth > Math.floor(CalendarData[m] / 0x10000) + 1) {
- cMonth--;
- }
- }
- }
- function GetcDateString() {
- var tmp = "";
- /*显示农历年:( 如:甲午(马)年 )*/
- /*tmp+=tgString.charAt((cYear-4)%10);
- tmp+=dzString.charAt((cYear-4)%12);
- tmp+="(";
- tmp+=sx.charAt((cYear-4)%12);
- tmp+=")年 ";*/
- if (cMonth < 1) {
- tmp += "(闰)";
- tmp += monString.charAt(-cMonth - 1);
- } else {
- tmp += monString.charAt(cMonth - 1);
- }
- tmp += "月";
- tmp += (cDay < 11) ? "初" : ((cDay < 20) ? "十" : ((cDay < 30) ? "廿" : "三十"));
- if (cDay % 10 != 0 || cDay == 10) {
- tmp += numString.charAt((cDay - 1) % 10);
- }
- return tmp;
- }
- function GetLunarDay(solarYear, solarMonth, solarDay) {
- //solarYear = solarYear<1900?(1900+solarYear):solarYear;
- if (solarYear < 1921 || solarYear > 2020) {
- return "";
- } else {
- solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
- e2c(solarYear, solarMonth, solarDay);
- return GetcDateString();
- }
- }
|