signDemandContractDetailCtrl.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. angular.module('push')
  2. .controller('signDemandContractDetailCtrl', function ($scope, ConfigService, $stateParams, dataToolsService, $ionicSlideBoxDelegate) {
  3. $scope.contract = $stateParams.contract;
  4. //买方单位
  5. dataToolsService.getOrganizationModelByOrgid($scope.contract.buyorgid).then(function (buyres) {
  6. if (buyres.code == 3350) {
  7. $scope.buyorgname = buyres.data.name;
  8. }
  9. })
  10. //卖方单位
  11. $scope.sellorgname = $scope.contract.sellorgname;
  12. //查看技术合同时,获取图片
  13. dataToolsService.getPhotoByContractId($scope.contract.id).then(function(res){
  14. if(res.code == 3350){
  15. $scope.photoList = res.data;
  16. }
  17. })
  18. $scope.showpdf = function(photo){
  19. window.open(ConfigService.imgurl + photo.originalName);
  20. }
  21. //合作模式
  22. dataToolsService.getCooperationmodelByCode($scope.contract.cooperationmodel).then(function (newRes) {
  23. if (newRes.code == 3350) {
  24. $scope.cooperationmodelInfo = newRes.data;
  25. }
  26. })
  27. $scope.bigImage = false; //初始默认大图是隐藏的
  28. $scope.hideBigImage = function () {
  29. if ($scope.app) {
  30. $scope.setStatusBar(0);
  31. }
  32. $scope.bigImage = false;
  33. }
  34. $scope.shouBigImage = function (index) {
  35. if ($scope.app) {
  36. $scope.setStatusBar(1);
  37. }
  38. $scope.bigImage = true; //显示大图
  39. $(function () {
  40. $('div.pinch-zoom').each(function () {
  41. new RTP.PinchZoom($(this), {});
  42. });
  43. });
  44. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  45. //图片总数量
  46. setTimeout(function () {
  47. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  48. //获取图片
  49. var imgObj = document.getElementsByClassName('bigimage');
  50. var n;
  51. for (n = 0; n < imgObj.length; n++) {
  52. // 获取图片的原始高度和宽度
  53. var oldWid = imgObj[n].naturalWidth;
  54. var oldHei = imgObj[n].naturalHeight;
  55. var screen = document.body.offsetWidth;
  56. var screenH = window.innerHeight;
  57. // console.log(oldWid/oldHei);
  58. // console.log(screen );
  59. var rate = oldWid / oldHei;
  60. if (oldWid >= screen && oldHei >= screenH) {
  61. var tw = screen;
  62. var th = tw / rate;
  63. if (th < screenH) {
  64. imgObj[n].style.width = tw + 'px';
  65. imgObj[n].style.height = th + 'px';
  66. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  67. } else {
  68. imgObj[n].style.width = screenH * rate + 'px';
  69. imgObj[n].style.height = screenH + 'px';
  70. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  71. }
  72. } else if (oldWid >= screen && oldHei <= screenH) {
  73. imgObj[n].style.width = screen + 'px';
  74. imgObj[n].style.height = screen / rate + 'px';
  75. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  76. } else if (oldWid <= screen && oldHei >= screenH) {
  77. // var hh=screenH;
  78. // var ww=screenH*rate;
  79. imgObj[n].style.width = screenH * rate + 'px';
  80. imgObj[n].style.height = screenH + 'px';
  81. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  82. } else {
  83. imgObj[n].style.width = oldWid + 'px';
  84. imgObj[n].style.height = oldHei + 'px';
  85. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  86. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  87. }
  88. }
  89. }, 500);
  90. }
  91. });