TaoLer/view/index/user/message.html

69 lines
1.8 KiB
HTML
Raw Normal View History

2020-01-01 13:17:19 +08:00
{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>
2020-03-29 19:57:18 +08:00
<div id="LAY_minemsg" style="margin-top: 10px;"></div>
2020-01-01 13:17:19 +08:00
</div>
{/block}
{block name="script"}
<script>
2020-03-28 21:48:35 +08:00
layui.cache.page = 'user';
2020-01-01 13:17:19 +08:00
layui.cache.user = {
2020-03-28 21:48:35 +08:00
username: '{$user.name??'游客'}'
,uid: {$user.id ? $user.id : -1}
,avatar: '{$user.name? $user['user_img']:'/static/res/images/avatar/00.jpg'}'
2020-01-01 13:17:19 +08:00
,experience: 83
2020-03-28 21:48:35 +08:00
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
2020-01-01 13:17:19 +08:00
};
layui.config({
version: "3.0.0"
,base: '/static/res/mods/'
}).extend({
fly: 'index'
}).use('fly');
2020-04-05 12:52:29 +08:00
//点开标题改变帖子已读状态
2020-03-29 19:57:18 +08:00
$('#LAY_minemsg').on('click','.art-title', function(){
2020-03-28 21:48:35 +08:00
var id = $(this).attr('id-data');
2020-03-29 19:57:18 +08:00
var othis = $(this);
2020-03-28 21:48:35 +08:00
$.ajax({
2020-04-01 12:18:43 +08:00
type:"post",
url:"{:url('message/read')}",
data:{"id":id},
daType:"json",
success:function (res){
if(res.status == 0){
2020-04-05 12:52:29 +08:00
othis.next().html('已读');
//location.reload();
2020-03-29 19:57:18 +08:00
//othis.append('<span class="float:right">已读</span>');
}
2020-04-01 12:18:43 +08:00
}
});
2020-03-28 21:48:35 +08:00
});
2020-03-31 23:01:00 +08:00
2020-04-05 12:52:29 +08:00
//点开系统消息改变已读状态
2020-03-31 23:01:00 +08:00
$('#LAY_minemsg').on('click','.sys-title', function(){
var id = $(this).attr('id-data');
2020-04-01 12:18:43 +08:00
var othis = $(this);
2020-03-31 23:01:00 +08:00
$.ajax({
2020-04-01 12:18:43 +08:00
type:"post",
url:"{:url('message/read')}",
data:{"id":id},
daType:"json",
success:function (res){
2020-03-31 23:01:00 +08:00
if(res.status == 0){
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
2020-04-01 12:18:43 +08:00
area: ['500px', '350px'], //宽高
content: '<div class="layui-form" style="padding: 10px 20px 0 20px;"> '+ res.content +'</div>'
2020-04-05 12:52:29 +08:00
}),
othis.next().html('已读');
2020-03-31 23:01:00 +08:00
}
2020-04-01 12:18:43 +08:00
}
});
2020-03-31 23:01:00 +08:00
});
2020-03-28 21:48:35 +08:00
2020-01-01 13:17:19 +08:00
</script>
{/block}