<template>
  <el-menu :default-openeds="['1', '3']" style="min-height: 100%; overflow-x: hidden"
           background-color="rgb(48,65,86)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           router
  >
    <div style="height: 60px;line-height: 60px;text-align: center">
      <img src="../../assets/logo.png" alt="" style="width: 20px;position: relative;top: 5px;margin-right: 5px">
      <b style="color: white" v-show="logoTextShow">在线考试学生端</b>
    </div>
    <!-- 动态绑定 index，使用模板字符串 -->
    <el-menu-item :index="`/user/profile?userId=${userId}`">
      <i class="el-icon-house"></i>
      <span>主页</span>
    </el-menu-item>

    <el-menu-item :index="`/student/exam?userId=${userId}`">
      <i class="el-icon-edit-outline"></i>
      <span>试卷中心</span>
    </el-menu-item>

    <el-menu-item :index="`/student/scoreList?userId=${userId}`">
      <i class="el-icon-s-data"></i>
      <span>分数查询</span>
    </el-menu-item>

    <el-menu-item :index="`/student/message?userId=${userId}`">
      <i class="el-icon-message"></i>
      <span>消息查询</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data() {
    return {
      hasStudentMenu: false, // 如果没有子项，将其设置为 false 来避免显示 submenu
      userId: '',  // 初始化 userId
    };
  },
  props: {
    isCollapse: Boolean,
    logoTextShow: Boolean
  },
  created() {
    // 从路由参数中获取 userId
    this.userId = this.$route.query.userId;
  }
}
</script>

<style scoped lang="scss">

</style>