angular.module('push') .controller('signDemandContractDetailCtrl', function ($scope, ConfigService, $stateParams, dataToolsService, $ionicSlideBoxDelegate) { $scope.contract = $stateParams.contract; //买方单位 dataToolsService.getOrganizationModelByOrgid($scope.contract.buyorgid).then(function (buyres) { if (buyres.code == 3350) { $scope.buyorgname = buyres.data.name; } }) //卖方单位 $scope.sellorgname = $scope.contract.sellorgname; //查看技术合同时,获取图片 dataToolsService.getPhotoByContractId($scope.contract.id).then(function(res){ if(res.code == 3350){ $scope.photoList = res.data; } }) $scope.showpdf = function(photo){ window.open(ConfigService.imgurl + photo.originalName); } //合作模式 dataToolsService.getCooperationmodelByCode($scope.contract.cooperationmodel).then(function (newRes) { if (newRes.code == 3350) { $scope.cooperationmodelInfo = newRes.data; } }) $scope.bigImage = false; //初始默认大图是隐藏的 $scope.hideBigImage = function () { if ($scope.app) { $scope.setStatusBar(0); } $scope.bigImage = false; } $scope.shouBigImage = function (index) { if ($scope.app) { $scope.setStatusBar(1); } $scope.bigImage = true; //显示大图 $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; var screen = document.body.offsetWidth; var screenH = window.innerHeight; // console.log(oldWid/oldHei); // console.log(screen ); var rate = oldWid / oldHei; if (oldWid >= screen && oldHei >= screenH) { var tw = screen; var th = tw / rate; if (th < screenH) { imgObj[n].style.width = tw + 'px'; imgObj[n].style.height = th + 'px'; imgObj[n].style.marginTop = (screenH - th) / 2 + 'px'; } else { imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } } else if (oldWid >= screen && oldHei <= screenH) { imgObj[n].style.width = screen + 'px'; imgObj[n].style.height = screen / rate + 'px'; imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px'; } else if (oldWid <= screen && oldHei >= screenH) { // var hh=screenH; // var ww=screenH*rate; imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } else { imgObj[n].style.width = oldWid + 'px'; imgObj[n].style.height = oldHei + 'px'; imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px'; imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px'; } } }, 500); } });