bind.vue 3.06 KB
<template>
  <div v-if="showBind" class="third-bind-wrapper">
    <div class="bind-dialog">
      <div class="under-row">
        <i class="iconfont iconphone2"></i>
        <div class="select-block">
          <CubeSelect class="area-code-select" v-model="code" :options="options"></CubeSelect>
        </div>
        <CubeInput class="bind-input" v-model="phone" placeholder="请输入手机号"></CubeInput>
      </div>
      <div class="under-row">
        <i class="iconfont iconyanzhengma"></i>
        <CubeInput class="bind-input" v-model="smsCode" placeholder="请输入验证码"></CubeInput>
        <CubeButton class="send-sms-btn" :disabled="!!sendBtnText" @click="sendSMS">{{sendBtnText || '获取验证码'}}</CubeButton>
      </div>
      <div class="submit-row">
        <CubeButton class="bind-btn">登录</CubeButton>
      </div>
    </div>
  </div>
</template>

<script>

import { Button, Input, Select } from 'cube-ui';

export default {
  name: 'ThirdBind',
  data() {
    return {
      showBind: false,
      code: '+86',
      options: ['+86', '+8700', '+88'],
      phone: '',
      smsCode: '',
      sendBtnText: ''
    }
  },
  methods: {
    show() {
      this.showBind = true;
    },
    sendSMS() {
      let total = 60;
      let timer = setInterval(() => {
        if (--total) {
          this.sendBtnText = '重新获取 ' + total;
        } else {
          this.sendBtnText = '';
          clearInterval(timer)
        }
      }, 1000);
      this.sendBtnText = '重新获取 ' + total;
    }
  },
  components: {
    CubeInput: Input,
    CubeSelect: Select,
    CubeButton: Button
  }
};
</script>

<style lang="scss" scoped>
.third-bind-wrapper {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bind-dialog {
  width: 670px;
  height: 600px;
  padding: 100px 60px;
  font-size: 24px;
  box-sizing: border-box;
  background-color: #fff;
  color: #444;
}

.under-row {
  line-height: 80px;
  border-bottom: 1px solid #eaeaea;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.iconfont {
  font-size: 40px;
  margin-right: 10px;
  vertical-align: middle;
}

.select-block {
  width: 130px;
  position: relative;
  margin-right: 10px;

  &:after {
    content: "";
    width: 1px;
    background-color: #eaeaea;
    position: absolute;
    right: 0;
    top: 30%;
    bottom: 30%;
  }
}

.area-code-select {
  display: inline-block;

  &:after {
    border: 0;
  }

  /deep/ .cube-select-text {
    font-size: 12px;
  }
}

.bind-input {
  flex-grow: 1;

  &:after {
    border: 0;
  }

  /deep/ .cube-input-field {
    font-size: 12px;
  }
}

.send-sms-btn {
  width: 180px;
  height: 54px;
  line-height: 54px;
  padding: 0;
  font-size: 12px;
  border-radius: 27px;
  transform: scale(0.9);

  &:after {
    border: 0;
  }
}

.submit-row {
  margin-top: 80px;
}

.bind-btn {
  height: 120px;
  font-size: 28px;
  background: #022c46;

  &.cube-btn_disabled {
    background: #ccc;
  }
}
</style>