<template>
  <view class="token-input">

    <view class="title">
      请输入EID token
    </view>

    <view style="margin-bottom: 60rpx">
      <input @input="bindTokenInput" placeholder="请输入token" :value="token" />
    </view>

    <view>
      <button @click='onConfirm'>跳转到eID小程序</button>
    </view>

  </view>
</template>

<script>
import { startEid, initEid } from '../mp_ecard_sdk/main'
export default {
  data() {
    return {
      token: '',
    }
  },
  onLaunch: function () {
    //初始化
    initEid();
  },
  methods: {
    bindTokenInput(e) {
      console.log('dd', e)
      this.token = e.detail.value;
    },
    onConfirm() {
      console.log('startEid', startEid)
      const param = {
        data: {
          token: this.token,
        },
        verifyDoneCallback(res) {
          console.log('收到核身完成的res', res);
        },
      };
      this.token && startEid(param);
    },
  }
}
</script>


<style>
.token-input {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* justify-content: center; */
}

input {
  margin-bottom: 40rpx;
  border: 1px solid #ccc;
  width: 600rpx;
  height: 80rpx;
}

button {
  width: 622rpx !important;
  height: 96rpx !important;
  background-color: #198eea;
  color: #FFFFFF;
  border: 2rpx solid #DDDDDD;
  font-size: 32rpx;
  font-weight: normal !important;
  line-height: 96rpx !important;
}
</style>