username@email.com
2021-06-03 904fb460b9359fe92e00ce25804d96c8a52bb513
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$.fn.lrtimeline = function (nodelist) {
 
    // title   标题
    // people  审核人
    // content 内容
    // time    时间
 
    var $self = $(this);
    if ($self.length == 0) {
        return $self;
    }
    $self.addClass('z-timeline');
    var $wrap = $('<div class="z-timeline-allwrap"></div>');
    var $ul = $('<ul></ul>');
 
    // 开始节点
    var $begin = $('<li class="z-timeline-header"><div>当前</div></li>')
    $ul.append($begin);
 
    $.each(nodelist, function (_index, _item) {
        // 中间节点
        var $li = $('<li class="z-timeline-item" ><div class="z-timeline-wrap" ></div></li>');
        if (_index == 0) {
            $li.find('div').addClass('z-timeline-current');
        }
        var $itemwrap = $li.find('.z-timeline-wrap');
        var $itemcontent = $('<div class="z-timeline-content"><span class="arrow"></span></div>');
        $itemcontent.append('<div class="z-timeline-title">' + _item.title + '</div>');
        $itemcontent.append('<div class="z-timeline-body"><span>' + _item.people + '</span>' + _item.content + '</div>')
        $itemwrap.append('<span class="z-timeline-date">' + _item.time + '</span>');
        $itemwrap.append($itemcontent);
        $ul.append($li);
    });
 
    // 结束节点
    $ul.append('<li class="z-timeline-ender"><div>开始</div></li>');
    
    $wrap.html($ul);
    $self.html($wrap);
 
};