util.fixbar

提问 未结 2 218
staroom
staroom VIP4 2019-11-20
悬赏:20飞吻
版本:layui 浏览器:chrome
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="__LIB__/layui255/css/layui.css" media="all">
<title>办公OA</title>
</head>
<style media="screen">
p{
margin: 0.5rem 0;
}
#content{
font-size: 1rem;
line-height: 2rem;
}
</style>
<body>
<div class="layui-container">
<fieldset class="layui-elem-field layui-field-title " >
<legend><b>{$news.title}</b></legend>
</fieldset>
<div class='layui-row layui-text'>
<div class='layui-col-xs6' style='text-align:left;'>{$news.name}    {:date('Y-m-d H:i:s',$news.sendtime)}</div>
<div class='layui-col-xs6' style='text-align:right;'>已阅/总数:  {$readcount}/{$allcount}</div>
</div>
<hr>
<div id='content'>{:htmlspecialchars_decode($news.content)}</div>
<hr>
<div id='fujian'>
<h4>附件:</h4>
<ul class="layui-list">
{volist name='osslist' id='oss'}
<li class='layui-list-item' id='li_{$oss.id}' style='margin:5px 0'>
{$i}:   <a href="{$oss.url}" target="_blank">{$oss.title}</a>  
</li>
{/volist}
</ul>
</div>
<hr>
{if($news.readshow=='1')}
<h4 id='show'>显示已读成员  ({$readcount})   <button class='layui-btn layui-btn-xs layui-btn-primary ' style='float:right;' name='updown'><i class="layui-icon layui-icon-down"></i></button></h4>
<p class='layui-hide' name='showtext'>
{volist name='readlist' id='user'}
{$user.name} 
{/volist}
</p>
<hr>
{/if}
{if($news.readshow=='2')}
<h4 id='showno'>显示未读成员  ({$noreadcount})   <button class='layui-btn layui-btn-xs layui-btn-primary ' style='float:right;' name='updown'><i class="layui-icon layui-icon-down"></i></button> </h4>
<p class='layui-hide' name='showtext'>
{volist name='noreadlist' id='user'}
{user.name},
{/volist}
</p>
<hr>
{/if}
{if($news.allowsay=='1')}
<h4><button type='button' {if($common==1)} class="layui-btn layui-btn-xs layui-btn-normal" {else/} class="layui-btn layui-btn-xs layui-btn-primary "{/if} id='common'><i class="layui-icon layui-icon-edit" ></i></button> ({$commontcount})
<button type='button' {if($praise==1)} class="layui-btn layui-btn-xs layui-btn-normal" {else/} class="layui-btn layui-btn-xs layui-btn-primary "{/if} id='praise'><i class="layui-icon layui-icon-praise" ></i></button> (<span id='acount'>{$agreecount}</span>)</h4>
<hr>
{volist name='commentlist' id='comm'}
<div class='layui-row' style='margin:1rem 0;'>
<div class='layui-col-xs1'><img src="{$comm.userid}" class='layui-circle' style='width:80%;text-align:center;' ></div>
<div class='layui-col-xs11'>
<h4>{$comm.name}</h4>
<h5>{$comm.create_time}    
{if($comm->getDat1;
$.post("delcomm",{
"id":id
},function(res){
window.location.href="{:url('/user/notice/shownews')}?id={$log.id}";
})
})
//展开
$("button[name='updown']").click(function(){
if($(this).children('i').hasClass('layui-icon-down')){
$(this).children('i').removeClass('layui-icon-down').addClass('layui-icon-up');
$("p[name=showtext]").removeClass('layui-hide')
}else{
$(this).children('i').removeClass('layui-icon-up').addClass('layui-icon-down');
$("p[name=showtext]").addClass('layui-hide');
}
})
//评论
$("#common").click(function(){

if($(this).hasClass('layui-btn-primary')){
layer.prompt({
formType: 2,
value: '',
title: '请输入评论内容',
area: ['400px', '200px']
}, function(value, index, elem){
$.post("docomment",{
"id":"{$news.id}",
"comment":value
},function(res){
layer.close(index);
window.location.href="{:url('/user/notice/shownews')}?id={$log.id}";
})

});
}else{
layer.msg('您已发表过评论了!',{icon:5});
}
})
//点赞
$("#praise").click(function(){

if($(this).hasClass('layui-btn-primary')){
$.post("doagree",{
"id":"{$news.id}"
},function(res){
let n=parseInt($("#acount").text());
$("#acount").text(n+1);
$("#praise").removeClass('layui-btn-primary').addClass('layui-btn-normal');
})
}else{
$.post("unagree",{
"id":"{$news.id}"
},function(res){
let n=parseInt($("#acount").text());
$("#acount").text(n-1);
$("#praise").addClass('layui-btn-primary').removeClass('layui-btn-normal');
})
}
form.render();
})
//执行
util.fixbar({
bar1:""
,bgcolor:"#1E9FFF"
,css:{top:30,left:30}
,click: function(type){
if(type==='bar1'){
window.location.href="{:url('/user/notice/index')}?typeid={$news.typeid}";
}
}


});




})
</script>
</body>
</html>
貌似util fixbar 的参数 css 存在BUG ,我设置为 css:{top:30,left:30}时, 只有fixbar 上的button 生效, 页面上其余的button 全失效了!
附原代码:
回帖
  • 贤心
    贤心 (管理员)
    2019-11-20
    因为 fixbar 组件默认设置的是 right bottom,所以如果您要设置 top left 时,必须将 right 和 bottom 设置为 auto,如:
    css:{
    top:30
    ,left:30
    ,bottom: 'auto'
    ,right: 'auto'
    }
    0 回复
  • staroom
    2019-11-20
    感谢大神指点迷津!
    0 回复