"use strict";const e=require("../../common/vendor.js"),t=e.defineComponent({data:()=>({positiveImg:"",upLoadPositiveImg:"",reverseImg:"",upLoadReverseImg:"",baidu_token:" "}),onLoad(){},methods:{getImageBase64:(e=null)=>new Promise(((t,o)=>{const s=new FileReader;s.readAsDataURL(e),s.onload=()=>{const e=s.result;t(e)},s.onerror=(e=null)=>o(e)})),uploadPositive(){e.index.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:e=>{this.upLoadPositiveImg=e.tempFilePaths[0],this.getImageBase64(e.tempFiles[0]).then(((e=null)=>{this.uploadIdentify(e)}))}})},uploadReverse(){e.index.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:e=>{this.upLoadReverseImg=e.tempFilePaths[0],this.getImageBase64(e.tempFiles[0]).then(((e=null)=>{this.uploadIdentify(e)}))}})},getACSS_TOKEN(){e.index.request({url:"https://aip.baidubce.com/oauth/2.0/token",method:"POST",data:new UTSJSONObject({grant_type:"client_credentials",client_id:"你的",client_secret:"你的"}),header:new UTSJSONObject({"Content-Type":"application/x-www-form-urlencoded"}),success:e=>{this.baidu_token=e.data.access_token}})},uploadIdentify(t=null){e.index.request({url:"/baiduApi/rest/2.0/ocr/v1/idcard?access_token="+this.baidu_token,method:"POST",data:new UTSJSONObject({image:t,id_card_side:"back"}),header:new UTSJSONObject({"Content-Type":"application/x-www-form-urlencoded"}),success:e=>{console.log(e.data)}})}}});const o=e._export_sfc(t,[["render",function(t,o,s,a,i,d){return{a:""==i.upLoadPositiveImg?i.positiveImg:i.upLoadPositiveImg,b:e.o(((...e)=>d.uploadPositive&&d.uploadPositive(...e))),c:""==i.upLoadReverseImg?i.reverseImg:i.upLoadReverseImg,d:e.o(((...e)=>d.uploadReverse&&d.uploadReverse(...e))),e:e.sei(t.virtualHostId,"view")}}],["__scopeId","data-v-4f0dfac5"]]);wx.createPage(o);
