activityDetailCtrl.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. /**
  2. * Created by pushkeji on 2018/10/11.
  3. */
  4. angular.module('push')
  5. .controller('activityDetailCtrl', ['$scope', 'activitiesModuleService', '$timeout', '$ionicPopup', '$q', 'UserService', '$stateParams', 'ResourceLibraryService', '$ionicSlideBoxDelegate', 'ConfigService',
  6. 'ScienceCircleService', 'CommonService', '$ionicScrollDelegate', 'ConstantService', '$ionicActionSheet', 'UtilService', 'ShareService', '$ionicModal', 'CommentService', 'dataToolsService', '$sce',
  7. function ($scope, activitiesModuleService, $timeout, $ionicPopup, $q, UserService, $stateParams, ResourceLibraryService, $ionicSlideBoxDelegate, ConfigService, ScienceCircleService, CommonService, $ionicScrollDelegate, ConstantService,
  8. $ionicActionSheet, UtilService, ShareService, $ionicModal, CommentService, dataToolsService, $sce) {
  9. $scope.hasCollect = false;
  10. $scope.showConsultBox = true;
  11. $scope.showComment = true;
  12. var pagenum = 1;
  13. var pagesize = 15;
  14. var title = '';
  15. var user = "";
  16. console.log($stateParams);
  17. var editTime = function (time) {
  18. var a = time.split(':');
  19. a.pop();
  20. return a.join(':');
  21. }
  22. var recourceid = 0;
  23. // 获取活动详情
  24. var getActivityDetailInfo = function () {
  25. activitiesModuleService.getActivityDetailInfo($stateParams.activityid).then(function (res) {
  26. console.log('res返回参数', res);
  27. $scope.allData = res.data;
  28. recourceid = $scope.allData.activityRecord.otherid;
  29. $scope.paramsForInfoCommentList.infoid = recourceid;
  30. $scope.infoComment.infoid = recourceid;
  31. getInfoCommentList();
  32. $scope.hasCollect = $scope.allData.collect;
  33. $scope.hasFavour = $scope.allData.favour;
  34. $scope.detail = Object.assign({}, res.data.activityInfo);
  35. $scope.detail.content = $sce.trustAsHtml($scope.detail.content);
  36. $scope.poster = '';
  37. $scope.accessory = [];
  38. var images = $scope.detail.images ? JSON.parse($scope.detail.images) : [];
  39. if (images.length > 0) {
  40. angular.forEach(images, function (val) {
  41. if (val.doctype == 4912) {
  42. $scope.poster = val.originalName;
  43. } else {
  44. $scope.accessory.push(val);
  45. }
  46. })
  47. }
  48. document.title = res.data.activityInfo.name;
  49. document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + $scope.poster);
  50. // 处理时间
  51. $scope.detail.begintime = editTime($scope.detail.begintime);
  52. $scope.detail.endtime = editTime($scope.detail.endtime);
  53. var bgTime = $scope.detail.begintime.split(' ');
  54. var edTime = $scope.detail.endtime.split(' ');
  55. $scope.organizeTime = '';
  56. if (bgTime[0] === edTime[0]) {
  57. $scope.organizeTime = bgTime[0] + ' ' + bgTime[1] + ' ~ ' + edTime[1];
  58. } else {
  59. $scope.organizeTime = $scope.detail.begintime + ' ~ ' + $scope.detail.endtime;
  60. }
  61. $scope.detail.dealtime = editTime($scope.detail.dealtime);
  62. // 活动地址
  63. $scope.address = $scope.detail.addr ? $scope.detail.addr.replace(/\//g, '') + " " + $scope.detail.addrdetail : $scope.detail.addrdetail;
  64. // 活动数据
  65. $scope.dataItem = res.data.tongjidata;
  66. angular.forEach($scope.dataItem, function (val) {
  67. val.hasList = val.list && val.list.length > 0;
  68. });
  69. $scope.buttonNum = 0;
  70. $scope.canapply = !res.data.ishasedit && res.data.activityInfo.status == 5300 && res.data.canaction != '5905' && ++$scope.buttonNum;
  71. if (ConfigService.islogin) {
  72. $scope.cancelapply = !res.data.ishasedit && res.data.activityInfo.status == 5300 && res.data.canaction == '5905' && ++$scope.buttonNum;
  73. $scope.ishasedit = res.data.ishasedit && ++$scope.buttonNum;
  74. $scope.isCancel = $scope.ishasedit && ++$scope.buttonNum;
  75. $scope.registmanage = res.data.ishasset && ++$scope.buttonNum;
  76. $scope.ishasinput = res.data.activityInfo.status == 5301 && ++$scope.buttonNum;
  77. } else {
  78. }
  79. // angular.forEach(buttons,function(val){
  80. // if(val=='5903'){
  81. // $scope.canapply=!res.data.ishasedit&&res.data.activityInfo.status==5300&&++$scope.buttonNum;
  82. // $scope.ishasedit=res.data.ishasedit&&++$scope.buttonNum;
  83. // $scope.isCancel=$scope.ishasedit&&++$scope.buttonNum;
  84. // $scope.registmanage=(res.data.ishasedit&&++$scope.buttonNum)||(res.data.registmanage&&$scope.buttonNum++);
  85. // $scope.ishasinput=false;
  86. // }else{
  87. // $scope.canapply=false;
  88. // $scope.ishasedit=false;
  89. // $scope.ishasset=false;
  90. // $scope.registmanage=(res.data.ishasedit&&$scope.buttonNum++)||(res.data.registmanage&&$scope.buttonNum++);
  91. // $scope.ishasinput=++$scope.buttonNum;
  92. // }
  93. // })
  94. // 编辑权限
  95. // $scope.ishasedit=res.data.ishasedit?res.data.ishasedit:$scope.buttonNum++;
  96. // 取消权限
  97. // $scope.ishasset=res.data.ishasset&&$scope.buttonNum++;
  98. // 报名管理
  99. // $scope.registmanage=res.data.registmanage&&$scope.buttonNum++;
  100. // $scope.ishasinput=res.data.ishasinput&&$scope.buttonNum++;
  101. })
  102. }
  103. getActivityDetailInfo();
  104. // $scope.detail= {
  105. // addrdetail: "测试活动3地址",
  106. // begintime: "2018-12-11 09:30:00",
  107. // content: "测试活动的简介简介简介简介简介简介简介简介简介简介简介",
  108. // creator: 670,
  109. // dealtime: "2018-12-27 17:00:00",
  110. // district: "甘肃省/白银市/靖远县",
  111. // endtime: "2018-12-28 15:00:00",
  112. // 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"}]',
  113. // minpeople: 0,
  114. // name: "测试活动4",
  115. // orgname: "测试活动单位",
  116. // regionsid: "620421",
  117. // 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}]',
  118. // type: 5922,
  119. // }
  120. // 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}]';
  121. // $scope.detail.content='<h3>1.简介项目1</h3><h4>&nbsp; &nbsp; 这是个很有意思的活动</h4><h3>2.简介项目2</h3><h4>&nbsp; &nbsp; 就是这个意思了,真的很好</h4><h3>3.简介项目3</h3><h4>&nbsp; &nbsp; 还想说些啥啊?<span style="font-style: italic;">你觉得呢,好的呢是么。解放路打扫房间打脸萨飞机来的肆拾玖坊放假啦时代峰峻多少了房间啊施蒂利克减肥的数量大房间都是拉福建省砥砺奋进收到了经济福利卡萨房价来说大姐夫荆防颗粒打死了附近的撒的拉风</span></h4><h4>&nbsp; &nbsp; 解放垃圾分类撒附件的及复健科打死了附近的萨芬健身房卡萨减肥的金风科技二氢钾而且我两款软件减肥的开始啦积分卡房间打开酸辣粉几十块拉附近的快乐撒房间打开来说房价的快乐撒附近的上课啦惊世毒妃多少克拉放假了SD卡解放路口的积分看了多少积分开了点撒酒疯今飞凯达撒房间打开来说就分开来的撒娇放得开撒酒疯今飞凯达放假啊啊开发建档立卡收费记录卡数据赋雷克萨按揭房可莱丝老司机法拉盛甲方领导萨卡积分卢卡斯解放路</h4>';
  122. $scope.sectionBoxTitle = [
  123. { name: '图文直播', selected: true },
  124. { name: '大家说', selected: false }
  125. ]
  126. $scope.hasMore = true;
  127. console.log($scope.sectionBoxTitle[0].selected && $scope.hasMore);
  128. $scope.selectSetion = 0;
  129. $scope.changeSectionPart = function (index) {
  130. $scope.selectSetion = index;
  131. angular.forEach($scope.sectionBoxTitle, function (val, indx) {
  132. val.selected = index == indx;
  133. })
  134. $scope.hasMore = false;
  135. if (index == 0) {
  136. pagenum = 1;
  137. $scope.hasMore = true;
  138. $scope.imageTextList = [];
  139. $scope.sectionBoxTitle[0].selected = true;
  140. $scope.getBroadcastList();
  141. }
  142. }
  143. $scope.imageTextList = [
  144. // {
  145. // image:'http://www.runoob.com/try/demo_source/blue-album.jpg',
  146. // title:'图文直播2',
  147. // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人fasfdsafdsaafdsafdasfdsafdsafasfdsafdsafsdafdsfdf'
  148. // },{
  149. // image:'http://www.runoob.com/try/demo_source/siamese-dream.jpg',
  150. // title:'图文直播3',
  151. // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
  152. // },{
  153. // image:'http://www.runoob.com/try/demo_source/nevermind.jpg',
  154. // title:'图文直播4',
  155. // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
  156. // },{
  157. // image:'http://www.runoob.com/try/demo_source/license-to-ill.jpg',
  158. // title:'图文直播5',
  159. // content:'图文直播1的内容,很好啊,嘿嘿,很多企业,很多搞下,很多人'
  160. // },
  161. ]
  162. $scope.goToActivityAction = function () {
  163. if (!ConfigService.islogin) {
  164. if (localStorage.wxFlag == "true") {
  165. if (localStorage.isUserFocusXW == 0) {
  166. var title = localStorage.appidStr;
  167. $scope.go('login');
  168. return;
  169. } else {
  170. if (localStorage.isUserBindWx == 0) {
  171. var wxFlag = JSON.parse(localStorage.params);
  172. if (wxFlag.weChatModel) {
  173. $scope.go('bindPhone', {
  174. params: localStorage.params,
  175. comfrom: 'maincontroller',
  176. url: window.location.href.split('#/')[1]
  177. });
  178. } else {
  179. $scope.go('login');
  180. return;
  181. }
  182. } else {
  183. $scope.go('login');
  184. return;
  185. }
  186. }
  187. } else {
  188. $scope.go('login');
  189. return;
  190. }
  191. return;
  192. }
  193. $scope.go('activityApply', { settingItems: $scope.detail.settingItems, activityid: $scope.detail.id })
  194. }
  195. /****评论*****/
  196. $scope.comment = { content: "" };
  197. // var recourceid='';
  198. var recourcetype = 30124;
  199. // 评论/评论回复的传参
  200. $scope.infoComment =
  201. {
  202. infoid: recourceid,//资源id
  203. infotype: recourcetype,// 资源类别
  204. parentid: 0,// 评论回复时,记录父评论的id
  205. parentuserid: 0,// 评论回复时,记录父评论的创建者
  206. content: "",// 评论/回复内容
  207. //TODO
  208. creator: UserService.id,// 创建者
  209. updater: UserService.id,// 更新者
  210. // creator:1,// 创建者
  211. // updater:1// 更新者
  212. contenttype: '活动详情页'
  213. };
  214. // 获取评论列表的传参
  215. $scope.paramsForInfoCommentList =
  216. {
  217. mode: 1,// 显示样式:1热门 2全部
  218. infoid: recourceid,// 资源id
  219. infotype: recourcetype,// 资源类型
  220. sortkey: 0,// 排序字段
  221. sorttype: "ASC",// 排序方式
  222. moduleid: ConstantService.TABLE_CODE_30002,// 评论表对应的code
  223. //TODO
  224. userid: UserService.id// 登录者id
  225. // userid:1// 登录者id
  226. };
  227. //获取热门评论列表
  228. var getInfoCommentList = function () {
  229. var paramsForInfoCommentList = {
  230. mode: 1,// 显示样式:1热门 2全部
  231. infoid: recourceid,// 资源id
  232. infotype: recourcetype,// 资源类型
  233. sortkey: 0,// 排序字段
  234. sorttype: "ASC",// 排序方式
  235. moduleid: ConstantService.TABLE_CODE_30002,// 评论表对应的code
  236. //TODO
  237. userid: UserService.id// 登录者id
  238. // userid:1// 登录者id
  239. };
  240. CommentService.getInfoCommentList(paramsForInfoCommentList).then(function (response) {
  241. console.log(response);
  242. // 评论列表
  243. $scope.comments = response.data;
  244. }, function () {
  245. })
  246. };
  247. getInfoCommentList();
  248. //发布普通评论
  249. $scope.publishComment = function (type, comment) {
  250. if (!ConfigService.islogin) {
  251. if (localStorage.wxFlag == "true") {
  252. if (localStorage.isUserFocusXW == 0) {
  253. var title = localStorage.appidStr;
  254. $scope.go('login');
  255. return;
  256. } else {
  257. if (localStorage.isUserBindWx == 0) {
  258. var wxFlag = JSON.parse(localStorage.params);
  259. if (wxFlag.weChatModel) {
  260. $scope.go('bindPhone', {
  261. params: localStorage.params,
  262. comfrom: 'maincontroller',
  263. url: window.location.href.split('#/')[1]
  264. });
  265. } else {
  266. $scope.go('login');
  267. return;
  268. }
  269. } else {
  270. $scope.go('login');
  271. return;
  272. }
  273. }
  274. } else {
  275. $scope.go('login');
  276. return;
  277. }
  278. return;
  279. }
  280. var content = $scope.comment.content;
  281. if (content.length == 0) {
  282. if ($scope.app) {
  283. UtilService.showMess("请输入评论内容!");
  284. } else {
  285. CommonService.showMessage("请输入评论内容!", $scope);
  286. }
  287. return;
  288. }
  289. $scope.showComment = true;
  290. $scope.infoComment.content = content;
  291. // 评论
  292. if (type == 1) {
  293. $scope.infoComment.parentid = 0;// 评论回复时,记录父评论的id
  294. $scope.infoComment.parentuserid = 0;// 评论回复时,记录父评论的创建者
  295. }
  296. // 评论回复
  297. else if (type == 2) {
  298. $scope.infoComment.parentid = comment.id;// 评论回复时,记录父评论的id
  299. $scope.infoComment.parentuserid = comment.creator;// 评论回复时,记录父评论的创建者
  300. }
  301. //提交评论信息
  302. $scope.showLoadingToast();
  303. console.log($scope.infoComment);
  304. $scope.infoComment.contenttype = '活动详情页';
  305. CommentService.publishSimpleComment($scope.infoComment).then(function () {
  306. if ($scope.app) {
  307. UtilService.showMess("评论成功");
  308. } else {
  309. CommonService.showMessage("评论成功", $scope);
  310. }
  311. $scope.infoComment.content = "";
  312. getInfoCommentList();
  313. /*if ($scope.comments.length >= 3) {
  314. $timeout(function () {
  315. $scope.getInfoCommentList();
  316. }, 650);
  317. }*/
  318. $scope.hideLoadingToast();
  319. }, function () {
  320. $scope.hideLoadingToast();
  321. });
  322. };
  323. //发表详细评论
  324. $scope.releaseComment = function () {
  325. $scope.go('releaseComment', {
  326. infoid: recourceid,
  327. infotype: recourcetype,
  328. comlen: $scope.commentlist.length,
  329. recourcecomefrom: recourcecomefrom
  330. })
  331. };
  332. //点击抢沙发
  333. $scope.hadSoft = function () {
  334. $scope.showComment = false;
  335. $(".my_comment").focus();
  336. };
  337. $scope.showComment = true;
  338. $scope.focus_write = function () {
  339. scrollToBottom();//滚动至底部
  340. $scope.showComment = false;
  341. $(".my_comment").focus();
  342. };
  343. $scope.hiddenComment = function () {
  344. $scope.showComment = true;
  345. };
  346. //跳转到评论详情页comment
  347. $scope.goComment = function (comment) {
  348. if (!ConfigService.islogin) {
  349. if (localStorage.wxFlag == "true") {
  350. if (localStorage.isUserFocusXW == 0) {
  351. var title = localStorage.appidStr;
  352. $scope.go('login');
  353. return;
  354. } else {
  355. if (localStorage.isUserBindWx == 0) {
  356. var wxFlag = JSON.parse(localStorage.params);
  357. if (wxFlag.weChatModel) {
  358. $scope.go('bindPhone', {
  359. params: localStorage.params,
  360. comfrom: 'maincontroller',
  361. url: window.location.href.split('#/')[1]
  362. });
  363. } else {
  364. $scope.go('login');
  365. return;
  366. }
  367. } else {
  368. $scope.go('login');
  369. return;
  370. }
  371. }
  372. } else {
  373. $scope.go('login');
  374. return;
  375. }
  376. return;
  377. }
  378. $scope.go("Reply", {
  379. comment: comment,
  380. infotype: comment.infotype,
  381. infoid: comment.infoid,
  382. comfrom: '活动详情页'
  383. })
  384. };
  385. // 滚动至底部
  386. var scrollToBottom = function () {
  387. $timeout(function () {
  388. $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom();
  389. }, 0);
  390. };
  391. //进入评论列表页
  392. $scope.goCommentList = function () {
  393. if (!ConfigService.islogin) {
  394. if (localStorage.wxFlag == "true") {
  395. if (localStorage.isUserFocusXW == 0) {
  396. var title = localStorage.appidStr;
  397. $scope.go('login');
  398. return;
  399. } else {
  400. if (localStorage.isUserBindWx == 0) {
  401. var wxFlag = JSON.parse(localStorage.params);
  402. if (wxFlag.weChatModel) {
  403. $scope.go('bindPhone', {
  404. params: localStorage.params,
  405. comfrom: 'maincontroller',
  406. url: window.location.href.split('#/')[1]
  407. });
  408. } else {
  409. $scope.go('login');
  410. return;
  411. }
  412. } else {
  413. $scope.go('login');
  414. return;
  415. }
  416. }
  417. } else {
  418. $scope.go('login');
  419. return;
  420. }
  421. return;
  422. }
  423. $timeout(function () {
  424. $scope.go('comment', {
  425. mode: 2,
  426. infoid: $scope.detail.id,
  427. infotype: 0,
  428. comfrom: 'task'
  429. });
  430. }, 350);
  431. };
  432. // 弹出简单评论框
  433. $scope.showComment = true;
  434. $scope.focus_write = function () {
  435. $scope.showComment = false;
  436. };
  437. // 隐藏简单评论框
  438. $scope.hiddenComment = function () {
  439. $scope.showComment = true;
  440. };
  441. // 简单评论框内容变更,判断 发表 按钮颜色
  442. $scope.commentValue = function () {
  443. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  444. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content.length > 1000) {
  445. if ($scope.app) {
  446. UtilService.showMess("您的评论已超过1000字!");
  447. } else {
  448. CommonService.showMessage("您的评论已超过1000字!", $scope);
  449. }
  450. $scope.comment.content = $scope.comment.content.substr(0, 1000);
  451. }
  452. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content != 0) {
  453. $scope.commentNotnull = {
  454. "background-color": "#2a90d7",
  455. "text-decoration": "underline"
  456. };
  457. } else {
  458. $scope.commentNotnull = {
  459. "background-color": "#ccc"
  460. };
  461. }
  462. };
  463. var customActionParams = {
  464. clicktype: 0,
  465. moduleid: 0,
  466. targetid: 0,
  467. userid: UserService.id
  468. }
  469. // 收藏页面
  470. $scope.collectResource = function (clicktype, moduleid, targetid) {
  471. if (!ConfigService.islogin) {
  472. if (localStorage.wxFlag == "true") {
  473. if (localStorage.isUserFocusXW == 0) {
  474. var title = localStorage.appidStr;
  475. $scope.go('login');
  476. return;
  477. } else {
  478. if (localStorage.isUserBindWx == 0) {
  479. var wxFlag = JSON.parse(localStorage.params);
  480. if (wxFlag.weChatModel) {
  481. $scope.go('bindPhone', {
  482. params: localStorage.params,
  483. comfrom: 'maincontroller',
  484. url: window.location.href.split('#/')[1]
  485. });
  486. } else {
  487. $scope.go('login');
  488. return;
  489. }
  490. } else {
  491. $scope.go('login');
  492. return;
  493. }
  494. }
  495. } else {
  496. $scope.go('login');
  497. return;
  498. }
  499. return;
  500. }
  501. customActionParams = {
  502. clicktype: clicktype,
  503. moduleid: moduleid,
  504. targetid: targetid,
  505. userid: UserService.id,
  506. content: '活动详情页'
  507. }
  508. console.log(customActionParams);
  509. CommentService.postClickFavour(customActionParams).then(function (res) {
  510. console.log(res);
  511. if (res.code == 3350) {
  512. if (clicktype == 2619 || clicktype == 2620) {
  513. $scope.hasCollect = !$scope.hasCollect;
  514. }
  515. if (clicktype == 2617 || clicktype == 2618) {
  516. $scope.hasFocus = !$scope.hasFocus;
  517. }
  518. if (clicktype == 2615 || clicktype == 2616) {
  519. $scope.hasFavour = !$scope.hasFavour;
  520. }
  521. getActivityDetailInfo();
  522. }
  523. })
  524. }
  525. // 分享页面
  526. $scope.shareRsource = function () {
  527. }
  528. //分享
  529. $scope.shareflg = false;
  530. $scope.openShare = function () {
  531. if ($scope.app) {
  532. $scope.shareflg = true;
  533. } else {
  534. $scope.shareMessage();
  535. }
  536. };
  537. $scope.closeShareBox = function () {
  538. $scope.shareflg = false;
  539. };
  540. //TODO
  541. $scope.showShareWechat = false;
  542. $scope.closeShare = function () {
  543. $scope.showShareWechat = false;
  544. };
  545. var sharelink = "https://blog.csdn.net/molong421/article/details/51586194";
  546. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  547. $scope.shareMessage = function (type) {
  548. $scope.shareflg = false;
  549. var linkUrl = ConfigService.webserver + '#/activityDetail/' + $stateParams.activityid;
  550. console.log(linkUrl);
  551. var imagurl = $scope.poster ? (ConfigService.imgurl + $scope.poster) : "https://cordova.apache.org/static/img/cordova_bot.png";
  552. var message = {
  553. title: $scope.detail.name,
  554. description: $scope.detail.content.substring(0, 19),
  555. url: linkUrl,
  556. imageurl: imagurl
  557. };
  558. console.log(linkUrl);
  559. if ($scope.app) {
  560. $scope.showLoadingToast();
  561. // var message = {
  562. // title: $scope.resourceDetail.title,
  563. // description: $scope.resourceDetail.title.substring(0,19),
  564. // url: sharelink,
  565. // imageurl: imagurl
  566. // };
  567. switch (type) {
  568. case 0:
  569. case 1:
  570. ShareService.shareToQQ(type, message).then(function () {
  571. $scope.hideLoadingToast();
  572. if ($scope.app) {
  573. UtilService.showMess("QQ分享成功");
  574. } else {
  575. CommonService.showMessage("QQ分享成功", $scope);
  576. }
  577. }, function (error) {
  578. $scope.hideLoadingToast();
  579. if ($scope.app) {
  580. UtilService.showMess(error);
  581. } else {
  582. CommonService.showMessage(error, $scope);
  583. }
  584. });
  585. break;
  586. case 2:
  587. ShareService.shareToWechat(type, message).then(function () {
  588. // UtilService.showMess("微信分享成功");
  589. $scope.hideLoadingToast();
  590. if ($scope.app) {
  591. UtilService.showMess("微信分享成功");
  592. } else {
  593. CommonService.showMessage("微信分享成功", $scope);
  594. }
  595. }, function (error) {
  596. // UtilService.showMess(error);
  597. $scope.hideLoadingToast();
  598. if ($scope.app) {
  599. UtilService.showMess(error);
  600. } else {
  601. CommonService.showMessage(error, $scope);
  602. }
  603. });
  604. break;
  605. case 3:
  606. ShareService.shareToWechat(type, message).then(function () {
  607. // UtilService.showMess("微信分享成功");
  608. $scope.hideLoadingToast();
  609. if ($scope.app) {
  610. UtilService.showMess("微信分享成功");
  611. } else {
  612. CommonService.showMessage("微信分享成功", $scope);
  613. }
  614. }, function (error) {
  615. // UtilService.showMess(error);
  616. $scope.hideLoadingToast();
  617. if ($scope.app) {
  618. UtilService.showMess(error);
  619. } else {
  620. CommonService.showMessage(error, $scope);
  621. }
  622. });
  623. break;
  624. case 4:
  625. ShareService.shareToWeibo(message).then(function () {
  626. // UtilService.showMess("新浪微博分享成功");
  627. $scope.hideLoadingToast();
  628. if ($scope.app) {
  629. UtilService.showMess("新浪微博分享成功");
  630. } else {
  631. CommonService.showMessage("新浪微博分享成功", $scope);
  632. }
  633. }, function (error) {
  634. // UtilService.showMess(error);
  635. $scope.hideLoadingToast();
  636. if ($scope.app) {
  637. UtilService.showMess(error);
  638. } else {
  639. CommonService.showMessage(error, $scope);
  640. }
  641. });
  642. break;
  643. default:
  644. break;
  645. }
  646. $timeout(function () {
  647. $scope.hideLoadingToast();
  648. }, 10000);
  649. } else {
  650. $scope.showShareWechat = true;
  651. var content = document.getElementById('qrcode-dialog2');
  652. console.log(content);
  653. content.innerHTML = '';
  654. var qrcode = new QRCode(content, {
  655. text: $scope.detail.name,
  656. // title: $scope.resourceDetail.baseInfoModel.title,
  657. // description: $scope.resourceDetail.baseInfoModel.title.substring(0,19),
  658. // url: linkUrl,
  659. // imageurl: imagurl,
  660. width: 200,
  661. height: 200
  662. })
  663. qrcode.makeCode(linkUrl);
  664. }
  665. };
  666. // 编辑任务
  667. $scope.editActivityAction = function () {
  668. if (!ConfigService.islogin) {
  669. if (localStorage.wxFlag == "true") {
  670. if (localStorage.isUserFocusXW == 0) {
  671. var title = localStorage.appidStr;
  672. $scope.go('login');
  673. return;
  674. } else {
  675. if (localStorage.isUserBindWx == 0) {
  676. var wxFlag = JSON.parse(localStorage.params);
  677. if (wxFlag.weChatModel) {
  678. $scope.go('bindPhone', {
  679. params: localStorage.params,
  680. comfrom: 'maincontroller',
  681. url: window.location.href.split('#/')[1]
  682. });
  683. } else {
  684. $scope.go('login');
  685. return;
  686. }
  687. } else {
  688. $scope.go('login');
  689. return;
  690. }
  691. }
  692. } else {
  693. $scope.go('login');
  694. return;
  695. }
  696. return;
  697. }
  698. $scope.go('activityRelease', { data: JSON.stringify($scope.allData) });
  699. }
  700. // 取消活动
  701. $scope.cancelActivity = function () {
  702. if (!ConfigService.islogin) {
  703. if (localStorage.wxFlag == "true") {
  704. if (localStorage.isUserFocusXW == 0) {
  705. var title = localStorage.appidStr;
  706. $scope.go('login');
  707. return;
  708. } else {
  709. if (localStorage.isUserBindWx == 0) {
  710. var wxFlag = JSON.parse(localStorage.params);
  711. if (wxFlag.weChatModel) {
  712. $scope.go('bindPhone', {
  713. params: localStorage.params,
  714. comfrom: 'maincontroller',
  715. url: window.location.href.split('#/')[1]
  716. });
  717. } else {
  718. $scope.go('login');
  719. return;
  720. }
  721. } else {
  722. $scope.go('login');
  723. return;
  724. }
  725. }
  726. } else {
  727. $scope.go('login');
  728. return;
  729. }
  730. return;
  731. }
  732. var params = {
  733. data: {
  734. id: $scope.detail.id,
  735. isenabled: 2,
  736. creator: $scope.detail.creator
  737. },
  738. node: UserService.node,
  739. }
  740. activitiesModuleService.releaseOrEditActivity(params).then(function (res) {
  741. if (user == "") {
  742. user = res.user;
  743. }
  744. if (res.code == 3350) {
  745. $scope.canapply = false;
  746. $scope.cancelapply = false;
  747. $scope.ishasedit = false;
  748. $scope.isCancel = false;
  749. $scope.registmanage = false;
  750. $scope.ishasinput = false;
  751. if ($scope.app) {
  752. UtilService.showMess("活动取消成功");
  753. } else {
  754. CommonService.showMessage("活动取消成功", $scope);
  755. }
  756. }
  757. })
  758. }
  759. // 报名管理
  760. $scope.goToParticipantList = function () {
  761. if (!ConfigService.islogin) {
  762. if (localStorage.wxFlag == "true") {
  763. if (localStorage.isUserFocusXW == 0) {
  764. var title = localStorage.appidStr;
  765. $scope.go('login');
  766. return;
  767. } else {
  768. if (localStorage.isUserBindWx == 0) {
  769. var wxFlag = JSON.parse(localStorage.params);
  770. if (wxFlag.weChatModel) {
  771. $scope.go('bindPhone', {
  772. params: localStorage.params,
  773. comfrom: 'maincontroller',
  774. url: window.location.href.split('#/')[1]
  775. });
  776. } else {
  777. $scope.go('login');
  778. return;
  779. }
  780. } else {
  781. $scope.go('login');
  782. return;
  783. }
  784. }
  785. } else {
  786. $scope.go('login');
  787. return;
  788. }
  789. return;
  790. }
  791. // const toStr = window.btoa(unescape(encodeURIComponent($scope.detail.settingItems)))
  792. // console.log(toStr);
  793. $scope.go('participantList', { activityid: $scope.detail.id, status: $scope.detail.status, settingItems: $scope.detail.settingItems });
  794. }
  795. // 现场录入
  796. $scope.liveBroadcast = function () {
  797. if (!ConfigService.islogin) {
  798. if (localStorage.wxFlag == "true") {
  799. if (localStorage.isUserFocusXW == 0) {
  800. var title = localStorage.appidStr;
  801. $scope.go('login');
  802. return;
  803. } else {
  804. if (localStorage.isUserBindWx == 0) {
  805. var wxFlag = JSON.parse(localStorage.params);
  806. if (wxFlag.weChatModel) {
  807. $scope.go('bindPhone', {
  808. params: localStorage.params,
  809. comfrom: 'maincontroller',
  810. url: window.location.href.split('#/')[1]
  811. });
  812. } else {
  813. $scope.go('login');
  814. return;
  815. }
  816. } else {
  817. $scope.go('login');
  818. return;
  819. }
  820. }
  821. } else {
  822. $scope.go('login');
  823. return;
  824. }
  825. }
  826. var isedit = 0;
  827. $scope.go('visitModularForm', {
  828. companyid: $stateParams.activityid,
  829. connid: 0,
  830. pageid: 17,
  831. orgtype: 10104,
  832. pagecode: 1000027,
  833. isedit: isedit,
  834. node: 320412000,
  835. pageTitle: isedit ? '编辑录入' : '新建录入',
  836. comfrom: 'activityDetail',
  837. title: title
  838. });
  839. }
  840. $scope.hasMore = true;
  841. // 现场直播
  842. $scope.getBroadcastList = function () {
  843. // var deferred = $q.defer();
  844. console.log(pagenum);
  845. activitiesModuleService.liveBroadcastList($stateParams.activityid, pagenum, pagesize).then(function (res) {
  846. console.log(res);
  847. if (res.code == 3350) {
  848. angular.forEach(res.data, function (val) {
  849. var images = JSON.parse(val.images);
  850. val.image = images && images.length > 0 ? images[0].photoName : '';
  851. })
  852. $scope.imageTextList = $scope.imageTextList.concat(res.data);
  853. if (pagenum >= res.page.totalPage) {
  854. $scope.hasMore = false;
  855. }
  856. pagenum++;
  857. // deferred.resolve(res.data);
  858. }
  859. }).finally(function () {
  860. $scope.$broadcast('scroll.infiniteScrollComplete');
  861. });
  862. // return deferred.promise;
  863. }
  864. $scope.getBroadcastList();
  865. $scope.loadMoreData = function () {
  866. }
  867. // 删除现场记录
  868. $scope.deleteBroadcast = function (id) {
  869. activitiesModuleService.deleteBroadcast(id, $stateParams.activityid).then(function (res) {
  870. console.log(res);
  871. if (res.code == 3350) {
  872. pagenum = 1;
  873. $scope.hasMore = true;
  874. $scope.imageTextList = [];
  875. $scope.getBroadcastList();
  876. }
  877. })
  878. };
  879. $scope.showModal = false;
  880. // $scope.checkBroadcastDetail=function(index){
  881. // console.log($scope.imageTextList[index]);
  882. // $scope.showModal=true;
  883. // $scope.liveBroadcastMessage=$scope.imageTextList[index];
  884. // $scope.liveBroadcastMessage.images=JSON.parse($scope.liveBroadcastMessage.images);
  885. // };
  886. //点击图片放大
  887. $scope.bigImage = false; //初始默认大图是隐藏的
  888. $scope.hideBigImage = function () {
  889. $timeout(function () {
  890. if ($scope.app) {
  891. $scope.setStatusBar(0);
  892. }
  893. $scope.bigImage = false;
  894. }, 400);
  895. };
  896. $scope.shouBigImage = function (index, type) { //传递一个参数(图片的URl)
  897. if ($scope.app) {
  898. $scope.setStatusBar(1);
  899. }
  900. if (type == 'accessory') {
  901. $scope.imgUrlList = $scope.accessory;
  902. } else {
  903. $scope.imgUrlList = $scope.liveBroadcastMessage.images;
  904. }
  905. console.log($scope.imgUrlList[index]);
  906. var str = $scope.imgUrlList[index].sourceName.split('.');
  907. if (str && str.length > 0 && str[1] != 'jpg' && str[1] != 'gif' && str[1] != 'bmp' && str[1] != 'png' && str[1] != 'jpeg') {
  908. if ($scope.imgUrlList[index]) {
  909. window.open(ConfigService.imgurl + $scope.imgUrlList[index].sourceName);
  910. return;
  911. }
  912. }
  913. $scope.bigImage = true; //显示大图
  914. $(function () {
  915. $('div.pinch-zoom').each(function () {
  916. new RTP.PinchZoom($(this), {});
  917. });
  918. });
  919. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  920. //图片总数量
  921. setTimeout(function () {
  922. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  923. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  924. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  925. //获取图片
  926. var imgObj = document.getElementsByClassName('bigimage');
  927. var n;
  928. for (n = 0; n < imgObj.length; n++) {
  929. // 获取图片的原始高度和宽度
  930. var oldWid = imgObj[n].naturalWidth;
  931. var oldHei = imgObj[n].naturalHeight;
  932. var screen = document.body.offsetWidth;
  933. var screenH = window.innerHeight;
  934. // console.log(oldWid/oldHei);
  935. // console.log(screen );
  936. var rate = oldWid / oldHei;
  937. if (oldWid >= screen && oldHei >= screenH) {
  938. var tw = screen;
  939. var th = tw / rate;
  940. if (th < screenH) {
  941. imgObj[n].style.width = tw + 'px';
  942. imgObj[n].style.height = th + 'px';
  943. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  944. } else {
  945. imgObj[n].style.width = screenH * rate + 'px';
  946. imgObj[n].style.height = screenH + 'px';
  947. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  948. }
  949. } else if (oldWid >= screen && oldHei <= screenH) {
  950. imgObj[n].style.width = screen + 'px';
  951. imgObj[n].style.height = screen / rate + 'px';
  952. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  953. } else if (oldWid <= screen && oldHei >= screenH) {
  954. // var hh=screenH;
  955. // var ww=screenH*rate;
  956. imgObj[n].style.width = screenH * rate + 'px';
  957. imgObj[n].style.height = screenH + 'px';
  958. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  959. } else {
  960. imgObj[n].style.width = oldWid + 'px';
  961. imgObj[n].style.height = oldHei + 'px';
  962. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  963. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  964. }
  965. }
  966. }, 500);
  967. };
  968. $scope.cancelApplyAction = function () {
  969. if (!ConfigService.islogin) {
  970. if (localStorage.wxFlag == "true") {
  971. if (localStorage.isUserFocusXW == 0) {
  972. var title = localStorage.appidStr;
  973. $scope.go('login');
  974. return;
  975. } else {
  976. if (localStorage.isUserBindWx == 0) {
  977. var wxFlag = JSON.parse(localStorage.params);
  978. if (wxFlag.weChatModel) {
  979. $scope.go('bindPhone', {
  980. params: localStorage.params,
  981. comfrom: 'maincontroller',
  982. url: window.location.href.split('#/')[1]
  983. });
  984. } else {
  985. $scope.go('login');
  986. return;
  987. }
  988. } else {
  989. $scope.go('login');
  990. return;
  991. }
  992. }
  993. } else {
  994. $scope.go('login');
  995. return;
  996. }
  997. }
  998. activitiesModuleService.cancelApply($stateParams.activityid).then(function (res) {
  999. console.log(res);
  1000. if (res.code == 3350) {
  1001. $scope.cancelapply = false;
  1002. $scope.canapply = true;
  1003. if ($scope.app) {
  1004. UtilService.showMess("取消报名成功");
  1005. } else {
  1006. CommonService.showMessage("取消报名成功", $scope);
  1007. }
  1008. getActivityDetailInfo();
  1009. }
  1010. })
  1011. }
  1012. $scope.gobackToHoll = function () {
  1013. $scope.go('activitiesHoll');
  1014. }
  1015. $scope.goPublisher = function (id) {
  1016. console.log(id);
  1017. if (!ConfigService.islogin) {
  1018. if (localStorage.wxFlag == "true") {
  1019. if (localStorage.isUserFocusXW == 0) {
  1020. var title = localStorage.appidStr;
  1021. $scope.go('login');
  1022. return;
  1023. } else {
  1024. if (localStorage.isUserBindWx == 0) {
  1025. var wxFlag = JSON.parse(localStorage.params);
  1026. if (wxFlag.weChatModel) {
  1027. $scope.go('bindPhone', {
  1028. params: localStorage.params,
  1029. comfrom: 'maincontroller',
  1030. url: window.location.href.split('#/')[1]
  1031. });
  1032. } else {
  1033. $scope.go('login');
  1034. return;
  1035. }
  1036. } else {
  1037. $scope.go('login');
  1038. return;
  1039. }
  1040. }
  1041. } else {
  1042. $scope.go('login');
  1043. return;
  1044. }
  1045. }
  1046. if (id != 0) {
  1047. $scope.go('publisher', { Id: id });
  1048. }
  1049. }
  1050. // 统计列表页面
  1051. var labelResourceListModal = function () {
  1052. $ionicModal.fromTemplateUrl('./modules/common/views/labelResourceListModal.html', {
  1053. scope: $scope,
  1054. animation: 'slide-in-left'
  1055. }).then(function (modal) {
  1056. $scope.labelResourceListModal = modal;
  1057. });
  1058. }
  1059. labelResourceListModal();
  1060. $scope.openList = function (hasList, item) {
  1061. if (hasList) {
  1062. $scope.searchtype = 2;
  1063. $scope.labelResourceListModal.show();
  1064. $scope.labelTitle = '活动 ' + $scope.detail.name + " " + item.name;
  1065. $scope.allList = item.list;
  1066. angular.forEach($scope.allList, function (val) {
  1067. activitiesModuleService.getUsernameByOrgname(val.title).then(function (res) {
  1068. val.username = res.data;
  1069. })
  1070. });
  1071. console.log($scope.allList);
  1072. }
  1073. }
  1074. $scope.goResourceDetail = function (resource) {
  1075. if (!ConfigService.islogin) {
  1076. if (localStorage.wxFlag == "true") {
  1077. if (localStorage.isUserFocusXW == 0) {
  1078. var title = localStorage.appidStr;
  1079. $scope.go('login');
  1080. return;
  1081. } else {
  1082. if (localStorage.isUserBindWx == 0) {
  1083. var wxFlag = JSON.parse(localStorage.params);
  1084. if (wxFlag.weChatModel) {
  1085. $scope.go('bindPhone', {
  1086. params: localStorage.params,
  1087. comfrom: 'maincontroller',
  1088. url: window.location.href.split('#/')[1]
  1089. });
  1090. } else {
  1091. $scope.go('login');
  1092. return;
  1093. }
  1094. } else {
  1095. $scope.go('login');
  1096. return;
  1097. }
  1098. }
  1099. } else {
  1100. $scope.go('login');
  1101. return;
  1102. }
  1103. } else {
  1104. $scope.labelResourceListModal.hide();
  1105. $scope.go('resourceCommonDetailsPage', {
  1106. recourceid: resource.id,
  1107. recourcetype: resource.restype,
  1108. recourcecomefrom: resource.comefrom,
  1109. creator: resource.creator,
  1110. title: resource.title
  1111. });
  1112. }
  1113. }
  1114. //微信分享时自定义标题和描述
  1115. var wechatInit = function () {
  1116. var url = encodeURIComponent(window.location.href.split("#")[0]);
  1117. dataToolsService.getWechatConfig(UserService.node, url).then(function (res) {
  1118. if (res.code == 3350) {
  1119. activitiesModuleService.getActivityDetailInfo($stateParams.activityid).then(function (res1) {
  1120. if (res1.code == 3350) {
  1121. $scope.wechattitle = res1.data.activityInfo.name;
  1122. $scope.wechatdesc = res1.data.activityInfo.remark;
  1123. $scope.wechatlink = res.data[3] + "#/activityDetail/" + $stateParams.activityid + "";
  1124. $scope.wechatimg = $scope.poster ? ($scope.poster | imgfilter) : './img/2018/activity-3.jpg';
  1125. wx.config({
  1126. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1127. appId: res.data[4], // 必填,公众号的唯一标识
  1128. timestamp: res.data[0], // 必填,生成签名的时间戳
  1129. nonceStr: res.data[1], // 必填,生成签名的随机串
  1130. signature: res.data[2],// 必填,签名
  1131. jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表
  1132. });
  1133. wx.ready(function () {
  1134. wx.onMenuShareTimeline({
  1135. title: $scope.wechattitle, // 分享标题
  1136. desc: $scope.wechatdesc, // 分享描述
  1137. link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  1138. imgUrl: $scope.wechatimg,
  1139. });
  1140. wx.onMenuShareAppMessage({
  1141. title: $scope.wechattitle, // 分享标题
  1142. desc: $scope.wechatdesc, // 分享描述
  1143. link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  1144. imgUrl: $scope.wechatimg,
  1145. });
  1146. });
  1147. wx.error(function (res) {
  1148. // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
  1149. console.log(JSON.stringify(res));
  1150. });
  1151. }
  1152. })
  1153. }
  1154. })
  1155. };
  1156. wechatInit();
  1157. }]);