1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114 |
- 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, '<span style="color:red">' + $scope.keyfilter.key + '</span>');
- 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: "<p class='applyWrapFloor'>" +
- "<i class='ion-ios-pricetags'></i>" +
- "<em>{{pushvalue}}</em>" +
- "<span>普适分</span></p>",
- scope: $scope,
- buttons: [
- {
- text: "取消",
- onTap: function () {
- console.log('取消')
- }
- },
- {
- text: '<span class="ionicAction_span">申请</span>',
- 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<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);
- };
- });
|