(function () { var page = { isScroll: true, init: function ($page) { renlian.layer.loading(true,"加载图片中"); var userinfo = renlian.storage.get('userinfo'); var postdata = { token: userinfo.baseinfo.token, loginMark: renlian.deviceId(), userid: userinfo.baseinfo.userId }; renlian.http.post(config.webapi + "/?s=api/get_vehicle_ElectronicPlateUrl", postdata, function(res) { if (res.data.BackElectronicPlateUrl != '' && res.data.BackElectronicPlateUrl != null && res.data.FrontElectronicPlateUrl != '' && res.data.FrontElectronicPlateUrl != null) { $('.ElectronicPlate').css('display','block'); var img = new Image(); var imgType = false; var img2 = new Image(); var img2Type = false; var type = false; var bigimg = $(".ElectronicPlate"); img.src = res.data.FrontElectronicPlateUrl; img.id = "FrontElectronicPlateUrl"; img2.src = res.data.BackElectronicPlateUrl; img2.id = "BackElectronicPlateUrl"; // if(img.complete && img2.complete) { // renlian.layer.loading(false); // bigimg.append(img); // bigimg.append(img2); // return; // } img.onload = function(){ bigimg.append(img); $('#FrontElectronicPlateUrl').attr('class','images'); $('#FrontElectronicPlateUrl').css('display','none'); if(type == true){ var n = $('#BackElectronicPlateUrl').next(),p = $('#FrontElectronicPlateUrl').prev(); $('.ElectronicPlate').append($('#BackElectronicPlateUrl')); //$('#FrontElectronicPlateUrl').insertBefore(n); //$('#BackElectronicPlateUrl').insertAfter(p); } imgType = true; if(img2Type == true){ $('#FrontElectronicPlateUrl').css('display','block'); $('#BackElectronicPlateUrl').css('display','block'); renlian.layer.loading(false); } } img2.onload = function(){ bigimg.append(img2); $('#BackElectronicPlateUrl').attr('class','images'); $('#BackElectronicPlateUrl').css('display','none'); if($('#FrontElectronicPlateUrl').length == 0){ type = true; } img2Type = true; if(imgType == true){ $('#FrontElectronicPlateUrl').css('display','block'); $('#BackElectronicPlateUrl').css('display','block'); renlian.layer.loading(false); } } // $('.ElectronicPlate').css('display','block'); // $('#FrontElectronicPlateUrl').attr('src',res.data.FrontElectronicPlateUrl); // $('#BackElectronicPlateUrl').attr('src',res.data.BackElectronicPlateUrl); } else{ $('.isnull').css('display','block'); $('.f-scroll').css('height','100%'); renlian.layer.loading(false); } }); } }; return page; })();