export default {
  methods: {
    async setcode() {
      this.$store
        .dispatch("user/UserInfor", {})
        .then(async (res) => {
          if (res === "success") {
          } else {
            await this.logout();
          }
        })
        .catch(async (err) => {
          console.log(err);
        });
    },
    async logout() {
      if (this.$route.path !== "/login") {
        await this.$store.dispatch("user/logout");
        this.$router.push(`/login`);
      }
    },
    async routeGoto(path, query) {
      window.vm.$router.push({
        path: path,
        query: query,
      });
    },
    setNum(s) {
      return s ? parseFloat(s + "").toFixed(2) : "-";
    },
  }
}
