<template>
  <a-drawer
    :visible="Svisible"
    class="drawerStyle subset"
    placement="right"
    width="70%"
    @after-visible-change="afterVisibleChange"
  >
    <div class="drawerMain">
      <div class="header">
        <div class="headerTitle">随机分组</div>
        <img
          style="width: 29px; height: 29px; cursor: pointer"
          src="../../assets/images/basicinfo/close.png"
          @click="closeDrawer"
        />
      </div>
      <div class="main">
        <div class="groupl">小组：</div>
        <div>
          <div class="groupin">
            <a-input
              v-model:value="value"
              placeholder="好好学习小组"
              style="border-radius: 8px; height: 40px"
            />
            <div class="delete">删除</div>
          </div>
          <div class="groupin">
            <a-input
              v-model:value="value"
              placeholder="全能小组"
              style="border-radius: 8px; height: 40px"
            />
            <div class="delete">删除</div>
          </div>
          <div class="groupin">
            <a-input
              v-model:value="value"
              placeholder="宇宙第一最强小组"
              style="border-radius: 8px; height: 40px"
            />
            <div class="delete">删除</div>
          </div>
        </div>
      </div>
      <div class="addgroup" @click="showAddGroup">
        <img src="../../assets/images/courseManage/add0.png" />
        <span class="grot">创建小组</span>
      </div>
      <div class="zhu">注：随机分组不对小组长生效</div>
      <div class="btnn">
        <button class="btn1">取消</button>
        <button class="btn2">确定</button>
      </div>
    </div>
  </a-drawer>
  <!-- 创建小组抽屉 -->
  <add-group v-model:Avisible="Avisible" />
</template>

<script>
import { reactive, toRefs } from "vue";
import AddGroup from "./AddGroup.vue";
export default {
  name: "SubsetManage",
  components: { AddGroup },
  props: {
    Svisible: {
      type: Boolean,
      default: false,
    },
  },
  setup(props, ctx) {
    const state = reactive({
      Avisible: false,
    });
    const closeDrawer = () => {
      ctx.emit("update:Svisible", false);
    };

    const afterVisibleChange = (bool) => {
      console.log("state", bool);
    };

    const showDrawer = () => {
      state.Svisible = true;
    };

    const showAddGroup = () => {
      state.Avisible = true;
    };
    return {
      ...toRefs(state),
      afterVisibleChange,
      showDrawer,
      closeDrawer,
      showAddGroup,
      // change,
    };
  },
};
</script>

<style scoped lang="scss">
.subset {
  .ant-drawer-content-wrapper {
    // max-width: 1000px;
    .ant-drawer-header {
      display: none !important;
    }
    .ant-drawer-body {
      padding: 0;
    }
  }
  .drawerMain {
    min-width: 600px;
    margin: 0px 32px 0px 32px;
    overflow-x: scroll;
    display: flex;
    flex-direction: column;
    .header {
      height: 73px;
      border-bottom: 1px solid #e8e8e8;
      display: flex;
      justify-content: space-between;
      align-items: center;
      // background-color: red;
      margin-bottom: 20px;
      .headerTitle {
        font-size: 18px;
        font-weight: 600;
        color: #333333;
        line-height: 25px;
        // margin-left: 24px;
      }
    }
    .main {
      display: flex;
      .groupin {
        display: flex;
        align-items: center;
        margin-top: 32px;
        .ant-input {
          border-radius: 5px;
          // height: 120%;
          width: 384px;
          height: 40px;
        }
        .delete {
          color: rgba(56, 125, 247, 1);
          font-size: 14px;
          margin-left: 10px;
          cursor: pointer;
        }
      }
      .groupl {
        color: rgba(0, 0, 0, 0.85);
        font-size: 16px;
        margin-top: 36px;
      }
    }
    .addgroup {
      width: 130px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      //margin-right: 16px;
      margin-top: 32px;
      border: 1px solid #409eff;
      border-radius: 8px;
      background: #409eff;
      cursor: pointer;
      .grot {
        color: #ffffff;
        margin-left: 5px;
        font-size: 14px;
      }
    }
    .zhu {
      margin-top: 24px;
      color: rgba(153, 153, 153, 1);
      font-size: 14px;
    }
    .btnn {
      height: 72px;
      width: 100%;
      position: absolute;
      bottom: 0;
      left: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
      .btn1 {
        width: 100px;
        height: 40px;
        border: 1px solid #4ea6ff;
        border-radius: 8px;
        color: #4ea6ff;
        background-color: #fff;
        cursor: pointer;
      }
      .btn2 {
        cursor: pointer;
        width: 100px;
        height: 40px;
        background: #4ea6ff;
        border-radius: 8px;
        border: 0;
        margin-left: 15px;
        color: #fff;
      }
    }
  }
}
</style>
