关于自动调用摄像头的持续拍照的的问题
发布于 5 年前 作者 fanping 10367 次浏览 来自 问答
  • 小程序Camera组件调用摄像头持续自动拍照上传,

部分手机无法按照预期自动拍照(华为手机尤其明显),

而且2~3分钟后手机发烫,电量耗费严重。

  • 所有手机自动拍照上传,得到后台响应后再继续拍第二张进行上传

arwxAPI.taskSequence()

.then(() => arwxAPI.uploadFile({

url: app.globalData.origin + ‘/ar-service/api/v1/info/upload’,

filePath: url,

name: ‘file’,

header: {

“Content-Type”: “multipart/form-data”

},

formData: {

‘openId’: openID,

‘latitude’: this.data.userPoint.lat === undefined ? ‘’ : this.data.userPoint.lat,

‘longitude’: this.data.userPoint.lng === undefined ? ‘’ : this.data.userPoint.lng

}

}))

.then(res => {

//将获取的结果置入

let resultJson = JSON.parse(res.data);

if (resultJson.payload != null && resultJson.payload.infos.length > 0) {

let resultList = [];

for (let num = 0; num < resultJson.payload.infos.length; num++) {

let item = resultJson.payload.infos[num];

let isSame = this.data.resultList.some((val, key) => {

return val.itemId == item.arCode

});

if (!isSame) {

resultList.push({

itemId: item.arCode,

itemIcon: item.iconPath,

itemName: item.title,

content: item.info,

video: item.videoUrl,

dealerList: [{

name: resultJson.payload.dealerName,

addr: resultJson.payload.dealerAddr,

distance: ‘距离’ + resultJson.payload.dealerLength + ‘公里’,

phone: resultJson.payload.dealerTel,

isFavor: false

},

{

name: resultJson.payload.fdName,

addr: resultJson.payload.fdAddr,

distance: ‘距离’ + resultJson.payload.fdLength + ‘公里’,

phone: resultJson.payload.fdTel,

isFavor: true

}

]

});

//弹出扫描结果页面

this.setData({

resultLogo: resultList[0].itemIcon

});

this.setData({

resultscan: true,

scanSuccess: true,

});

this.resultRingAnimation();

}

}

setTimeout(() => {

this.setData({

resultscan: false

});

}, 3500);

let newResultList = this.data.resultList.concat(resultList);

this.setData({

resultList: newResultList.reverse()

});

}

回到顶部