锘?*! * author: niqilin * www.niqilin.com * date: 2021-07-01 **/ /*妫€娴嬫祻瑙堝櫒鏂规硶 ------------------------------------------------*/ var pageurl = window.location.search; if (pageurl == '?m2w') { addCookie('m2wcookie', '1', 0); } if (getCookie('m2wcookie') != '1' && browserRedirect()) { var url = window.location.href;//鑾峰彇鏁翠釜url url = '/' + url.split('/').slice(3).join('/');//鍘绘帀鍩熷悕 location.href = 'https://m.sczljg.com' + url; } //榧犳爣绉诲叆瀵艰埅鏁堟灉 $(function () { //椤甸潰婊氬姩浜嬩欢鎵ц $(window).scroll(function () { //鏄剧ず闅愯棌椤堕儴 var scrollTop = $(window).scrollTop();//鑾峰彇鍨傜洿婊氬姩璺濈锛屽綋鍓嶇獥鍙i《绔埌鏁翠釜椤甸潰椤剁鐨勮窛绂 var obj = $(".header");//鑾峰彇椤堕儴瀵硅薄 $(window).scroll(function () { if ($(this).scrollTop() < $(".header").height()) {//鍦ㄩ《閮 obj.removeClass("header-show"); obj.removeClass("header-hide"); } else if ($(this).scrollTop() >= scrollTop && $(this).scrollTop() > $(".header").height()) {//寰€涓嬫粦闅愯棌 obj.removeClass("header-show"); obj.addClass("header-hide"); //淇濇寔椤堕儴 //obj.addClass("header-show"); } else {//寰€涓婃粦鏄剧ず obj.removeClass("header-hide"); obj.addClass("header-show"); } scrollTop = $(this).scrollTop(); }); //鏄剧ず渚ц竟鏍 $(this).scrollTop() > 400 ? $(".sidebar").fadeIn(380) : $(".sidebar").fadeOut(380); //搴曢儴琛ㄥ崟鏀剁缉鍒颁晶杈 if ($(document).scrollTop() >= $(document).height() - $(window).height()) { if (!$(".dialog-bar .dialog-bottom").hasClass("close") & !$(".dialog-bar .dialog-content").hasClass("active")) { //鏄剧ず $(".dialog-bar .dialog-bottom").addClass("close");//鏄剧ず搴曢儴琛ㄥ崟 $(".dialog-woman").show();//鏄剧ず宸︿晶鍜ㄨ } }; }); //鏄剧ず璧勬枡闈㈡澘 $(".header-user-icon").hover(function () { $(".header-user-popover").addClass("active"); }, function () { $(".header-user-popover").removeClass("active"); }); //璧勬枡闈㈡澘鎮诞浜嬩欢 $(".header-user-popover").hover(function () { $(".header-user-popover").addClass("active"); }, function () { $(".header-user-popover").removeClass("active"); }); headerHover(); function headerHover() { var h = $("#header"); var aLi = $("#header .header-nav li"); var aItem1 = $("#header .header-nav li .header-panel-list li"); var aItem2 = $("#header .header-nav li .header-panel-sublist li"); var num = 0; h.hover(function () { $(this).addClass("header-show"); }, function () { if ($(window).scrollTop() < $(".header").height()) {//鍦ㄩ《閮 $(".header").removeClass("header-show"); $(".header").removeClass("header-hide"); } else {//寰€涓婃粦鏄剧ず $(".header").removeClass("header-hide"); $(".header").addClass("header-show"); } }); aLi.hover(function () { h.addClass("header-show"); $(this).find(".header-panel").css({ "display": "block", "opacity": "0" }); $(this).find(".header-panel").stop().animate({ "top": "81px", "opacity": "1" }, 500); }, function () { $(this).find(".header-panel").stop().animate({ "top": "100px", "opacity": "0" }, 500, function () { $(this).css({ "display": "none" }); }); }); fn1(); aItem1.hover(function () { num = $(this).index(); fn1(); }); function fn1() { aItem1.removeClass("active"); aItem1.eq(num).addClass("active"); aItem2.removeClass("active"); aItem2.eq(num).addClass("active"); } }; /*寮圭獥琛ㄥ崟 ------------------------------------------------*/ //姣忛殧10绉掓樉绀哄挩璇㈠脊绐 //var popupTimer = setTimeout(function () { // showPopup(); //}, 40000); /*搴曢儴琛ㄥ崟 ------------------------------------------------*/ //鍒囨崲搴曢儴琛ㄥ崟 $(".dialog-bar .dialog-title").click(function () { if (!$(".dialog-bar .dialog-content").hasClass("active")) { //鏄剧ず $(".dialog-bar .dialog-content").addClass("active");//鏄剧ず搴曢儴琛ㄥ崟 $(".dialog-bar .dialog-bottom .dialog-img").addClass("dialog-img-active");//鏀惧ぇ鍥剧墖 $(".dialog-bar .dialog-show").css("transform", "rotateX(0)");//绠ご鍥炬爣鍚戜笅 $(".dialog-bar .dialog-close").show();//鏄剧ず鍏抽棴鎸夐挳 }else { //闅愯棌 $(".dialog-bar .dialog-content").removeClass("active");//闅愯棌搴曢儴琛ㄥ崟 $(".dialog-bar .dialog-bottom .dialog-img").removeClass("dialog-img-active");//缂╁皬鍥剧墖 $(".dialog-bar .dialog-show").css("transform", "rotateX(180deg)");//绠ご鍥炬爣鍚戜笂 $(".dialog-bar .dialog-close").hide();//鏄剧ず鍏抽棴鎸夐挳 } }); //鍏抽棴搴曢儴琛ㄥ崟 $(".dialog-bar .dialog-close").click(function () { if (!$(".dialog-bar .dialog-bottom").hasClass("close")) { //鏄剧ず $(".dialog-bar .dialog-bottom").addClass("close");//鏄剧ず搴曢儴琛ㄥ崟 $(".dialog-woman").show();//鏄剧ず宸︿晶鍜ㄨ } }); //宸︿晶浜虹墿鍜ㄨ鎸夐挳 $(".dialog-woman").click(function () { if ($(".dialog-bar .dialog-bottom").hasClass("close")) { //鏄剧ず $(".dialog-bar .dialog-bottom").removeClass("close");//鏄剧ず搴曢儴琛ㄥ崟 $(".dialog-woman").hide();//鏄剧ず宸︿晶鍜ㄨ } if (!$(".dialog-bar .dialog-content").hasClass("active")) { //鏄剧ず $(".dialog-bar .dialog-content").addClass("active");//鏄剧ず搴曢儴琛ㄥ崟 $(".dialog-bar .dialog-bottom .dialog-img").addClass("dialog-img-active");//鏀惧ぇ鍥剧墖 $(".dialog-bar .dialog-show").css("transform", "rotateX(0)");//绠ご鍥炬爣鍚戜笅 $(".dialog-bar .dialog-close").show();//鏄剧ず鍏抽棴鎸夐挳 } }); }); //鏄剧ず鍜ㄨ寮圭獥 function showPopup() { $(".popup").fadeIn(380); //clearTimeout(popupTimer); } //闅愯棌鍜ㄨ寮圭獥 function hidePopup() { $(".popup").fadeOut(380); //var popupTimer = setTimeout(function () { // showPopup(); //}, 60000); } //杩斿洖椤堕儴 function goTop() { $('html,body').stop().animate({ 'scrollTop': 0 }, 600); } /*宸ュ叿绫绘柟娉 ------------------------------------------------*/ //妫€娴嬫槸鍚︾Щ鍔ㄨ澶囨潵璁 function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { return true; } else { return false; } } //鍐機ookie function addCookie(objName, objValue, objHours) { var str = objName + "=" + escape(objValue); if (objHours > 0) {//娴忚鍣ㄥ叧闂椂cookie鑷姩娑堝け,涓?鏃朵笉璁惧畾杩囨湡鏃堕棿 var date = new Date(); var ms = objHours * 3600 * 1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } //璇籆ookie function getCookie(objName) {//鑾峰彇鎸囧畾鍚嶇О鐨刢ookie鐨勫€ var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.length; i++) { var temp = arrStr[i].split("="); if (temp[0] == objName) return unescape(temp[1]); } return ""; } //鍥涜垗浜斿叆鍑芥暟 function ForDight(Dight, How) { Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How); return Dight; } //鍙厑璁歌緭鍏ユ暟瀛 function checkNumber(e) { var keynum = window.event ? e.keyCode : e.which; if ((48 <= keynum && keynum <= 57) || (96 <= keynum && keynum <= 105) || keynum == 8) { return true; } else { return false; } } //鍙厑璁歌緭鍏ュ皬鏁 function checkForFloat(obj, e) { var isOK = false; var key = window.event ? e.keyCode : e.which; if ((key > 95 && key < 106) || //灏忛敭鐩樹笂鐨?鍒? (key > 47 && key < 60) || //澶ч敭鐩樹笂鐨?鍒? (key == 110 && obj.value.indexOf(".") < 0) || //灏忛敭鐩樹笂鐨?鑰屼笖浠ュ墠娌℃湁杈撳叆. (key == 190 && obj.value.indexOf(".") < 0) || //澶ч敭鐩樹笂鐨?鑰屼笖浠ュ墠娌℃湁杈撳叆. key == 8 || key == 9 || key == 46 || key == 37 || key == 39) { isOK = true; } else { if (window.event) { //IE e.returnValue = false; //event.returnValue=false 鏁堟灉鐩稿悓. } else { //Firefox e.preventDefault(); } } return isOK; } //澶嶅埗鏂囨湰 function copyText(txt) { window.clipboardData.setData("Text", txt); var d = dialog({ content: '澶嶅埗鎴愬姛锛? }).show(); setTimeout(function () { d.close().remove(); }, 2000); } //鍒囨崲楠岃瘉鐮 function ToggleCode(obj, codeurl) { $(obj).children("img").eq(0).attr("src", codeurl + "?time=" + Math.random()); return false; } //鍏ㄩ€夊彇娑堟寜閽嚱鏁帮紝璋冪敤鏍峰紡濡傦細 function checkAll(chkobj) { if ($(chkobj).text() == "鍏ㄩ€?) { $(chkobj).text("鍙栨秷"); $(".checkall").prop("checked", true); } else { $(chkobj).text("鍏ㄩ€?); $(".checkall").prop("checked", false); } } //Tab鎺у埗閫夐」鍗 function tabs(tabObj, event) { //缁戝畾浜嬩欢 var tabItem = $(tabObj).find(".tab-head ul li a"); tabItem.bind(event, function () { //璁剧疆鐐瑰嚮鍚庣殑鍒囨崲鏍峰紡 tabItem.removeClass("selected"); $(this).addClass("selected"); //璁剧疆鐐瑰嚮鍚庣殑鍒囨崲鍐呭 var tabNum = tabItem.parent().index($(this).parent()); $(tabObj).find(".tab-content").hide(); $(tabObj).find(".tab-content").eq(tabNum).show(); }); } //鏄剧ず娴姩绐楀彛 function showWindow(obj) { var tit = $(obj).attr("title"); var box = $(obj).html(); dialog({ width: 500, title: tit, content: box, okValue: '纭畾', ok: function () { } }).showModal(); } /*椤甸潰绾ч€氱敤鏂规硶 ------------------------------------------------*/ //鏅鸿兘娴姩灞傚嚱鏁 $.fn.smartFloat = function () { var position = function (element) { var top = element.position().top, pos = element.css("position"); var tabHead = $("#tabHead").offset().top; var w = element.innerWidth(); $(window).scroll(function () { var scrolls = $(this).scrollTop(); if (scrolls > top && scrolls > tabHead) { if (window.XMLHttpRequest) { element.css({ width: w, position: "fixed", top: 0 }); } else { element.css({ top: scrolls }); } } else { element.css({ position: pos, top: top }); } }); }; return $(this).each(function () { position($(this)); }); }; //鎼滅储鏌ヨ function SiteSearch(send_url, divTgs) { var str = $.trim($(divTgs).val()); if (str.length > 0 && str != "璇疯緭鍏ュ叧閿瘝") { window.location.href = send_url + "?keyword=" + encodeURI($(divTgs).val()); } return false; } //閾炬帴涓嬭浇 function downLink(point, linkurl) { if (point > 0) { dialog({ title: '鎻愮ず', content: "涓嬭浇闇€瑕? + point + "绉垎
閲嶅涓嬭浇涓嶆墸绉垎锛岃缁х画鍚楋紵", okValue: '纭畾', ok: function () { window.location.href = linkurl; }, cancelValue: '鍙栨秷', cancel: function () { } }).showModal(); } else { window.location.href = linkurl; } return false; } //璁$畻绉垎鍏戞崲 function numConvert(obj) { var maxAmount = parseFloat($("#hideAmount").val()); //鎬婚噾棰 var pointCashrate = parseFloat($("#hideCashrate").val()); //鍏戞崲姣斾緥 var currAmount = parseFloat($(obj).val()); //闇€瑕佽浆鎹㈢殑閲戦 if (currAmount > maxAmount) { currAmount = maxAmount; $(obj).val(maxAmount); } var convertPoint = currAmount * pointCashrate; $("#convertPoint").text(convertPoint); } //鎵ц鍒犻櫎鎿嶄綔 function ExecDelete(sendUrl, checkValue, urlObj) { //妫€鏌ヤ紶杈撶殑鍊 if (!checkValue) { dialog({ title: '鎻愮ず', content: '璇烽€夋嫨鎮ㄨ鎿嶄綔鐨勮褰曪紒', okValue: '纭畾', ok: function () { } }).showModal(); return false; } dialog({ title: '鎻愮ず', content: '鍒犻櫎璁板綍鍚庝笉鍙仮澶嶏紝纭畾缁х画鍚楋紵', okValue: '纭畾', ok: function () { $.ajax({ type: "POST", url: sendUrl, dataType: "json", data: { "checkId": checkValue }, timeout: 20000, success: function (data, textStatus) { if (data.status == 1) { var tipdialog = dialog({ content: data.msg }).show(); setTimeout(function () { tipdialog.close().remove(); if ($(urlObj)) { location.href = $(urlObj).val(); } else { location.reload(); } }, 2000); } else { dialog({ title: '鎻愮ず', content: data.msg, okValue: '纭畾', ok: function () { } }).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { dialog({ title: '鎻愮ず', content: '鐘舵€侊細' + textStatus + '锛涘嚭閿欐彁绀猴細' + errorThrown, okValue: '纭畾', ok: function () { } }).showModal(); } }); }, cancelValue: '鍙栨秷', cancel: function () { } }).showModal(); } //鍗曞嚮鎵цAJAX璇锋眰鎿嶄綔 function clickSubmit(sendUrl) { $.ajax({ type: "POST", url: sendUrl, dataType: "json", timeout: 20000, success: function (data, textStatus) { if (data.status == 1) { var d = dialog({ content: data.msg }).show(); setTimeout(function () { d.close().remove(); location.reload(); }, 2000); } else { dialog({ title: '鎻愮ず', content: data.msg, okValue: '纭畾', ok: function () { } }).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { dialog({ title: '鎻愮ず', content: "鐘舵€侊細" + textStatus + "锛涘嚭閿欐彁绀猴細" + errorThrown, okValue: '纭畾', ok: function () { } }).showModal(); } }); } //=====================鍙戦€侀獙璇侀偖浠谍==================== function sendEmail(username, sendurl) { if (username == "") { dialog({ title: '鎻愮ず', content: '瀵逛笉璧凤紝鐢ㄦ埛鍚嶄笉鍏佽涓虹┖锛?, okValue: '纭畾', ok: function () { } }).showModal(); return false; } //鎻愪氦 $.ajax({ url: sendurl, type: "POST", timeout: 60000, data: { "username": username }, dataType: "json", success: function (data, type) { if (data.status == 1) { var d = dialog({ content: data.msg }).show(); setTimeout(function () { d.close().remove(); }, 2000); } else { dialog({ title: '鎻愮ず', content: data.msg, okValue: '纭畾', ok: function () { } }).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { dialog({ title: '鎻愮ず', content: "鐘舵€侊細" + textStatus + "锛涘嚭閿欐彁绀猴細" + errorThrown, okValue: '纭畾', ok: function () { } }).showModal(); } }); } //=====================鍙戦€佹墜鏈虹煭淇¢獙璇佺爜===================== var wait = 0; //璁$畻鍙橀噺 function sendSMS(btnObj, valObj, sendUrl) { if ($(valObj).val() == "") { dialog({ title: '鎻愮ず', content: '瀵逛笉璧凤紝璇峰~鍐欐墜鏈哄彿鐮佸悗鍐嶈幏鍙栵紒', okValue: '纭畾', ok: function () { } }).showModal(); return false; } //鍙戦€丄JAX璇锋眰 $.ajax({ url: sendUrl, type: "POST", timeout: 60000, data: { "mobile": $(valObj).val() }, dataType: "json", beforeSend: function (XMLHttpRequest) { $(btnObj).unbind("click").removeAttr("onclick"); //绉婚櫎鎸夐挳浜嬩欢 }, success: function (data, type) { if (data.status == 1) { wait = data.time * 60; //璧嬪€兼椂闂 time(); //璋冪敤璁$畻鍣 var d = dialog({ content: data.msg }).show(); setTimeout(function () { d.close().remove(); }, 2000); } else { $(btnObj).removeClass("gray").text("鍙戦€佺‘璁ょ爜"); $(btnObj).bind("click", function () { sendSMS(btnObj, valObj, sendUrl); //閲嶆柊缁戝畾浜嬩欢 }); dialog({ title: '鎻愮ず', content: data.msg, okValue: '纭畾', ok: function () { } }).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { $(btnObj).removeClass("gray").text("鍙戦€佺‘璁ょ爜"); $(btnObj).bind("click", function () { sendSMS(btnObj, valObj, sendUrl); //閲嶆柊缁戝畾浜嬩欢 }); dialog({ title: '鎻愮ず', content: "鐘舵€侊細" + textStatus + "锛涘嚭閿欐彁绀猴細" + errorThrown, okValue: '纭畾', ok: function () { } }).showModal(); } }); //鍊掕鏃惰绠楀櫒 function time() { if (wait == 0) { $(btnObj).removeClass("gray").text("鍙戦€佺‘璁ょ爜"); $(btnObj).bind("click", function () { sendSMS(btnObj, valObj, sendUrl); //閲嶆柊缁戝畾浜嬩欢 }); } else { $(btnObj).addClass("gray").text("閲嶆柊鍙戦€?" + wait + ")"); wait--; setTimeout(function () { time(btnObj); }, 1000) } } } /*琛ㄥ崟AJAX鎻愪氦灏佽(鍖呭惈楠岃瘉) ------------------------------------------------*/ function AjaxInitForm(formObj, btnObj, isDialog, urlObj, callback) { var argNum = arguments.length; //鍙傛暟涓暟 $(formObj).Validform({ tiptype: 3, callback: function (form) { //AJAX鎻愪氦琛ㄥ崟 $(form).ajaxSubmit({ beforeSubmit: formRequest, success: formResponse, error: formError, url: $(formObj).attr("url"), type: "post", dataType: "json", timeout: 60000 }); return false; } }); //琛ㄥ崟鎻愪氦鍓 function formRequest(formData, jqForm, options) { $(btnObj).prop("disabled", true); $(btnObj).val("鎻愪氦涓?.."); } //琛ㄥ崟鎻愪氦鍚 function formResponse(data, textStatus) { if (data.status == 1) { $(btnObj).val("鎻愪氦鎴愬姛"); //鏄惁鎻愮ず锛岄粯璁や笉鎻愮ず if (isDialog == 1) { var d = dialog({ content: data.msg }).show(); setTimeout(function () { d.close().remove(); if (argNum == 5) { callback(); } else if (data.url) { location.href = data.url; } else if ($(urlObj).length > 0 && $(urlObj).val() != "") { location.href = $(urlObj).val(); } else { location.reload(); } }, 2000); } else { if (argNum == 5) { callback(); } else if (data.url) { location.href = data.url; } else if ($(urlObj)) { location.href = $(urlObj).val(); } else { location.reload(); } } } else { dialog({ title: '鎻愮ず', content: data.msg, okValue: '纭畾', ok: function () { } }).showModal(); $(btnObj).prop("disabled", false); $(btnObj).val("鍐嶆鎻愪氦"); } } //琛ㄥ崟鎻愪氦鍑洪敊 function formError(XMLHttpRequest, textStatus, errorThrown) { dialog({ title: '鎻愮ず', content: '鐘舵€侊細' + textStatus + '锛涘嚭閿欐彁绀猴細' + errorThrown, okValue: '纭畾', ok: function () { } }).showModal(); $(btnObj).prop("disabled", false); $(btnObj).val("鍐嶆鎻愪氦"); } } //鏄剧ず璇勮AJAX鍒嗛〉鍒楄〃 function AjaxPageList(listDiv, pageDiv, pageSize, pageCount, sendUrl) { //pageIndex -椤甸潰绱㈠紩鍒濆鍊 //pageSize -姣忛〉鏄剧ず鏉℃暟鍒濆鍖 //pageCount -鍙栧緱鎬婚〉鏁 InitComment(0);//鍒濆鍖栬瘎璁烘暟鎹 $(pageDiv).pagination(pageCount, { callback: pageselectCallback, prev_text: "涓婁竴椤?, next_text: "涓嬩竴椤?, items_per_page: pageSize, num_display_entries: 3, current_page: 0, num_edge_entries: 5, link_to: "javascript:;" }); //鍒嗛〉鐐瑰嚮浜嬩欢 function pageselectCallback(page_id, jq) { InitComment(page_id); } //璇锋眰璇勮鏁版嵁 function InitComment(page_id) { page_id++; $.ajax({ type: "POST", dataType: "json", url: sendUrl + "&page_size=" + pageSize + "&page_index=" + page_id, beforeSend: function (XMLHttpRequest) { $(listDiv).html('

姝e湪鎷煎懡鍔犺浇锛岃绋嶅€?..

'); }, success: function (data) { var strHtml = ''; for (var i in data) { strHtml += '
  • ' + '
    '; if (typeof (data[i].avatar) != "undefined" && data[i].avatar.length > 0) { strHtml += ''; } else { strHtml += ''; } strHtml += '
    ' + '
    ' + '
    ' + '' + data[i].user_name + '\n' + '' + data[i].add_time + '' + '
    ' + '

    ' + unescape(data[i].content) + '

    ' + '
    '; if (data[i].is_reply == 1) { strHtml += '
    ' + '
    ' + '' + data[i].reply_time + '' + '绠$悊鍛樺洖澶嶏細' + '
    ' + '

    ' + unescape(data[i].reply_content) + '

    ' + '
    '; } strHtml += '
  • '; } $(listDiv).html(strHtml); }, error: function (XMLHttpRequest, textStatus, errorThrown) { $(listDiv).html('

    鏆傛棤璇勮锛屽揩鏉ユ姠娌欏彂鍚э紒

    '); } }); } }