94 lines
3.6 KiB
HTML
94 lines
3.6 KiB
HTML
|
<div class="bg-white">
|
||
|
<div id="logList" class="log-timeline p-3"></div>
|
||
|
</div>
|
||
|
<script>
|
||
|
function project_log(){
|
||
|
if($('#projectTab').find('li').eq(5).data('load') =='true'){
|
||
|
return false;
|
||
|
}
|
||
|
$('#projectTab').find('li').eq(5).data('load','true');
|
||
|
let tool = layui.tool;
|
||
|
|
||
|
//日志
|
||
|
let callback = function(res){
|
||
|
$('.log-more').remove();
|
||
|
if(res.code==0 && res.data.length>0){
|
||
|
let itemLog = '',log_time='';
|
||
|
$.each(res.data, function (index, item) {
|
||
|
let link="",detail = "";
|
||
|
if(log_time != item.create_time){
|
||
|
if(log_time==''){
|
||
|
itemLog+='<dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||
|
}
|
||
|
else{
|
||
|
itemLog+='</dl><dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||
|
}
|
||
|
log_time = item.create_time;
|
||
|
}
|
||
|
|
||
|
if(item.topic_title != ''){
|
||
|
link='<a class="'+item.module+' open-a" data-url="'+item.url+'">'+item.topic+' '+item.topic_title+'</a>';
|
||
|
}
|
||
|
if(item.field =='new' || item.field =='delete'){
|
||
|
detail= `
|
||
|
<span class="log-content gray">${item.action}了项目${item.module_name}${link}</strong><span class="ml-4 gray" title="${item.create_time}">${item.times}</span>
|
||
|
`;
|
||
|
}
|
||
|
else if(item.field =='content'){
|
||
|
detail= `
|
||
|
<span class="log-content gray">${item.action}了<strong>${item.title}</strong><i title="对比查看" class="iconfont icon-yuejuan" style="color:#1E9FFF; cursor: pointer;"></i> <span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||
|
`;
|
||
|
}
|
||
|
else if(item.field =='file'|| item.field =='link' || item.field =='user'){
|
||
|
detail= `
|
||
|
<span class="log-content gray">${item.action}了${item.title}<strong>${item.new_content}</strong><span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||
|
`;
|
||
|
}
|
||
|
else if(item.field =='document'){
|
||
|
if(item.action =='修改'){
|
||
|
detail= `
|
||
|
<span class="log-content gray">项目${item.module_name}${link}${item.action}了${item.title}<strong>${item.remark}</strong><i title="对比查看" class="iconfont icon-yuejuan" style="color:#1E9FFF; cursor: pointer;"></i> <span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||
|
`;
|
||
|
}
|
||
|
else{
|
||
|
detail= `
|
||
|
<span class="log-content gray">项目${item.module_name}${link}${item.action}了${item.title}<strong>${item.remark}</strong><span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||
|
`;
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
detail= `
|
||
|
<span class="log-content gray">将项目${item.module_name}${link}<strong>${item.title}</strong>从 ${item.old_content} ${item.action}为<strong>${item.new_content}</strong><span class="ml-4 gray" title="${item.create_time}">${item.times}</span></span>
|
||
|
`;
|
||
|
}
|
||
|
itemLog+= `
|
||
|
<dd><img src="${item.thumb}" class="log-thumb" /><span class="log-name">${item.name}</span>${detail}</dd>
|
||
|
`;
|
||
|
});
|
||
|
|
||
|
itemLog+='</dl>';
|
||
|
if(res.data.length>19){
|
||
|
itemLog+='<div class="py-3 log-more"><button class="layui-btn layui-btn-normal layui-btn-sm" type="button">查看更多项目动态</button></div>';
|
||
|
}
|
||
|
$("#logList").append(itemLog);
|
||
|
}
|
||
|
else{
|
||
|
if(project_page ==1){
|
||
|
$("#logList").html('<div class="layui-data-none">暂无动态</div>');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let project_page=1;
|
||
|
tool.get("/project/api/project_log",{topic_id:project_id,page:project_page},callback);
|
||
|
$('#logList').on('click','.log-more',function(){
|
||
|
project_page++;
|
||
|
tool.get("/project/api/project_log",{topic_id:project_id,page:project_page},callback);
|
||
|
});
|
||
|
|
||
|
$('#logList').on('click','.open-a',function(){
|
||
|
let url = $(this).data('url');
|
||
|
parent.layui.tool.side(url);
|
||
|
});
|
||
|
}
|
||
|
</script>
|