<template>
  <el-button
    v-if="func_permissions.video"
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/videoList')"
    >视频列表</el-button
  >
  <el-button
    v-if="func_permissions.device"
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/device')"
    >设备管理</el-button
  >
  <el-button
    v-if="func_permissions.cid"
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/cid')"
    >集成部署</el-button
  >
  <el-button
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/User')"
    >用户</el-button
  >
  <el-button
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/chat')"
    >聊天</el-button
  >
  <el-button
    type="primary"
    size="mini"
    @click.prevent="handleMenuSelect('/group')"
    >群组</el-button
  >
  <el-button
    type="primary"
    size="mini"
    class="el-button--danger"
    @click="logout()"
    >退出登录</el-button
  >
</template>

<script>
import { GetUserInfoService } from "@/api/user.js";
export default {
  data() {
    return {
      tokenData: {
        token: localStorage.getItem("token"),
        ip: localStorage.getItem("ip"),
        userId: localStorage.getItem("userId"),
        username: localStorage.getItem("username"),
        id: 2002,
        keyword: "",
      },
      func_permissions: {
        video: localStorage.getItem("video_func") === "true",  //string转为boolean
        device: localStorage.getItem("device_func") === "true", //string转为boolean
        cid: localStorage.getItem("cid_func") === "true", //string转为boolean
      },
    };
  },
  methods: {
    handleMenuSelect(path) {
       //this.getMyUserInfo();
      this.$router.push(path);
    },
    logout() {
      //询问是否退出登录
      if (!confirm("确定退出登录吗？")) {
        return;
      }
      //退出登录
      localStorage.clear();
      this.$router.push("/login");
    },
  },
};
</script>
