123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- angular.module('push')
- .controller('ActivityLogistyCtrl', function ($scope, $stateParams, DockingService, UserService,$timeout,$ionicSlideBoxDelegate) {
- var folupid = $stateParams.folupid;
- $scope.role = $stateParams.role;// 当前用户的权限:0用户 3超级管理员
- var orgname = $stateParams.orgname;
- $scope.docking_content = $stateParams.docking_content;
- $scope.user = UserService.user.user;
- $scope.addressstr = "";
- // 获取企业对应的活动跟进表明细
- var getActivitiesFollowupInfo = function () {
- $scope.showLoadingToast();
- DockingService.getActivitiesFollowupInfo(folupid, $scope.role, orgname, $scope.docking_content).then(function (response) {
- if ($scope.role == 0) {
- $scope.activityInfo = response.activityList[0];
- var tempimglist = [];
- angular.forEach($scope.activityInfo.taglist, function (value, index) {
- if (angular.isDefined(value.picList)) {
- if (tempimglist.length > 0) {
- tempimglist = tempimglist.concat(value.picList);
- } else {
- tempimglist = value.picList;
- }
- }
- });
- $scope.activityInfo.imagelist = tempimglist;
- }
- if ($scope.role == 3) {
- $scope.activitylist = response.activityList;
- $scope.companyinfo = response.activityList[0];
- $scope.orglogo = response.activityList[$scope.activitylist.length - 1].orglogo;
- angular.forEach($scope.activitylist, function (val, ind) {
- var tempimglist = [];
- angular.forEach(val.taglist, function (value, index) {
- if (angular.isDefined(value.picList)) {
- if (tempimglist.length > 0) {
- tempimglist = tempimglist.concat(value.picList);
- } else {
- tempimglist = value.picList;
- }
- }
- });
- $scope.activitylist[ind].imagelist = tempimglist;
- })
- }
- if(angular.isDefined($scope.activityInfo.orgplaceaddress)) {
- repslash($scope.activityInfo.orgplaceaddress);
- }
- $scope.hideLoadingToast();
- }, function () {
- UtilService.showMess("网络不给力,请重试");
- $scope.hideLoadingToast();
- });
- };
- getActivitiesFollowupInfo();
- var repslash = function (str) {
- $scope.addressstr = str.replace("/","");
- if($scope.addressstr.indexOf("/") != -1){
- repslash($scope.addressstr);
- }else {
- return $scope.addressstr;
- }
- };
- //点击图片放大
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- if($scope.app){
- $scope.setStatusBar(0);
- }
- $timeout(function () {
- $scope.bigImage = false;
- }, 400);
- };
- $scope.shouBigImage = function (index) { //传递一个参数(图片的URl)
- if($scope.app){
- $scope.setStatusBar(1);
- }
- $(function () {
- $('div.pinch-zoom').each(function () {
- new RTP.PinchZoom($(this), {});
- });
- });
- $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 cc = screen / (oldWid / oldHei);
- imgObj[n].style.height = cc + 'px';
- if (cc < screenH) {
- imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
- // console.log("e:"+imgObj[n].style.marginTop);
- } else {
- imgObj[n].style.marginTop = 0 + 'px';
- // console.log((cc-screenH) +'px')
- }
- }
- }, 10);
- };
- //删除图片
- $scope.deletePhoto = function (index) {
- $scope.activityInfo.imagelist.splice(index, 1);
- };
- });
|