TaoLer/view/index/user/message.html
2020-04-01 12:18:43 +08:00

68 lines
1.8 KiB
HTML

{extend name="public/user" /}
{block name="content"}
<div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_msg" style="margin-top: 15px;">
<button class="layui-btn layui-btn-danger" id="LAY_delallmsg">清空全部消息</button>
<div id="LAY_minemsg" style="margin-top: 10px;"></div>
</div>
{/block}
{block name="script"}
<script>
layui.cache.page = 'user';
layui.cache.user = {
username: '{$user.name??'游客'}'
,uid: {$user.id ? $user.id : -1}
,avatar: '{$user.name? $user['user_img']:'/static/res/images/avatar/00.jpg'}'
,experience: 83
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
};
layui.config({
version: "3.0.0"
,base: '/static/res/mods/'
}).extend({
fly: 'index'
}).use('fly');
//点开标题写入帖子已读
$('#LAY_minemsg').on('click','.art-title', function(){
var id = $(this).attr('id-data');
var othis = $(this);
$.ajax({
type:"post",
url:"{:url('message/read')}",
data:{"id":id},
daType:"json",
success:function (res){
if(res.status == 0){
location.reload();
//othis.append('<span class="float:right">已读</span>');
}
}
});
});
//点开标题写入系统信已读
$('#LAY_minemsg').on('click','.sys-title', function(){
var id = $(this).attr('id-data');
var othis = $(this);
$.ajax({
type:"post",
url:"{:url('message/read')}",
data:{"id":id},
daType:"json",
success:function (res){
if(res.status == 0){
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['500px', '350px'], //宽高
content: '<div class="layui-form" style="padding: 10px 20px 0 20px;"> '+ res.content +'</div>'
});
//location.reload(); //数据刷新
}
}
});
});
</script>
{/block}