<template>
    <popup v-if="show">
      <img class="bg-scene" :src="bg" alt="">
      <div class="ui-message ui-message-confirm" style="width: 90%">
        <div class="ui-message-header">
          <span>访问密码</span>
          <span >
          </span>
        </div>
        <div class="ui-message-main re-name">
          <div>
            <input
              @keyup.enter="emitname"
              class="ui-input"
              type="password"
              maxlength="20"
              placeholder="请输入访问密码"
              v-model="key"
            />
            <i v-if="key" class="iconfont icon_close" @click="key=''"></i>
          </div>
        </div>
        <div class="ma-line"></div>
        <div class="ui-message-footer">
          <div class="btn">
            <button @click="emitname" class="ui-button ui-button-rect submit" :class="{disable:!key}" >
              确定
            </button>
          </div>
        </div>
      </div>
    </popup>
</template>

<script>
import Popup from "@/components/shared/popup";

export default {
  props:['show','bg'],
  components:{
    Popup
  },
  data(){
    return {
      key:''
    }
  },
  methods:{
    emitname(){
      if (!this.key.trim()) {
        return this.$alert({ content: "请输入访问密码" });
      }
      this.$emit('submit',this.key)
    }
  }
}
</script>

<style lang="less" scoped>
.bg-scene{
  width: 100%;
  height: 100%;
  filter:blur(10px);
}
.ui-message-confirm{
  border-radius: 0;
  .icon_close{
    color: #909090;
  }
  

  .ui-message-header{
    border-bottom: 1px solid #EBEBEB;
  }
  .ui-message-main{
    width: 80%;
    margin: 20px auto;
    background: #fff;
    .ui-input{
      background-color: #fff;
      border: 1px solid rgba(#909090,0.5);
      color: #909090;
    }
    >div{
      position: relative;
      >i{
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: #ebebeb;
        color: #fff;
        border-radius: 50%;
        padding: 2px;
        cursor: pointer;
        font-size: 14px;
      }
    }
  }
  .ui-message-footer{
    width: 100%;
    padding-top: 20px;
    border-top: 1px solid #EBEBEB;
    .btn{
      width: 80%;
      display: flex;
      justify-content: center;
      margin: 0 auto;
      .ui-button{
        max-width: 104px
      }
    }

    .ui-button-rect{
      border-radius: 0!important;
      align-items: center;
      vertical-align: middle;
      color: #202020;
      display: flex;
      justify-content: center;
      padding: 0 20px;
      line-height: 28px!important;
      height: 28px!important;
      border: none;
      text-align: center;
      max-width: 88px;
      >i{
        margin-left: 5px;
      }
    }
  }
}

.con {
  padding: 24px 30px;
  .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .icon_close{
      color: #202020;
    }
  }
  .btn{
    margin-top: 18px;
    .ui-button{
      position: relative;
      &:hover{
        .upload-list{
          display: block;
        }
      }
    }
  }
  
  >.list{
    margin-top: 20px;
    .img{
      width: 60px;
      height: 60px;
      position: relative;
      overflow: hidden;
      cursor: pointer;
      >img{
        position: absolute;
        height: 100%;
        transform: translate(-50%,-50%);
        top: 50%;
        left: 50%;
      }
    }
    .audio{
      position: relative;
      width: 60px;
      height: 60px;
      i{
        font-size: 24px;
        position: absolute;
        transform: translateY(-50%);
        top: 50%;
        left: 5px;
        cursor: pointer;
      }
    }
  }
}

.cancel{
  background: #EBEBEB;

}



.ui-message-header{
  font-weight: bold;
  font-size: 16px;
}


</style>