angular.module('push') .controller('resourceCommonInfoDetailsRepeatPageCtrl', function ($scope, $timeout, $ionicPopup,$rootScope, $stateParams, $ionicScrollDelegate,$ionicActionSheet, dataToolsService, CommentService, UserService, UtilService, roleService, ConstantService, TechnicalBrokerPublishTrainService, ShareService,$ionicSlideBoxDelegate, AccountService,ConfigService,$q,$ionicModal,CommonService) { $scope.searchtype=4; // $stateParams.label?$scope.allLabel=JSON.parse($stateParams.label):''; $scope.defaultLan = UserService.defaultLan; // 按标签查询页面 var labelResourceListModal=function(){ $ionicModal.fromTemplateUrl('./modules/common/views/labelResourceListModal.html', { scope: $scope, animation: 'slide-in-left' }).then(function (modal) { $scope.labelResourceListModal = modal; }); } labelResourceListModal(); $scope.keyfilter={ key:'' } // 搜索关键字标红 $scope.badge = function (title) { var re = eval("/" + $scope.keyfilter.key + "/g"); title = title.replace(re, '' + $scope.keyfilter.key + ''); return $sce.trustAsHtml(title) }; $scope.isShowSearchButton = true; $scope.showSearchButtonLeft=function(){ $scope.isShowSearchButton = false; $timeout(function(){ $(".showSearchInput").focus(); },300) } $scope.clearSearch=function(){ $scope.isShowSearchButton = true; $scope.keyfilter.key = ""; } //进入记录详情 $scope.goDockingdetails = function (rec) { $scope.islogin = ConfigService.islogin; if(!$scope.islogin){ if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } }else{ $scope.labelResourceListModal.hide(); $scope.go('resourceCommonInfoDetailsPage', {resid: rec.id, isAllVisitor: 1,node:UserService.node}); } }; //TODO $scope.comfrom=$stateParams.comfrom; // $stateParams.label?$scope.label=JSON.parse($stateParams.label):''; var funid=$scope.comfrom=='typein'?2:1; // 传入参数 //81:对接宝 var recourceid = $stateParams.resid; var recourcetype = $scope.type = ConstantService.CATEGORY_MODULE_81; // console.log($stateParams); var recourcecomefrom = $stateParams.node; var connid = $stateParams.resid; var isCache = $stateParams.isCache; //登录者id $scope.userId = UserService.id; $scope.imagelist=[]; $rootScope.imgUrlList=[]; /*var recourceid = 27; var recourcetype = $scope.type = ConstantService.CATEGORY_MODULE_81; var recourcecomefrom = "320412000"; var connid = 27; $scope.userId = 653;*/ //加载等待页 $scope.isloadingPageFloor=false; //加载失败页 $scope.isloadingPageFail=false; $scope.isAllVisitor=$stateParams.isAllVisitor;//1:云走访,0是我的走访 // 提交的评论 $scope.comment = {content: ""}; // 点赞 $scope.TRACE_TYPE_2615 = ConstantService.TRACE_TYPE_2615; // 取消点赞 $scope.TRACE_TYPE_2616 = ConstantService.TRACE_TYPE_2616; // 关注 $scope.TRACE_TYPE_2617 = ConstantService.TRACE_TYPE_2617; // 取消关注 $scope.TRACE_TYPE_2618 = ConstantService.TRACE_TYPE_2618; // 收藏 $scope.TRACE_TYPE_2619 = ConstantService.TRACE_TYPE_2619; // 取消收藏 $scope.TRACE_TYPE_2620 = ConstantService.TRACE_TYPE_2620; // 分享 $scope.TRACE_TYPE_2628 = ConstantService.TRACE_TYPE_2628; // 无权限显示内容 $scope.TRACE_TYPE_STRING_2600 = ConstantService.TRACE_TYPE_STRING_2600; // 私密显示内容 $scope.TRACE_TYPE_STRING_2603 = ConstantService.TRACE_TYPE_STRING_2603; // 基本信息表 resourcelibrary $scope.TABLE_CODE_30001 = ConstantService.TABLE_CODE_30001; // 评论表 info_comment $scope.TABLE_CODE_30002 = ConstantService.TABLE_CODE_30002; // 对接信息表 connectioninfo 走访 $scope.TABLE_CODE_30003 = ConstantService.TABLE_CODE_30003; // 用户基本信息 sys_users $scope.TABLE_CODE_30043 = ConstantService.TABLE_CODE_30043; //获取走访历史履历 var getHistoryInterviewList = function (orgid, userid,recourcecomefrom,funid) { TechnicalBrokerPublishTrainService.getHistoryInterviewList("", userid, orgid, 1, funid,recourcecomefrom).then(function (response) { if(UtilService.isDefined(response.data)){ // 获取走访录入界面的传参 $scope.rolePageModel= { //TODO id: response.data.templettype,// 模版id orgtype: 0// 走访对应的机构类型 }; // console.log("================历史走访履历=============="); // 基本信息 $scope.historyInterviewList = response.data; } }, function () { }); }; //获取走访详情 var getBasicInfo=function(){ var deferred = $q.defer(); dataToolsService.getConnectioninfoDetailByConnid(connid,1000002,0,recourcecomefrom).then(function (response){ if(response.data){ $scope.isloadingPageFloor=false; $scope.isloadingPageFail=false; angular.forEach(response.data.infoSectionList,function(val){ if(val.title){ angular.forEach(val.unitlist,function(value){ if(value.addimg){ value.imageList=[]; value.imageList=JSON.parse(value.content); } }) if($stateParams.node=='320412000'||$stateParams.node=='900000001'){ if($scope.comfrom=='typein'&&(($stateParams.templettype!=3&&val.title!='基本信息')||$stateParams.templettype==3)){ $scope.scrollTitle.push(val); }else if($scope.comfrom!='typein'){ $scope.scrollTitle.push(val); } }else{ $scope.scrollTitle.push(val); } } }) $ionicSlideBoxDelegate.update(); } // $scope.$watch("$scope.connInfoDetail.infoSectionList",function(){ // $ionicSlideBoxDelegate.update(); // }); deferred.resolve(response.data); }) return deferred.promise; } var getPublicResourceList = function () { $scope.isloadingPageFloor=true; $scope.scrollTitle=[]; //$scope.showLoadingToast(); // console.log($stateParams); // 获取基本信息 getBasicInfo().then(function(data){ // dataToolsService.getConnectioninfoDetailByConnid(connid,1000002,0,recourcecomefrom).then(function (response) { // if(UtilService.isDefined(response.data)){ // // console.log("=============获取走访详情================="); // console.log(response); // // 基本信息 // $scope.connInfoDetail=response.data; // document.title=$scope.connInfoDetail.baseInfoModel.title; // document.getElementById('shareSourc').setAttribute('src',ConfigService.imgurl+$scope.connInfoDetail.baseInfoModel.logo); // console.log($scope.connInfoDetail); // connid=response.data.id; // $scope.scrollTitle=[]; // angular.forEach(response.data.infoSectionList,function(val){ // if(val.title){ // angular.forEach(val.unitlist,function(value){ // if(value.addimg){ // value.imageList=[]; // value.imageList=JSON.parse(value.content); // } // }) // if($stateParams.node=='320412000'||$stateParams.node=='900000001'){ // if($scope.comfrom=='typein'&&(($stateParams.templettype!=3&&val.title!='基本信息')||$stateParams.templettype==3)){ // $scope.scrollTitle.push(val); // }else if($scope.comfrom!='typein'){ // $scope.scrollTitle.push(val); // } // }else{ // $scope.scrollTitle.push(val); // } // } // }) // $ionicSlideBoxDelegate.update(); // $scope.$watch("$scope.connInfoDetail.infoSectionList",function(){ // $ionicSlideBoxDelegate.update(); // }); // var orgid=$scope.connInfoDetail.baseInfoModel.oid; // var recourcecomefrom = $stateParams.node; // // angular.forEach($scope.connInfoDetail.infoSectionList,function (value) { // // angular.forEach(value.unitlist,function (content) { // // if(content.addimg==1){ // // $scope.imagelist=JSON.stringify(content.content).toString(); // // var imgWrap = JSON.parse($scope.imagelist); // // var v1=eval(imgWrap); // // $rootScope.imgUrlList=$rootScope.imgUrlList.concat(v1); // // } // // }); // // }); // // console.log($scope.connInfoDetail.infoSectionList); // // console.log($rootScope.imgUrlList); // $timeout(function () { // $(".main-select").eq(0).addClass("arrange_borderBottom") // }, 50); // // 获取走访详情后,判断 // $timeout(function () { // //1:云走访,传递用户id=0,0是我的走访,传递登录用户 // var userid = UserService.id; // if($scope.isAllVisitor == 1){ // userid = 0; // } // getHistoryInterviewList(orgid, userid,recourcecomefrom,funid); // }, 100); // } // $timeout(function () { // $scope.isloadingPageFloor=false; // $scope.isloadingPageFail=false; // },50); // //$scope.hideLoadingToast(); // }, function () { // $scope.isloadingPageFloor=false; // //$scope.hideLoadingToast(); // if($scope.app){ // UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); // }else{ // CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR,$scope); // } // $scope.isloadingPageFail=true; // }); // 获取其他信息 dataToolsService.getConnectionOtherInfoDetail(connid,1000002,0,recourcecomefrom).then(function (response) { if(UtilService.isDefined(response.data)){ // console.log("=============获取走访详情================="); console.log(response); $scope.connInfoDetail={}; // 基本信息 if(data.id){ if(response.data.id){ $scope.connInfoDetail=response.data; $scope.connInfoDetail.infoSectionList=Object.assign($scope.connInfoDetail.infoSectionList,data.infoSectionList); }else{ $scope.connInfoDetail=data; } } document.title=$scope.connInfoDetail.baseInfoModel.title; document.getElementById('shareSourc').setAttribute('src',ConfigService.imgurl+$scope.connInfoDetail.baseInfoModel.logo); console.log($scope.connInfoDetail); connid=$scope.connInfoDetail.id; angular.forEach(response.data.infoSectionList,function(val){ if(val.title){ angular.forEach(val.unitlist,function(value){ if(value.addimg){ value.imageList=[]; value.imageList=JSON.parse(value.content); } }) if($stateParams.node=='320412000'||$stateParams.node=='900000001'){ if($scope.comfrom=='typein'&&(($stateParams.templettype!=3&&val.title!='基本信息')||$stateParams.templettype==3)){ $scope.scrollTitle.push(val); }else if($scope.comfrom!='typein'){ $scope.scrollTitle.push(val); } }else{ $scope.scrollTitle.push(val); } } }) $ionicSlideBoxDelegate.update(); $scope.$watch("$scope.connInfoDetail.infoSectionList",function(){ $ionicSlideBoxDelegate.update(); }); var orgid=$scope.connInfoDetail.baseInfoModel.oid; var recourcecomefrom = $stateParams.node; // angular.forEach($scope.connInfoDetail.infoSectionList,function (value) { // angular.forEach(value.unitlist,function (content) { // if(content.addimg==1){ // $scope.imagelist=JSON.stringify(content.content).toString(); // var imgWrap = JSON.parse($scope.imagelist); // var v1=eval(imgWrap); // $rootScope.imgUrlList=$rootScope.imgUrlList.concat(v1); // } // }); // }); console.log($scope.connInfoDetail.infoSectionList); // console.log($rootScope.imgUrlList); $timeout(function () { $(".main-select").eq(0).addClass("arrange_borderBottom") }, 50); // 获取走访详情后,判断 $timeout(function () { //1:云走访,传递用户id=0,0是我的走访,传递登录用户 var userid = UserService.id; if($scope.isAllVisitor == 1){ userid = 0; } getHistoryInterviewList(orgid, userid,recourcecomefrom,funid); }, 100); } $timeout(function () { $scope.isloadingPageFloor=false; $scope.isloadingPageFail=false; },50); //$scope.hideLoadingToast(); }, function () { $scope.isloadingPageFloor=false; //$scope.hideLoadingToast(); if($scope.app){ UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); }else{ CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR,$scope); } $scope.isloadingPageFail=true; }); }) }; getPublicResourceList(); // 走访历史列表 $scope.historyInterviewList = []; //切换到对应页面 var commonChaneSlide=function (num) { //切换到对应页面 /*$scope.act = $scope.activity[num];*/ /************2018****************/ $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop(); $timeout(function () { $("#orgname").prop("disabled", true); },50); /* $scope.act = $scope.activity[num].className;*/ var alltab=document.querySelectorAll(".main-select"); var tablength = alltab.length;//标题个数 var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般 var OffLeft = $(".main-select").eq(num).offset().left;//获取当前点击标题距离父容器左边框的距离 var SelfWidth = $(".main-select").eq(num).width();//获取当前点击标题宽度 var startTranform = $(".visitModule_header .scroll").offset().left+25; var movewidth = OffLeft - middlewidth + SelfWidth / 2; startTranform -= movewidth; if (startTranform <= 0) { if (num < tablength - 1) { $('.visitModule_header .scroll').css({ 'transform': 'translate3d(' + startTranform + 'px,0,0)' }); } } else if (num < 4) { $('.visitModule_header .scroll').css({ 'transform': 'translate3d(0,0,0)' }); } $(".main-select").eq(num).addClass("arrange_borderBottom").siblings().removeClass("arrange_borderBottom"); $ionicSlideBoxDelegate.slide(num); }; // 点击页头切换页面 $scope.changeAct = function (num) { commonChaneSlide(num); }; $scope.go_changed=function(index){ commonChaneSlide(index); }; $timeout(function () { $ionicSlideBoxDelegate.$getByHandle("messageBanner").update(); $(".main-select").eq(0).addClass("arrange_borderBottom") }, 50); $scope.repeatLoad = function () { $scope.isloadingPageFail=false; getPublicResourceList(); }; //分享 $scope.shareflg = false; $scope.openShare = function () { if($scope.app){ $scope.shareflg = true; }else{ $scope.shareMessage(); } }; $scope.closeShareBox = function () { $scope.shareflg = false; }; //TODO $scope.showShareWechat=false; $scope.closeShare=function(){ $scope.showShareWechat=false; }; var sharelink = "https://blog.csdn.net/molong421/article/details/51586194"; //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博 $scope.shareMessage = function (type) { console.log($scope.connInfoDetail); $scope.shareflg = false; var linkUrl=ConfigService.webserver+'#/resourceCommonInfoDetailsRepeatPage/'+$stateParams.resid+'/'+$stateParams.comfrom+'/'+$stateParams.templettype+'/'+$stateParams.node; var imagurl =$scope.connInfoDetail.baseInfoModel.logo?(ConfigService.imgurl+$scope.connInfoDetail.baseInfoModel.logo):"https://cordova.apache.org/static/img/cordova_bot.png"; var message = { title: $scope.connInfoDetail.baseInfoModel.title, description: $scope.connInfoDetail.baseInfoModel.title.substring(0,19), url: linkUrl, imageurl: imagurl }; console.log(linkUrl); if($scope.app){ $scope.showLoadingToast(); // var message = { // title: $scope.connInfoDetail.title, // description: $scope.connInfoDetail.title.substring(0,19), // url: sharelink, // imageurl: imagurl // }; switch (type) { case 0: case 1: ShareService.shareToQQ(type, message).then(function () { $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess("QQ分享成功"); }else{ CommonService.showMessage("QQ分享成功",$scope); } }, function (error) { $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess(error); }else{ CommonService.showMessage(error,$scope); } }); break; case 2: ShareService.shareToWechat(type, message).then(function () { // UtilService.showMess("微信分享成功"); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess("微信分享成功"); }else{ CommonService.showMessage("微信分享成功",$scope); } }, function (error) { // UtilService.showMess(error); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess(error); }else{ CommonService.showMessage(error,$scope); } }); break; case 3: ShareService.shareToWechat(type, message).then(function () { // UtilService.showMess("微信分享成功"); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess("微信分享成功"); }else{ CommonService.showMessage("微信分享成功",$scope); } }, function (error) { // UtilService.showMess(error); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess(error); }else{ CommonService.showMessage(error,$scope); } }); break; case 4: ShareService.shareToWeibo(message).then(function () { // UtilService.showMess("新浪微博分享成功"); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess("新浪微博分享成功"); }else{ CommonService.showMessage("新浪微博分享成功",$scope); } }, function (error) { // UtilService.showMess(error); $scope.hideLoadingToast(); if($scope.app){ UtilService.showMess(error); }else{ CommonService.showMessage(error,$scope); } }); break; default: break; } $timeout(function () { $scope.hideLoadingToast(); }, 10000); }else{ $scope.showShareWechat=true; var content=document.getElementById('qrcode-dialog'); content.innerHTML=''; console.log($scope.connInfoDetail.baseInfoModel.title); var qrcode=new QRCode(content,{ text:$scope.connInfoDetail.baseInfoModel.title, // title: $scope.connInfoDetail.baseInfoModel.title, // description: $scope.connInfoDetail.baseInfoModel.title.substring(0,19), // url: linkUrl, // imageurl: imagurl, width:200, height:200 }) qrcode.makeCode(linkUrl); } }; //发布普通评论 $scope.publishComment = function (type, comment) { $scope.showComment = true; var content = $scope.comment.content; $scope.infoComment.content = content; // 评论 if(type == 1){ $scope.infoComment.parentid = 0;// 评论回复时,记录父评论的id $scope.infoComment.parentuserid = 0;// 评论回复时,记录父评论的创建者 } // 评论回复 else if(type == 2){ $scope.infoComment.parentid = comment.id;// 评论回复时,记录父评论的id $scope.infoComment.parentuserid = comment.creator;// 评论回复时,记录父评论的创建者 } //提交评论信息 $scope.showLoadingToast(); CommentService.publishSimpleComment($scope.infoComment).then(function () { UtilService.showMess("评论成功"); $scope.infoComment.content = ""; getInfoCommentList(); /*if ($scope.comments.length >= 3) { $timeout(function () { $scope.getInfoCommentList(); }, 650); }*/ $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }); }; //发表详细评论 $scope.releaseComment = function () { $scope.go('releaseComment', { infoid: recourceid, infotype: recourcetype, comlen: $scope.commentlist.length, recourcecomefrom: recourcecomefrom }) }; //点击抢沙发 $scope.hadSoft = function () { $scope.showComment = false; $(".my_comment").focus(); }; $scope.showComment = true; $scope.focus_write = function () { scrollToBottom();//滚动至底部 $scope.showComment = false; $(".my_comment").focus(); }; $scope.hiddenComment = function () { $scope.showComment = true; }; //跳转到评论详情页comment $scope.goComment = function (comment) { $scope.go("Reply", {comment: comment, infotype: comment.infotype, infoid: comment.infoid}) }; // 滚动至底部 var scrollToBottom = function () { $timeout(function () { $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom(); }, 0); }; $scope.openCard=function (item) { $scope.connInfoDetail.resourceClasses[item].isShowCard=!$scope.connInfoDetail.resourceClasses[item].isShowCard; }; //进入评论列表页 $scope.goCommentList = function () { $timeout(function () { $scope.go('comment', { mode: 2, infoid: $scope.connInfoDetail.id, infotype: $scope.type }); }, 350); }; // 申请权限消耗普适积分 var consumptionPushPoints = function (authorityid) { // 获取录入界面的传参 $scope.requestModel = { data: [], userid: UserService.id }; // 传参格式 $scope.requestModel.data.push(authorityid); AccountService.consumptionPushPoints($scope.requestModel).then(function (response) { if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) { // console.log("==============申请权限消耗普适积分成功================"); // console.log(response); // 消耗成功后刷新页面 $scope.go('resourceCommonInfoDetailsPage', { resid: recourceid, isAllVisitor: 1, isCache:true // 是否要强制刷新 }); }else if (response.code == ConstantService.INTERFACE_STATUS_CODE_21102) { // 提示积分不足 UtilService.showMess(ConstantService.INTERFACE_MESSAGE_21102); } }, function () { // 购买失败 UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); }); }; //查看将消耗 $scope.isCanApply=function () { $scope.pushvalue = 0; AccountService.getAuthorityInfo(authorityid).then(function (response) { if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) { // 消耗成功后刷新页面 $scope.authorityinfo = response.data; $scope.pushvalue = $scope.authorityinfo.pushvalue; $ionicPopup.show({ title:'申请查看将消耗', template: "
" + "" + "{{pushvalue}}" + "普适分
", scope: $scope, buttons: [ { text: "取消", onTap: function () { console.log('取消') } }, { text: '申请', type: "button-positive", onTap: function () { console.log('申请'); // 申请权限消耗普适积分 consumptionPushPoints(); } } ] }); } }, function () { // 购买失败 UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); }); }; //是否可以申请权限 $scope.isApplyAuthority=function (authorityid) { var tempdata = { title: $scope.connInfoDetail.title, recourceid: recourceid, recourcetype: recourcetype, recourcecomefrom: recourcecomefrom, authorityid: authorityid, type: ConstantService.TRACE_TYPE_2640 }; $scope.go("resourceApply", {authoritydata: angular.toJson(tempdata)}); }; // 获取评论列表的传参 $scope.paramsForInfoCommentList= { mode: 1,// 显示样式:1热门 2全部 infoid: recourceid,// 资源id infotype:recourcetype,// 资源类型 sortkey:0,// 排序字段 sorttype:"ASC",// 排序方式 moduleid:ConstantService.TABLE_CODE_30002,// 评论表对应的code //TODO userid:UserService.id// 登录者id // userid:1// 登录者id }; //详情页评论 $scope.appComment = function () { $scope.showComment = true; var islogin = ConfigService.islogin; if (!islogin) { $ionicLoading.show({ template: '请登录!', noBackdrop: true }); $timeout(function () { $ionicLoading.hide(); }, 1000); return; } else { var content = $scope.comment.say; //提交评论信息 DetailsService.appComment(id, moduleId, content, siteName).then(function () { //评论成功后重新获取评论列表 CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) { // console.log(response); // 评论列表 $scope.comments = response.data; }, function () { }) //重置评论内容为空 $scope.comment.say = ""; }, function () { }); } }; $scope.resource = {}; // 点赞、收藏、分享的传参 $scope.clickRecord= { //TODO targetid: $stateParams.recourceid, // targetid: 124, moduleid: ConstantService.TABLE_CODE_30003, userid:UserService.id, // userid:1, clicktype:1, content:'走访历史详情页' }; // 评论/评论回复的传参 $scope.infoComment= { infoid: recourceid,//资源id infotype:recourcetype,// 资源类别 parentid:0,// 评论回复时,记录父评论的id parentuserid:0,// 评论回复时,记录父评论的创建者 content:"",// 评论/回复内容 //TODO creator:UserService.id,// 创建者 updater:UserService.id,// 更新者 // creator:1,// 创建者 // updater:1// 更新者 contenttype:'走访历史详情页' }; //获取热门评论列表 var getInfoCommentList = function () { CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) { // console.log(response); // 评论列表 $scope.comments = response.data; }, function () { }) }; getInfoCommentList(); // 弹出简单评论框 $scope.showComment = true; $scope.focus_write = function () { $scope.showComment = false; }; // 隐藏简单评论框 $scope.hiddenComment = function () { $scope.showComment = true; }; // 简单评论框内容变更,判断 发表 按钮颜色 $scope.commentValue = function () { var search_history = angular.element(document.getElementsByClassName("my_comment")); if (UtilService.isDefined($scope.comment.content) && $scope.comment.content.length > 1000) { UtilService.showMess("您的评论已超过1000字!"); $scope.comment.content = $scope.comment.content.substr(0, 1000); } if (UtilService.isDefined($scope.comment.content) && $scope.comment.content != 0) { $scope.commentNotnull = { "background-color": "#2a90d7", "text-decoration": "underline" }; }else{ $scope.commentNotnull = { "background-color": "#ccc" }; } }; var search_history = angular.element(document.getElementsByClassName("my_comment")); //查看信息的详情时跳转 $scope.goLibrary=function () { $scope.go(''); }; $scope.opencardWrap=function (currentIndex) { $scope.connInfoDetail.connectioninfoModelList[currentIndex].isShowVisitContent=!$scope.connInfoDetail.connectioninfoModelList[currentIndex].isShowVisitContent; }; $scope.openCard=function () { $scope.connInfoDetail.connectioninfoModelList.isShowCard=!$scope.connInfoDetail.connectioninfoModelList.isShowCard; }; // 控制重复点击 var flag = 1; // 操作:点赞、关注、收藏 $scope.praiseAction=function (clicktype, recourceid, moduleid, ind) { if(flag == 0){ return; } flag = 0; // 点赞 or 收藏 资源 // 取消点赞 or 取消收藏 资源 if(clicktype == $scope.TRACE_TYPE_2615 || clicktype == $scope.TRACE_TYPE_2619 || clicktype == $scope.TRACE_TYPE_2616 || clicktype == $scope.TRACE_TYPE_2620){ $scope.clickRecord.targetid = recourceid; $scope.clickRecord.moduleid = moduleid; }else if(clicktype == $scope.TRACE_TYPE_2617 || clicktype == $scope.TRACE_TYPE_2618){ // 关注 用户 // 取消关注 用户 $scope.clickRecord.targetid = $scope.connInfoDetail.creator; $scope.clickRecord.moduleid = $scope.TABLE_CODE_30043; } $scope.clickRecord.clicktype = clicktype; CommentService.postClickFavour($scope.clickRecord).then(function (response) { // console.log(response); if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) { // 点赞 if(clicktype == $scope.TRACE_TYPE_2615) { // 信息 if(moduleid == $scope.TABLE_CODE_30003) { $scope.connInfoDetail.favourcount = $scope.connInfoDetail.favourcount + 1; $scope.connInfoDetail.favour=!$scope.connInfoDetail.favour; }else // 评论 if(moduleid == $scope.TABLE_CODE_30002) { $scope.comments[ind].favourcount = $scope.comments[ind].favourcount + 1; $scope.comments[ind].favour=!$scope.comments[ind].favour; } }else // 取消点赞 if(clicktype == $scope.TRACE_TYPE_2616) { // 信息 if(moduleid == $scope.TABLE_CODE_30003) { $scope.connInfoDetail.favourcount = $scope.connInfoDetail.favourcount - 1; $scope.connInfoDetail.favour=!$scope.connInfoDetail.favour; }else // 评论 if(moduleid == $scope.TABLE_CODE_30002) { $scope.comments[ind].favourcount = $scope.comments[ind].favourcount - 1; $scope.comments[ind].favour=!$scope.comments[ind].favour; } } // 关注 // 取消关注 else if(clicktype == $scope.TRACE_TYPE_2617 || clicktype == $scope.TRACE_TYPE_2618) { $scope.connInfoDetail.focus=!$scope.connInfoDetail.focus; } // 收藏 // 取消收藏 else if(clicktype == $scope.TRACE_TYPE_2619 || clicktype == $scope.TRACE_TYPE_2620) { $scope.connInfoDetail.collect=!$scope.connInfoDetail.collect; } } // UtilService.showMess(response.clickStatus); // 若是评论点赞,则刷新评论列表 if (moduleid == $scope.TABLE_CODE_30002) { $timeout(function () { getInfoCommentList(); }, 650); } // 恢复可用 flag = 1; }, function () { // 恢复可用 flag = 1; UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR); }) }; // 滚动至底部 var scrollToBottom = function () { $timeout(function () { $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom(); }, 0); }; //打开操作表:设置/编辑 $scope.openActionSheet = function () { // isedit:是否可以编辑资源,isset:是否可以设置权限 var buttonlist = [{text: '复制'}]; if ($scope.connInfoDetail.hasset) { buttonlist.push({text: '设置'}); buttonlist.push({text: '编辑'}); } $ionicActionSheet.show({ buttons: buttonlist, cancelText: '取消', buttonClicked: function (index) { if (index == 0) { //copy $scope.go('visitModularForm', { companyid: 0, pageid: $stateParams.templettype, orgtype: $stateParams.orgtype, isedit: 2, connid: $scope.connInfoDetail.id, pagecode:$stateParams.pagecode, node:$stateParams.node, pageTitle:$stateParams.comfrom=='typein'?'复制并新建录入':'复制并新建走访' }); // $scope.go('visitModularForm', { // companyid: 0, // pageid: $scope.connInfoDetail.templettype, // orgtype: 1, // isedit: 2,// isedit:对应的是0新增/1编辑/2复制并编辑 // connid: $scope.connInfoDetail.id, // pagecode:$stateParams.pagecode, // node:$stateParams.node, // pageTitle:'新建走访' // }); } else if (index == 1) { // console.log($scope.connInfoDetail.typecodemap); $scope.go("selectFieldsToSet", {typecodemap: $scope.connInfoDetail.typecodemap, resid: recourceid, typecode: ConstantService.TABLE_CODE_300031}); } else if (index = 2) { // console.log('编辑'); $scope.go('visitModularForm', { companyid: 0, pageid: $stateParams.templettype, orgtype: $stateParams.orgtype, isedit: 1, connid: $scope.connInfoDetail.id, pagecode:$stateParams.pagecode, node:$stateParams.node, pageTitle:$stateParams.comfrom=='typein'?'编辑录入':'编辑走访' }); return true; } } }); }; //进入资源详情 $scope.jumpResourceDetail = function (company) { console.log(company); // 再跳转到资源详情页 $scope.go('resourceCommonDetailsPage', { recourceid: company.resourcelibrary.id, recourcetype: company.resourcelibrary.restype, recourcecomefrom: company.resourcelibrary.comefrom, creator: company.resourcelibrary.creator, templettype:$stateParams.templettype, orgtype:$stateParams.orgtype, comfrom:$scope.comfrom, title:company.name, // label:$stateParams.label }); }; // 点击走访历史进入走访详情页 $scope.gotoResourceCommonInfoDetailsRepeatPage = function (resid) { $scope.go('resourceCommonInfoDetailsRepeatPage', {resid: resid}); }; // 点击头像或名字进入个人主页 $scope.goPublisher = function (userid) { if (userid != 0) { $scope.go('publisher', {Id: userid}); } }; //点击图片放大 $scope.bigImage = false; //初始默认大图是隐藏的 $scope.hideBigImage = function () { $timeout(function () { if($scope.app){ $scope.setStatusBar(0); } $scope.bigImage = false; }, 400); }; $scope.hideBigImage=function(){ $scope.bigImage = false; } $scope.shouBigImage = function (outerIndex,innerIndex,index) { //传递一个参数(图片的URl) if($scope.app){ $scope.setStatusBar(1); } $scope.bigImage = true; $scope.imgUrlList=$scope.scrollTitle[outerIndex].unitlist[innerIndex].imageList; // console.log($scope.imgUrlList);//显示大图 // console.log(index); $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { // console.log(parseInt($ionicSlideBoxDelegate.slidesCount())); // console.log(parseInt($ionicSlideBoxDelegate.currentIndex())); $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); console.log(imgObj); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; console.log(oldWid); console.log(oldHei); 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