<template>
  <a-drawer
    :visible="addtestVisible"
    class="drawerStyle addtestDrawer"
    width="80%"
    title="添加作业"
    placement="right"
    @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="contentMain">
        <div class="main_left">
          <div class="main_item">
            <div class="signbox">
              <div class="sign">
                <img
                  src="@/assets/images/coursewareManage/asterisk.png"
                  alt=""
                />
              </div>
              <span style="margin-right: 3px">考试名称：</span>
            </div>
            <div class="btnbox">
              <a-input
                v-model:value="inputV1"
                style="width: 424px; height: 32px"
                placeholder="请输入考试名称"
              />
            </div>
          </div>
          <div class="main_item2">
            <div class="signbox">
              <span style="margin-right: 3px">考试说明：</span>
            </div>
            <div class="textarea">
              <a-textarea
                v-model:value="textV1"
                placeholder="请输入考试说明"
                allow-clear
              />
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <div class="sign">
                <img
                  src="@/assets/images/coursewareManage/asterisk.png"
                  alt=""
                />
              </div>
              <span style="margin-right: 3px">选择考试：</span>
            </div>
            <div class="btnbox">
              <a-select
                dropdownClassName="dropdown-style"
                style="width: 424px"
                placeholder="请输入考试名称"
                :options="options1"
                allowClear
                showSearch
              />
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <div class="sign">
                <img
                  src="@/assets/images/coursewareManage/asterisk.png"
                  alt=""
                />
              </div>
              <span style="margin-right: 3px">考试时间：</span>
            </div>
            <div class="btnbox">
              <a-range-picker
                style="width: 424px"
                :placeholder="['      开始时间', '        结束时间']"
              />
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <div class="sign">
                <img
                  src="@/assets/images/coursewareManage/asterisk.png"
                  alt=""
                />
              </div>
              <span style="margin-right: 3px">考试时长：</span>
            </div>
            <div class="btnbox">
              <a-input
                v-model:value="inputV2"
                style="width: 388px; height: 32px"
              />
              <span style="margin-left: 5px">分钟</span>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <div class="sign">
                <img
                  src="@/assets/images/coursewareManage/asterisk.png"
                  alt=""
                />
              </div>
              <span style="margin-right: 3px">考试限制：</span>
            </div>
            <div class="btnbox">
              <span style="margin-right: 8px">允许重复考试</span>
              <a-input
                v-model:value="inputV3"
                style="width: 88px; height: 32px"
              />
              <span style="margin-left: 8px">次</span>
              <span style="margin-left: 24px; color: #999999"
                >-1表示无限制</span
              >
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">显示答案：</span>
            </div>
            <div class="btnbox">
              <a-radio-group v-model:value="radioV1">
                <a-radio v-model:checked="checked" :value="1" @click="cloradio1">允许查看</a-radio>
                <a-radio v-model:checked="checked" :value="2" @click="cloradio1"
                  >不允许查看</a-radio
                >
              </a-radio-group>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">显示解析：</span>
            </div>
            <div class="btnbox">
              <a-radio-group v-model:value="radioV2">
                <a-radio v-model:checked="checked" :value="1" @click="cloradio2">允许查看</a-radio>
                <a-radio v-model:checked="checked" :value="2" @click="cloradio2"
                  >不允许查看</a-radio
                >
              </a-radio-group>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">评分模式：</span>
            </div>
            <div class="btnbox">
              <div class="btnbox">
                <a-radio-group v-model:value="radioV3">
                  <a-radio v-model:checked="checked" :value="1" @click="cloradio3"
                    >最高一次</a-radio
                  >
                  <a-radio v-model:checked="checked" :value="2" @click="cloradio3"
                    >最后一次</a-radio
                  >
                </a-radio-group>
              </div>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">及格线：</span>
            </div>
            <div class="btnbox">
              <a-input
                v-model:value="value2"
                style="width: 88px; height: 32px"
              />
              <span style="margin-left: 8px">分</span>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">试题排列：</span>
            </div>
            <div class="btnbox">
              <a-radio-group v-model:value="radioV4">
                <a-radio v-model:checked="checked" :value="1" @click="cloradio4">试题乱序</a-radio>
                <a-radio v-model:checked="checked" :value="2" @click="cloradio4">试题排序</a-radio>
                <a-radio v-model:checked="checked" :value="3" @click="cloradio4">全部乱序</a-radio>
              </a-radio-group>
            </div>
          </div>
        </div>
      </div>
      <div class="main_btns">
        <button class="btn1">取消</button>
        <button class="btn2">确定</button>
      </div>
    </div>
  </a-drawer>
</template>
  <script>
import { reactive, toRefs, ref } from "vue";
const rowSelection = ref({
  checkStrictly: false,
  onChange: (selectedRowKeys, selectedRows) => {
    console.log(
      `selectedRowKeys: ${selectedRowKeys}`,
      "selectedRows: ",
      selectedRows
    );
  },
  onSelect: (record, selected, selectedRows) => {
    console.log(record, selected, selectedRows);
  },
  onSelectAll: (selected, selectedRows, changeRows) => {
    console.log(selected, selectedRows, changeRows);
  },
});
export default {
  name: "AddTest",
  // components: {
  // },
  props: {
    addtestVisible: {
      type: Boolean,
      default: false,
    },
  },
  setup(props, ctx) {
    const state = reactive({
      inputV1: "",
      inputV2: "",
      inputV3: "",
      testV1: "",
      radioV1: "",
      radioV2: "",
      radioV3: "",
      radioV4: "",
    });
    const closeDrawer = () => {
      ctx.emit("update:addtestVisible", false);
      state.radioV1 = "";
        state.radioV2 = "";
        state.radioV3 = "";
        state.radioV4 = "";
    };
    const afterVisibleChange = (bool) => {
      console.log("state", bool);
    };
    const cloradio1 = (value) => {
      if (value != "") {
        state.radioV1 = "";
      }
    }
    const cloradio2 = (value) => {
      if (value != "") {
        state.radioV2 = "";
      }
    }
    const cloradio3 = (value) => {
      if (value != "") {
        state.radioV3 = "";
      }
    }
    const cloradio4 = (value) => {
      if (value != "") {
        state.radioV4 = "";
      }
    }
    return {
      ...toRefs(state),
      afterVisibleChange,
      closeDrawer,
      rowSelection,
      cloradio1,
      cloradio2,
      cloradio3,
      cloradio4,
    };
  },
};
</script>
  <style lang="scss">
.ant-table-striped :deep(.table-striped) td {
  background-color: #fafafa !important;
}
.addtestDrawer {
  .drawerMain {
    .header {
      height: 73px;
      border-bottom: 1px solid #e8e8e8;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .headerTitle {
        font-size: 18px;
        font-weight: 600;
        color: #333333;
        line-height: 25px;
        margin-left: 24px;
      }
    }
    .contentMain {
      display: flex;
      justify-content: space-between;
      .main_left {
        padding-right: 30px;
        flex: 1;
        border-right: 1px solid #e8e8e8;
        .main_item {
          display: flex;
          align-items: center;
          margin-bottom: 32px;
          .signbox {
            width: 120px;
            display: flex;
            justify-content: end;
            align-items: center;
            .sign {
              margin-right: 5px;
            }
          }
          .btnbox {
            display: flex;
            flex: 1;
            align-items: center;
            .xkbtn {
              cursor: pointer;
              width: 130px;
              height: 40px;
              background: #388be1;
              border-radius: 8px;
              border: 0;
              margin-right: 8px;
              color: #fff;
            }
          }
        }
        .main_item2 {
          display: flex;
          align-items: flex-start;
          margin-bottom: 32px;
          .signbox {
            width: 120px;
            display: flex;
            justify-content: end;
            align-items: center;
            .sign {
              margin-right: 5px;
            }
          }
          .kqszbox {
            .qdqtbox {
              margin-left: 56px;
            }
            .setbox {
              display: flex;
              flex-wrap: wrap;
              margin-top: 10px;
              margin-bottom: 24px;
              .timerbox {
                margin-top: 6px;
                margin-right: 32px;
                display: flex;
                align-items: center;
                flex-wrap: nowrap;
              }
            }
          }
          .btnbox2 {
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            .xkbtn {
              cursor: pointer;
              width: 130px;
              height: 40px;
              background: #388be1;
              border-radius: 8px;
              border: 0;
              margin-right: 16px 8px 32px 0;
              color: #fff;
              margin-top: 16px;
              margin-bottom: 60px;
            }
          }
        }
      }
    }
    .main_btns {
      height: 72px;
      width: 100%;
      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>
  