var Ip="http://120.77.11.13:91"// 浼樿鎺ュ彛 //var Ip="http://c2.mikeblog.cn"// 浼樿鎺ュ彛 var IpUrl="http://youanmi.com"//鏌氬畨绫虫帴鍙 $(function() { var oTop = $('#goTop'); var widW = $(window).width(); //绐楅珮搴 瀹藉害 var widH = $(window).height(); //鐐瑰嚮top鍥炲埌椤堕儴 oTop.click(function() { $('body,html').animate({ "scrollTop": 0 }, 500) }) // $(".solve .common").on('mouseover',function() { // var ln = $(this).index(); // $(this).find('span').addClass("solve-on").parents('.common').siblings().find('span').removeClass('solve-on'); // $(this).parents('.solution').find('.text-list').eq(ln).show().siblings('.text-list').hide(); // }); //棣栭〉閫夋嫨鍗 $(".shouBian-list ul li").on('mouseover',function() { var ln = $(this).index(); $(this).addClass("active").siblings('li').removeClass("active"); $(this).parents('.shouMain').find('.shouBian-side img').eq(ln).show().siblings('img').hide(); }); //鐒︾偣 $('.lay3-name input').focus(function() { $(this).css({ 'border': '1px solid #66afe9', 'boxShadow': '0px 0px 8px #c7e4fa', 'color': '#333' }); $(this).parent('.lay3-name').find('#shareName').next('.erro').hide(); $(this).parent('.lay3-name').find('#checkTrade').next('.erro').hide(); $(this).parent('.lay3-name').find('#checkMobile').next('.erro').hide(); $('#jionBtn').css({ 'background': '#ff7521', 'fontSize': '20px', 'cursor': 'pointer' }).val('鎻愪氦'); }); $('.lay3-name input').blur(function() { $(this).css({ 'border': '1px solid #ddd', 'boxShadow': 'none' }); }); //寮圭獥 $.fn.center = function() { return this.each(function() { var $this = $(this), parent = $this.parent(), topPos, topMargin, leftMargin, resizeTimeout; if (parent.is("body:not(.root-height-set)")) { $("html,body").css("height", "100%").addClass("root-height-set"); } if ($this.css("position") === "absolute" || $this.css("position") === "fixed") { topPos = "50%"; topMargin = "-" + Math.round($this.outerHeight() / 2) + "px"; leftMargin = "-" + Math.round($this.outerWidth() / 2) + "px"; $this.css({ "left": "50%", "margin-left": leftMargin }); } else { topPos = Math.floor((parent.height() - $this.outerHeight()) / 2); topMargin = "auto"; $this.css({ "position": "relative", "margin-left": "auto", "margin-right": "auto" /* "top": "50%", "margin-top": topMargin*/ }); } $this.css({ "top": topPos, "margin-top": topMargin }); $(window).resize(function() { if (resizeTimeout) { clearTimeout(resizeTimeout); } resizeTimeout = setTimeout(function() { if ($this.css("position") === "absolute") { topMargin = "-" + Math.round($this.outerHeight() / 2) + "px"; leftMargin = "-" + Math.round($this.outerWidth() / 2) + "px"; $this.css({ "margin-left": leftMargin, "margin-top": topMargin }); } else { //topPos=Math.floor((parent.height()-$this.outerHeight())/2); //$this.css("top",topPos); } }, 100); }); }); } // function cjSuccess() { $('.cjSuccess').css({ 'height': widH + 'px' }).show(); $('.AllBig').center(); $('.AllBig').show(); } $('.AllBigBnt').click(function() { $('.cjSuccess').hide(); $('.AllBig').hide(); $('#shareName').val(''); $('#checkMobile').val(''); $('#checkTrade').val(''); window.location.reload(); }); $('.AllBig p').click(function() { $('.cjSuccess').hide(); $('.AllBig').hide(); $('#shareName').val(''); $('#checkMobile').val(''); $('#checkTrade').val(''); window.location.reload(); }); //姝e垯 function shareName() { var reg = /^[0-9A-Za-z\u4e00-\u9fa5]{1,14}$/; var share = $('#shareName').val(); //share.replace(/^\s+|\s+$/g, '') if (share == "蹇呭~") { $('#shareName').next('.erro').show().text('璇疯緭鍏ユ偍鐨勫鍚嶏紒'); return false; } else { if (!reg.test(share)) { $('#shareName').next('.erro').show().text('璇疯緭鍏ユ偍鐨勫鍚嶏紒'); return false; } } return true; } function checkTrade() { var trade = $('#checkTrade').val(); var red = /^[0-9A-Za-z\u4e00-\u9fa5]{1,14}$/; //trade == '' || trade == null if (!red.test(trade)) { $('#checkTrade').next('.erro').show().text('璇疯緭鍏ユ偍鐨勮涓氾紒'); return false; } return true; } function checkMobile() { var rex = /^0?(13[0-9]|15[012356789]|18[0-9]|17[0-9])[0-9]{8}$/; var mobile = $('#checkMobile').val(); if (!rex.test(mobile)) { $('#checkMobile').next('.erro').show().text('鎵嬫満鍙锋牸寮忛敊璇紒'); return false; } return true; } //鑾峰彇url 鍙傛暟 function getArguments() { var url = location.search; //鑾峰彇url涓??"绗﹀悗鐨勫瓧涓 var theRequest = new Object(); if(url==''){ theRequest=null; } else { if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]); } } else { theRequest = null } } return theRequest; } var channel = ''; if(getArguments() != null){ channel = getArguments().channel; if(channel == null || channel == '' || (channel != 3 && channel != 2)){ channel = 1; } }else{ channel = 1; } var hrefUrl = window.location.href; //鎺ュ彛 function jionBtn(btn,userName,iPhone,industry){ $(btn).click(function() { var sh = shareName(userName); var cm = checkMobile(iPhone); var ct = checkTrade(industry); if (sh && cm && ct) { var param ={ AppID:'usee_Data_Sync', AppSecret:'U2016usee!@#', UserName: $(userName).val(), Phone: $(iPhone).val(), Industry: $(industry).val(), NewMediaType:10000, SourceUrl:hrefUrl } $.ajax({ type: 'post', url:Ip+"/c2/client/potential", dataType: "json", async: true, data:JSON.stringify(param), beforeSend: function(){ $(btn).unbind('click'); $(btn).val('姝e湪鎻愪氦涓?).css({'background':'#ccc',"cursor": "default"}); }, success: function(data) { //alert(JSON.stringify(data)) if (data.Status == 1) { cjSuccess(); setTimeout(function(){ btnHide(); $('.cjSuccess').hide(); window.location.reload(); },3000) } else if (data.Status == 0) { //console.log(data.msg) $(btn).css({ 'background': '#ccc', 'fontSize': '16px', 'cursor': 'auto' }).text('姝や俊鎭凡鎻愪氦杩囦簡'); }else{ alert('鎻愪氦閿欒锛佽閲嶆柊鎻愪氦'); window.location.reload(); } }, error: function(data) { console.log(data) //return false; alert('鎻愪氦鏈夎锛佽閲嶆柊鎻愪氦'); } }); } }); } jionBtn("#jionBtn",'#shareName','#checkMobile','#checkTrade');//footer澶撮儴鎻愪氦淇℃伅 });