123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- $(function(){
- function getParams(url) {
- var theRequest = new Object();
- if (!url)
- url = location.href;
- if (url.indexOf("?") !== -1)
- {
- var str = url.substr(url.indexOf("?") + 1) + "&";
- var strs = str.split("&");
- for (var i = 0; i < strs.length - 1; i++)
- {
- var key = strs[i].substring(0, strs[i].indexOf("="));
- var val = strs[i].substring(strs[i].indexOf("=") + 1);
- theRequest[key] = val;
- }
- }
- return theRequest;
- }
- var objUrl = {};
- var url = window.location.href;
- var params = getParams(url);
- if(!$.isEmptyObject(params)){
- $.each(params,function(key,val){
- objUrl[key] = val;
- })
- }
- $('.m_bm').prev().css('border-bottom','0');
- var pmheight = $(window).height();
- $('.m_category_list_box').css('height',pmheight);
- $('.m_follow_box').css('height',pmheight);
- $('.m_category_xg').on('click',function(){
- $('.m_follow_box').show();
- $(this).hide();
- })
- $('.m_follow_gb').on('click',function(){
- $('.m_category_xg').show();
- $('.m_follow_box').hide();
- })
- $('.m_follow_zez').on('click',function(){
- $('.m_category_xg').show();
- $('.m_follow_box').hide();
- })
- var listId = "";
- var zxId = 0;
- var isf = true;
- AjaxFn();
- fun();
- $('.find_nav_list ul li').on('click',function(){
- var gbdata = $(this).attr('gbid');
- if(gbdata == 1){
- $('.m_category_list_box').show();
- $(this).attr('gbid',2).siblings().attr('gbid',1);
- }else{
- $(this).attr('gbid',1);
- $('.m_category_list_box').hide();
- }
- listId = $(this).attr('listid');
-
-
- ajax_list();
- })
- $('.m_OuterLayer').on('click',function(){
- $('.m_category_list_box').hide();
- $('.find_nav_list ul li').attr('gbid',1);
- })
- ajax_list();
- function ajax_list (){
- var html = '';
- $.ajax({
- url: "/knowledgebase/getnav",
- data:{id:listId},
- type: "GET",
- dataType: "json",
- success: function(data) {
-
- if(data.code == 200){
- $.each(data.data, function (i, data) {
- html+='<li zxid="'+data.id+'">'+data.name+'</li>';
- });
- var i =null;
- if(typeof zxId == 'string' && zxId != null){
- $.each(data.data,function (k, v){
- if(zxId == v.id){
- i = v.pid;
- }
- })
-
-
- $('.find_nav_list ul li[listid="'+i+'"]').find('a').parent().attr('class','find_nav_cur').siblings().attr('class','');
-
- $('.find_nav_list ul li[listid="'+i+'"]').find('a').addClass('on');
- $('.find_nav_list ul li[listid="'+i+'"]').siblings().find('a').removeClass('on');
- }
- $(".m_category_list").html(html);
- $('.m_category_list li').on('click',function(){
-
- $('.m_category_list_box').hide();
- $('.find_nav_list ul li').attr('gbid',1);
- zxId = $(this).attr('zxid');
- $('.m_category_zx_box').html("");
-
- if(!$.isEmptyObject(objUrl)){
- window.localStorage.setItem("id", zxId);
- window.location.href = '/knowledgebase/list';
- }
- AjaxFn();
-
- fun();
-
-
- })
- }
- }
- });
- }
-
- function AjaxFn(){
- var txt='';
-
- if(!$.isEmptyObject(objUrl)){
- txt = '?name='+objUrl.name
- }else{
- if(isf){
- if(window.localStorage.getItem("id") != null){
- zxId = window.localStorage.getItem("id");
- window.localStorage.clear();
- }
- isf = false;
- }
-
- txt = '?&id='+zxId;
- }
- page = 0;
- size = 10;
- page++;
- $.ajax({
- type: 'GET',
- url: '/knowledgebase/getlist'+txt+'&page='+page+'&limit='+size,
-
- dataType: 'json',
- success: function(data){
- if(data.code == 200){
- $('.m_category_zx_box').append(ModuleWay(data.data))
-
- PublicAction.AjaxSend(
- {
- CORID:'apply_submit',
- }
- );
- }
-
-
-
- },
- error: function(xhr, type){
-
-
-
- }
- });
-
-
-
-
-
-
-
-
-
- }
- function ModuleWay(data){
-
- var html ="";
- $.each(data, function (i, data) {
- if(data.thumb != null && data.thumb != "" && data.thumb.length == 1){
- html+='<div class="m_category_zx m_category_zx_bx">';
- html+='<a href="/knowledgebase/details/'+data.id+'/" class="c">';
-
- html+='<img src=http://img.yigouf.com/pc/newsknowledge/'+data.thumb[0]+' alt="">';
-
- html+='<div class="m_category_text">';
- html+='<em>'+data.subject+'</em>';
- html+='<p class="c">';
- html+='<i>时间:'+data.create_at+'</i>';
- html+='<i>浏览:'+data.clicks+'</i>';
- html+='</p>';
- html+='</div>';
- html+='</a>';
- html+='</div>';
- }else if(data.thumb != null && data.thumb != "" && data.thumb.length > 1){
- html+='<div class="m_category_st m_category_zx_bx">';
- html+='<a href="/knowledgebase/details/'+data.id+'/">';
- html+='<em>'+data.subject+'</em>';
- html+='<p class="c">';
- html+='<i>来源:'+data.source+'</i>';
- html+='<i>时间:'+data.create_at+'</i>';
- html+='<i>浏览:'+data.clicks+'</i>';
- html+='</p>';
- html+='<ul class="c">';
- for(k in data.thumb){
-
- html+='<li><img src=http://images.pinfangge.top/pc/newsknowledge/'+data.thumb[k]+' alt=""></li>';
- }
- html+='</ul>';
- html+='</a>';
- html+='</div>';
- }
- var _length = $('.m_bm').length;
-
- if(i == 1 && _length <= 0){
-
-
-
-
-
-
-
-
-
-
- html+='<div class="m_bm1 c">';
- html+='<img src="/image/knowledgebase/m_bm1.png" alt="" />';
- html+='<form class="submit_area submit_area1">';
- html+='<input type="hidden" name="aid" value="0"> ';
- html+='<input type="hidden" name="source" value="18">';
- html+='<input type="hidden" name="equipment" value="1">';
- html+='<input type="text" placeholder="请输入您的手机号" name="mobile">';
- html+='<input type="button" value="抢看攻略" class="apply_submit">';
- html+='</form>';
- html+='</div>';
-
- }
- })
- return html ;
- }
-
-
-
-
-
- function fun(){
-
- $('#y_mainid').dropload({
-
- scrollArea : window,
-
- loadDownFn : function(me){
- page++;
-
- $.ajax({
- type: 'GET',
- url: '/knowledgebase/getlist?&page='+page+'&limit='+size + '&id='+zxId,
- dataType: 'json',
- success: function(data){
-
- if(data.code == 200){
- $('.m_category_zx_box').append(ModuleWay(data.data))
-
- PublicAction.AjaxSend(
- {
- CORID:'apply_submit',
- }
- );
- }else{
-
- me.lock();
-
- me.noData();
-
- }
-
-
- setTimeout(function(){
-
-
-
- me.resetload();
- },500);
- $('.dropload-down').eq(0).show().siblings('.dropload-down').remove();
-
-
- },
- error: function(xhr, type){
-
-
-
- }
- });
- }
- });
- }
- })
-
|