diff --git a/css/main.css b/css/main.css index 0f7b5148379b5a594cc41b9bd9ee6e2cfd3b5f4b..e18bb749b9a2f34e3cf8d72fb18b165f810d84b2 100755 --- a/css/main.css +++ b/css/main.css @@ -763,6 +763,10 @@ body { background-position: bottom center; */ } +.chat_room_history > div { + padding: 10px 0 0 0; +} + .submit-area .el-form-item__content { margin-left: 10px!important; } @@ -1161,4 +1165,11 @@ audio { right: 10px; bottom: 215px; font-weight:normal; +} + +.notify-at-goto { + display: inline-block; + padding: 0 8px; + color: #0098ff; + cursor: pointer; } \ No newline at end of file diff --git a/index.php b/index.php index dba4c5c65199949a6464e1637801660088b2ab49..7a007ef57ec5d49243834cca1d90b2a8a6bc7b80 100755 --- a/index.php +++ b/index.php @@ -179,7 +179,7 @@ if (strpos($_SERVER['HTTP_USER_AGENT'], "Triden")) {
-
+
@@ -1329,6 +1329,13 @@ if (strpos($_SERVER['HTTP_USER_AGENT'], "Triden")) { }, mounted() { let that = this; + // 重写notify,设置默认偏移 + const notifyFunc = this.$notify; + that.$notify = function (obj) { + notifyFunc( + Object.assign({offset: 70}, obj) + ) + } document.addEventListener('paste', that.getClipboardFiles); that.emojiList = []; for(let i=1;i<=30;i++){ @@ -2266,11 +2273,13 @@ if (strpos($_SERVER['HTTP_USER_AGENT'], "Triden")) { }); } if (!isNotificated) { + console.log("@", obj) that.$notify({ title: that.urldecode(obj.user.user_name) + "@了你:", - message: that.urldecode(obj.content), + message: that.urldecode(obj.content) + `[查看]`, duration: 0, - offset: 70, + dangerouslyUseHTMLString: true + // offset: 70, }); } } @@ -2281,7 +2290,8 @@ if (strpos($_SERVER['HTTP_USER_AGENT'], "Triden")) { that.$notify({ title: that.urldecode(obj.user.user_name) + "说:", message: that.urldecode(obj.content), - duration: 5000 + duration: 5000, + // offset: 70, }); } } diff --git a/js/scroll-helper.js b/js/scroll-helper.js index 0777799f8f40edcee888ec2081941e1ac978c8d4..36ff60c5d43d50f4af74f46c1013e8b538fc22ca 100755 --- a/js/scroll-helper.js +++ b/js/scroll-helper.js @@ -23,6 +23,27 @@ const scrollFuncs = { } else { vue.showScrollToBottomBtn = false; } + }, + + /** + * 滚动到指定消息 + * @param {*} msgid + */ + scrollToChat: function (msgid) { + const chatRoom = document.querySelector('#chat_room_history'); + const chat = document.querySelector(`#msgid_${msgid}`); + chatRoom.scrollTop = chat.offsetTop - 100; + chat.style.backgroundColor = 'rgba(251, 114, 153,0.1)'; + chat.style.transition = 'all 600ms'; + setTimeout(() => { + chat.style.transition = 'all 2000ms'; + chat.style.backgroundColor = 'transparent'; + setTimeout(() => { + chat.style.transition = 'unset'; + }, 2000); + }, 3000); } + + } \ No newline at end of file