<template>
  <a-drawer
    :visible="addvoteVisible"
    class="drawerStyle"
    width="70%"
    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="vote">
          <div class="votebox">
            <img
              class="voteimg"
              src="../../assets/images/basicinfo/asterisk.png"
            />
            <div class="votename">投票名称：</div>
          </div>
          <div style="width: 424px">
            <a-input v-model:value="value" placeholder="请输入投票名称" />
          </div>
        </div>
        <!-- 投票名称 -->
        <!-- 创建投票 -->
        <div class="vote">
          <div class="votebox">
            <img
              class="voteimg"
              src="../../assets/images/basicinfo/asterisk.png"
            />
            <div class="votename">创建投票：</div>
          </div>
          <div class="votebtn" @click="showVoteDrawer">创建投票</div>
        </div>
        <!-- 创建投票 -->
        <!-- 起止时间 -->
        <div class="vote">
          <div class="votebox">
            <div class="voteimg"></div>
            <div class="votename">起止时间：</div>
          </div>
          <div class="votedate">
            <a-range-picker />
          </div>
        </div>
        <!-- 起止时间 -->
        <!-- 基础投票数 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">基础投票数：</div>
          </div>
          <div>
            <div class="votebtn">点击上传</div>
            <div class="voteclassify">支持：xls.xlsx</div>
          </div>
        </div>
        <!-- 基础投票数 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
        <!-- 投票说明 -->
        <div class="vote" style="align-items: flex-start">
          <div class="votebox" style="margin-top: 10px">
            <div class="voteimg"></div>
            <div class="votename">投票说明：</div>
          </div>
          <div style="width: 500px">
            <a-textarea :rows="4" placeholder="请输入投票说明" :maxlength="6" />
          </div>
        </div>
        <!-- 投票说明 -->
      </div>
    </div>
  </a-drawer>
  <a-drawer
    v-model:visible="voteDrawerShow"
    class="custom-class"
    title="创建投票"
    placement="right"
    @after-visible-change="afterVoteVisibleChange"
  >
    <p>Some contents...</p>
    <p>Some contents...</p>
    <p>Some contents...</p>
  </a-drawer>
</template>
<script>
import { reactive, toRefs } from "vue";
export default {
  name: "AddVote",
  props: {
    addvoteVisible: {
      type: Boolean,
      default: false,
    },
  },
  setup(props, ctx) {
    const state = reactive({
      voteDrawerShow: false,
    });
    const closeDrawer = () => {
      ctx.emit("update:addvoteVisible", false);
      ctx.emit("changeData", false);
      localStorage.setItem("stageId", props.chooseStageId);
      localStorage.setItem("chapterId", props.isactive);
    };

    const afterVisibleChange = () => {};

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

    const showVoteDrawer = () => {
      state.voteDrawerShow = true;
    };
    const afterVoteVisibleChange = () => {};
    return {
      ...toRefs(state),
      afterVisibleChange,
      showDrawer,
      closeDrawer,
      // change,
      showVoteDrawer,
      afterVoteVisibleChange,
    };
  },
};
</script>
<style lang="scss">
.addvote {
}
.drawerStyle {
  .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 {
      .vote {
        display: flex;
        align-items: center;
        margin-top: 32px;
        margin-left: 20px;
        .votebox {
          width: 100px;
          display: flex;
          align-items: center;
          justify-content: flex-end;
          // background-color: pink;
          .voteimg {
            width: 10px;
            height: 10px;
            margin-right: 5px;
          }
          .votename {
            font-size: 14px;
            font-weight: 400;
            color: #333333;
            line-height: 20px;
          }
        }

        .votebtn {
          width: 130px;
          height: 40px;
          background: #4ea6ff;
          border-radius: 8px;
          display: flex;
          align-items: center;
          justify-content: center;
          cursor: pointer;
          font-size: 14px;
          font-weight: 400;
          color: #ffffff;
          line-height: 20px;
        }
        .voteclassify {
          font-size: 14px;
          font-weight: 400;
          color: #999999;
          line-height: 20px;
          margin-top: 16px;
        }
        .ant-picker {
          width: 424px;
        }
      }
    }
  }
}
</style>
