// 鍓嶇妯℃澘 ! function(a) { "use strict"; var b = function(a, c) { var d = /[^\w\-\.:]/.test(a) ? new Function(b.arg + ",tmpl", "var _e=tmpl.encode" + b.helper + ",_s='" + a.replace(b.regexp, b.func) + "';return _s;") : b.cache[a] = b.cache[a] || b(b.load(a)); return c ? d(c, b) : function(a) { return d(a, b) } }; b.cache = {}, b.load = function(a) { return document.getElementById(a).innerHTML }, b.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g, b.func = function(a, b, c, d, e, f) { return b ? { "\n": "\\n", "\r": "\\r", " ": "\\t", " ": " " } [b] || "\\" + b : c ? "=" === c ? "'+_e(" + d + ")+'" : "'+(" + d + "==null?'':" + d + ")+'" : e ? "';" : f ? "_s+='" : void 0 }, b.encReg = /[<>&"'\x00]/g, b.encMap = { "<": "<", ">": ">", "&": "&", '"': """, "'": "'" }, b.encode = function(a) { return (null == a ? "" : "" + a).replace(b.encReg, function(a) { return b.encMap[a] || "" }) }, b.arg = "o", b.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}", "function" == typeof define && define.amd ? define(function() { return b }) : a.tmpl = b }(this); // 杩蜂綘鍙戝竷璁㈤槄绯荤粺 (function($) { var o = $({}); $.subscribe = function() { o.on.apply(o, arguments); }; $.unsubscribe = function() { o.off.apply(o, arguments); }; $.publish = function() { o.trigger.apply(o, arguments); }; }($)); $(function() { 'use strict'; var win = window; win.GLOBAL = win.GLOBAL || {}; win.hr = win.hr || {}; win.hr.version = '1.6.11'; win.hr.page = win.hr.page || {}; win.hr.component = win.hr.component || {}; /** * @description 娉ㄥ唽缁勪欢 * @param {String} name 缁勪欢鍚嶅瓧 * @param {Object} obj 缁勪欢 Javascript 閫昏緫锛孞SON 鏍煎紡 * @return {Object} 杩斿洖 window.hr.component 瀵硅薄 * @example * hr.regComponent('缁勪欢鍚?, { * init: function () { // 姝 init 鏂规硶涓哄繀闇€锛岀粍浠舵敞鍐屽悗浼氭墽琛岀殑鏂规硶 * this.someAction(); * }, * someAction: function () { * // 缁勪欢 Javascript 閫昏緫锛屽彲浠ユ牴鎹渶瑕佸啓澶氫釜 Function * } * }); * 缁勪欢娉ㄥ唽鍚庡鏋滆鍐嶆璋冪敤锛屽彲浠ョ敤 hr.component.缁勪欢鍚 鑾峰彇缁勪欢瀵硅薄 */ win.hr.regComponent = function(name, obj) { if (typeof name == 'string' && name !== '') { win.hr.util._createNamespace(name.split('.'), obj, win.hr.component); } }; /** * @description 娉ㄥ唽椤甸潰 * @param {String} name 椤甸潰鍚嶅瓧 * @param {Object} obj 椤甸潰 Javascript 閫昏緫锛孞SON 鏍煎紡 * @return {Object} 杩斿洖 window.hr.page 瀵硅薄 * @example * hr.regPage('椤甸潰鍚?, { * init: function () { // 姝 init 鏂规硶涓哄繀闇€锛岀粍浠堕〉闈㈠悗浼氭墽琛岀殑鏂规硶 * this.someAction(); * }, * someAction: function () { * // 椤甸潰 Javascript 閫昏緫锛屽彲浠ユ牴鎹渶瑕佸啓澶氫釜 Function * } * }); * 椤甸潰娉ㄥ唽鍚庡鏋滆鍐嶆璋冪敤锛屽彲浠ョ敤 hr.page.椤甸潰鍚 鑾峰彇椤甸潰瀵硅薄 */ win.hr.regPage = function(name, obj) { if (typeof name == 'string' && name !== '') { win.hr.util._createNamespace(name.split('.'), obj, win.hr.page); } }; win.hr.util = { /** * @description 娓叉煋妯℃澘 * @param {JSON} opt 鍖呭惈浠ヤ笅鍐呭 * @param {String} opt.tmpl 妯℃澘鍖哄煙鐨 ID 鍚 * @param {Object} opt.data 瑕佹覆鏌撶殑 JSON 鏁版嵁 * @param {Object} opt.to 瑕佽拷鍔犺繘鐨 jQuery DOM 瀵硅薄 * @param {Object} opt.insertTo 瑕佹彃鍏ュ埌鍏朵箣鍓嶆垨涔嬪悗鐨 jQuery DOM 瀵硅薄 * @param {String} opt.method 娓叉煋鐨勬柟寮忥紝鍖呮嫭 replace銆乤ppend 鍜 prepend锛屽綋鍚屾椂鏈 insertTo 鏃讹紝鏄互 insertTo 涓哄熀鍑 * @param {Function} opt.callbackFn 鍥炶皟鍑芥暟 */ renderTmpl: function(opt) { var strTargetTmpl = opt.tmpl || ''; var jsonData = opt.data || {}; var $target = opt.to; var method = opt.method || 'append'; var $insertTo = opt.insertTo || null; if ($target) { var tmpled = tmpl(strTargetTmpl, jsonData); switch (method) { case 'replace': $target.html(tmpled); break; case 'append': if ($insertTo) { $(tmpled).insertAfter($insertTo); } else { $target.append(tmpled); } break; case 'prepend': if ($insertTo) { $(tmpled).insertBefore($insertTo); } else { $target.prepend(tmpled); } break; default: break; } } $.isFunction(opt.callbackFn) && opt.callbackFn(); }, /** * @description 浠 URL 涓幏鍙栨寚瀹氬弬鏁板€ * @param {String} str 瑕佷粠 URL 涓幏鍙栫殑鍙傛暟鍊 */ getUrlParam: function(str) { var s = location.search; var tmp = []; var value = ''; if (s) { tmp = s.substr(1).split('&'); } for (var i = 0; i < tmp.length; i++) { if (tmp[i].substring(0, tmp[i].indexOf('=')) === str) { value = tmp[i].substr(tmp[i].indexOf('=') + 1); break; } } return value; }, /** * @description 浣跨敤 rem 鍗曚綅鏃惰嚜鍔ㄨ绠 html 鍒濆瀛椾綋灏哄銆傛瘮濡傝璁$鏄 750px 鐨勶紝閭d箞瀵瑰簲鐨 1rem 灏辩瓑浜 100px锛涘鏋滆璁$鏄潪鏍囧噯灏哄锛屾瘮濡 844px锛岄偅涔堝彲浠ヤ紶鍏ュ弬鏁 baseWidth 844锛岃繖鏍峰彲浠ヤ繚璇 1rem 绛変簬 100px锛屼究浜庤绠椼€ * @param {Number} baseWidth 鍩哄噯灏哄 */ resizePage: function(baseWidth) { var baseW = baseWidth || 750; var docEl = document.documentElement, resizeEvt = 'orientationchange' in win ? 'orientationchange' : 'resize', recalc = function() { var clientWidth = docEl.clientWidth; if (!clientWidth) { return; } if (clientWidth > baseW) { clientWidth = baseW; } docEl.style.fontSize = 100 * (clientWidth / baseW) + 'px'; }; if (!document.addEventListener) { return; } win.addEventListener(resizeEvt, recalc, false); recalc(); }, /** * @description 鍐呴儴鏂规硶锛屽垱寤轰竴涓懡鍚嶇┖闂 */ _createNamespace: function(parts, obj, parent) { var obj = obj || { init: function() {} }; var i = 0; if (parts[0] === 'hr') { parts = parts.slice(1); } for (i = 0; i < parts.length; i++) { if (typeof parent[parts[i]] == 'undefined') { parent[parts[i]] = obj; // 缁勪欢鎴栭〉闈㈡敞鍐屽悗鎵ц obj.init(); } parent = parent[parts[i]]; } }, nav: function() { $('.links').on('click', function(e) { $(this).children('.opt').stop().slideToggle(200); e.stopPropagation(); //闃绘鍐掓场 }) if ($(window).width() > 1199) { $(document).ready(function() { var p = 0, t = 0; $(window).scroll(function(e) { p = $(this).scrollTop(); if (t > 200) { $('.header').addClass('fixed'); $('.side-nav .top').addClass('show'); } else { $('.header').removeClass('fixed'); $('.side-nav .top').removeClass('show'); } setTimeout(function() { t = p; }, 0); }); }); $('body').on('mouseleave', '.header-nav>li', function() { $(this).find('.two-level').stop().slideUp(0); }).on('mouseenter', '.header-nav>li', function() { $(this).find('.two-level').stop().slideDown(); }); } else { $('body').on('click', '.menuBtn', function() { $(this).stop().toggleClass('open'); $('.hd-r').stop().slideToggle(); }) $(".header-nav .level > a").attr("href", "javascript:;") $(".header-nav .level").click(function() { $(this).find(".two-level").stop().slideToggle() }) } // $(window).resize(function(){ // location.reload() // }) $(document).click(function() { $('.fd-logo .link ul').stop().slideUp(200); }) $('.fd-logo').on('click', '.link .tit', function(e) { $(this).siblings('ul').slideToggle(); e.stopPropagation(); }); $('body').on('mouseenter', '.header-nav', function() { $('.header').addClass('open'); }); $('body').on('mouseleave', '.header-nav', function() { $('.header').removeClass('open'); }); $('body').on('mouseenter', '.header-btn-group .qr-box>a', function() { $(this).siblings('.qr').show(); }); $('body').on('mouseleave', '.header-btn-group .qr-box>a', function() { $(this).siblings('.qr').hide(); }); $('body').on('click', '.header-btn-group .sear>a', function() { $(this).siblings('.search').toggleClass('show'); }); $('body').on('click', '.about-word .item .more', function() { $(this).parents(".item").css("height", "auto") $(this).hide() }); // 閫夐」鍗 榧犳爣鐐瑰嚮鍒囨崲 $(".TAB_CLICK li").click(function() { var tab = $(this).parent(".TAB_CLICK"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addClass('on').siblings(tab.find("li")).removeClass('on'); $(con).eq(on).show().siblings(con).hide(); }); $('body').on('click', '.gotop', function() { $("html,body").animate({ scrollTop: 0 }, 500); }); $(window).scroll(function() { var _top = $(window).scrollTop(); if (_top < 100) { $('.gotop').stop().fadeOut(500); } else { $('.gotop').stop().fadeIn(500); } }); } }; win.hr.init = function() { hr.util.nav(); new WOW().init(); // TODO 杩欓噷鏀鹃〉闈㈠垵濮嬪寲鏃堕渶瑕佹墽琛岀殑浠g爜 }; win.hr.init(); });