From 53ec51d8f788e55b4cff0d5f1ef570c038993759 Mon Sep 17 00:00:00 2001 From: cleverqin <705597001@qq.com> Date: Mon, 23 Nov 2020 13:45:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=B6=88=E6=81=AF=E4=BC=9A=E4=BA=A7=E7=94=9F?= =?UTF-8?q?xss=E6=94=BB=E5=87=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 +- static/css/common.css | 26 +++++++++++++++++++++ static/index.html | 16 +++++++++---- static/js/index.js | 54 ++++++++++++++++++++++++++----------------- 4 files changed, 72 insertions(+), 26 deletions(-) diff --git a/app.js b/app.js index 51b5b19..147993d 100644 --- a/app.js +++ b/app.js @@ -93,7 +93,7 @@ io.sockets.on('connection',(socket)=>{ //删除登录用户信息,并通知所有在线用户 util.removeUser(socket.user.id); socket.broadcast.emit('system', socket.user, 'logout'); - store.saveUser(user,"logout"); + store.saveUser(socket.user,"logout"); } }); let userJson=socket.handshake.query.User; diff --git a/static/css/common.css b/static/css/common.css index a4a70d2..ac9f81a 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -252,10 +252,36 @@ html,body{ .message-item-send .message-content-container{ background-color: #0087f7; color: #f2f2f2; + position: relative; +} +.message-item-send .message-content-container:after{ + display: block; + content: ''; + position: absolute; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid #0087f7; + top: 15px; + left: 100%; +} +.message-item-receive .message-content-container{ + position: relative; + background-color: #ffffff; + color: #606266; } .message-item-receive .message-avatar{ float: left; } +.message-item-receive .message-content-container:before{ + display: block; + content: ''; + position: absolute; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid #ffffff; + top: 15px; + right: 100%; +} /****用户组件样式****/ .user-item-avatar{ display: block; diff --git a/static/index.html b/static/index.html index 72f7b74..924f8fa 100644 --- a/static/index.html +++ b/static/index.html @@ -44,7 +44,9 @@ :num="getUnReadNum(item.id)" :key="item.id">