Browse Source

更新处理显示

lex 1 year ago
parent
commit
42a9f6b808
4 changed files with 16 additions and 12 deletions
  1. 1 1
      dev-dist/sw.js
  2. 8 8
      src/components/layout/index.module.less
  3. 5 1
      src/components/layout/layoutTop.tsx
  4. 2 2
      vite.config.ts

+ 1 - 1
dev-dist/sw.js

@@ -82,7 +82,7 @@ define(['./workbox-5357ef54'], (function (workbox) { 'use strict';
     "revision": "3ca0b8505b4bec776b69afdba2768812"
   }, {
     "url": "index.html",
-    "revision": "0.t8a3g7sakg"
+    "revision": "0.2qdsoqsio4o"
   }], {});
   workbox.cleanupOutdatedCaches();
   workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

+ 8 - 8
src/components/layout/index.module.less

@@ -131,18 +131,18 @@
       .messageBadge {
         margin-right: 24px;
 
-        :global {
-          .n-badge-sup {
-            // left: 20px;
-            // -webkit-animation: TadaNum 1s 2s both infinite !important;
-            // -moz-animation: TadaNum 1s 2s both infinite !important;
-            // -ms-animation: TadaNum 1s 2s both infinite !important;
-            // animation: TadaNum 1s 2s both infinite !important;
+
+
+        &.messageBadgeNo {
+          :global {
+            .n-badge-sup {
+              visibility: hidden;
+            }
           }
+
         }
 
         .messageIcon {
-
           width: 32px;
           height: 32px;
           cursor: pointer;

+ 5 - 1
src/components/layout/layoutTop.tsx

@@ -57,6 +57,7 @@ export default defineComponent({
       if (evt.data.api === 'onImClose') {
         showImGroup.value = false;
       } else if (evt.data.api === 'getNoReadMessageCount') {
+        console.log(evt, 'onMessage');
         noReadCount.value = evt.data.count || 0;
       }
     };
@@ -82,7 +83,10 @@ export default defineComponent({
               <NBadge
                 value={noReadCount.value}
                 max={99}
-                class={styles.messageBadge}
+                class={[
+                  styles.messageBadge,
+                  noReadCount.value <= 0 ? styles.messageBadgeNo : ''
+                ]}
                 {...{ id: 'home-2' }}
                 color={'#FF1036'}>
                 <NImage

+ 2 - 2
vite.config.ts

@@ -3,7 +3,7 @@ import vue from '@vitejs/plugin-vue';
 import vueJsx from '@vitejs/plugin-vue-jsx';
 import Components from 'unplugin-vue-components/vite';
 import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
-import viteESLint from 'vite-plugin-eslint';
+// import viteESLint from 'vite-plugin-eslint';
 import legacyPlugin from '@vitejs/plugin-legacy';
 import { VitePWA } from 'vite-plugin-pwa';
 // 引入等比适配插件
@@ -29,7 +29,7 @@ export default defineConfig({
   plugins: [
     vue(),
     vueJsx(),
-    viteESLint(),
+    // viteESLint(),
     Components({
       dts: true,
       resolvers: [NaiveUiResolver()]