78 lines
3.3 KiB
HTML
78 lines
3.3 KiB
HTML
<div class="table-content">
|
|
<div id="logList" class="log-timeline layui-card p-3"></div>
|
|
</div>
|
|
|
|
<script>
|
|
function pageInit(){
|
|
var project_id = {$id};
|
|
var project_page = 1;
|
|
var 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-href="'+item.url+'">'+item.topic+' '+item.topic_title+'</a>';
|
|
}
|
|
if(item.field =='new' || item.field =='delete'){
|
|
detail= `
|
|
<span class="log-content font-gray">${item.action}了项目${item.module_name}${link}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span>
|
|
`;
|
|
}
|
|
else if(item.field =='content'){
|
|
detail= `
|
|
<span class="log-content font-gray">${item.action}了<strong>${item.title}</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 if(item.field =='file'|| item.field =='link' || item.field =='user'){
|
|
detail= `
|
|
<span class="log-content font-gray">${item.action}了${item.title}<strong>${item.new_content}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
|
`;
|
|
}
|
|
else if(item.field =='document'){
|
|
if(item.action =='修改'){
|
|
detail= `
|
|
<span class="log-content font-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 font-gray">项目${item.module_name}${link}${item.action}了${item.title}<strong>${item.remark}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
|
`;
|
|
}
|
|
}
|
|
else{
|
|
detail= `
|
|
<span class="log-content font-gray">将项目${item.module_name}${link}<strong>${item.title}</strong>从 ${item.old_content} ${item.action}为<strong>${item.new_content}</strong><span class="ml-4 font-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);
|
|
}
|
|
}
|
|
tool.get("/api/log/log_list",{topic_id:project_id,page:project_page},callback);
|
|
$('#logList').on('click','.log-more',function(){
|
|
project_page++;
|
|
tool.get("/api/log/log_list",{topic_id:project_id,page:project_page},callback);
|
|
});
|
|
}
|
|
</script> |