/** * Created by pushkeji on 2018/8/16. */ angular.module('push') .controller('identifyCheckCtrl', ['$scope', '$stateParams', 'AccountService', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', '$ionicSlideBoxDelegate', '$timeout', function ($scope, $stateParams, AccountService, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, $ionicSlideBoxDelegate, $timeout) { if ($stateParams.pageTitle) { $scope.pageTitle = $stateParams.pageTitle; } else { $scope.pageTitle = sessionStorage.indentifyDetailTitle; } if ($stateParams.code) { $scope.code = $stateParams.code; } else { $scope.code = sessionStorage.indentifyDetailCode; } if ($stateParams.type) { $scope.type = $stateParams.type; } else { $scope.type = sessionStorage.type; } if ($scope.type == 5101) { // 未认证 } else { // 查看 } $scope.formList = [ { title: '统一社会信用代码', content: '1234564556', type: 'input', needed: true, }, { title: '所在地区', type: 'selectArea', content: '[{"name":"河北省","code":"0"},{"name":"秦皇岛市","code":"130000"},{"name":"昌黎县","code":"130300"}]' }, { title: '证件类型', type: 'certificateType', content: '身份证', }, { title: '证件号码', type: 'input', content: '1234567898', }, { title: '工作证明', type: 'upload', 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"}]', imagelist: [], imageSaveList: [], imageDeleteList: [], remarkType: 'manage', }, { title: '是否认领机构管理人', type: 'toggle', content: '是', togglecontent: false, } ] // 先从数据中读取照片 angular.forEach($scope.formList, function (val, index) { if (val.type == 'upload') { if (val.content != '') { var temp = JSON.parse(val.content); val.imagelist = Object.assign([], temp); val.content = '点击放大查看图片' } }; if (val.type == 'selectArea') { if (val.content != '') { var tempArea = JSON.parse(val.content); var str = ''; angular.forEach(tempArea, function (val, index) { str += val.name + ' '; }) val.content = str; } } }) // 点击放大图片 //点击图片放大 $scope.bigImage = false; //初始默认大图是隐藏的 $scope.hideBigImage = function () { $timeout(function () { $scope.bigImage = false; }, 400); }; $scope.shouBigImage = function (index, outerIndex) { //传递一个参数(图片的URl) console.log('aaa'); $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $scope.imagelist = $scope.formList[outerIndex].imagelist; $scope.bigImage = true;//显示大图 $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -10); //获取图片 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); }; window.addEventListener("resize", function () { var domWidth = window.document.documentElement.getBoundingClientRect().width; if (domWidth > 540) { $scope.viewscreen = 'browser'; } else { $scope.viewscreen = 'app'; } }) }]);