12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214 |
- /**
- * Created by pushkeji on 2018/10/11.
- */
- angular.module('push')
- .controller('activityDetailCtrl', ['$scope', 'activitiesModuleService', '$timeout', '$ionicPopup', '$q', 'UserService', '$stateParams', 'ResourceLibraryService', '$ionicSlideBoxDelegate', 'ConfigService',
- 'ScienceCircleService', 'CommonService', '$ionicScrollDelegate', 'ConstantService', '$ionicActionSheet', 'UtilService', 'ShareService', '$ionicModal', 'CommentService', 'dataToolsService', '$sce',
- function ($scope, activitiesModuleService, $timeout, $ionicPopup, $q, UserService, $stateParams, ResourceLibraryService, $ionicSlideBoxDelegate, ConfigService, ScienceCircleService, CommonService, $ionicScrollDelegate, ConstantService,
- $ionicActionSheet, UtilService, ShareService, $ionicModal, CommentService, dataToolsService, $sce) {
- $scope.hasCollect = false;
- $scope.showConsultBox = true;
- $scope.showComment = true;
- var pagenum = 1;
- var pagesize = 15;
- var title = '';
- var user = "";
- console.log($stateParams);
- var editTime = function (time) {
- var a = time.split(':');
- a.pop();
- return a.join(':');
- }
- var recourceid = 0;
- // 获取活动详情
- var getActivityDetailInfo = function () {
- activitiesModuleService.getActivityDetailInfo($stateParams.activityid).then(function (res) {
- console.log('res返回参数', res);
- $scope.allData = res.data;
- recourceid = $scope.allData.activityRecord.otherid;
- $scope.paramsForInfoCommentList.infoid = recourceid;
- $scope.infoComment.infoid = recourceid;
- getInfoCommentList();
- $scope.hasCollect = $scope.allData.collect;
- $scope.hasFavour = $scope.allData.favour;
- $scope.detail = Object.assign({}, res.data.activityInfo);
- $scope.detail.content = $sce.trustAsHtml($scope.detail.content);
- $scope.poster = '';
- $scope.accessory = [];
- var images = $scope.detail.images ? JSON.parse($scope.detail.images) : [];
- if (images.length > 0) {
- angular.forEach(images, function (val) {
- if (val.doctype == 4912) {
- $scope.poster = val.originalName;
- } else {
- $scope.accessory.push(val);
- }
- })
- }
- document.title = res.data.activityInfo.name;
- document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + $scope.poster);
- // 处理时间
- $scope.detail.begintime = editTime($scope.detail.begintime);
- $scope.detail.endtime = editTime($scope.detail.endtime);
- var bgTime = $scope.detail.begintime.split(' ');
- var edTime = $scope.detail.endtime.split(' ');
- $scope.organizeTime = '';
- if (bgTime[0] === edTime[0]) {
- $scope.organizeTime = bgTime[0] + ' ' + bgTime[1] + ' ~ ' + edTime[1];
- } else {
- $scope.organizeTime = $scope.detail.begintime + ' ~ ' + $scope.detail.endtime;
- }
- $scope.detail.dealtime = editTime($scope.detail.dealtime);
- // 活动地址
- $scope.address = $scope.detail.addr ? $scope.detail.addr.replace(/\//g, '') + " " + $scope.detail.addrdetail : $scope.detail.addrdetail;
- // 活动数据
- $scope.dataItem = res.data.tongjidata;
- angular.forEach($scope.dataItem, function (val) {
- val.hasList = val.list && val.list.length > 0;
- });
- $scope.buttonNum = 0;
- $scope.canapply = !res.data.ishasedit && res.data.activityInfo.status == 5300 && res.data.canaction != '5905' && ++$scope.buttonNum;
- if (ConfigService.islogin) {
- $scope.cancelapply = !res.data.ishasedit && res.data.activityInfo.status == 5300 && res.data.canaction == '5905' && ++$scope.buttonNum;
- $scope.ishasedit = res.data.ishasedit && ++$scope.buttonNum;
- $scope.isCancel = $scope.ishasedit && ++$scope.buttonNum;
- $scope.registmanage = res.data.ishasset && ++$scope.buttonNum;
- $scope.ishasinput = res.data.activityInfo.status == 5301 && ++$scope.buttonNum;
- } else {
- }
- // angular.forEach(buttons,function(val){
- // if(val=='5903'){
- // $scope.canapply=!res.data.ishasedit&&res.data.activityInfo.status==5300&&++$scope.buttonNum;
- // $scope.ishasedit=res.data.ishasedit&&++$scope.buttonNum;
- // $scope.isCancel=$scope.ishasedit&&++$scope.buttonNum;
- // $scope.registmanage=(res.data.ishasedit&&++$scope.buttonNum)||(res.data.registmanage&&$scope.buttonNum++);
- // $scope.ishasinput=false;
- // }else{
- // $scope.canapply=false;
- // $scope.ishasedit=false;
- // $scope.ishasset=false;
- // $scope.registmanage=(res.data.ishasedit&&$scope.buttonNum++)||(res.data.registmanage&&$scope.buttonNum++);
- // $scope.ishasinput=++$scope.buttonNum;
- // }
- // })
- // 编辑权限
- // $scope.ishasedit=res.data.ishasedit?res.data.ishasedit:$scope.buttonNum++;
- // 取消权限
- // $scope.ishasset=res.data.ishasset&&$scope.buttonNum++;
- // 报名管理
- // $scope.registmanage=res.data.registmanage&&$scope.buttonNum++;
- // $scope.ishasinput=res.data.ishasinput&&$scope.buttonNum++;
- })
- }
- getActivityDetailInfo();
- // $scope.detail= {
- // addrdetail: "测试活动3地址",
- // begintime: "2018-12-11 09:30:00",
- // content: "测试活动的简介简介简介简介简介简介简介简介简介简介简介",
- // creator: 670,
- // dealtime: "2018-12-27 17:00:00",
- // district: "甘肃省/白银市/靖远县",
- // endtime: "2018-12-28 15:00:00",
- // images: '[{"id":0,"title":"","doctype":4912,"isenabled":1,"photoName":"group3/M00/0B/0A/wKjILFv0vBKAeWXUAACkL__E3Tk447.png","originalName":"group3/M00/0B/0A/wKjILFv0vBeAf3TtAAhU-rYzbZ8482.png","sourceName":"group3/M00/0B/0A/wKjILFv0vBiAXaNYABLZCnk8hN4458.png","sourceSize":"1.2MB"},{"id":0,"title":"","doctype":4900,"isenabled":1,"photoName":"","originalName":"group3/M00/0B/0C/wKjILFwhwBWAQWntAAUmgJZfd2Q366.png","sourceName":"group3/M00/0B/0C/wKjILFwhwBWAETT2AAfyBnYTZ6A668.png","sourceSize":"508.5KB"}]',
- // minpeople: 0,
- // name: "测试活动4",
- // orgname: "测试活动单位",
- // regionsid: "620421",
- // settingItems: '[{"id":1,"linktype":null,"text":"姓名","savekey":"","isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":2,"linktype":null,"text":"电话","savekey":"","isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":5,"linktype":null,"text":"身份证号","savekey":"","isfixed":"false","isneed":false,"type":"","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":4,"linktype":null,"text":"所属行业","savekey":null,"isfixed":"false","isneed":false,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":8,"linktype":null,"text":"需求","savekey":null,"isfixed":"false","isneed":false,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":4,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":3,"linktype":null,"text":"所属机构","savekey":null,"isfixed":"false","isneed":false,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":7,"linktype":null,"text":"成果","savekey":null,"isfixed":"false","isneed":false,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":5,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":9,"linktype":null,"text":"专利","savekey":null,"isfixed":"false","isneed":false,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":7,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":6,"linktype":null,"text":"简介","savekey":null,"isfixed":"false","isneed":false,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true}]',
- // type: 5922,
- // }
- // var settingItems='[{"id":1,"linktype":null,"text":"姓名","savekey":"","isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":2,"linktype":null,"text":"电话","savekey":"","isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":3,"linktype":null,"text":"身份类别","savekey":null,"isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":4,"linktype":null,"text":"所属机构","savekey":null,"isfixed":"true","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"disabled":true},{"id":6,"linktype":null,"text":"身份证号","savekey":"","isfixed":"false","isneed":true,"type":"","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":5,"linktype":null,"text":"所属行业","savekey":null,"isfixed":"false","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":9,"linktype":null,"text":"需求","savekey":null,"isfixed":"false","isneed":true,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":4,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":10,"linktype":null,"text":"专利","savekey":null,"isfixed":"false","isneed":true,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":7,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":8,"linktype":null,"text":"成果","savekey":null,"isfixed":"false","isneed":true,"type":"configurablePages","node":"320412000","orgtype":"10104","pagetitle":"新建录入","pagecode":"1000027","pageid":5,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true},{"id":7,"linktype":null,"text":"简介","savekey":null,"isfixed":"false","isneed":true,"type":"input","node":"320412000","orgtype":"","pagetitle":"","pagecode":"","pageid":null,"tablename":"activity_setting_item","tablecode":null,"hasChosen":true,"disabled":false,"showButton":true}]';
- // $scope.detail.content='<h3>1.简介项目1</h3><h4> 这是个很有意思的活动</h4><h3>2.简介项目2</h3><h4> 就是这个意思了,真的很好</h4><h3>3.简介项目3</h3><h4> 还想说些啥啊?<span style="font-style: italic;">你觉得呢,好的呢是么。解放路打扫房间打脸萨飞机来的肆拾玖坊放假啦时代峰峻多少了房间啊施蒂利克减肥的数量大房间都是拉福建省砥砺奋进收到了经济福利卡萨房价来说大姐夫荆防颗粒打死了附近的撒的拉风</span></h4><h4> 解放垃圾分类撒附件的及复健科打死了附近的萨芬健身房卡萨减肥的金风科技二氢钾而且我两款软件减肥的开始啦积分卡房间打开酸辣粉几十块拉附近的快乐撒房间打开来说房价的快乐撒附近的上课啦惊世毒妃多少克拉放假了SD卡解放路口的积分看了多少积分开了点撒酒疯今飞凯达撒房间打开来说就分开来的撒娇放得开撒酒疯今飞凯达放假啊啊开发建档立卡收费记录卡数据赋雷克萨按揭房可莱丝老司机法拉盛甲方领导萨卡积分卢卡斯解放路</h4>';
- $scope.sectionBoxTitle = [
- { name: '图文直播', selected: true },
- { name: '大家说', selected: false }
- ]
- $scope.hasMore = true;
- console.log($scope.sectionBoxTitle[0].selected && $scope.hasMore);
- $scope.selectSetion = 0;
- $scope.changeSectionPart = function (index) {
- $scope.selectSetion = index;
- angular.forEach($scope.sectionBoxTitle, function (val, indx) {
- val.selected = index == indx;
- })
- $scope.hasMore = false;
- if (index == 0) {
- pagenum = 1;
- $scope.hasMore = true;
- $scope.imageTextList = [];
- $scope.sectionBoxTitle[0].selected = true;
- $scope.getBroadcastList();
- }
- }
- $scope.imageTextList = [
- // {
- // image:'http://www.runoob.com/try/demo_source/blue-album.jpg',
- // title:'图文直播2',
- // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人fasfdsafdsaafdsafdasfdsafdsafasfdsafdsafsdafdsfdf'
- // },{
- // image:'http://www.runoob.com/try/demo_source/siamese-dream.jpg',
- // title:'图文直播3',
- // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
- // },{
- // image:'http://www.runoob.com/try/demo_source/nevermind.jpg',
- // title:'图文直播4',
- // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
- // },{
- // image:'http://www.runoob.com/try/demo_source/license-to-ill.jpg',
- // title:'图文直播5',
- // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
- // },
- ]
- $scope.goToActivityAction = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- $scope.go('activityApply', { settingItems: $scope.detail.settingItems, activityid: $scope.detail.id })
- }
- /****评论*****/
- $scope.comment = { content: "" };
- // var recourceid='';
- var recourcetype = 30124;
- // 评论/评论回复的传参
- $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: '活动详情页'
- };
- // 获取评论列表的传参
- $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
- };
- //获取热门评论列表
- var getInfoCommentList = function () {
- var 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
- };
- CommentService.getInfoCommentList(paramsForInfoCommentList).then(function (response) {
- console.log(response);
- // 评论列表
- $scope.comments = response.data;
- }, function () {
- })
- };
- getInfoCommentList();
- //发布普通评论
- $scope.publishComment = function (type, comment) {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- var content = $scope.comment.content;
- if (content.length == 0) {
- if ($scope.app) {
- UtilService.showMess("请输入评论内容!");
- } else {
- CommonService.showMessage("请输入评论内容!", $scope);
- }
- return;
- }
- $scope.showComment = true;
- $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();
- console.log($scope.infoComment);
- $scope.infoComment.contenttype = '活动详情页';
- CommentService.publishSimpleComment($scope.infoComment).then(function () {
- if ($scope.app) {
- UtilService.showMess("评论成功");
- } else {
- CommonService.showMessage("评论成功", $scope);
- }
- $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) {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- $scope.go("Reply", {
- comment: comment,
- infotype: comment.infotype,
- infoid: comment.infoid,
- comfrom: '活动详情页'
- })
- };
- // 滚动至底部
- var scrollToBottom = function () {
- $timeout(function () {
- $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom();
- }, 0);
- };
- //进入评论列表页
- $scope.goCommentList = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- $timeout(function () {
- $scope.go('comment', {
- mode: 2,
- infoid: $scope.detail.id,
- infotype: 0,
- comfrom: 'task'
- });
- }, 350);
- };
- // 弹出简单评论框
- $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) {
- if ($scope.app) {
- UtilService.showMess("您的评论已超过1000字!");
- } else {
- CommonService.showMessage("您的评论已超过1000字!", $scope);
- }
- $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 customActionParams = {
- clicktype: 0,
- moduleid: 0,
- targetid: 0,
- userid: UserService.id
- }
- // 收藏页面
- $scope.collectResource = function (clicktype, moduleid, targetid) {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- customActionParams = {
- clicktype: clicktype,
- moduleid: moduleid,
- targetid: targetid,
- userid: UserService.id,
- content: '活动详情页'
- }
- console.log(customActionParams);
- CommentService.postClickFavour(customActionParams).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- if (clicktype == 2619 || clicktype == 2620) {
- $scope.hasCollect = !$scope.hasCollect;
- }
- if (clicktype == 2617 || clicktype == 2618) {
- $scope.hasFocus = !$scope.hasFocus;
- }
- if (clicktype == 2615 || clicktype == 2616) {
- $scope.hasFavour = !$scope.hasFavour;
- }
- getActivityDetailInfo();
- }
- })
- }
- // 分享页面
- $scope.shareRsource = function () {
- }
- //分享
- $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) {
- $scope.shareflg = false;
- var linkUrl = ConfigService.webserver + '#/activityDetail/' + $stateParams.activityid;
- console.log(linkUrl);
- var imagurl = $scope.poster ? (ConfigService.imgurl + $scope.poster) : "https://cordova.apache.org/static/img/cordova_bot.png";
- var message = {
- title: $scope.detail.name,
- description: $scope.detail.content.substring(0, 19),
- url: linkUrl,
- imageurl: imagurl
- };
- console.log(linkUrl);
- if ($scope.app) {
- $scope.showLoadingToast();
- // var message = {
- // title: $scope.resourceDetail.title,
- // description: $scope.resourceDetail.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-dialog2');
- console.log(content);
- content.innerHTML = '';
- var qrcode = new QRCode(content, {
- text: $scope.detail.name,
- // title: $scope.resourceDetail.baseInfoModel.title,
- // description: $scope.resourceDetail.baseInfoModel.title.substring(0,19),
- // url: linkUrl,
- // imageurl: imagurl,
- width: 200,
- height: 200
- })
- qrcode.makeCode(linkUrl);
- }
- };
- // 编辑任务
- $scope.editActivityAction = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- $scope.go('activityRelease', { data: JSON.stringify($scope.allData) });
- }
- // 取消活动
- $scope.cancelActivity = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- var params = {
- data: {
- id: $scope.detail.id,
- isenabled: 2,
- creator: $scope.detail.creator
- },
- node: UserService.node,
- }
- activitiesModuleService.releaseOrEditActivity(params).then(function (res) {
- if (user == "") {
- user = res.user;
- }
- if (res.code == 3350) {
- $scope.canapply = false;
- $scope.cancelapply = false;
- $scope.ishasedit = false;
- $scope.isCancel = false;
- $scope.registmanage = false;
- $scope.ishasinput = false;
- if ($scope.app) {
- UtilService.showMess("活动取消成功");
- } else {
- CommonService.showMessage("活动取消成功", $scope);
- }
- }
- })
- }
- // 报名管理
- $scope.goToParticipantList = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- return;
- }
- // const toStr = window.btoa(unescape(encodeURIComponent($scope.detail.settingItems)))
- // console.log(toStr);
- $scope.go('participantList', { activityid: $scope.detail.id, status: $scope.detail.status, settingItems: $scope.detail.settingItems });
- }
- // 现场录入
- $scope.liveBroadcast = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- }
- var isedit = 0;
- $scope.go('visitModularForm', {
- companyid: $stateParams.activityid,
- connid: 0,
- pageid: 17,
- orgtype: 10104,
- pagecode: 1000027,
- isedit: isedit,
- node: 320412000,
- pageTitle: isedit ? '编辑录入' : '新建录入',
- comfrom: 'activityDetail',
- title: title
- });
- }
- $scope.hasMore = true;
- // 现场直播
- $scope.getBroadcastList = function () {
- // var deferred = $q.defer();
- console.log(pagenum);
- activitiesModuleService.liveBroadcastList($stateParams.activityid, pagenum, pagesize).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- angular.forEach(res.data, function (val) {
- var images = JSON.parse(val.images);
- val.image = images && images.length > 0 ? images[0].photoName : '';
- })
- $scope.imageTextList = $scope.imageTextList.concat(res.data);
- if (pagenum >= res.page.totalPage) {
- $scope.hasMore = false;
- }
- pagenum++;
- // deferred.resolve(res.data);
- }
- }).finally(function () {
- $scope.$broadcast('scroll.infiniteScrollComplete');
- });
- // return deferred.promise;
- }
- $scope.getBroadcastList();
- $scope.loadMoreData = function () {
- }
- // 删除现场记录
- $scope.deleteBroadcast = function (id) {
- activitiesModuleService.deleteBroadcast(id, $stateParams.activityid).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- pagenum = 1;
- $scope.hasMore = true;
- $scope.imageTextList = [];
- $scope.getBroadcastList();
- }
- })
- };
- $scope.showModal = false;
- // $scope.checkBroadcastDetail=function(index){
- // console.log($scope.imageTextList[index]);
- // $scope.showModal=true;
- // $scope.liveBroadcastMessage=$scope.imageTextList[index];
- // $scope.liveBroadcastMessage.images=JSON.parse($scope.liveBroadcastMessage.images);
- // };
- //点击图片放大
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- $timeout(function () {
- if ($scope.app) {
- $scope.setStatusBar(0);
- }
- $scope.bigImage = false;
- }, 400);
- };
- $scope.shouBigImage = function (index, type) { //传递一个参数(图片的URl)
- if ($scope.app) {
- $scope.setStatusBar(1);
- }
- if (type == 'accessory') {
- $scope.imgUrlList = $scope.accessory;
- } else {
- $scope.imgUrlList = $scope.liveBroadcastMessage.images;
- }
- console.log($scope.imgUrlList[index]);
- var str = $scope.imgUrlList[index].sourceName.split('.');
- if (str && str.length > 0 && str[1] != 'jpg' && str[1] != 'gif' && str[1] != 'bmp' && str[1] != 'png' && str[1] != 'jpeg') {
- if ($scope.imgUrlList[index]) {
- window.open(ConfigService.imgurl + $scope.imgUrlList[index].sourceName);
- return;
- }
- }
- $scope.bigImage = true; //显示大图
- $(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');
- 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.cancelApplyAction = function () {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- }
- activitiesModuleService.cancelApply($stateParams.activityid).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- $scope.cancelapply = false;
- $scope.canapply = true;
- if ($scope.app) {
- UtilService.showMess("取消报名成功");
- } else {
- CommonService.showMessage("取消报名成功", $scope);
- }
- getActivityDetailInfo();
- }
- })
- }
- $scope.gobackToHoll = function () {
- $scope.go('activitiesHoll');
- }
- $scope.goPublisher = function (id) {
- console.log(id);
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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;
- }
- }
- if (id != 0) {
- $scope.go('publisher', { Id: id });
- }
- }
- // 统计列表页面
- var labelResourceListModal = function () {
- $ionicModal.fromTemplateUrl('./modules/common/views/labelResourceListModal.html', {
- scope: $scope,
- animation: 'slide-in-left'
- }).then(function (modal) {
- $scope.labelResourceListModal = modal;
- });
- }
- labelResourceListModal();
- $scope.openList = function (hasList, item) {
- if (hasList) {
- $scope.searchtype = 2;
- $scope.labelResourceListModal.show();
- $scope.labelTitle = '活动 ' + $scope.detail.name + " " + item.name;
- $scope.allList = item.list;
- angular.forEach($scope.allList, function (val) {
- activitiesModuleService.getUsernameByOrgname(val.title).then(function (res) {
- val.username = res.data;
- })
- });
- console.log($scope.allList);
- }
- }
- $scope.goResourceDetail = function (resource) {
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $scope.go('login');
- 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('resourceCommonDetailsPage', {
- recourceid: resource.id,
- recourcetype: resource.restype,
- recourcecomefrom: resource.comefrom,
- creator: resource.creator,
- title: resource.title
- });
- }
- }
- //微信分享时自定义标题和描述
- var wechatInit = function () {
- var url = encodeURIComponent(window.location.href.split("#")[0]);
- dataToolsService.getWechatConfig(UserService.node, url).then(function (res) {
- if (res.code == 3350) {
- activitiesModuleService.getActivityDetailInfo($stateParams.activityid).then(function (res1) {
- if (res1.code == 3350) {
- $scope.wechattitle = res1.data.activityInfo.name;
- $scope.wechatdesc = res1.data.activityInfo.remark;
- $scope.wechatlink = res.data[3] + "#/activityDetail/" + $stateParams.activityid + "";
- $scope.wechatimg = $scope.poster ? ($scope.poster | imgfilter) : './img/2018/activity-3.jpg';
- wx.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: res.data[4], // 必填,公众号的唯一标识
- timestamp: res.data[0], // 必填,生成签名的时间戳
- nonceStr: res.data[1], // 必填,生成签名的随机串
- signature: res.data[2],// 必填,签名
- jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表
- });
- wx.ready(function () {
- wx.onMenuShareTimeline({
- title: $scope.wechattitle, // 分享标题
- desc: $scope.wechatdesc, // 分享描述
- link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: $scope.wechatimg,
- });
- wx.onMenuShareAppMessage({
- title: $scope.wechattitle, // 分享标题
- desc: $scope.wechatdesc, // 分享描述
- link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: $scope.wechatimg,
- });
- });
- wx.error(function (res) {
- // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
- console.log(JSON.stringify(res));
- });
- }
- })
- }
- })
- };
- wechatInit();
- }]);
|