Atitit vod click event design flow  视频点播系统点击事件文档

 

Atitit vod click event design flow  视频点播系统点击事件文档

 

重构规划1

Click cate1

Click  mov4

 

重构规划

事件注册,与事件分发管理器分开

Click cate

Main.js line730

 

   // --------------------------------------------

    // UI interaction

    // --------------------------------------------

    $(document).live('click', function(e){

        console.log(e, e.target);

        key_events.enter($(e.target));

});

 

 

  console.log(e, e.target);

When cliek

E:: mouseEvent

E.target==a.item.h2.hover

<a class="item h2 hover" href="javascript:void(0)" e="filter_by_cate" value="3"><img src="movietype/1.jpg"></a>

 

 

//ati p6a add recomm enterKey eventCallback

     key_events.enter = function(curr){

        curr = curr || $(get_curr_hover());

        

        if (curr.hasClass('nav_tab')){

            curr.parent().find('a').removeClass('selected');

            curr.addClass('selected');

            

        //     $('.activeview .movie_list').html($('script[name="' +curr.attr('e')+ '"]').text());

        }

        var e = curr.attr('e');

        if (e){

            // get history

            key_events.backlast.data.push($('.activeview').html());

            key_events[e] && key_events[e](e, curr);

        }

    };

 

 

 

    var e = curr.attr('e');

e = "filter_by_cate"curr = [a.item.h2.hover, selector: "

 

 

Line397

//ati p89 add .beir  filter_by_cate yash empty

    key_events.filter_by_cate = function(e, curr){

//ati p89

//e8=filter_by_cate

//curr=a.item.h2 hover

        var value = curr.attr('value') || curr.text();

        xhr.get_filter_by(e, value, function(data){

            render.movie_list_normal(data);

load_finish_p89();

        });

//ati p89 show the new bycate saerch mvs div .and hide the last div

        setTimeout(function(){ key_events.filter_close_layer(); }, 300)

    };

 

 

Line108

 

  xhr.get_filter_by = function(f, value, fn, err){

        var sql_t;

//ati p89  search by cate

        if (f == 'filter_by_cate'){

threadLocalParamMap={};

            

threadLocalParamMap.fn=fn;

threadLocalParamMap.err=err;

threadLocalParamMap.xhr=xhr;

threadLocalParamMap.value=value;

//alert("get_posts_befor");

get_posts(threadLocalParamMap);

 

cms_api.js

function get_posts(paramJsonMap)

{

try{

var  sql_t = 'material_type';

var xhr=paramJsonMap.xhr;

var fn=paramJsonMap.fn;

var err=paramJsonMap.err;

var value=paramJsonMap.value;

threadLocalParamMap.xhr=xhr;

threadLocalParamMap.fn=fn;

 

//com.attilax.api.imoveSqlExcutor.exe

if(window.location.host=="")  //cs envi

{

   //todox pa6 param use naming params jsonfmt ..not use obj arr

   //beir param1=xxx param2=xxx param3=xxx

var mp="$method=aaaCms.CmsImpLocalFileVer.list_nocache&$callback=get_posts_callback¶m="+value;

// alert(mp);

HRE.exe(mp,get_posts_callback);

//var json=urlParams2json(param);

//sendNSCommand(json.method,param,callback);

//alert("sendNSCommand ok");

return;

}

 

 

            xhr.req({http_param: 'select  * from gv_material where '+[sql_t, '=', value].join(' ')+' order by material_description ' }, fn, err);

}catch(e)

{

showErr(e);

}

}

 

 

 

 

 

//ati pb28 search after list evenet

    render.movie_list = function(data, style, err_txt){

        data = data || {};

        var rows = data.rows, r, o = [];

        for (var i=0,j=rows.length; i<j; i++){

            r = rows[i];

//paa

var img_src='/vdx/' +r.thumb;

if(inDesktopMode())

{

img_src= "file:///"+r.thumb;

}

//paa end

var html_str='<a class="item ' +(style||'mv')+ '" href="javascript:void(0)" e="mv_detail" page_hint="'+(i+1)+'/'+j+'" mid="' +r.material_id+ '"><img class="img_item" _src="' +img_src+ '"><h3 class="b c"><span>' +r.material_description+ '</span></h3></a>';

//alert(r.material_id);

            o.push(html_str);

        }

        var w = Math.max(((style=='mv_tiny')?310:390) * o.length, 1000);

        if (o.length <= 0) o.push('<h2>' +(err_txt||'没有找到相关影片,请更换其他搜索条件。')+ '</h2>');

 

        o.unshift('<div class="page_hint">'+1+'/'+rows.length+'</div><div class="movie_page clearfix" style="width:' +w+ 'px">');

        o.push('</div>')

        $('.activeview .movie_list').append(o.join(''));

        render.set_movie_list_auto();

    };

 

Click  mov

 

e = "mv_detail"curr = [a.item.mv.hover, selector: ""

    

    //paa add recomm get_post(

//pb28 add recomm    detail item clien event  ,,get_movie_detail is invoke my detail_client() ,then callback

    key_events.mv_detail = function(e, curr){

        var mid = curr.attr('mid');

//alert(" item id:"+mid);

        if (!mid)

{

 

  xhr.get_movie_detail(mid, function(data){

 

 

 

 

    xhr.get_movie_detail = function(mid, fn, err){

threadLocalParamMap={};            

threadLocalParamMap.fn=fn;

threadLocalParamMap.err=err;

threadLocalParamMap.xhr=xhr;

//threadLocalParamMap.value=value;

get_post(mid);

     

    };

 

 

 

/AtiPlatf_se/src_atibrow/com/attilax/movcms/CmsImpLocalFileVer.java

public Objectget_post_api(Object id)

Map m=(Map) get_post(id);

 

 

  xhr.get_movie_detail(mid, function(data){

//alert(data);

//ati pb28  add try

try{

。。。。。

if(window.location.host=="")  //cs envi

{

get_post_intro(r.txt_file);

}

 

作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 

汉字名:艾提拉(艾龙)   EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

Atiend

 

 

posted @ 2016-11-06 01:07  attilaxAti  阅读(312)  评论(0编辑  收藏  举报