configureCourse.vue 4.12 KB
<!-- 配置课程 -->
<template>
  <div class="configureCourse">
    <div class="left-wrap">
      <div class="header">
        <img class="staff-icon" src="../../images/staff-icon.png" alt="" />
        <div class="title">
          员工列表
          <div class="num">共7人,已配置1人</div>
        </div>
      </div>
      <div class="staff-list">
        <div
          v-for="(item, index) in staffList"
          :key="item.id"
          :class="['staff-item', staffIndex == index ? 'active' : '']"
          @click="handleClick(index)"
        >
          {{ item.name }}
          <div class="config" v-if="item.isConfig">已配置</div>
        </div>
      </div>
    </div>
    <div class="right-wrap">
      <div class="nav-tabs">
        <div
          :class="['nav-item', activeName == index ? 'active' : '']"
          v-for="(item, index) in tabPaneList"
          :key="index"
          @click="handleTabClick(index)"
        >
          {{ item.label }}
        </div>
      </div>
      <components :is="tabName"></components>
    </div>
  </div>
</template>
<script>
import staffDetail from "./staffDetail"
import couseAllocation from "./couseAllocation"
export default {
  name: "configureCourse",
  components: { staffDetail, couseAllocation },
  data() {
    return {
      staffIndex: 0,
      activeName: "0",
      tabPaneList: [
        {
          label: "员工详情"
        },
        {
          label: "课程配置"
        }
      ],
      tabName: "staffDetail",
      staffList: [
        {
          name: "王小虎",
          isConfig: true,
          id: 1
        },
        {
          name: "李小宣",
          isConfig: true,
          id: 1
        },
        {
          name: "胡明星",
          isConfig: true,
          id: 1
        },
        {
          name: "郝怡逸",
          isConfig: true,
          id: 1
        }
      ]
    }
  },
  methods: {
    handleClick(index) {
      this.staffIndex = index
    },
    handleTabClick(index) {
      this.activeName = index
      const arr = {
        0: "staffDetail",
        1: "couseAllocation"
      }
      this.tabName = arr[+this.activeName]
    }
  }
}
</script>
<style lang="scss" scoped>
.configureCourse {
  display: flex;
  margin: 0 20px;
  .left-wrap {
    min-width: 200px;
    width: 200px;
    height: 988px;
    background: #ffffff;
    margin-right: 16px;
    .header {
      display: flex;
      align-items: flex-start;
      margin: 12px 0 8px 13px;
      .staff-icon {
        width: 16px;
        height: 16px;
        margin-right: 8px;
        margin-top: 3px;
      }
      .title {
        color: #333333;
        font-size: 16px;
        font-weight: 400;
        .num {
          color: #999999;
          font-size: 12px;
          font-weight: 400;
          margin-top: 2px;
        }
      }
    }
    .staff-list {
      height: calc(100% - 62px);
      overflow-y: auto;
      .staff-item {
        color: #666666;
        font-size: 16px;
        font-weight: 400;
        padding: 10px 12px 10px 36px;
        position: relative;
        .config {
          position: absolute;
          border-radius: 2px;
          border: 1px solid #2cca74;
          background: #e9eef7;
          padding: 4px 8px;
          color: #2cca74;
          font-size: 12px;
          font-weight: 500;
          top: 10px;
          right: 12px;
        }
      }
      .active {
        color: #2a58ad;
        background: #e9eef7;
        border-right: 3px solid #2a58ad;
      }
    }
  }
  .right-wrap {
    width: calc(100% - 216px);
    .nav-tabs {
      display: flex;
      align-items: center;
      .nav-item {
        width: 112px;
        height: 44px;
        border-radius: 4px 4px 0 0;
        color: #666666;
        font-size: 16px;
        font-weight: 400;
        line-height: 44px;
        box-sizing: border-box;
        text-align: center;
        margin-right: 2px;
        border: 1px solid #e5e5e5;
        background: #f8f8f8;
      }
      .active {
        color: #2a58ad;
        font-size: 16px;
        font-weight: 500;
        border: 1px solid #e5e5e5;
        background: #ffffff;
      }
    }
    // background: #ffffff;
  }
}
</style>