oneplus 5 手机调用相机闪退
发布于 4 年前 作者 yuxiuying 6721 次浏览 来自 问答

oneplus 5 手机调用相机,退出小程序

预期:希望和其他Andriod手机一样正常调用相机功能

  • 复现路径
  • 提供一个最简复现 Demo
2 回复

提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

手机oneplus 5
系统安卓8.1.0
微信版本6.6.7

代码片段

wxml

<view class=“page__img”>

<view class=“section section_gap” >

<view class=“section__ctn”>

<view wx:for="{{srcarr}}" wx:key=“key”  class=‘imgblock’>

<image wx:if="{{index==srclength-1}}"  catchtap=“bindaddimg” style=“width: 105rpx; height: 105rpx;margin-right:14rpx;margin-left:14rpx; background-color: #eeeeee; display:{{srclength<6?‘block’:‘none’}}”  src="{{item}}"></image>

<image wx:else="{{index!==srclength}}" catchtouchstart=“start” catchtouchend=“touchend” data-index="{{index}}" style=“width: 105rpx; height: 105rpx;margin-right:14rpx;margin-left:14rpx; background-color: #eeeeee;”  src="{{item}}"></image>

<image class=“deleteimg”  wx:for-index=“deleteIndex"style=“display:{{imgIndex[index]==true?‘block’:‘none’}}” bindtap=“shutimg” wx:if=”{{index!==srclength-1}}" data-id="{{index}}" src=’…/…/images/checkimg.png’></image>

</view>

</view>

</view>

</view>

sxcss:

.currentImgNumber{

font-size:24rpx;

position:absolute;

right:0;

bottom:-6px;

color: #b9b9b9;

}

.imgblock{

display: inline-block;

position: relative;

}

.deleteimg{

position: absolute;

right: -15rpx;

top:-15rpx;

font-size: 24rpx;

z-index: 1000;

width:46rpx;

height: 46rpx;

border: 0rpx solid #dcdddd!important;

}

js:

bindaddimg: function (e) { //添加图片

var imgs = this.data.srcarr;

var c = this.data.srcarr;

var that = this;

var nowCount = this.data.srclength - 1;

wx.chooseImage({

count: 5 - nowCount, // 默认9

sizeType: [‘original’, ‘compressed’], // 可以指定是原图还是压缩图,默认二者都有

sourceType: [‘album’, ‘camera’], // 可以指定来源是相册还是相机,默认二者都有

success: function (res) {

// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片

var tempFilePaths = res.tempFilePaths;

for (var i = 0; i < tempFilePaths.length; i++) {

http.uploadFile(’/miniApp/uploadImg’, tempFilePaths[i],

function (data) {

var data = JSON.parse(data)

var imgs = that.data.srcarr;

var image = [data[0].url];

var c = image.concat(imgs);

if (image) {

that.data.currentImgNumber = that.data.currentImgNumber + 1;

}

var len = that.data.currentImgNumber;

that.setData({

currentImgNumber: len,

srcarr: c,

srclength: c.length,

selectImg: [],

imgIndex: { //选择要删除的图片的下标默认全是false

0: true,

1: true,

2: true,

3: true,

4: true

}

});

}, function (res) {

})

}

}

})

},

回到顶部