<template>
    <popup v-if="show">
      <img class="bg-scene" :src="bg" alt="">
      <div class="ui-message ui-message-confirm" style="width: 400px">
        <div class="ui-message-header">
          <span>访问密码</span>
          <span>
          </span>
        </div>
        <div class="ui-message-main re-name">
          <div :class="{active: isPassWordFocus}"  >
            <input
              @keyup.enter="emitname"
              class="ui-input"
              type="password"
              ref="uinput"
              maxlength="20"
              placeholder="请输入访问密码"
              v-model="key"
              @focusin="isPassWordFocus = true" 
              @focusout="isPassWordFocus = false"
            />
            <i v-if="key" ref="isearch" class="iconfont iconedit_close" @click="key=''"></i>
          </div>
        </div>
        <div class="ui-message-footer">
          <div class="btn">
            <button @click="emitname" class="ui-button 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:'',
      isPassWordFocus:false
    }
  },
  methods:{
    emitname(){
      this.$refs.uinput.blur()
      if (!this.key.trim()) {
        return
      }
      
      this.$emit('submit',this.key)
    }
  }
}
</script>

<style lang="less" scoped>
.bg-scene{
  width: 100%;
  height: 100%;
  filter:blur(10px);
}
.ui-message-confirm{
  background: #FFFFFF;
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  border: 1px solid #E4E7ED;
  height: 230px;
  .icon_close{
    color: #909090;
  }
  

 
  .ui-message-main{
    margin: 40px auto;
    background: #fff;
    >div{
      position: relative;
      width: 100%;
      height: 36px;
      background: #FFFFFF;
      border-radius: 4px;
      border: 1px solid #EBEDF0;
      >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-input{
      color: #969799;
      background: none;
      border: none;
      width: 100%;
      height: 100%;
    }

    .active{
      border-color: #0076F6;
    }
    
  }
  .ui-message-footer{
    width: 100%;
    .btn{
      width: 80%;
      display: flex;
      justify-content: center;
      margin: 0 auto;
      .ui-button{
        max-width: 104px
      }
    }

  }
}
</style>

<style lang="less" scoped>
.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-button-rect{
  border-radius: 0;
  align-items: center;
  vertical-align: middle;
  color: #202020;
  display: flex;
  justify-content: center;
  padding: 0 20px;
  line-height: 32px;
  height: 32px;
  border: none;
  text-align: center;
  >i{
    margin-left: 5px;
  }
}


.ui-message-header{
  font-size: 18px;
}


</style>