添加简单emoji支持
This commit is contained in:
parent
e2edd67101
commit
338c48f3d4
@ -232,4 +232,27 @@ a {
|
||||
|
||||
.msg-agent-img img{
|
||||
width: 10rem;
|
||||
}
|
||||
}
|
||||
|
||||
.emoji-list{
|
||||
display: none;
|
||||
position: fixed;
|
||||
border-top: solid 1px #e9e9e9;
|
||||
background: #fff;
|
||||
bottom: 50px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.emoji-list ul{
|
||||
overflow: auto;
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
|
||||
.emoji-list li{
|
||||
list-style-type:none;
|
||||
float: left;
|
||||
width: 30px;
|
||||
cursor: pointer;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
|
199
public/css/server.css
Normal file
199
public/css/server.css
Normal file
@ -0,0 +1,199 @@
|
||||
.friend {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
background: #fbfcfe;
|
||||
border-right: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.chat {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: calc(100% - 301px);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.friend-head {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
height: 51px;
|
||||
padding: 0 12px;
|
||||
font-size: 15px;
|
||||
line-height: 50px;
|
||||
color: #767d85;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #e9e9e9;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.friend-head-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.message-agent,.message-client{
|
||||
overflow: auto;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.message-container{
|
||||
padding: 0 20px 0 20px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.message-time-sender{
|
||||
line-height: 1;
|
||||
margin-bottom: 5px;
|
||||
font-size: 12px;
|
||||
color: #adb2bb;
|
||||
}
|
||||
|
||||
.message-agent-time-sender{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.message-content{
|
||||
border-radius: 3px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
border: 1px dashed transparent;
|
||||
}
|
||||
|
||||
.message-agent-content{
|
||||
position: relative;
|
||||
float: right;
|
||||
background-color: #f0f1f3;
|
||||
color: #161e26;
|
||||
}
|
||||
.message-client-content{
|
||||
position: relative;
|
||||
float: left ;
|
||||
background-color: #e7f4ff;
|
||||
color: #161e26;
|
||||
}
|
||||
|
||||
.message-sender{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
height: 180px;
|
||||
border-top: 1px solid #e9e9e9;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.sender-editor{
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
|
||||
.message-sender textarea{
|
||||
resize: none;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
color: #161e26;
|
||||
line-height: 22px;
|
||||
background-color: #fff;
|
||||
height: calc(100% - 40px);
|
||||
padding: 20px;
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
|
||||
.btnMsgSend{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
bottom: 15px;
|
||||
}
|
||||
|
||||
.user-info{
|
||||
height: 60px;
|
||||
background: #ffffff;
|
||||
line-height: 60px;
|
||||
font-size: 16px;
|
||||
color: #767d85;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.chat-user{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.user-info img{
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.user-info .user-avatar{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-info .user-name{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.empty-status{
|
||||
width: 150px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
margin-top: 200px;
|
||||
}
|
||||
|
||||
.empty-status img{
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.msg-tips{
|
||||
margin-top: 25px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.msg-client-img{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.msg-client-img img{
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
.msg-agent-img{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.msg-agent-img img{
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
.layui-icon{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.message-emoji-picture{
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.emoji-list{
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 300px;
|
||||
bottom:230px;
|
||||
border: solid 1px #e9e9e9;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 15px 30px 0 rgba(52,63,75,.2);
|
||||
}
|
||||
|
||||
.emoji-list ul{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.emoji-list li{
|
||||
float: left;
|
||||
width: 30px;
|
||||
cursor: pointer;
|
||||
height: 30px;
|
||||
}
|
||||
|
@ -178,6 +178,16 @@ $(function(){
|
||||
|
||||
});
|
||||
|
||||
$(".emoji-list li").click(function () {
|
||||
var content = $("#textarea").val();
|
||||
$("#textarea").val(content + " " +$(this).html()+ " " );
|
||||
$(".emoji-list").toggle();
|
||||
});
|
||||
|
||||
$(".emoji-send").click(function () {
|
||||
$(".emoji-list").toggle();
|
||||
});
|
||||
|
||||
//连接服务器
|
||||
socket.on('connect', function () {
|
||||
//uuid = 'chat'+ guid();
|
||||
@ -203,4 +213,6 @@ $(function(){
|
||||
insert_agent_html(msg);
|
||||
scrollToBottom();
|
||||
});
|
||||
|
||||
|
||||
});
|
@ -35,7 +35,7 @@ layui.use(['layer', 'form', 'jquery'], function () {
|
||||
// 下面写你的发送消息的代码
|
||||
msg_send();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//聊天窗口自动滚到底
|
||||
@ -153,6 +153,7 @@ layui.use(['layer', 'form', 'jquery'], function () {
|
||||
//发送消息
|
||||
function msg_send() {
|
||||
var msg = $("#msg-send-textarea").val();
|
||||
|
||||
if(msg){
|
||||
var msg_sender = {
|
||||
"type":'private',
|
||||
@ -285,6 +286,16 @@ layui.use(['layer', 'form', 'jquery'], function () {
|
||||
|
||||
});
|
||||
|
||||
$(".emoji-list li").click(function () {
|
||||
var content = $("#msg-send-textarea").val();
|
||||
$("#msg-send-textarea").val(content + " " +$(this).html()+ " " );
|
||||
$(".emoji-list").toggle();
|
||||
});
|
||||
|
||||
$("#emojiBtn").click(function () {
|
||||
$(".emoji-list").toggle();
|
||||
});
|
||||
|
||||
//连接服务器
|
||||
socket.on('connect', function () {
|
||||
console.log('连接成功...');
|
||||
|
@ -27,23 +27,39 @@
|
||||
<div class="content-block msg-container" id="msg-container">
|
||||
|
||||
</div>
|
||||
|
||||
<footer id="chatFooter" class="footer">
|
||||
<div class="input-holder">
|
||||
<div class="emoji-image docs-icons" id="btn-uploader">
|
||||
<span class="icon icon-emoji emoji-send"></span>
|
||||
<span id="pickfiles" class="icon icon-picture picture-upload"></span>
|
||||
</div>
|
||||
|
||||
<div class="text-holder">
|
||||
<textarea id="textarea" placeholder="请输入"></textarea>
|
||||
<a id="btnSend">发送</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<div class="emoji-list">
|
||||
<ul>
|
||||
<li title="笑脸">😁</li>
|
||||
<li title="哭脸">😂</li>
|
||||
<li title="表情1">😃</li>
|
||||
<li title="表情2">😄</li>
|
||||
<li title="表情3">😅</li>
|
||||
<li title="表情4">😆</li>
|
||||
<li title="表情5">😇</li>
|
||||
<li title="表情6">😈</li>
|
||||
<li title="表情7">😉</li>
|
||||
<li title="表情8">😊</li>
|
||||
<li title="表情9">😋</li>
|
||||
<li title="表情10">😌</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//twemoji.maxcdn.com/2/twemoji.min.js?2.3.1"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/plupload/2.1.9/moxie.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/plupload/2.1.9/plupload.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/qiniu-js-sdk/1.0.14-beta/qiniu.min.js"></script>
|
||||
@ -55,7 +71,6 @@
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type='text/javascript' src='js/common.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' src='js/client/client.js' charset='utf-8'></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,180 +1,5 @@
|
||||
<% include header.ejs %>
|
||||
<style>
|
||||
.friend {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
background: #fbfcfe;
|
||||
border-right: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.chat {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: calc(100% - 301px);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.friend-head {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
height: 51px;
|
||||
padding: 0 12px;
|
||||
font-size: 15px;
|
||||
line-height: 50px;
|
||||
color: #767d85;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #e9e9e9;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.friend-head-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.message-agent,.message-client{
|
||||
overflow: auto;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.message-container{
|
||||
padding: 0 20px 0 20px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.message-time-sender{
|
||||
line-height: 1;
|
||||
margin-bottom: 5px;
|
||||
font-size: 12px;
|
||||
color: #adb2bb;
|
||||
}
|
||||
|
||||
.message-agent-time-sender{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.message-content{
|
||||
border-radius: 3px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
border: 1px dashed transparent;
|
||||
}
|
||||
|
||||
.message-agent-content{
|
||||
position: relative;
|
||||
float: right;
|
||||
background-color: #f0f1f3;
|
||||
color: #161e26;
|
||||
}
|
||||
.message-client-content{
|
||||
position: relative;
|
||||
float: left ;
|
||||
background-color: #e7f4ff;
|
||||
color: #161e26;
|
||||
}
|
||||
|
||||
.message-sender{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
height: 180px;
|
||||
border-top: 1px solid #e9e9e9;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.sender-editor{
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
|
||||
.message-sender textarea{
|
||||
resize: none;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
color: #161e26;
|
||||
line-height: 22px;
|
||||
background-color: #fff;
|
||||
height: calc(100% - 40px);
|
||||
padding: 20px;
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
|
||||
.btnMsgSend{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
bottom: 15px;
|
||||
}
|
||||
|
||||
.user-info{
|
||||
height: 60px;
|
||||
background: #ffffff;
|
||||
line-height: 60px;
|
||||
font-size: 16px;
|
||||
color: #767d85;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.chat-user{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.user-info img{
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.user-info .user-avatar{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-info .user-name{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.empty-status{
|
||||
width: 150px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
margin-top: 200px;
|
||||
}
|
||||
|
||||
.empty-status img{
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.msg-tips{
|
||||
margin-top: 25px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.msg-client-img{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.msg-client-img img{
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
.msg-agent-img{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.msg-agent-img img{
|
||||
width: 10rem;
|
||||
}
|
||||
|
||||
.message-emoji-picture{
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/server.css">
|
||||
<div class="layui-fluid">
|
||||
<div class="friend">
|
||||
<div class="friend-head">
|
||||
@ -194,7 +19,7 @@
|
||||
</div>
|
||||
<div class="message-sender">
|
||||
<div class="message-emoji-picture" id="btn-uploader">
|
||||
<i class="layui-icon" style="font-size: 25px; color: #969faa;"></i>
|
||||
<i id="emojiBtn" class="layui-icon" style="font-size: 25px; color: #969faa;"></i>
|
||||
<i id="pickfiles" class="layui-icon picture-upload" style="font-size: 25px; color: #969faa;margin-left: 10px;"></i>
|
||||
</div>
|
||||
<div class="sender-editor">
|
||||
@ -202,8 +27,25 @@
|
||||
<div class="layui-btn layui-btn-normal btnMsgSend layui-btn-disabled" title="Enter快捷发送,Ctrl+Enter换行">发送</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="emoji-list">
|
||||
<ul>
|
||||
<li title="笑脸">😁</li>
|
||||
<li title="哭脸">😂</li>
|
||||
<li title="表情1">😃</li>
|
||||
<li title="表情2">😄</li>
|
||||
<li title="表情3">😅</li>
|
||||
<li title="表情4">😆</li>
|
||||
<li title="表情5">😇</li>
|
||||
<li title="表情6">😈</li>
|
||||
<li title="表情7">😉</li>
|
||||
<li title="表情8">😊</li>
|
||||
<li title="表情9">😋</li>
|
||||
<li title="表情10">😌</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="http://tool.keleyi.com/ip/visitoriphost/"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/plupload/2.1.9/moxie.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/plupload/2.1.9/plupload.min.js"></script>
|
||||
<script type="text/javascript" src="http://cdn.staticfile.org/qiniu-js-sdk/1.0.14-beta/qiniu.min.js"></script>
|
||||
@ -211,6 +53,5 @@
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script type='text/javascript' src='js/common.js' charset='utf-8'></script>
|
||||
<script src="/js/server/index.js"> </script>
|
||||
<script type="text/javascript" src="http://tool.keleyi.com/ip/visitoriphost/"></script>
|
||||
|
||||
<% include footer.ejs %>
|
Loading…
x
Reference in New Issue
Block a user