service.vue 2.66 KB

<template>
  <div >
    <el-container style="min-height: 550px">
      <el-aside width="210px" style="background-color: #f8f8f9;">
        <!--左侧菜单组件-->
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#f8f8f9"
          text-color="#909399"
          active-text-color="#f64556" router style="border-right: none">
          <el-menu-item index="/service/dashboard" class="is-active">
            <i class="el-icon-menu "></i>
            <span slot="title">服务首页</span>
          </el-menu-item>
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-bank-card"></i>
              <span>我的钱包</span>
            </template>
            <el-menu-item index="/service/account">我的账户</el-menu-item>
            <el-menu-item index="/service/cardticket">我的卡券</el-menu-item>
          </el-submenu>
          <el-menu-item index="/service/order">
            <i class="el-icon-tickets"></i>
            <span slot="title">我的订单</span>
          </el-menu-item>
          <el-menu-item index="/service/payback">
            <i class="el-icon-finished"></i>
            <span slot="title">欠费补缴</span>
          </el-menu-item>
          <el-menu-item index="/service/mycar">
            <i class="el-icon-truck"></i>
            <span slot="title">我的车辆</span>
          </el-menu-item>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span>个人中心</span>
            </template>
            <el-menu-item index="/service/information">个人资料</el-menu-item>
            <el-menu-item index="/service/myevaluate">我的评价</el-menu-item>
          </el-submenu>
          <el-menu-item  @click="logout">
            <i class="el-icon-finished"></i>
            <span slot="title">退出服务</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-main class="app-container" style="background-color: #f0f2f5;">
        <router-view :key="key" />
      </el-main>
    </el-container>

  </div>

</template>

<script>
  export default {
    computed: {
      key() {
        return this.index
      }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      async logout() {
        await this.$store.dispatch('user/logout')
        this.$router.push(`/login?redirect=${this.$route.fullPath}`)
      }
    }
  }

</script>
<style scoped>

</style>