
<template>
<el-container style="height:100%;border: 1px solid #eee">
  <el-aside width="200px" style="background-color: rgb(238, 241, 246);height:100%;">
    <el-menu :default-openeds="['1', '3']" style="background-color: rgb(238, 241, 246);height:100%;">
      <el-submenu index="1">
        <template slot="title">GIC后台组件</template>
        <el-menu-item index="1-1" @click="$router.push('/test/marketingEvent')">营销事件</el-menu-item>
        <el-menu-item index="1-2" @click="$router.push('/test/storeNew')">门店组件</el-menu-item>
        <el-menu-item index="1-2" @click="$router.push('/test/card')">卡券弹窗组件</el-menu-item>
        <el-menu-item index="1-2" @click="$router.push('/test/linktools')">链接小工具组件</el-menu-item>
        <!-- <el-menu-item index="1-3">选项3</el-menu-item> -->
      </el-submenu>
      <el-menu-item index="2" @click="$router.push('/test/staticcom')">静态组件
      </el-menu-item>
      <el-submenu index="3">
        <template slot="title">其他组件</template>
        <el-menu-item index="3-1">选项1</el-menu-item>
        <el-menu-item index="3-2">选项2</el-menu-item>
        <el-menu-item index="3-3">选项3</el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>

  <el-container style="background-color:#fff;">
    <el-header style="text-align: right; font-size: 12px">
      <el-dropdown>
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item><span @click="logout">退出登录</span></el-dropdown-item>
          <el-dropdown-item><span @click="login">重新登录</span></el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span>damogic</span>
    </el-header>
    <el-main>
      <router-view></router-view>
    </el-main>
  </el-container>
</el-container>
</template>
<style>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }
</style>

<script>
  export default {
    data() {
      const item = {
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      };
      return {
        tableData: Array(20).fill(item)
      }
    },
    methods:{
      login() {
        this.axios.get('http://gicdev.demogic.com/api-auth/do-login?requestProject=gic-web&loginName=damogic&password=damo2018&eid=ff808081593917d90159398ec6340012').then(res => {
          console.log(res);
          if (res.data.errorCode === 0) {
            this.$message({type:'success',message:'登录成功'});
          }
        })
      },
      logout() {
        window.location.href = '/gic-web';
      }
    }
  };
</script>
