|
|
|
@ -146,8 +146,9 @@ function getData(respone) {
|
|
|
|
|
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >#'+dataInstrument[i].custom_id+'</h3>' |
|
|
|
|
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >@'+dataInstrument[i].caretaker+'</h3>' |
|
|
|
|
+'</div>'; |
|
|
|
|
|
|
|
|
|
console.log(dataInstrument[i].clips.length) |
|
|
|
|
if(dataInstrument[i].clips.length === 0){ |
|
|
|
|
console.log('========= = 0 =========') |
|
|
|
|
imageTag = '<div class="flexCenter">' |
|
|
|
|
+'<div class="flexCenter bgImage">' |
|
|
|
|
+'<div class="flexCenter">' |
|
|
|
@ -171,38 +172,42 @@ function getData(respone) {
|
|
|
|
|
+'</div>' |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
if(dataInstrument[i].clips.length > 1){ |
|
|
|
|
var tagMiniImage = '' |
|
|
|
|
var loopImage = dataInstrument[i].clips.length |
|
|
|
|
var style4 = '' |
|
|
|
|
for(j=1;j<loopImage-1;j++){ |
|
|
|
|
if(dataInstrument[i].clips.length >= 2){ |
|
|
|
|
console.log('*********** >= 2 ***********') |
|
|
|
|
var tagMiniImage = '' |
|
|
|
|
var loopImage = dataInstrument[i].clips.length1 |
|
|
|
|
for(j=1;j<loopImage;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="'+dataInstrument[i].clips[j].photo+'" alt=""/>' |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="'+dataInstrument[i].clips[j].photo+'" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" ></h6>'; |
|
|
|
|
} |
|
|
|
|
for(j=loopImage-1;j<3;j++){ |
|
|
|
|
for(j=loopImage+1;j<3;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="" alt=""/>' |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" >ไม่มีรูปภาพ</h6>'; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
console.log('*********** < 2 ***********') |
|
|
|
|
var tagMiniImage = '' |
|
|
|
|
for(j=1;j<4;j++){ |
|
|
|
|
if (j==3){ |
|
|
|
|
style4 = 'style="margin-top:5px"' |
|
|
|
|
style4 = 'margin-top:5px' |
|
|
|
|
} |
|
|
|
|
tagMiniImage = tagMiniImage |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" '+style4+' src="" alt=""/>' |
|
|
|
|
+'<img id="myImg'+j+''+i+'" class="miniImage" style="'+style4+'" src="" alt=""/>' |
|
|
|
|
+'<h6 class="miniImage flexCenter" >ไม่มีรูปภาพ</h6>'; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(dataInstrument) |
|
|
|
|
|
|
|
|
|
imageTag = '<div class="flexCenter">' |
|
|
|
|
+'<div class="flexCenter bgImage">' |
|
|
|
|
+'<div class="flexCenter">' |
|
|
|
@ -302,6 +307,8 @@ function uploadImage(idImage) {
|
|
|
|
|
console.log(reader) |
|
|
|
|
reader.onload = function(e) { |
|
|
|
|
instrument = dataInstrument[parseInt(idImage)] |
|
|
|
|
console.log(instrument) |
|
|
|
|
console.log('-------------xxxx-------------') |
|
|
|
|
var uriAdd = [{'uri':e.target.result}]; |
|
|
|
|
dataUri = dataUri.concat(uriAdd); |
|
|
|
|
if(idImage == 'add'){ |
|
|
|
@ -310,7 +317,7 @@ function uploadImage(idImage) {
|
|
|
|
|
else{ |
|
|
|
|
var loopImage = instrument.clips.length |
|
|
|
|
for(idImg=0;idImg<loopImage;idImg++){ |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idData].clips[idImg].photo); |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(idImage) |
|
|
|
@ -321,8 +328,10 @@ function uploadImage(idImage) {
|
|
|
|
|
idloopImage = 0 |
|
|
|
|
} |
|
|
|
|
var idUri = 0 |
|
|
|
|
console.log(dataUri) |
|
|
|
|
console.log(loopImage-1) |
|
|
|
|
for(idImg=loopImage-1;idImg<idloopImage+dataUri.length;idImg++){ |
|
|
|
|
console.log(idloopImage+dataUri.length) |
|
|
|
|
for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){ |
|
|
|
|
$('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri); |
|
|
|
|
idUri += 1 |
|
|
|
|
} |
|
|
|
@ -441,12 +450,18 @@ function removeImage(idData){
|
|
|
|
|
loopImage = 1 |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
var time = new Date() |
|
|
|
|
var loopImage = dataInstrument[idData].clips.length |
|
|
|
|
console.log(dataInstrument[idData]) |
|
|
|
|
for(j=0;j<loopImage;j++){ |
|
|
|
|
$('#myImg'+j+''+idData).attr('src', loopImage[j]);
|
|
|
|
|
console.log('#myImg'+j+''+idData) |
|
|
|
|
document.getElementById("myImg"+j+''+idData).src = dataInstrument[idData].clips[j].photo+'?'+time; |
|
|
|
|
console.log(document.getElementById("myImg"+j+''+idData).src) |
|
|
|
|
console.log(document.getElementById("myImg"+j+''+idData)) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
for(j=loopImage-1;j<4;j++){ |
|
|
|
|
for(j=loopImage;j<4;j++){ |
|
|
|
|
$('#myImg'+j+''+idData).attr('src',''); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|