123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- angular.module('push')
- .controller('demandRewardDetailCtrl', function ($scope, AccountService, ResourceLibraryService, UserService, CommonService, UtilService, $stateParams, $ionicPopup, $ionicSlideBoxDelegate, dataToolsService) {
- $scope.resid = $stateParams.resid;
- $scope.userid = UserService.id;
- $scope.comefrom = $stateParams.comefrom;
- $scope.list = $stateParams.list;
- $scope.org = {};
- var getDemandRewardDetal = function (insertDBFlag) {
- //0没有实际作用,只为了调通接口
- ResourceLibraryService.getDemandRewardDetal($stateParams.resid, insertDBFlag, 0, 0).then(function (res) {
- if (res.code == 3350) {
- var data = res.data;
- $scope.applyname = data.sysUsersInfo.applyname;
- $scope.certificate = data.sysUsersInfo.brokercertificate;
- $scope.orgname = data.orgName;
- $scope.title = data.resourcelibrary.title;
- $scope.content = data.resourcelibrary.content;
- $scope.contactor = data.resourcelibrary.contactor;
- $scope.tel = data.sysUsersInfo.tel;
- $scope.createtime = data.sysUsers.createtime;
- $scope.demandstatus = data.demandReward.demandstatus;
- $scope.refusereason = data.demandReward.refusereason;
- $scope.org.orguser = data.demandReward.orguser;
- $scope.org.orgtel = data.demandReward.orgtel;
- $scope.restype = data.demandReward.restype;
- $scope.abutList = data.companyAbutLkList;
- $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
- $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
- dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
- if (newRes.code == 3350) {
- $scope.cooperationmodelInfo = newRes.data;
- }
- })
- }
- })
- }
- getDemandRewardDetal(false);
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- if ($scope.app) {
- $scope.setStatusBar(0);
- }
- $scope.bigImage = false;
- }
- $scope.shouBigImage = function (outindex, innerindex) {
- if ($scope.app) {
- $scope.setStatusBar(1);
- }
- $scope.bigImageList = $scope.abutList[outindex].photoList;
- $scope.bigImage = true; //显示大图
- $(function () {
- $('div.pinch-zoom').each(function () {
- new RTP.PinchZoom($(this), {});
- });
- });
- $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
- //图片总数量
- setTimeout(function () {
- $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0);
- //获取图片
- 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);
- }
- $scope.submitDemandReward = function (resid, insertDBFlag) {
- var orguser = $scope.org.orguser;
- var orgtel = $scope.org.orgtel;
- var mess = false;
- if (orguser == null || orguser == undefined) {
- mess = true;
- $ionicPopup.alert({
- title: '提示',
- template: '请填写单位负责人姓名'
- })
- return;
- }
- if (orgtel == null || orgtel == undefined) {
- mess = true;
- $ionicPopup.alert({
- title: '提示',
- template: '请填写负责人联系方式'
- })
- return;
- }
- if (!mess) {
- if ($scope.comefrom == "reward") {
- AccountService.getTechnicalAwardDetail(UserService.id, resid, UserService.node, true, orguser, orgtel, $scope.restype).then(function (res) {
- if (res.code == 3350) {
- $scope.go('reward');
- }
- })
- } else {
- ResourceLibraryService.getDemandRewardDetal(resid, insertDBFlag, orguser, orgtel).then(function (res) {
- if (res.code == 3350) {
- $scope.go('taskHoll');
- }
- })
- }
- }
- }
- })
- ;
|