<template>
  <el-container style="height: 650px; border: 1px solid #eee">
    <el-header style="text-align: right; font-size: 12px">
      <el-row>
        <el-col :md="2">
          <ul class="el-menu--horizontal el-menu">
            <li class="el-menu-item">
              <a href="/cam" style="text-decoration-line: none">
                <img src="@/assets/img/icon/logo.png" class="el-avatar--circle el-avatar--medium" alt="img">
                MyCam
              </a>
            </li>
          </ul>
        </el-col>
        <el-col :md="20">
          <el-menu
            :default-active="this.$route.path"
            router
            mode="horizontal"
          >
            <el-menu-item index="/cam/list">
              <template slot="title" class="el-icon-camera">摄像头</template>
            </el-menu-item>
          </el-menu>
        </el-col>
        <el-col :md="2">
          <el-dropdown>
            <img
              :src="user.avatarUrl"
              class="el-avatar--circle el-avatar--medium"
              style="margin-right: 10px; margin-top: 15px"
              alt=""
            >
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                icon="el-icon-s-platform"
                class="size"
                @click.native="goToHome"
              >主站</el-dropdown-item>
              <el-dropdown-item
                icon="el-icon-error"
                class="size"
                @click.native="goToLogout"
              >退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import { userMixin } from 'assets/js/mixin'
import { getAuthedUser } from '@/utils/auth'

export default {
  name: 'Cam',
  mixins: [userMixin],
  data() {
    return {
      user: null,
      loginUser: null
    }
  },
  created() {
    document.title = '我的监控'
    const userInfo = getAuthedUser()
    if (userInfo !== null) {
      this.user = userInfo
      this.loginUser = userInfo
    }
  }
}
</script>

<style>
</style>
