//qq微信登录 function openLogin(type){ if( $("input[name='yonghuxieyi']").is(':checked') == false ){ alert('未勾选用户协议哦!'); return false; } var iWidth = 800; var iHeight = 600; var iTop = (window.screen.availHeight - 30 - iHeight) / 2; var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; window.open("/e/memberconnect/?apptype=" + type,"","width="+iWidth+", height="+iHeight+", top="+iTop+", left="+iLeft); } //登录注册 function login(){ // $('#mengcheng').show(); // $('#login').show(); window.open("/e/member/register/index.php?tobind=0&groupid=1"); } //弹窗 function tan(status){ if(status==3){ $('#mengcheng').show(); if(ispay==1){ var money = $("input[name='pay-money']").val(); var taocan = $("input[name='taocan']").val(); createWxQR(money, taocan); $('#vip-alert').show(); $('#yhhb').hide(); }else{ $('.addvip').show(); } return false; } if(status==4){ $('#mengcheng').show(); $('.upvip').show(); $('.upvip').find('.more-vip').attr('href','/index/pay/payupdate'); return false; } if(status==5){ $('.code').show(); $('#mengcheng').show(); return false; } if(status==7){ $('.code').show(); $('.get-again').html('验证码有误,请重新输入').css('color','red'); $('#mengcheng').show(); return false; } if(status==6){ alert('系统繁忙,请过5分钟后再试!'); return false; } if(status==10){ alert('系统检测到下载异常,请联系客服QQ:1494456634解决!'); return false; } if(status==100){ $('#mengcheng').show(); $('.upvip').show(); $('.upvip').find('.more-vip').attr('href','/index/pay/payupdate'); return false; $('.upredpacket').show(); $('#mengcheng').show(); return false; } } function pvload() { var enddie=new Date(); var endTime=enddie.getTime(); var loadtime =(endTime-startTime)/1000; if(exetime>0 || code>0){ var url = '/api/Stats/time'; $.ajax({ type: "GET", url: url, data:{'code':code,'exetime':exetime,'loadtime':loadtime,'uid':uid,'click':click_num}, jsonp: "callback", dataType: "jsonp", success: function(data){} }); } } $(function(){ $(".lazy").lazyload({ effect: "fadeIn", threshold :350 }); $(".lazy-nodelay").lazyload(); $('.be-vip').click(function(){ $('.addvip').hide(); $('#mengcheng').hide(); }); //验证码相关 $('.code .get-again').click(function(){ var timestamp = new Date().getTime(); $("#yanzhengma").attr('src',$('#yanzhengma').attr('src') + '?' +timestamp ); }); $('.y-close').click(function(){ $('.yhj').hide(); $(this).parent().hide(); var url = '/api/activity/close'; $.getJSON(url,function(data){}); }); $('#yanzhengma').click(function(){ var timestamp = new Date().getTime(); $(this).attr('src',$(this).attr('src') + '?' +timestamp ); }); //弹窗注册相关 $('.close').click(function(){ $(this).parent().hide(); $('#mengcheng').hide(); }); $('.regist-lg').click(function(){ var name = $(this).attr('name'); $('.loginname').html(name); window.open("/e/member/login/"); // login(); }); $('.regist').click(function(){ var name = $(this).attr('name'); $('.loginname').html(name); // window.open("/e/member/login/"); login(); }); //意见反馈 $('.advice').click(function(){ if(!isLogin){ login(); return false; } $('#mengcheng').show(); $('.user-advice').show(); }); //搜索相关 function search(){ var input = 'search' == $(this).attr('name') ? $(this) : $(this).prev().find(':input[name="search"]'); var q = $.trim(input.val()),t = $('.search-btn').attr('key-type'); if(q == ''){ window.location.href='http://www.tukuppt.com/ppt/' return false; } $.getJSON("/api/keyword/check", {q:q,t:t}, function(r) { if(r.code == 1){ alert(r.msg); return false; } window.location.href=r.redirect_url; }); } $('.search-btn').on('click', search); $('#dropdown-box').on('mousedown', '.tips-item', function(){ var k = $('#keyword'); k.val($(this).find('.tips-keyword').text()); search.call(k); }); $('#dropdown-box-float').on('mousedown', '.tips-item', function(){ var k = $('#keyword-float'); k.val($(this).find('.tips-keyword').text()); search.call(k); }); function renderTips(d){ c = d.list.length; if (c == 0) { this.html('').hide(); return false; } var h = ''; this.html(h).show(); } $.fn.sotips = function(opts){ var opts = $.extend({}, { box: $('#dropdown-box'), isStore: true, salt: 'v1.3' }, opts),checkTips = function(){ var q = $.trim(this.val()),t; t = this.attr('key-type'); f = q+'#'+t+opts.salt; var d = store.get(f),n = new Date().getTime() / 1000; if (!opts.isStore || "undefined" == typeof(d) || d.expire < n) { $.getJSON("/api/search_tips", {q:q,t:t}, function(r) { if(r.code == 1){ opts.box.html('').hide(); } else { renderTips.call(opts.box, r.data); } store.set(f, r.data); }); } else if (d.list != '') { renderTips.call(opts.box, d); } } this.on('focus', function(){ checkTips.call($(this)); }); this.on('blur', function(){ opts.box.hide(); }); this.on('keydown', function(e){ if (13 == e.which) { search.call(this); return false; } }); this.on('keyup', function(e){ var k = e.which; if (38 == k || 40 == k){ var c = opts.box.find('.tips-count'),l,i,o; l = parseInt(c.attr('data-length')); i = parseInt(c.attr('data-index')); if (38 == k) { i = i == 0 ? l - 1 : i - 1; } else { i = i >= l ? 0 : i + 1; } c.attr('data-index', i); o = opts.box.find('.tips-item').eq(i); o.addClass('hover').siblings().removeClass('hover'); $(this).val(o.find('.tips-keyword').text()); } else { checkTips.call($(this)); } }); }; $('#keyword').sotips(); $('#keyword-float').sotips({box: $('#dropdown-box-float')}); //收藏通用 $('.d-coll,.b-collect').click(function(){ var pid = $(this).attr('pid'); var issc = $(this).attr('issc'); var that = $(this); var isfrom = $(this).attr('isfrom'); if(!isLogin) { login(); return false; } if(issc == 0){ var url = '/api/picsc'; }else{ var url = '/api/delsc'; } //详情页 if(isfrom==1){ if(issc==1){ that.find('span').html('收藏'); that.attr('issc',0); that.find('i').removeClass('chose'); }else{ that.find('span').html('已收藏'); that.attr('issc',1); that.find('i').addClass('chose'); } }else if(isfrom==2){ if(issc==1){ that.attr('issc',0); that.removeClass('chose'); }else{ that.attr('issc',1); that.addClass('chose'); } }else{ if(issc==1){ that.html('收藏'); that.attr('issc',0); that.removeClass('chose'); }else{ that.html('已收藏'); that.attr('issc',1); that.addClass('chose'); } } var isuser = $(this).attr('user'); if(isuser==1){ that.parent().remove(); } $.ajax({ type: 'get', url: url, data: {'pid':pid}, success: function(res){ } }); }); //意见反馈 $('.user-advice .submit').click(function(){ var content = $('.user-advice .u-advice').val(); var contact = $('.user-advice .connect').val(); if(content == ''){ alert('请输入您宝贵的意见!'); return false; } if(contact == ''){ alert('请输入您的联系方式!'); return false; } var url = '/api/advice'; $.ajax({ type: "GET", url: url, data:{'content':content,'contact':contact,'uid':uid}, jsonp: "callback", dataType: "jsonp", success: function(data){} }) $('.user-advice').hide(); $('#mengcheng').hide(); }); //验证码下载功能 //下载功能 $(document).on('click', '.d-down,#tjyzm', function() { if (isLogin == false) { login(); return false; } var pid = $(this).attr('pid'); if (pid == '') return false; //验证码 $('#tjyzm').attr('pid',pid); $('.code').hide(); $('#mengcheng').hide(); var code = $('.c-code').val(); $('.c-code').val(''); var url = "/index/down"; $.ajax({ type: "GET", url: url, data:{pid:pid,code:code}, jsonp: "callback", dataType: "jsonp", success: function(data){ if(data.status==1){ window.location.href = data.downurl; }else{ var timestamp = new Date().getTime(); $("#yanzhengma").attr('src',$('#yanzhengma').attr('src') + '?' +timestamp ); tan(data.whyinfo); } } }) }); $(document).on('click', '.box-down', function() { if (isLogin == false) { login(); return false; } var pid = $(this).attr('pid'); window.location.href = '/muban/'+pid+'.html'; }); $('.head-list').on('mouseover', function(){ $('.down-list').show(); }); $('.head-list').on('mouseout', function(){ $('.down-list').hide(); }); $('.more-type').on('mouseover',function(){ $('.h-types').show(); }); $('.more-type').on('mouseout',function(){ $('.h-types').hide(); }); $('.h-types').on('mouseover',function(){ $('.h-types').show(); }); $('.h-types').on('mouseout',function(){ $('.h-types').hide(); }); $(".return-top").click(function() { $("html,body").animate({scrollTop:0}, 500); }); }); $(window).load(function(){ pvload(); var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?a620c01aafc084582f0ec24d96b73ad8"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); if(istuisong==1){ (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); } });