- 小程序wx.chooseImage重复调用问题?
<view class="front_box" data-type="2" bindtap="bindUploadFile"> <image class="idcard_outline" src="{{frontPic}}"></image> <view class="flex tip"> <image class="icon-cammer" src="{{imgUrl}}icon-cammer.jpg"></image> <text>点击扫描身份证</text> <text class="bold PingFangM">人像面</text> </view> bindUploadFile(e){ let that=this; let type =e.currentTarget.dataset.type; console.log(that.data.orderNo) wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success(res) { // tempFilePath可以作为img标签的src属性显示图片 const tempFilePaths = res.tempFilePaths console.log(tempFilePaths) let imgFormat = tempFilePaths[0].substring(tempFilePaths[0].lastIndexOf(".") + 1, tempFilePaths[0].length); wx.getFileSystemManager().readFile({ filePath: res.tempFilePaths[0], //选择图片返回的相对路径 encoding: 'base64', //编码格式 success: ret => { //成功的回调 // console.log('data:image/png;base64,' + ret.data) let param={ flag: "flag", rqstType: 'AJAX', channelNo: '23', identifyNo: '1', ocrType: '07', imgType: imgFormat, paramData: ret.data, type: type, orderNo: that.data.orderNo, customType: '1', contNo: that.data.orderNo } request({ url: 'OCR', data: param }).then(rest=>{ let data = JSON.parse(rest.MESSAGE); wx.showToast({ title: data.message.value, icon: 'none' }) if(type==='2'){ if (data.cardsinfo){ that.setData({ 'cardInfo.name': data.cardsinfo.card.item[1], 'cardInfo.sex': data.cardsinfo.card.item[2], 'cardInfo.birthday': data.cardsinfo.card.item[4], 'cardInfo.idNo': data.cardsinfo.card.item[6], frontPic: tempFilePaths, frontPicFlag: true }) } }else{ if (data.cardsinfo) { that.setData({ 'cardInfo.endDate': data.cardsinfo.card.item[4], backPic: tempFilePaths, backPicFlag: true }) } } }) } }) } }) } 在wx.chooseImage 的时候打开相册,选择完成以后又跳回到相册中如何解决(没有报错,走的是success,我也没有再次调用接口),有时候会出现,有时候不会出现
2020-04-16 - 在web-view中调用wx.miniProgram.navigateTo报undefined?
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"> $scope.clickCloseWind = function () { function ready() { if(window.__wxjs_environment === 'miniprogram'){ wx.miniProgram.navigateTo({url: '/pages/mine/mine'}) }else{ wx.closeWindow(); } } if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) { document.addEventListener('WeixinJSBridgeReady', ready, false) } else { ready() } [图片]
2020-03-22