郑州第一人民医院UI

common.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. $(function() {
  2. $('.headerTitle').click(function() {
  3. window.location.href = "index.html";
  4. })
  5. $('.headFour').click(function() {
  6. window.location.href = "RepairStatistic.html";
  7. })
  8. getNowFormatDate();
  9. setInterval('getNowFormatDate()', 1000);
  10. getlocation();
  11. setInterval(Ajax, huayi.config.indextime); //Ajax调用函数
  12. // setInterval(locat, huayi.config.cachetime);//缓存调用函数
  13. setInterval(getlocation, huayi.config.Weathertime); //天气调用函数
  14. // var calendar = ;
  15. })
  16. function getNowFormatDate() {
  17. var date = new Date();
  18. var month = date.getMonth() + 1,
  19. strDate = date.getDate(),
  20. strHours = date.getHours(),
  21. strMinutes = date.getMinutes();
  22. if (month >= 1 && month <= 9) {
  23. month = "0" + month;
  24. }
  25. if (strDate >= 0 && strDate <= 9) {
  26. strDate = "0" + strDate;
  27. }
  28. if (strHours >= 0 && strHours <= 9) {
  29. strHours = "0" + strHours;
  30. }
  31. if (strMinutes >= 0 && strMinutes <= 9) {
  32. strMinutes = "0" + strMinutes;
  33. }
  34. var currentdate = date.getFullYear() + "-" + month + "-" + strDate +
  35. " " + strHours + ":" + strMinutes;
  36. // + seperator2 + date.getSeconds();
  37. // return currentdate;
  38. $('.headerRightInCon_l').text(date.getFullYear() + "-" + month + "-" + strDate);
  39. $('.headerRightInCon_m').text(strHours + ":" + strMinutes);
  40. showCal(); //农历
  41. }
  42. //气温天气
  43. function getlocation() {
  44. //var bl = true;
  45. //var citylocation = new qq.maps.CityService({
  46. // complete: function (result) {
  47. // //if (bl) {
  48. // // citylocation.searchCityByName(result.detail.name);
  49. // // bl = false;
  50. // //}
  51. // //else {
  52. // // var cityProvice = result.detail.detail.split(",");
  53. // // getWeather(cityProvice[1], cityProvice[0]);
  54. // //}
  55. // GetWeatherByLatLng(result.detail.latLng.lat, result.detail.latLng.lng);
  56. // }
  57. //});
  58. //citylocation.searchLocalCity();
  59. getWeather("河南省", "郑州市")
  60. }
  61. function GetWeatherByLatLng(latitude, longitude) {
  62. $.ajax({
  63. type: "get",
  64. url: huayi.config.callcenter_url + 'equipmentapi/api/RunningChart/getweatherbylatlng?latitude=' + latitude +
  65. '&longitude=' + longitude,
  66. async: true,
  67. dataType: 'json',
  68. success: function(data) {
  69. if (data.state == 'success') {
  70. $('.airQuality').text(data.data.data.air.aqi_name); //空气质量
  71. $('.windPower').text(data.data.data.observe.wind_power); //风力
  72. $('.humidity').text(data.data.data.observe.humidity + "%"); //湿度
  73. $('.temperature').text(data.data.data.observe.degree); //温度
  74. }
  75. }
  76. });
  77. }
  78. function getWeather(provinces, citys) {
  79. $.ajax({
  80. type: "get",
  81. url: huayi.config.callcenter_url + 'equipmentapi/api/RunningChart/getweather?province=' + provinces + '&city=' +
  82. citys,
  83. async: true,
  84. dataType: 'json',
  85. success: function(data) {
  86. if (data.state == 'success') {
  87. $('.airQuality').text(data.data.data.air.aqi_name); //空气质量
  88. $('.windPower').text(data.data.data.observe.wind_power); //风力
  89. $('.humidity').text(data.data.data.observe.humidity + "%"); //湿度
  90. $('.temperature').text(data.data.data.observe.degree); //温度
  91. }
  92. }
  93. });
  94. }
  95. //滚动效果
  96. ;(function($) {
  97. function Scroll(obj, opt) {
  98. this.obj = obj;
  99. this.opt = $.extend(obj, opt);
  100. this.init = function() {
  101. clearInterval(obj.attr("timerID"));
  102. this.Scrolls(obj, opt);
  103. }
  104. }
  105. Scroll.prototype = {
  106. // timerID:null,
  107. Scrolls: function(obj, opt) {
  108. this.hovered(obj, opt)
  109. },
  110. scrollDown: function(obj, opt) {
  111. var _this = obj.eq(0).find("ul:first");
  112. var lineH = _this.find("li:first").height(); //获取行高
  113. _this.animate({
  114. marginTop: -lineH + "px"
  115. }, //动画展示css样式
  116. opt.speed,
  117. function() {
  118. _this.find("li:first").appendTo(_this);
  119. _this.css({
  120. marginTop: "0px"
  121. });
  122. }
  123. )
  124. },
  125. hovered: function(obj, opt) {
  126. var timerID, $thats = this,
  127. _thisH = obj.eq(0).find("ul:first").height(),
  128. thisH = obj.eq(0).height();
  129. obj.eq(0).find("ul:first").unbind();
  130. //鼠标事件绑定
  131. obj.eq(0).find("ul:first").hover(function() {
  132. clearInterval(obj.attr("timerID"));
  133. }, function() {
  134. if (_thisH > thisH) {
  135. timerID = setInterval(function() {
  136. $thats.scrollDown(obj, opt)
  137. }, opt.timer); //这里调用向下或者向上滚动函数
  138. obj.attr("timerID", timerID);
  139. }
  140. }).mouseout();
  141. }
  142. }
  143. $.fn.Scroll = function(obj) {
  144. var $that = this;
  145. //参数初始化
  146. if (!obj) var obj = {};
  147. var _this = $that.eq(0).find("ul:first");
  148. var lineH = _this.find("li:first").height(), //获取行高
  149. line = obj.line ? parseInt(obj.line, 10) : parseInt($that.height() / lineH, 10), //每次滚动的行数,默认为一屏,即父容器高度
  150. speed = obj.speed ? parseInt(obj.speed, 10) : 500, //卷动速度,数值越大,速度越慢(毫秒)
  151. timer = obj.timer ? parseInt(obj.timer, 10) : 2000; //滚动的时间间隔(毫秒)
  152. if (line == 0) line = 1;
  153. var rollNumObj = new Scroll($that, obj);
  154. rollNumObj.init();
  155. };
  156. //合同到期提醒
  157. function ContractScroll(obj, opt) {
  158. this.obj = obj;
  159. this.opt = $.extend(obj, opt);
  160. this.init = function() {
  161. clearInterval(obj.attr("timerID"));
  162. this.ContractScrolls(obj, opt);
  163. }
  164. }
  165. ContractScroll.prototype = {
  166. ContractScrolls: function(obj, opt) {
  167. this.hovereds(obj, opt)
  168. },
  169. scrollDowns: function(obj, opt) {
  170. var _this = obj.eq(0).find("ul:first");
  171. var lineH = _this.find("li:first").height(); //获取行高
  172. _this.animate({
  173. marginTop: -lineH + "px"
  174. }, //动画展示css样式
  175. opt.speed,
  176. function() {
  177. _this.find("li:first").siblings().removeClass('active').appendTo(_this);
  178. _this.find("li:first").removeClass('active').appendTo(_this);
  179. _this.css({
  180. marginTop: "0px"
  181. });
  182. _this.find("li:first").addClass('active');
  183. if (_this.find("li:first").attr('data-day') >= 0 && _this.find("li:first").attr('data-day') <= 30) {
  184. $('.lateTime').text(_this.find("li:first").attr('data-day'));
  185. $('.htWorld').text('距合同到期');
  186. $('.htWorld').removeClass('actzive');
  187. $('.htLate').addClass('active');
  188. } else if (_this.find("li:first").attr('data-day') > 30) {
  189. // $('.lateTime').text($(this).attr('data-day'));
  190. $('.lateTime').text(_this.find("li:first").attr('data-day'));
  191. $('.htWorld').text('距合同到期');
  192. $('.htWorld').removeClass('active');
  193. $('.htLate').removeClass('active');
  194. } else {
  195. $('.lateTime').text(_this.find("li:first").attr('data-day') * -1);
  196. $('.htWorld').text('合同已过期');
  197. $('.htWorld').addClass('active');
  198. $('.htLate').addClass('active');
  199. }
  200. }
  201. )
  202. },
  203. hovereds: function(obj, opt) {
  204. var timerID, $thats = this,
  205. _thisH = obj.eq(0).find("ul:first").height(),
  206. thisH = obj.eq(0).height();
  207. obj.eq(0).find("ul:first").unbind();
  208. //鼠标事件绑定
  209. obj.eq(0).find("ul:first").hover(function() {
  210. clearInterval(obj.attr("timerID"));
  211. }, function() {
  212. if (_thisH > thisH) {
  213. timerID = setInterval(function() {
  214. $thats.scrollDowns(obj, opt)
  215. }, opt.timer); //这里调用向下或者向上滚动函数
  216. obj.attr("timerID", timerID);
  217. }
  218. }).mouseout();
  219. }
  220. }
  221. $.fn.ContractScroll = function(obj) {
  222. var $thatt = this;
  223. //参数初始化
  224. if (!obj) var obj = {};
  225. var _this = $thatt.eq(0).find("ul:first");
  226. var lineH = _this.find("li:first").height(), //获取行高
  227. line = obj.line ? parseInt(obj.line, 10) : parseInt($thatt.height() / lineH, 10), //每次滚动的行数,默认为一屏,即父容器高度
  228. speed = obj.speed ? parseInt(obj.speed, 10) : 500, //卷动速度,数值越大,速度越慢(毫秒)
  229. timer = obj.timer ? parseInt(obj.timer, 10) : 2000; //滚动的时间间隔(毫秒)
  230. if (line == 0) line = 1;
  231. var rollNumObjs = new ContractScroll($thatt, obj);
  232. rollNumObjs.init();
  233. };
  234. })(jQuery);
  235. //以下获取农历日期
  236. function showCal() {
  237. var D = new Date();
  238. var yy = D.getFullYear();
  239. var mm = D.getMonth() + 1;
  240. var dd = D.getDate();
  241. var ww = D.getDay();
  242. var ss = parseInt(D.getTime() / 1000);
  243. if (yy < 100) yy = "19" + yy;
  244. // return GetLunarDay(yy, mm, dd);
  245. $('.headerRightInCon_r').html('农历:' + GetLunarDay(yy, mm, dd));
  246. }
  247. //定义全局变量
  248. var CalendarData = new Array(100);
  249. var madd = new Array(12);
  250. var tgString = "甲乙丙丁戊己庚辛壬癸";
  251. var dzString = "子丑寅卯辰巳午未申酉戌亥";
  252. var numString = "一二三四五六七八九十";
  253. var monString = "正二三四五六七八九十冬腊";
  254. var weekString = "日一二三四五六";
  255. var sx = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
  256. var cYear, cMonth, cDay, TheDate;
  257. CalendarData = new Array(0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A, 0xEA5,
  258. 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B, 0x25D, 0x92D, 0x2192B,
  259. 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6,
  260. 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54,
  261. 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B,
  262. 0x30D4A, 0xEA5, 0x80D65, 0x5AC, 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D,
  263. 0x92D, 0x5192B, 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95);
  264. madd[0] = 0;
  265. madd[1] = 31;
  266. madd[2] = 59;
  267. madd[3] = 90;
  268. madd[4] = 120;
  269. madd[5] = 151;
  270. madd[6] = 181;
  271. madd[7] = 212;
  272. madd[8] = 243;
  273. madd[9] = 273;
  274. madd[10] = 304;
  275. madd[11] = 334;
  276. function GetBit(m, n) {
  277. return (m >> n) & 1;
  278. }
  279. //农历转换
  280. function e2c() {
  281. TheDate = (arguments.length != 3) ? new Date() : new Date(arguments[0], arguments[1], arguments[2]);
  282. var total, m, n, k;
  283. var isEnd = false;
  284. var tmp = TheDate.getYear();
  285. if (tmp < 1900) {
  286. tmp += 1900;
  287. }
  288. total = (tmp - 1921) * 365 + Math.floor((tmp - 1921) / 4) + madd[TheDate.getMonth()] + TheDate.getDate() - 38;
  289. if (TheDate.getYear() % 4 == 0 && TheDate.getMonth() > 1) {
  290. total++;
  291. }
  292. for (m = 0;; m++) {
  293. k = (CalendarData[m] < 0xfff) ? 11 : 12;
  294. for (n = k; n >= 0; n--) {
  295. if (total <= 29 + GetBit(CalendarData[m], n)) {
  296. isEnd = true;
  297. break;
  298. }
  299. total = total - 29 - GetBit(CalendarData[m], n);
  300. }
  301. if (isEnd) break;
  302. }
  303. cYear = 1921 + m;
  304. cMonth = k - n + 1;
  305. cDay = total;
  306. if (k == 12) {
  307. if (cMonth == Math.floor(CalendarData[m] / 0x10000) + 1) {
  308. cMonth = 1 - cMonth;
  309. }
  310. if (cMonth > Math.floor(CalendarData[m] / 0x10000) + 1) {
  311. cMonth--;
  312. }
  313. }
  314. }
  315. function GetcDateString() {
  316. var tmp = "";
  317. /*显示农历年:( 如:甲午(马)年 )*/
  318. /*tmp+=tgString.charAt((cYear-4)%10);
  319. tmp+=dzString.charAt((cYear-4)%12);
  320. tmp+="(";
  321. tmp+=sx.charAt((cYear-4)%12);
  322. tmp+=")年 ";*/
  323. if (cMonth < 1) {
  324. tmp += "(闰)";
  325. tmp += monString.charAt(-cMonth - 1);
  326. } else {
  327. tmp += monString.charAt(cMonth - 1);
  328. }
  329. tmp += "月";
  330. tmp += (cDay < 11) ? "初" : ((cDay < 20) ? "十" : ((cDay < 30) ? "廿" : "三十"));
  331. if (cDay % 10 != 0 || cDay == 10) {
  332. tmp += numString.charAt((cDay - 1) % 10);
  333. }
  334. return tmp;
  335. }
  336. function GetLunarDay(solarYear, solarMonth, solarDay) {
  337. //solarYear = solarYear<1900?(1900+solarYear):solarYear;
  338. if (solarYear < 1921 || solarYear > 2020) {
  339. return "";
  340. } else {
  341. solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
  342. e2c(solarYear, solarMonth, solarDay);
  343. return GetcDateString();
  344. }
  345. }