<template>
  <div @click="openDrawer">
    <slot></slot>
  </div>
  <a-drawer
      :visible="visible"
      class="drawerStyle addfaceteachDrawer"
      width="90%"
      title="添加面授"
      placement="right"
  >
    <div class="drawerMain">
      <div class="header">
        <div v-if="edit" class="headerTitle">编辑面授</div>
        <div v-else 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="courseName"
                  style="width: 400px; height: 40px; border-radius: 8px;"
                  placeholder="请输入课程任务名称"
                  :maxlength="20"
              />
            </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">
              <button class="xkbtn" @click="showDrawerSelFacet">
                {{ chooseCourse ? "重选" : "选择" }}面授课
              </button>
              <div v-if="chooseCourse">
                <a-tag closable color="processing" @close="logC">
                  <span style="font-size: 14px; line-height: 33px">{{
                      chooseCourseName
                    }}</span>
                </a-tag>
              </div>
            </div>
            <!-- 选择面授侧弹窗 -->
            <div>
              <sel-facet
                  v-model:selfacetVisible="selfacetvisible"
                  v-model:chooseCourse="chooseCourse"
                  v-model:chooseCourseName="chooseCourseName"
              />
            </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="select" style="width: 400px;">
              <!--              <a-auto-complete placeholder="选择老师" :value="memberValue.label" style="width: 364px"-->
              <!--                               :options="options" @change="handleChange2" @search="handleSearch"></a-auto-complete>-->
              <ProjectManager
                  v-model:value="memberValue.value"
                  v-model:name="memberValue.label"
              ></ProjectManager>
            </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="select">
              <a-range-picker style="width: 400px;"
                              :show-time="{ format: 'HH:mm' }"
                              :disabled-date="disabledDate" 
                             
                              format="YYYY/MM/DD HH:mm"
                              v-model:value="chooseTime"
                              :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="select">
              <a-input-number
                  :min="0"
                  :max="300"
                  :precision="0"
                  style="width: 400px; height: 40px; border-radius: 8px;"
                  v-model:value="duration"
              ></a-input-number>
              <span style="margin-left: 5px; width: 30px">分</span>
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <div class="sign">

              </div>
              <span style="margin-right: 3px">上课地点：</span>
            </div>
            <div class="select">
              <a-input
                  v-model:value="address"
                  style="width: 400px; height: 40px; border-radius: 8px;"
                  placeholder="请输入上课地址"
                  :maxlength="100"
              />
            </div>
          </div>
          <div class="main_item2">
            <div class="signbox">
              <span style="margin-right: 3px">面授说明：</span>
            </div>
            <div class="textarea">
              <a-textarea
                  v-model:value="description"
                  placeholder="请输入说明"
                  allow-clear
                  show-count
                  :maxlength="200"
                  :rows="6"
              />
            </div>
          </div>
          <div class="main_item2">
            <div class="signbox">
              <span style="margin-right: 3px">考勤设置：</span>
            </div>
            <div class="kqszbox">
              <div class="qdqtbox">
                <div class="qdbtn">
                  <div class="btntext">签到</div>
                </div>
              </div>
              <div class="setbox">
                <div class="timerbox">
                  <span>开始前：</span>
                  <a-input-number
                      :min="0"
                      :max="300"
                      :precision="0"
                      style="
                      width: 100px;
                      height: 32px;
                      border-radius: 8px;
                      overflow: hidden;
                    "
                      v-model:value="before"
                  ></a-input-number>
                  <span style="color: #999999; margin-left: 8px">分钟</span>
                </div>
                <div class="timerbox">
                  <span>开始后：</span>
                  <a-input-number
                      :min="0"
                      :max="300"
                      :precision="0"
                      style="
                      width: 100px;
                      height: 32px;
                      border-radius: 8px;
                      overflow: hidden;
                    "
                      v-model:value="afterStartValue"
                  ></a-input-number>
                  <span style="color: #999999; margin-left: 8px">分钟</span>
                </div>
              </div>
            </div>
          </div>
          <!--
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">完成标准设置：</span>
            </div>
            <div class="btnbox">
              <a-checkbox
                v-model:checked="onlySign"
                @click="onlySign = !onlySign"
                >仅签到</a-checkbox
              >
            </div>
          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">其他设置：</span>
            </div>
            <div class="btnbox">
              <a-checkbox
                v-model:checked="completeLeave"
                @click="completeLeave = !completeLeave"
                >学员请假后记为任务完成
              </a-checkbox>
            </div>
          </div>
           -->

          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">现场参与：</span>
            </div>
            <div class="btnbox">
              <a-checkbox
                  v-model:checked="innerPersion"
                  @click="innerPersion = !innerPersion"
              >允许项目内人员临时到场参加
              </a-checkbox>

            </div>
            <div class="btnbox">

              <a-checkbox
                  v-model:checked="outPersion"
                  @click="outPersion = !outPersion"
              >允许项目外人员临时到场参加
              </a-checkbox>
            </div>
          </div>
          <div class="main_item2">
            <div class="signbox">
              <span style="margin-right: 3px">评估：</span>
            </div>
            <div class="btnbox2">
              <a-checkbox
                  v-model:checked="needEval"
                  @click="needEval = !needEval"
              >需要评估
              </a-checkbox
              >
            </div>
          </div>
          <div v-if="needEval" class="main_item">
            <div class="signbox"></div>
            <div class="btnbox">
              <button class="xkbtn" @click="showAssessment">选择评估</button>
              <div v-if="assessmentName">
                <a-tag closable color="processing" @close="logA">
                  <span style="font-size: 14px; line-height: 33px">{{
                      assessmentName
                    }}</span>
                </a-tag>
              </div>
              <AssessmentList
                  v-model:assessmentVisible="assessmentVisible"
                  v-model:assessmentId="assessmentId"
                  v-model:assessmentName="assessmentName"
              />
            </div>
          </div>
        </div>
        <div class="main_right">
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">配置作业：</span>
            </div>
            <div class="btnbox" @click="showDrawerAddHomework">
              <button class="xkbtn">配置</button>
            </div>

            <!-- 添加作业侧弹窗 -->
            <div>
              <add-homework
                  v-model:addhomeworkVisible="addhomeworkvisible"
                  @getWork="getWork"
                  :faceLevel="true"
                  v-model:EditWorkId="EditWorkId"
                  v-model:workName="workName"
              />
            </div>
            <!-- 添加作业侧弹窗 -->
          </div>
          <div v-if="EditWorkId > 0" class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">已选作业：</span>
            </div>
            <div class="btnbox" @click="showDrawerAddHomework">
              <a-tag closable color="processing" @close="logW">
                <span style="font-size: 14px; line-height: 33px">{{
                    workName
                  }}</span>
              </a-tag>
            </div>


          </div>
          <div class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">配置考试：</span>
            </div>
            <div class="btnbox" @click="showDrawerAddTest">
              <button class="xkbtn">配置</button>
            </div>
            <!-- 添加考试侧弹窗 -->
            <div>
              <add-test
                  v-model:addtestVisible="addtestvisible"
                  v-model:EditTestId="EditTestId"
                  v-model:testName="testName"
                  v-model:offCourseId="offCourseId"
                  :faceLevel="true"
              />
            </div>
            <!-- 添加考试侧弹窗 -->
          </div>
          <div v-if="EditTestId > 0" class="main_item">
            <div class="signbox">
              <span style="margin-right: 3px">已选考试：</span>
            </div>
            <div class="btnbox">
              <a-tag closable color="processing" @close="logT">
                <span style="font-size: 14px; line-height: 33px">{{
                    testName
                  }}</span>
              </a-tag>
            </div>
          </div>
          <div class="mbl_items">
            <div class="item_nam">
              <span style="margin-right: 10px"></span>
            </div>
            <div class="item_inp">
              <FJUpload v-model:value="attach" @changevalue="changevalue"/>
            </div>
          </div>
        </div>
      </div>
      <div class="main_btns">
        <button class="btn1" @click="closeDrawer">取消</button>
        <button class="btn2" @click="confirm">确定</button>
      </div>
    </div>
  </a-drawer>
</template>
<script setup>
import {ref} from "vue";
import SelFacet from "../../components/drawers/SelFacet.vue";
import AddHomework from "../../components/drawers/AddHomework.vue";
import AddTest from "../../components/drawers/AddTest.vue";
import AssessmentList from "@/components/drawers/AssessmentList.vue";
import ProjectManager from "@/components/project/ProjectManagerNew";
import FJUpload from "@/components/common/FJUpload";

// const props = defineProps({
//   courseId: String,
// })
const visible = ref(false)

// const emit = defineEmits({})

const closeDrawer = () => {
 visible.value = false
};
function confirm(){

}

function openDrawer(){
  visible.value=true
}


</script>
<style lang="scss">
.ant-table-striped :deep(.table-striped) td {
  background-color: #fafafa !important;
}

.addfaceteachDrawer {
  .drawerMain {
    .header {
      height: 73px;
      border-bottom: 1px solid #e8e8e8;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-shrink: 0;

      .headerTitle {
        font-size: 18px;
        font-weight: 600;
        color: #333333;
        line-height: 25px;
        margin-left: 24px;
      }
    }

    .contentMain {
      display: flex;
      justify-content: space-between;

      .main_left {
        height: 1080px;
        padding-right: 30px;
        flex: 1;
        border-right: 1px solid #e8e8e8;

        .main_item {
          display: flex;
          align-items: center;
          margin-top: 32px;
          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: #4ea6ff;
              border-radius: 8px;
              border: 0;
              margin-right: 8px;
              color: #fff;
            }
          }
        }

        .main_item2 {
          display: flex;
          align-items: flex-start;
          margin-bottom: 32px;

          .textarea {
            width: 400px;

            .ant-input {
              width: 100%;
            }

            .ant-input-textarea-show-count {
              position: relative;
            }

            .ant-input-textarea-show-count::after {
              position: absolute;
              right: 10px;
              bottom: 0px;
            }

            .ant-input {
              border-radius: 8px;
            }
          }

          .signbox {
            width: 120px;
            display: flex;
            justify-content: end;
            align-items: center;
          }

          .kqszbox {
            .qdqtbox {
              margin-left: 5px;
              cursor: pointer;
            }

            .qdbtn,
            .qtbtn {
              width: 75px;
              height: 24px;
              background: rgba(56, 139, 225, 0.16);
              border-radius: 2px;
              border: 1px solid #387df7;
              display: flex;
              align-items: center;
              justify-content: center;

              .btntext {
                color: #387df7;
              }
            }

            .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: #4ea6ff;
              border-radius: 8px;
              border: 0;
              margin-right: 16px 8px 32px 0;
              color: #fff;
            }
          }
        }
      }

      .main_right {
        width: 400px;

        .main_item {
          display: flex;
          align-items: center;
          margin-top: 32px;
          margin-bottom: 32px;

          .signbox {
            width: 120px;
            display: flex;
            justify-content: end;
            align-items: center;
          }

          .btnbox {
            display: flex;
            flex: 1;
            align-items: center;
            overflow: hidden;
            text-overflow: ellipsis;

            .xkbtn {
              cursor: pointer;
              width: 130px;
              height: 40px;
              background: #4ea6ff;
              border-radius: 8px;
              border: 0;
              margin-right: 8px;
              color: #fff;
            }
          }
        }

        .mbl_items {
          display: flex;
          align-items: center;
          justify-content: flex-end;
          margin-bottom: 10px;

          .item_nam {
            width: 100px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            white-space: nowrap;

            .asterisk_icon {
              width: 10px;
              height: 10px;
              margin-right: 5px;
              margin-top: -15px;
            }
          }

          .item_inp {
            flex: 1;
            position: relative;

            .inp_num {
              position: absolute;
              left: 398px;
              top: 10px;
            }

            .accessory {
              margin-left: 54px;
            }
          }
        }

        .tips {
          font-size: 12px;
          margin-top: 10px;

        }

        .mbl_items12 {
          width: 373px;
          margin-left: -13px;
        }
      }
    }

    .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>
