-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.html
executable file
·147 lines (144 loc) · 5.34 KB
/
message.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>留言板-闲言</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="res/layui/css/layui.css">
<link rel="stylesheet" href="res/static/css/mian.css">
</head>
<body class="lay-blog">
<div class="header">
<div class="header-wrap">
<h1 class="logo pull-left">
<a href="index.html">
<img src="res/static/images/logo.png" alt="" class="logo-img">
<img src="res/static/images/logo-text.png" alt="" class="logo-text">
</a>
</h1>
<form class="layui-form blog-seach pull-left" action="">
<div class="layui-form-item blog-sewrap">
<div class="layui-input-block blog-sebox">
</div>
</div>
</form>
<div class="blog-nav pull-right">
<ul class="layui-nav pull-left">
<li class="layui-nav-item"><a href="index.html">首页</a></li>
<li class="layui-nav-item layui-this"><a href="message.html">留言</a></li>
<li class="layui-nav-item"><a href="about.html">关于</a></li>
</ul>
<a href="#" class="personal pull-left layui-nav-item exit" style="font-size: 16px;">
<i class="layui-icon layui-icon-username"></i>
退出
</a>
</div>
<div class="mobile-nav pull-right" id="mobile-nav">
<a href="javascript:;">
<i class="layui-icon layui-icon-more"></i>
</a>
</div>
</div>
<ul class="pop-nav" id="pop-nav">
<li><a href="index.html">首页</a></li>
<li><a href="message.html">留言</a></li>
<li><a href="about.html">关于</a></li>
</ul>
</div>
<div class="bg">
<div class="bg-wrap">
<div class="self-intro">
<span class="head-pic"></span>
<span class="nick"></span>
</div>
</div>
</div>
<div class="container-wrap">
<div class="container container-message">
<div class="contar-wrap" id="contar-wrap">
<form class="layui-form" action="">
<div class="layui-form-item layui-form-text">
<textarea class="layui-textarea" id="LAY-msg-content" style="resize:none"></textarea>
</div>
</form>
<div class="item-btn">
<button class="layui-btn layui-btn-normal" id="item-btn">提交</button>
</div>
<!--留言显示板块-->
<div id="LAY-msg-box"></div>
<div id="test1" class="paging"></div>
</div>
</div>
</div>
<div class="footer">
<p>
<span>© 2019</span>
<span><a href="http://www.layui.com" target="_blank">浙江大学软件学院</a></span>
<span>S403</span>
</p>
<p><span>人生就是一场修行,祝君猪事顺利</span></p>
</div>
</div>
<script src="res/jquery/Myfunc.js"></script>
<script src="res/jquery/jquery-1.12.4.js"></script>
<script src="res/layui/layui.js"></script>
<script src="res/jquery/Myfunc.js"></script>
<script>
layui.config({
base: 'res/static/js/'
}).use('blog');
</script>
<script>
$(function () {
// 初始化用户信息
let user = JSON.parse(localStorage.getItem('UserAccount'));
$.ajax({
url:'http://47.100.226.85:8080/find-friends/look/messages',
type:'post',
xhrFields:{
withCredentials:true
},
contentType: "application/json",
data:JSON.stringify({'ownerAccount':user}),
success:function (data) {
console.log(data);
// 页面初始化
$('.head-pic').css({
background:`url("${data.ownerInfo.headpic}") center center`,
backgroundSize: "100%"
});
$('.nick').text(data.ownerInfo.name);
updateContent(data.messages);
// 分页设置
layui.laypage.render({
elem: 'test1', //test1是ID,不用加#号
count: data.totalMessages,
theme: '#07A8C5',
jump: function (obj,first) {
let curPage = obj.curr;
if(!first) {
$.ajax({
url:'http://47.100.226.85:8080/find-friends/message/refresh',
xhrFields:{
withCredentials:true
},
data:JSON.stringify({
ownerAccount: user,
pageNumber:curPage,
isPublish:'false'
}), // 参数是页码
type:'post',
contentType:'application/json',
success:function (data) {
console.log(data);
updateContent(data.messages);
},
});
}
}
});
}
});
})
</script>
</body>