demandRewardDetailCtrl.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. angular.module('push')
  2. .controller('demandRewardDetailCtrl', function ($scope, AccountService, ResourceLibraryService, UserService, CommonService, UtilService, $stateParams, $ionicPopup, $ionicSlideBoxDelegate, dataToolsService) {
  3. $scope.resid = $stateParams.resid;
  4. $scope.userid = UserService.id;
  5. $scope.comefrom = $stateParams.comefrom;
  6. $scope.list = $stateParams.list;
  7. $scope.org = {};
  8. var getDemandRewardDetal = function (insertDBFlag) {
  9. //0没有实际作用,只为了调通接口
  10. ResourceLibraryService.getDemandRewardDetal($stateParams.resid, insertDBFlag, 0, 0).then(function (res) {
  11. if (res.code == 3350) {
  12. var data = res.data;
  13. $scope.applyname = data.sysUsersInfo.applyname;
  14. $scope.certificate = data.sysUsersInfo.brokercertificate;
  15. $scope.orgname = data.orgName;
  16. $scope.title = data.resourcelibrary.title;
  17. $scope.content = data.resourcelibrary.content;
  18. $scope.contactor = data.resourcelibrary.contactor;
  19. $scope.tel = data.sysUsersInfo.tel;
  20. $scope.createtime = data.sysUsers.createtime;
  21. $scope.demandstatus = data.demandReward.demandstatus;
  22. $scope.refusereason = data.demandReward.refusereason;
  23. $scope.org.orguser = data.demandReward.orguser;
  24. $scope.org.orgtel = data.demandReward.orgtel;
  25. $scope.restype = data.demandReward.restype;
  26. $scope.abutList = data.companyAbutLkList;
  27. $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
  28. $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
  29. dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
  30. if (newRes.code == 3350) {
  31. $scope.cooperationmodelInfo = newRes.data;
  32. }
  33. })
  34. }
  35. })
  36. }
  37. getDemandRewardDetal(false);
  38. $scope.bigImage = false; //初始默认大图是隐藏的
  39. $scope.hideBigImage = function () {
  40. if ($scope.app) {
  41. $scope.setStatusBar(0);
  42. }
  43. $scope.bigImage = false;
  44. }
  45. $scope.shouBigImage = function (outindex, innerindex) {
  46. if ($scope.app) {
  47. $scope.setStatusBar(1);
  48. }
  49. $scope.bigImageList = $scope.abutList[outindex].photoList;
  50. $scope.bigImage = true; //显示大图
  51. $(function () {
  52. $('div.pinch-zoom').each(function () {
  53. new RTP.PinchZoom($(this), {});
  54. });
  55. });
  56. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  57. //图片总数量
  58. setTimeout(function () {
  59. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0);
  60. //获取图片
  61. var imgObj = document.getElementsByClassName('bigimage');
  62. var n;
  63. for (n = 0; n < imgObj.length; n++) {
  64. // 获取图片的原始高度和宽度
  65. var oldWid = imgObj[n].naturalWidth;
  66. var oldHei = imgObj[n].naturalHeight;
  67. var screen = document.body.offsetWidth;
  68. var screenH = window.innerHeight;
  69. // console.log(oldWid/oldHei);
  70. // console.log(screen );
  71. var rate = oldWid / oldHei;
  72. if (oldWid >= screen && oldHei >= screenH) {
  73. var tw = screen;
  74. var th = tw / rate;
  75. if (th < screenH) {
  76. imgObj[n].style.width = tw + 'px';
  77. imgObj[n].style.height = th + 'px';
  78. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  79. } else {
  80. imgObj[n].style.width = screenH * rate + 'px';
  81. imgObj[n].style.height = screenH + 'px';
  82. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  83. }
  84. } else if (oldWid >= screen && oldHei <= screenH) {
  85. imgObj[n].style.width = screen + 'px';
  86. imgObj[n].style.height = screen / rate + 'px';
  87. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  88. } else if (oldWid <= screen && oldHei >= screenH) {
  89. // var hh=screenH;
  90. // var ww=screenH*rate;
  91. imgObj[n].style.width = screenH * rate + 'px';
  92. imgObj[n].style.height = screenH + 'px';
  93. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  94. } else {
  95. imgObj[n].style.width = oldWid + 'px';
  96. imgObj[n].style.height = oldHei + 'px';
  97. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  98. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  99. }
  100. }
  101. }, 500);
  102. }
  103. $scope.submitDemandReward = function (resid, insertDBFlag) {
  104. var orguser = $scope.org.orguser;
  105. var orgtel = $scope.org.orgtel;
  106. var mess = false;
  107. if (orguser == null || orguser == undefined) {
  108. mess = true;
  109. $ionicPopup.alert({
  110. title: '提示',
  111. template: '请填写单位负责人姓名'
  112. })
  113. return;
  114. }
  115. if (orgtel == null || orgtel == undefined) {
  116. mess = true;
  117. $ionicPopup.alert({
  118. title: '提示',
  119. template: '请填写负责人联系方式'
  120. })
  121. return;
  122. }
  123. if (!mess) {
  124. if ($scope.comefrom == "reward") {
  125. AccountService.getTechnicalAwardDetail(UserService.id, resid, UserService.node, true, orguser, orgtel, $scope.restype).then(function (res) {
  126. if (res.code == 3350) {
  127. $scope.go('reward');
  128. }
  129. })
  130. } else {
  131. ResourceLibraryService.getDemandRewardDetal(resid, insertDBFlag, orguser, orgtel).then(function (res) {
  132. if (res.code == 3350) {
  133. $scope.go('taskHoll');
  134. }
  135. })
  136. }
  137. }
  138. }
  139. })
  140. ;