<template>
  <div class="my-page">
    <div class="breadcrumb">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/career/plan/index' }"
          >生涯·志愿</el-breadcrumb-item
        >
        <el-breadcrumb-item :to="{ path: '/career/subject/index' }"
          >选科查询</el-breadcrumb-item
        >
        <el-breadcrumb-item>由专业选科目</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="my-box">
      <div class="my-box-title">我的其他选科方案</div>
      <div class="major-card-list">
        <div
          class="divide-equally-box"
          v-for="(item, index) in dataList"
          :key="index"
        >
          <div class="major-card-item">
            <div class="major-card-title">{{ item.course }}</div>
            <div class="major-progress-box">
              <el-progress
                type="circle"
                stroke-width="14"
                width="96"
                color="#c8eee3"
                :percentage="item.marjorRate"
              ></el-progress>
              <div class="major-progress-text">
                可报{{ item.marjorRate }}%的专业
              </div>
              <div class="bottom-box">
                <div class="bottom-bar">
                  <div class="setdf" @click="httpschemeDf(item)">设为默认</div>
                  <i class="el-icon-delete" @click="httpschemeDfRemove(item)"></i>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getMyXkcx, schemeDf, schemeDfRemove } from "@/api/webApi/webQue";

export default {
  data() {
    return {
      dataList: [],
    };
  },
  created() {
    this.httpGetMyXkcx();
  },
  methods: {
    httpGetMyXkcx() {
      getMyXkcx({}).then((res) => {
        this.dataList = res.rows;
      });
    },
    httpschemeDf(item) {
      schemeDf({
        id:item.id,
        df:true
      }).then((res) => {
        this.$message.success("操作成功！")
      });
    },
    httpschemeDfRemove(item) {
      schemeDfRemove({
        id:item.id
      }).then((res) => {
        this.httpGetMyXkcx()
      });
    },
  },
};
</script>

<style scoped>
.breadcrumb {
  padding: 15px 30px;
  margin: 15px 0;
  border-bottom: 1px solid #eee;
  border-radius: 2px;
  background-color: #fff;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
}
.el-breadcrumb {
  font-size: 16px !important;
}
.my-box-title {
  color: #4c4c4c;
  font-size: 24px;
  text-align: center;
  margin-top: 100px;
}

.major-card-list {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
}
.divide-equally-box {
  width: 33%;
}
.major-card-item {
  width: 320px;
  margin: 20px auto;
  background: rgba(255, 255, 255, 1);
  box-shadow: 2px 2px 10px 0px rgb(0 0 0 / 10%);
  margin-top: 20px;
}
.major-card-title {
  text-align: center;
  background: #47c6a2;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  padding: 25px 0px;
}
.major-progress-box {
  padding: 40px 0 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.major-progress-text {
  margin-top: 20px;
}
.bottom-box {
  height: 80px;
  width: 100%;
  position: relative;
}
.bottom-bar {
  position: absolute;
  right: 0;
  top: 25px;
  display: flex;
  align-items: center;
  padding: 8px 25px;
  background-color: #eeeeee;
  border-radius: 100px 0px 0px 100px;
}
.setdf,
.el-icon-delete {
  cursor: pointer;
}
.setdf {
  color: #73a0fa;
  font-size: 14px;
  margin-right: 30px;
}
.el-icon-delete {
  color: #f62008;
}
</style>
