//拍照上传
function cameraOpen() {
//回调方法
uexCamera.cbOpen = function(opId, dataType, data) {
if (maxImg != 0) {
filefrom += "," + data;
} else {
filefrom += data;
}
var img = filefrom.split(",");
var imgList = "";
maxImg = 0
maxSelect = 5
for (var i in img) {
imgList += '<div class="ub-img uwh-adph umar-r-20" style="float:left;background-image:url(' + img[i] + ')" onclick="deleteImg(\'' + img[i] + '\')"></div>'
maxImg++;
maxSelect--;
}
if (maxImg == 5) {
$('#tianzige').addClass("uhide")
}
$('#userimg').html(imgList)
}
//打开相机
uexCamera.open();
}
//相册上传
function imagePick() {
//回调方法
uexImage.onPickerClosed = function(data) {
console.log(data)
appcan.logs('onPickerClosed:' + data);
if (data == "") {
return;
}
var data = JSON.parse(data);
if (data.isCancelled == true) {
return;
}
for (var i = data.data.length - 1; i >= 0; i--) {
if (maxImg != 0) {
filefrom += "," + data.data[i];
} else {
filefrom += data.data[i];
}
maxImg++;
}
var img = filefrom.split(",");
var imgList = "";
maxImg = 0
maxSelect = 5
for (var i in img) {
imgList += '<div class=" ub-img uwh-adph umar-r-20" style="float:left;background-image:url(' + img[i] + ')" onclick="deleteImg(\'' + img[i] + '\')"></div>'
maxImg++;
maxSelect--;
}
if (maxImg == 5) {
$('#tianzige').addClass("uhide")
}
$('#userimg').html(imgList)
}
var data = JSON.stringify({
min : 1,
max : maxSelect
})
//打开相册
uexImage.openPicker(data);
}
网友评论