WXL
23 分钟以前 9d408b549b899631db29af772ee4e96f4c49a91c
src/layout/components/Navbar.vue
@@ -45,7 +45,14 @@
        trigger="click"
      >
        <div class="avatar-wrapper">
          <img :src="avatar" class="user-avatar" />
          <img
            :src="
              sex == 1
                ? require('@/assets/images/yisn.jpg')
                : require('@/assets/images/yisna.jpg')
            "
            class="user-avatar"
          />
          <i class="el-icon-caret-bottom" />
        </div>
        <el-dropdown-menu slot="dropdown">
@@ -85,7 +92,7 @@
    SizeSelect,
    Search,
    RuoYiGit,
    RuoYiDoc,
    RuoYiDoc
  },
  computed: {
    ...mapGetters(["sidebar", "avatar", "device"]),
@@ -96,41 +103,41 @@
      set(val) {
        this.$store.dispatch("settings/changeSetting", {
          key: "showSettings",
          value: val,
          value: val
        });
      },
      }
    },
    topNav: {
      get() {
        return this.$store.state.settings.topNav;
      },
    },
      }
    }
  },
  data() {
    return {
      isBadgeHidden: true,
      badgeVal: 0,
      sex: this.$store.state.user.sex
    };
  },
  mounted() {
    // this.returs();
  },
  methods: {
//     async returs() {
//       await listSystemmessageCount()
//         .then((res) => {
//           this.badgeVal = res.data;
// console.log('跑');
//           if (this.badgeVal > 0) {
//             this.isBadgeHidden = false;
//           }
//         })
//         .catch((error) => {});
//     },
    //     async returs() {
    //       await listSystemmessageCount()
    //         .then((res) => {
    //           this.badgeVal = res.data;
    // console.log('跑');
    //           if (this.badgeVal > 0) {
    //             this.isBadgeHidden = false;
    //           }
    //         })
    //         .catch((error) => {});
    //     },
    clickMessage() {
      this.$router.push({
        path: "/message",
        path: "/message"
      });
    },
    toggleSideBar() {
@@ -140,7 +147,7 @@
      this.$confirm("确定注销并退出系统吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          this.$store.dispatch("LogOut").then(() => {
@@ -148,21 +155,21 @@
          });
        })
        .catch(() => {});
    },
    }
  },
  watch: {
    badgeVal: function () {
    badgeVal: function() {
      const timer = setInterval(() => {
        this.returs();
      },5000);
      this.$once("hook:beforeDestroy",()=>{
      }, 5000);
      this.$once("hook:beforeDestroy", () => {
        clearInterval(timer);
      })
    },
  },
      });
    }
  }
};
</script>
<style lang="scss" >
<style lang="scss">
.el-badge {
  .el-badge__content.is-fixed {
    top: 13px !important ;