Browse Source

Merge branch 'dev_1.1.3' of https://git.yishihui.com/DeNet/de-net into dev_1.1.3

wenliming 2 years ago
parent
commit
9f20629306
1 changed files with 25 additions and 6 deletions
  1. 25 6
      src/view/content/message/index.vue

+ 25 - 6
src/view/content/message/index.vue

@@ -19,7 +19,7 @@
             <!-- 自定义系统消息 -->
             <div class="denet-message-area" @click="clickItem(item)" v-if="item.bizType == 3">
                 <img :src="item.bizData.icon" alt />
-                <span>{{item.bizData.text}}</span>
+                <span>{{ item.bizData.text }}</span>
                 <div class="denet-message-close" @click.stop="clickClose(item)">
                     <img :src="require('@/assets/img/icon-message-close.png')" alt />
                 </div>
@@ -32,17 +32,25 @@ import { onMounted, reactive } from "vue";
 let state = reactive({
     list: [],
 })
+let timer, now_time
 
 // 过5秒消失逻辑
 const overTimeClose = () => {
-    setTimeout(() => {
-        let now_time = new Date().getTime()
+    if (timer) {
+        return
+    }
+    timer = setInterval(() => {
+        if (state.list.length == 0) {
+            clearInterval(timer)
+            timer = null
+        }
+        now_time = new Date().getTime()
         for (let i in state.list) {
-            if ((now_time - state.list[i].read_time) > 4500) {
+            if ((now_time - state.list[i].read_time) >= 5000) {
                 state.list.splice(i, 1)
             }
         }
-    }, 5000)
+    }, 1000)
 }
 
 const clickClose = (item) => {
@@ -58,7 +66,7 @@ const clickItem = (item) => {
     switch (String(item.bizType)) {
         case '1':
             // 跳转详情页
-            window.open(`https://twitter.com/${item.bizData.twitterAccount}/status/${item.bizData.twitterId}`)    
+            window.open(`https://twitter.com/${item.bizData.twitterAccount}/status/${item.bizData.twitterId}`)
             break;
         case '2':
             window.open('https://twitter.com/search?q=%23DeNet&src=typed_query')
@@ -124,6 +132,7 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         cursor: pointer;
         filter: drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.22));
         margin-left: 129px;
+        animation: right_to_left 1s;
 
         img:first-child {
             width: 40px;
@@ -169,4 +178,14 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         }
     }
 }
+
+@keyframes right_to_left {
+    0% {
+        right: -400px;
+    }
+
+    100% {
+        right: 0;
+    }
+}
 </style>