identifyCheckCtrl.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * Created by pushkeji on 2018/8/16.
  3. */
  4. angular.module('push')
  5. .controller('identifyCheckCtrl', ['$scope', '$stateParams', 'AccountService', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', '$ionicSlideBoxDelegate', '$timeout', function ($scope, $stateParams, AccountService, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, $ionicSlideBoxDelegate, $timeout) {
  6. if ($stateParams.pageTitle) {
  7. $scope.pageTitle = $stateParams.pageTitle;
  8. } else {
  9. $scope.pageTitle = sessionStorage.indentifyDetailTitle;
  10. }
  11. if ($stateParams.code) {
  12. $scope.code = $stateParams.code;
  13. } else {
  14. $scope.code = sessionStorage.indentifyDetailCode;
  15. }
  16. if ($stateParams.type) {
  17. $scope.type = $stateParams.type;
  18. } else {
  19. $scope.type = sessionStorage.type;
  20. }
  21. if ($scope.type == 5101) {
  22. // 未认证
  23. } else {
  24. // 查看
  25. }
  26. $scope.formList = [
  27. {
  28. title: '统一社会信用代码',
  29. content: '1234564556',
  30. type: 'input',
  31. needed: true,
  32. }, {
  33. title: '所在地区',
  34. type: 'selectArea',
  35. content: '[{"name":"河北省","code":"0"},{"name":"秦皇岛市","code":"130000"},{"name":"昌黎县","code":"130300"}]'
  36. }, {
  37. title: '证件类型',
  38. type: 'certificateType',
  39. content: '身份证',
  40. }, {
  41. title: '证件号码',
  42. type: 'input',
  43. content: '1234567898',
  44. }, {
  45. title: '工作证明',
  46. type: 'upload',
  47. content: '[{"id":0,"title":"","doctype":2901,"isenabled":1,"photoName":"group1/M00/03/B6/wKjIKlt2fSyAd4xeAAAjTv3ipjo563.jpg","originalName":"group1/M00/03/B6/wKjIKlt2fS2AXjEDAAB0To0zfJ0763.jpg","sourceName":"group1/M00/03/B6/wKjIKlt2fTOAd7eaAAUzwhkmoOQ644.jpg","sourceSize":"332.9KB"},{"id":0,"title":"","doctype":2901,"isenabled":1,"photoName":"","originalName":"group1/M00/03/B8/wKjIKFt2fdGANYAAAAB_F00AlS4598.jpg","sourceName":"group1/M00/03/B8/wKjIKFt2fdGAd0E0AATS0lOeySw847.jpg","sourceSize":"308.7KB"},{"id":0,"title":"","doctype":2901,"isenabled":1,"photoName":"group1/M00/03/B6/wKjIKlt2fR2APyJXAAA28DUf37U033.jpg","originalName":"group1/M00/03/B6/wKjIKlt2fR2ARqeHAAC3xB_fbHE692.jpg","sourceName":"group1/M00/03/B6/wKjIKlt2fSqAe-15AAVERVHOkDA760.jpg","sourceSize":"337.1KB"},{"id":0,"title":"","doctype":2901,"isenabled":1,"photoName":"group1/M00/0A/FF/wKjILFt2uE-AcEGlAACa1iazkqs202.jpg","originalName":"group1/M00/0A/FF/wKjILFt2uFCAGFlrAAJylgKvX_E575.jpg","sourceName":"group1/M00/0A/FF/wKjILFt2uFCAPXtUAA_NqCOAzzs573.jpg","sourceSize":"1011.4KB"}]',
  48. imagelist: [],
  49. imageSaveList: [],
  50. imageDeleteList: [],
  51. remarkType: 'manage',
  52. }, {
  53. title: '是否认领机构管理人',
  54. type: 'toggle',
  55. content: '是',
  56. togglecontent: false,
  57. }
  58. ]
  59. // 先从数据中读取照片
  60. angular.forEach($scope.formList, function (val, index) {
  61. if (val.type == 'upload') {
  62. if (val.content != '') {
  63. var temp = JSON.parse(val.content);
  64. val.imagelist = Object.assign([], temp);
  65. val.content = '点击放大查看图片'
  66. }
  67. };
  68. if (val.type == 'selectArea') {
  69. if (val.content != '') {
  70. var tempArea = JSON.parse(val.content);
  71. var str = '';
  72. angular.forEach(tempArea, function (val, index) {
  73. str += val.name + ' ';
  74. })
  75. val.content = str;
  76. }
  77. }
  78. })
  79. // 点击放大图片
  80. //点击图片放大
  81. $scope.bigImage = false; //初始默认大图是隐藏的
  82. $scope.hideBigImage = function () {
  83. $timeout(function () {
  84. $scope.bigImage = false;
  85. }, 400);
  86. };
  87. $scope.shouBigImage = function (index, outerIndex) { //传递一个参数(图片的URl)
  88. console.log('aaa');
  89. $(function () {
  90. $('div.pinch-zoom').each(function () {
  91. new RTP.PinchZoom($(this), {});
  92. });
  93. });
  94. $scope.imagelist = $scope.formList[outerIndex].imagelist;
  95. $scope.bigImage = true;//显示大图
  96. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  97. //图片总数量
  98. setTimeout(function () {
  99. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -10);
  100. //获取图片
  101. var imgObj = document.getElementsByClassName('bigimage');
  102. var n;
  103. for (n = 0; n < imgObj.length; n++) {
  104. // 获取图片的原始高度和宽度
  105. var oldWid = imgObj[n].naturalWidth;
  106. var oldHei = imgObj[n].naturalHeight;
  107. var screen = document.body.offsetWidth;
  108. var screenH = window.innerHeight;
  109. // console.log(oldWid / oldHei);
  110. // console.log(screen);
  111. var rate = oldWid / oldHei;
  112. if (oldWid >= screen && oldHei >= screenH) {
  113. var tw = screen;
  114. var th = tw / rate;
  115. if (th < screenH) {
  116. imgObj[n].style.width = tw + 'px';
  117. imgObj[n].style.height = th + 'px';
  118. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  119. } else {
  120. imgObj[n].style.width = screenH * rate + 'px';
  121. imgObj[n].style.height = screenH + 'px';
  122. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  123. }
  124. } else if (oldWid >= screen && oldHei <= screenH) {
  125. imgObj[n].style.width = screen + 'px';
  126. imgObj[n].style.height = screen / rate + 'px';
  127. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  128. } else if (oldWid <= screen && oldHei >= screenH) {
  129. // var hh=screenH;
  130. // var ww=screenH*rate;
  131. imgObj[n].style.width = screenH * rate + 'px';
  132. imgObj[n].style.height = screenH + 'px';
  133. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  134. } else {
  135. imgObj[n].style.width = oldWid + 'px';
  136. imgObj[n].style.height = oldHei + 'px';
  137. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  138. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  139. }
  140. }
  141. }, 500);
  142. };
  143. window.addEventListener("resize", function () {
  144. var domWidth = window.document.documentElement.getBoundingClientRect().width;
  145. if (domWidth > 540) {
  146. $scope.viewscreen = 'browser';
  147. } else {
  148. $scope.viewscreen = 'app';
  149. }
  150. })
  151. }]);