driverLicenseInformation.Vue 5.3 KB
Newer Older
Nature's avatar
Nature committed
1 2 3 4 5 6 7 8 9 10
/**
* @Author Sean
* @Date 2019/4/23
*/
<template>
  <h-view class="public-style" style="height: 100%" title="驾驶证识别">
    <h-content>
      <list-item>
        <item>
          <div slot="name">姓名</div>
Nature's avatar
Nature committed
11
          <div slot="content">\{{ licenseList.name }}</div>
Nature's avatar
Nature committed
12 13 14 15 16
        </item>
      </list-item>
      <list-item>
        <item>
          <div slot="name">性别</div>
Nature's avatar
Nature committed
17
          <div slot="content">\{{ licenseList.gender }}</div>
Nature's avatar
Nature committed
18 19 20
        </item>
        <item>
          <div slot="name">国籍</div>
Nature's avatar
Nature committed
21
          <div slot="content">\{{ licenseList.nation }}</div>
Nature's avatar
Nature committed
22 23 24
        </item>
        <item>
          <div slot="name">证号</div>
Nature's avatar
Nature committed
25
          <div slot="content">\{{ licenseList.cardno }}</div>
Nature's avatar
Nature committed
26 27 28
        </item>
        <item>
          <div slot="name">住址</div>
Nature's avatar
Nature committed
29
          <div slot="content">\{{ licenseList.address }}</div>
Nature's avatar
Nature committed
30 31 32
        </item>
        <item>
          <div slot="name">出生日期</div>
Nature's avatar
Nature committed
33
          <div slot="content">\{{ licenseList.birthdate }}</div>
Nature's avatar
Nature committed
34 35 36
        </item>
        <item>
          <div slot="name">初次领证日期</div>
Nature's avatar
Nature committed
37
          <div slot="content">\{{ licenseList.issuedate }}</div>
Nature's avatar
Nature committed
38 39 40
        </item>
        <item>
          <div slot="name">准驾车型</div>
Nature's avatar
Nature committed
41
          <div slot="content">\{{ licenseList.driverclass }}</div>
Nature's avatar
Nature committed
42 43 44
        </item>
        <item>
          <div slot="name">有效期限</div>
Nature's avatar
Nature committed
45
          <div slot="content">\{{ licenseList.validdate }}</div>
Nature's avatar
Nature committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
        </item>
      </list-item>
    </h-content>
    <bottom-tab>
      <tab-button @click.native="openShow" >
        识别
      </tab-button>
    </bottom-tab>
  </h-view>
</template>

<script>
  export default {
    data() {
      return {
        licenseList : {
          name: "",
          gender: "",
          nation: "",
          cardno: "",
          address: "",
          birthdate: "",
          issuedate: "",
          driverclass: "",
          validdate :"",
          cropped_image : "",
          created_by : "",
          last_updated_by : ""
        }
      }
    },
    created: function () {
    },
    mounted: function () {
    },
    updated: function () {
    },
    destroyed: function () {
    },
    methods: {
      // 打开sheet操作
      openShow (checkId) {
        let vm = this
        wx.chooseImage({
          count: 1, // 微信最多能选择9张图片
          sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
          sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
          success: function (data) {
            hlsPopup.showLoading('请稍候')
            vm.localIds = data.localIds // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
            /*   data.localIds.forEach((localId, index) => {
                 wx.getLocalImgData({
                   localId: localId, // 图片的localID
                   alert('localId '+ localId)
                   success: function (res) {
                     vm.getHanwanyun(res.localData);
                     alert('路径 '+res.localData)
                   },
                 })
               })*/
            vm.wxImageUpload()
          },
        })
      },
      // 图片上传到微信服务器
      wxImageUpload () {
        let vm = this
        let localId = vm.localIds.pop()
        wx.uploadImage({
          localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
          isShowProgressTips: 0, // 默认为1,显示进度提示
          success: function (res) {

            /* else {
               hlsPopup.hideLoading()
               hlsPopup.showLongCenter('图片上传成功')
             }*/
            vm.getHanwanyun(res.serverId)

          },
        })
      },
      //识别
      getHanwanyun(serverId) {
        let vm = this
        let url = process.env.rootPath + '/havon/media' + '?index=' + serverId
        let param = {
          'wechatCode': process.env.wxCode,
          'mediaId': serverId,
          'sysName': 'HLS_HANVON',
          'apiName': 'hanvon_drivercard',
        }
        hlsHttp.post(url, param).then(function (res) {
          hlsPopup.hideLoading();
          if (res.driverCard.name) {
            vm.licenseList.name = res.driverCard.name;
          }if (res.driverCard.gender) {
            vm.licenseList.gender = res.driverCard.gender;
          }if (res.driverCard.nation) {
            vm.licenseList.nation = res.driverCard.nation;
          }if (res.driverCard.cardno) {
            vm.licenseList.cardno = res.driverCard.cardno;
          }if (res.driverCard.address) {
            vm.licenseList.address = res.driverCard.address;
          }if (res.driverCard.birthdate) {
            vm.licenseList.birthdate = res.driverCard.birthdate;
          }if (res.driverCard.issuedate) {
            vm.licenseList.issuedate = res.driverCard.issuedate;
          }if (res.driverCard.driverclass) {
            vm.licenseList.driverclass = res.driverCard.driverclass;
          }if (res.driverCard.validdate) {
            vm.licenseList.validdate = res.driverCard.validdate;
          }if (res.driverCard.cropped_image) {
            vm.licenseList.cropped_image = res.driverCard.cropped_image;
          }
        });
      },
    }
  }
</script>

<style scoped lang="less" rel="stylesheet">
  .public-style {
    .content {

    }
  }
</style>