CloudDockingdetailsCtrl.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. angular.module('push')
  2. .controller('CloudDockingdetailsCtrl', function ($scope, DockingService, UtilService, $stateParams, $sce, ShareService, $timeout, UserService, $ionicModal,
  3. SearchResultService, $ionicSlideBoxDelegate, CommentService, $ionicActionSheet, ResourceLibraryService, AuthorityService) {
  4. if($scope.app){
  5. $scope.setStatusBar(0);
  6. }
  7. $scope.user = UserService.user.user;
  8. $scope.userid = UserService.id;
  9. $scope.viplevel = UserService.viplevel;
  10. var infoid = $stateParams.infoid;
  11. var infotype = 81;
  12. var infocomefrom = $stateParams.infocomefrom;
  13. var creator = $stateParams.creator;
  14. //获取相关资源
  15. $scope.getRelativeResource = function () {
  16. CommentService.getRelativeResource(0, $scope.conninfo.title, "", "", "", infoid).then(function (response) {
  17. // console.log(response);
  18. $scope.relativelist = response.resourcelibrary;
  19. $scope.relativerecord = response.connectioninfoEntity;
  20. }, function () {
  21. })
  22. };
  23. var getConninfoDetail = function () {
  24. DockingService.newGetConnInfoDetails(infoid).then(function (response) {
  25. // console.log(response);
  26. $scope.conninfo = response;
  27. $scope.starwidth = ($scope.conninfo.totalpoint / 10) * 100 + "%";
  28. $scope.picturelist = response.picture;
  29. $scope.picturelisttt = angular.copy(response.picture);
  30. $scope.cardlist = response.unit;
  31. $scope.content = $sce.trustAsHtml(response.content);
  32. $scope.getRelativeResource();
  33. $scope.hideLoadingToast();
  34. }, function () {
  35. $scope.hideLoadingToast();
  36. UtilService.showMess("网络不给力,请重试");
  37. });
  38. };
  39. $scope.showactivityinfo = false;
  40. $scope.showrecon = false;
  41. var getActivityInfo = function (isCreator) {
  42. if (isCreator == 3) {
  43. DockingService.getAdminActivitiesFollowupList(infoid).then(function (response) {
  44. if (angular.isDefined(response.returnlist)) {
  45. $scope.showactivityinfo = response.returnlist.length > 0;
  46. } else {
  47. $scope.showactivityinfo = false;
  48. }
  49. }, function () {
  50. });
  51. DockingService.getKeeponRecordList(infoid, 3).then(function (response) {
  52. if (angular.isDefined(response.list)) {
  53. $scope.showrecon = response.list.length > 0;
  54. } else {
  55. $scope.showrecon = false;
  56. }
  57. }, function () {
  58. });
  59. } else {
  60. DockingService.getMyActivityFollowUpList(infoid).then(function (response) {
  61. if (angular.isDefined(response.list)) {
  62. $scope.showactivityinfo = response.list.length > 0;
  63. } else {
  64. $scope.showactivityinfo = false;
  65. }
  66. }, function () {
  67. });
  68. DockingService.getKeeponRecordList(infoid, 0).then(function (response) {
  69. if (angular.isDefined(response.list)) {
  70. $scope.showrecon = response.list.length > 0;
  71. } else {
  72. $scope.showrecon = false;
  73. }
  74. }, function () {
  75. });
  76. }
  77. };
  78. //提取当前用户是否有 查看/编辑 本记录权限
  79. var getVisitAuthority = function () {
  80. $scope.showLoadingToast();
  81. ResourceLibraryService.getVisitAuthority(0, infoid, creator, infocomefrom, infotype).then(function (response) {
  82. // console.log(response);
  83. getConninfoDetail();
  84. // isedit:是否可以编辑资源,isset:是否可以设置权限,bl:是否可以访问
  85. $scope.roler = response;
  86. getActivityInfo($scope.roler.isCreator)
  87. }, function () {
  88. $scope.hideLoadingToast();
  89. UtilService.showMess("网络不给力,请重试");
  90. })
  91. };
  92. getVisitAuthority();
  93. //获取热门评论
  94. var checkflg = 0;
  95. var getHotCommentList = function () {
  96. CommentService.getHotCommentList(infoid, infotype).then(function (response) {
  97. // console.log(response);
  98. $scope.commentlist = response.res.comment;
  99. $scope.MoreComment = response.MoreComment;
  100. if (checkflg != 0) {
  101. $scope.conninfo.totalpoint = response.totalpoint;
  102. $scope.starwidth = (response.totalpoint / 10) * 100 + "%";
  103. }
  104. checkflg = 1;
  105. }, function () {
  106. })
  107. };
  108. getHotCommentList();
  109. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  110. $scope.shareMessage = function (type) {
  111. $scope.softTap = false;
  112. $scope.showLoadingToast();
  113. CommentService.createShareRecord($scope.conninfo.share_url, infoid, infocomefrom, infotype).then(function (response) {
  114. // console.log(response);
  115. var imagurl = "http://test.ubitech.cn/000000000/themes/avatar_save/1490753632823.jpg";
  116. if ($scope.picturelist.length > 0) {
  117. imagurl = $scope.imgUrl + $scope.picturelist[0].photo_name;
  118. }
  119. var message = {
  120. title: $scope.conninfo.title,
  121. description: $scope.conninfo.content.substring(0, 19),
  122. url: response.shareurl,
  123. imageurl: imagurl
  124. };
  125. switch (type) {
  126. case 0:
  127. case 1:
  128. ShareService.shareToQQ(type, message).then(function () {
  129. UtilService.showMess("QQ分享成功");
  130. getCurrencyFromShare(response.clickid);
  131. $scope.hideLoadingToast();
  132. }, function (error) {
  133. UtilService.showMess(error);
  134. $scope.hideLoadingToast();
  135. });
  136. break;
  137. case 2:
  138. case 3:
  139. ShareService.shareToWechat(0, message).then(function () {
  140. UtilService.showMess("微信分享成功");
  141. getCurrencyFromShare(response.clickid);
  142. $scope.hideLoadingToast();
  143. }, function (error) {
  144. UtilService.showMess(error);
  145. $scope.hideLoadingToast();
  146. });
  147. break;
  148. case 4:
  149. ShareService.shareToWeibo(message).then(function () {
  150. UtilService.showMess("新浪微博分享成功");
  151. getCurrencyFromShare(response.clickid);
  152. $scope.hideLoadingToast();
  153. }, function (error) {
  154. UtilService.showMess(error);
  155. $scope.hideLoadingToast();
  156. });
  157. break;
  158. default:
  159. break;
  160. }
  161. $timeout(function () {
  162. $scope.hideLoadingToast();
  163. }, 10000);
  164. }, function () {
  165. $scope.hideLoadingToast();
  166. })
  167. };
  168. var getCurrencyFromShare = function (clickid) {
  169. CommentService.getCurrencyFromShare(clickid);
  170. };
  171. $scope.shareflg = false;
  172. $scope.openShare = function () {
  173. $scope.shareflg = true;
  174. };
  175. $scope.closeShare = function () {
  176. $scope.shareflg = false;
  177. };
  178. //编辑对接详情
  179. $scope.editorButton = function () {
  180. $scope.go("cloudEditconninfo", {infoid: infoid});
  181. };
  182. $scope.relativelist2 = [];
  183. $scope.goPrivateResource = function (tempobj) {
  184. if (tempobj.length > 1) {
  185. $scope.showModel();
  186. $scope.relativelist2 = tempobj;
  187. } else {
  188. $scope.go('resourcePrivateDetails', {
  189. recourceid: tempobj[0].unique,
  190. recourcetype: tempobj[0].type,
  191. recourcecomefrom: tempobj[0].source,
  192. creator: tempobj[0].clickthrough
  193. });
  194. }
  195. };
  196. //关注用户 --已经关注是1,未关注是2
  197. var focusflg = 0;
  198. $scope.focusUser = function () {
  199. if (focusflg != 0) {
  200. return;
  201. }
  202. focusflg = 1;
  203. var status = $scope.conninfo.isFocus == 2 ? 1 : 2;
  204. SearchResultService.doFocus($scope.conninfo.isFocus, $scope.conninfo.creator).then(function (response) {
  205. // console.log(response);
  206. if (response.status == true) {
  207. if ($scope.conninfo.isFocus == 1) {
  208. $scope.conninfo.isFocus = 2;
  209. UtilService.showMess("取消关注成功");
  210. } else {
  211. $scope.conninfo.isFocus = 1;
  212. UtilService.showMess("关注成功");
  213. }
  214. } else {
  215. UtilService.showMess("网络不给力,请重试");
  216. }
  217. $timeout(function () {
  218. focusflg = 0;
  219. }, 500);
  220. }, function () {
  221. focusflg = 0;
  222. UtilService.showMess("网络不给力,请重试");
  223. });
  224. };
  225. //评分
  226. $scope.starnum = 0;
  227. $scope.evaluateNum = function (num) {
  228. $scope.starnum = num;
  229. };
  230. //详情页评论
  231. $scope.showComment = true;
  232. $scope.publishComment = function () {
  233. $scope.showComment = true;
  234. var content = $scope.comment.content;
  235. //提交评论信息
  236. $scope.showLoadingToast();
  237. CommentService.publishComment(0, infoid, infotype, "", "", content, infocomefrom, $scope.starnum).then(function () {
  238. UtilService.showMess("评论成功");
  239. $scope.comment.content = "";
  240. $scope.starnum = 0;
  241. getHotCommentList();
  242. if ($scope.commentlist.length >= 3) {
  243. $timeout(function () {
  244. $scope.goCommentList();
  245. }, 650);
  246. }
  247. $scope.hideLoadingToast();
  248. }, function () {
  249. $scope.hideLoadingToast();
  250. });
  251. };
  252. //发表详细评论
  253. $scope.releaseComment = function () {
  254. $scope.go('releaseComment', {
  255. infoid: infoid,
  256. infotype: infotype,
  257. comlen: $scope.commentlist.length,
  258. recourcecomefrom: infocomefrom
  259. })
  260. };
  261. //进入评论列表页
  262. $scope.goCommentList = function () {
  263. $timeout(function () {
  264. $scope.go('toolDiscuss', {
  265. infoid: infoid,
  266. infotype: infotype,
  267. recourcecomefrom: infocomefrom,
  268. isedit: $scope.roler.isedit
  269. });
  270. }, 350);
  271. };
  272. //资源点赞
  273. var zydianzanflg = 0;
  274. $scope.dianZan = function () {
  275. if (zydianzanflg != 0) {
  276. return;
  277. }
  278. zydianzanflg = 1;
  279. CommentService.clickFavour(infoid, infotype, infocomefrom).then(function (response) {
  280. // console.log(response);
  281. if (response.favourState == 1) {
  282. $scope.conninfo.favourcount++;
  283. $scope.conninfo.Like = true;
  284. } else {
  285. $scope.conninfo.favourcount--;
  286. $scope.conninfo.Like = false;
  287. }
  288. // UtilService.showMess(response.clickStatus);
  289. $timeout(function () {
  290. zydianzanflg = 0;
  291. }, 500);
  292. }, function () {
  293. zydianzanflg = 0;
  294. UtilService.showMess("网络不给力,请重试");
  295. })
  296. };
  297. //评论点赞
  298. var pldianzanflg = 0;
  299. $scope.content_zan = function (comment, index) {
  300. if (pldianzanflg != 0) {
  301. return;
  302. }
  303. pldianzanflg = 1;
  304. CommentService.commentLike(comment.id, infotype).then(function (response) {
  305. // console.log(response);
  306. if (response.favourState == 1) {
  307. $scope.commentlist[index].favourcount++;
  308. $scope.commentlist[index].Like = true;
  309. } else {
  310. $scope.commentlist[index].favourcount--;
  311. $scope.commentlist[index].Like = false;
  312. }
  313. // UtilService.showMess(response.clickStatus);
  314. $timeout(function () {
  315. pldianzanflg = 0;
  316. }, 500);
  317. }, function () {
  318. pldianzanflg = 0;
  319. UtilService.showMess("网络不给力,请重试");
  320. })
  321. };
  322. //收藏
  323. var storeflg = 0;
  324. $scope.collectResource = function () {
  325. if (storeflg != 0) {
  326. return;
  327. }
  328. storeflg = 1;
  329. CommentService.collectResource(infoid, infotype, infocomefrom, 2).then(function (response) {
  330. // console.log(response);
  331. if (response.clickStatus == "收藏成功") {
  332. $scope.conninfo.Enshrine = true;
  333. } else {
  334. $scope.conninfo.Enshrine = false;
  335. }
  336. UtilService.showMess(response.clickStatus);
  337. $timeout(function () {
  338. storeflg = 0;
  339. }, 500);
  340. }, function () {
  341. storeflg = 0;
  342. UtilService.showMess("网络不给力,请重试");
  343. })
  344. };
  345. //进入评论详情页
  346. $scope.goCommentDetail = function (comment) {
  347. $scope.go('resourceCommentReply', {
  348. comment: angular.toJson(comment),
  349. infoid: infoid,
  350. infotype: infotype,
  351. recourcecomefrom: infocomefrom,
  352. isedit: $scope.roler.isedit
  353. });
  354. };
  355. $scope.comment = {
  356. content: ""
  357. };
  358. //弹出评论框
  359. $scope.commentValue = function () {
  360. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  361. if ($scope.comment.content.length > 1000) {
  362. UtilService.showMess("您的评论已超过1000字!");
  363. $scope.comment.content = $scope.comment.content.substr(0, 1000);
  364. }
  365. if (search_history.val.length != 0) {
  366. $scope.commentNotnull = {
  367. "background-color": "#2a90d7",
  368. "text-decoration": "underline"
  369. };
  370. }
  371. };
  372. //删除自己刚刚发布或者以后的评论
  373. $scope.delectToolDis = function (commentid) {
  374. $scope.showLoadingToast();
  375. CommentService.deleteComment(commentid).then(function () {
  376. UtilService.showMess("删除成功");
  377. getHotCommentList();
  378. $scope.hideLoadingToast();
  379. }, function () {
  380. $scope.hideLoadingToast();
  381. });
  382. };
  383. //打开操作表
  384. $scope.openActionSheet = function () {
  385. // isedit:是否可以编辑资源,isset:是否可以设置权限
  386. var buttonlist = [];
  387. if ($scope.roler.isedit) {
  388. buttonlist.push({text: '编辑', type: "edit"});
  389. }
  390. if ($scope.roler.isset) {
  391. buttonlist.push({text: '设置', type: "set"});
  392. if ($scope.cardlist.length > 0) {
  393. buttonlist.push({text: '需求跟进', type: "schedule"});
  394. }
  395. }
  396. $ionicActionSheet.show({
  397. buttons: buttonlist,
  398. cancelText: '取消',
  399. buttonClicked: function (index) {
  400. if (buttonlist[index].type == "edit") {
  401. $scope.go("cloudEditconninfo", {infoid: infoid});
  402. } else if (buttonlist[index].type == "set") {
  403. var tempdata1 = {
  404. title: $scope.conninfo.title,
  405. recourceid: infoid,
  406. recourcetype: infotype,
  407. recourcecomefrom: infocomefrom,
  408. creator: creator
  409. };
  410. $scope.go("authorityRecordSet", {authoritydata: angular.toJson(tempdata1)});
  411. } else if (buttonlist[index].type == "schedule") {
  412. var tempcompanylist = [];
  413. var tmepreqlist = [];
  414. angular.forEach($scope.cardlist, function (value, index) {
  415. tempcompanylist.push(value.name);
  416. if (angular.isDefined(value.themelist)) {
  417. angular.forEach(value.themelist, function (val, ind) {
  418. tmepreqlist.push(val.title);
  419. })
  420. }
  421. });
  422. $scope.go("ActivitySchedule", {infoid: infoid, companylist: tempcompanylist, reqlist: tmepreqlist})
  423. }
  424. /*if (buttonlist.length > 1) {
  425. if (index == 0) {
  426. $scope.go("cloudEditconninfo", {infoid: infoid});
  427. } else if (index == 1) {
  428. var tempdata1 = {
  429. title: $scope.conninfo.title,
  430. recourceid: infoid,
  431. recourcetype: infotype,
  432. recourcecomefrom: infocomefrom,
  433. creator: creator
  434. };
  435. $scope.go("authorityRecordSet", {authoritydata: angular.toJson(tempdata1)});
  436. }
  437. } else {
  438. if ($scope.roler.isedit) {
  439. $scope.go("cloudEditconninfo", {infoid: infoid});
  440. }
  441. if ($scope.roler.isset) {
  442. var tempdata2 = {
  443. title: $scope.conninfo.title,
  444. recourceid: infoid,
  445. recourcetype: infotype,
  446. recourcecomefrom: infocomefrom,
  447. creator: creator
  448. };
  449. $scope.go("authorityRecordSet", {authoritydata: angular.toJson(tempdata2)});
  450. }
  451. }*/
  452. return true;
  453. }
  454. });
  455. };
  456. //显示更多名片部分
  457. $scope.showMoreCard = function (index) {
  458. $(".parentWrapCard").eq(index).toggle();
  459. $(".showCardWrap").eq(index).toggle();
  460. $(".changeArrowButton").eq(index).toggleClass("upArrow");
  461. var cardText = $(".downArrow").eq(index).text();
  462. // if (cardText == '展开') {
  463. // $(".downArrow").eq(index).text("收起");
  464. // } else {
  465. // $(".downArrow").eq(index).text("展开");
  466. // }
  467. };
  468. //点击图片放大
  469. $scope.bigImage = false; //初始默认大图是隐藏的
  470. $scope.hideBigImage = function () {
  471. $timeout(function () {
  472. if($scope.app){
  473. $scope.setStatusBar(0);
  474. }
  475. $scope.bigImage = false;
  476. }, 400);
  477. };
  478. $scope.shouBigImage = function (index, piclist) {//传递一个参数(图片的URl)
  479. if($scope.app){
  480. $scope.setStatusBar(1);
  481. }
  482. $scope.bigImage = true; //显示大图
  483. $scope.picturelisttt = piclist;
  484. // console.log(index);
  485. $(function () {
  486. $('div.pinch-zoom').each(function () {
  487. new RTP.PinchZoom($(this), {});
  488. });
  489. });
  490. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  491. //图片总数量
  492. setTimeout(function () {
  493. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  494. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  495. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -5);
  496. // var nowIndex=parseInt($ionicSlideBoxDelegate.currentIndex());
  497. var totalIndex = parseInt($ionicSlideBoxDelegate.slidesCount());
  498. // console.log(index);
  499. $scope.nowIndex = index + 1;
  500. $scope.totalIndex = totalIndex;
  501. //获取图片
  502. var imgObj = document.getElementsByClassName('bigimage');
  503. var n;
  504. for (n = 0; n < imgObj.length; n++) {
  505. // 获取图片的原始高度和宽度
  506. var oldWid = imgObj[n].naturalWidth;
  507. var oldHei = imgObj[n].naturalHeight;
  508. var screen = document.body.offsetWidth;
  509. var screenH = window.innerHeight;
  510. // console.log(oldWid/oldHei);
  511. // console.log(screen );
  512. var cc = screen / (oldWid / oldHei);
  513. imgObj[n].style.height = cc + 'px';
  514. if (cc < screenH) {
  515. imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
  516. // console.log("e:" + imgObj[n].style.marginTop);
  517. } else {
  518. imgObj[n].style.marginTop = 0 + 'px';
  519. // console.log((cc - screenH) + 'px')
  520. }
  521. }
  522. }, 0);
  523. };
  524. $scope.slideHasChanged = function (index) {
  525. // console.log(index);
  526. $scope.nowIndex = index + 1;
  527. };
  528. $scope.hadSoft = function () {
  529. $scope.showComment = false;
  530. };
  531. $scope.showComment = true;
  532. $scope.focus_write = function () {
  533. $scope.showComment = false;
  534. $(".my_comment").focus();
  535. };
  536. $scope.hiddenComment = function () {
  537. $scope.showComment = true;
  538. };
  539. //进入相关资源详情
  540. $scope.goRelativeResource = function (relative) {
  541. if (relative.type == 81) {
  542. $scope.go('cloudDockingdetail', {
  543. infoid: relative.id,
  544. infocomefrom: relative.creatorcomefrom,
  545. creator: relative.creator
  546. });
  547. } else {
  548. if (relative.groupid == "0") {
  549. $scope.go('resourceDetails', {
  550. recourceid: relative.unique,
  551. recourcetype: relative.type,
  552. recourcecomefrom: relative.source,
  553. categorylabel: ""
  554. });
  555. } else {
  556. $scope.go('resourcePrivateDetails', {
  557. recourceid: relative.unique,
  558. recourcetype: relative.type,
  559. recourcecomefrom: relative.source,
  560. creator: relative.clickthrough
  561. });
  562. }
  563. }
  564. $scope.hideModel();
  565. };
  566. //进入相关资源列表
  567. $scope.goResourceMatch = function (relative) {
  568. $scope.go('resourceMatch', {
  569. type: relative.type,
  570. title: $scope.conninfo.title,
  571. categorylabel: "",
  572. recordid: infoid
  573. });
  574. };
  575. $scope.goResourceApply = function () {
  576. if ($scope.viplevel == 1) {
  577. AuthorityService.isHasEnoughCount(1).then(function (response) {
  578. if (response.isHasEnoughCount == 1) {
  579. var tempdata = {
  580. title: $scope.conninfo.title,
  581. recourceid: infoid,
  582. recourcetype: infotype,
  583. recourcecomefrom: infocomefrom
  584. };
  585. $scope.go("resourceApply", {authoritydata: angular.toJson(tempdata)})
  586. } else {
  587. UtilService.showMess("本月申请次数已用完");
  588. }
  589. }, function () {
  590. });
  591. } else {
  592. var tempdata = {
  593. title: $scope.conninfo.title,
  594. recourceid: infoid,
  595. recourcetype: infotype,
  596. recourcecomefrom: infocomefrom
  597. };
  598. $scope.go("resourceApply", {authoritydata: angular.toJson(tempdata)})
  599. }
  600. };
  601. //分享到我的资源库
  602. $scope.openCollectShare = function () {
  603. var tempres = [{
  604. infoid: infoid,
  605. infocomefrom: infocomefrom,
  606. infoType: infotype
  607. }];
  608. $scope.go('chooseShareFolder', {chereslist: angular.toJson(tempres), folderid: $scope.conninfo.claid});
  609. };
  610. //查看原图
  611. $scope.viewOldImg = function (index) {
  612. // console.log($scope.picturelisttt[index]);
  613. // console.log("查看原图" + index);
  614. var url = UtilService.isDefined($scope.picturelisttt[index].source_name) ? $scope.picturelisttt[index].source_name : $scope.picturelisttt[index].photo_name;
  615. $(".bigimage").eq(index).attr("src", $scope.imgUrl + url);
  616. $timeout(function () {
  617. $scope.picturelisttt[index].loadsource = true;
  618. }, 20);
  619. };
  620. //请求SDK权限
  621. $scope.loadImg = function (pic) {
  622. if (UtilService.checkPlatform()) {
  623. window.imagePicker.verifyStorage(
  624. function (results) {
  625. if (results == "1") {
  626. downloadPicture(pic);
  627. }
  628. }, function (error) {
  629. }
  630. );
  631. } else {
  632. downloadPicture(pic);
  633. }
  634. };
  635. //图片下载
  636. var downloadPicture = function (pic) {
  637. $scope.showLoadingToast();
  638. var fileTransfer = new FileTransfer();
  639. var url = UtilService.isDefined(pic.source_name) ? pic.source_name : pic.photo_name;
  640. var imgname = url.substring(url.lastIndexOf('/') + 1);//图片名称
  641. var loadurl = $scope.imgUrl + url;//图片下载地址
  642. var fileURL = "";//下载后的地址
  643. if (UtilService.checkPlatform()) {
  644. fileURL = cordova.file.externalRootDirectory + "pushpicture/" + imgname;
  645. } else {
  646. fileURL = cordova.file.documentsDirectory + imgname;
  647. }
  648. // console.log(loadurl);
  649. // console.log(fileURL);
  650. fileTransfer.download(
  651. loadurl,
  652. fileURL,
  653. function (entry) {
  654. // console.log(entry);
  655. if (UtilService.checkPlatform()) {
  656. var tempstr = entry.toURL().replace("file://", "");
  657. UtilService.showMess("图片下载成功,地址:" + tempstr);
  658. } else {
  659. UtilService.showMess("图片下载成功");
  660. }
  661. $scope.hideLoadingToast();
  662. },
  663. function (error) {
  664. // console.log(error);
  665. $scope.hideLoadingToast();
  666. UtilService.showMess("网络不给力,请重试");
  667. },
  668. null, // or, pass false
  669. {
  670. //headers: {
  671. // "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
  672. //}
  673. }
  674. );
  675. };
  676. /*查看原图进度条提示框*/
  677. $scope.loadPercent = "40%";
  678. //拨打电话
  679. $scope.openTel = function (tel) {
  680. window.open("tel:" + tel);
  681. };
  682. //关联跳转列表页
  683. $ionicModal.fromTemplateUrl('templates/relativelist.html', {
  684. scope: $scope,
  685. animation: 'slide-in-up'
  686. }).then(function (modal) {
  687. $scope.modal = modal;
  688. });
  689. //关闭关联列表
  690. $scope.hideModel = function () {
  691. $scope.modal.hide();
  692. $scope.relativelist2 = [];
  693. };
  694. //打开关联列表
  695. $scope.showModel = function () {
  696. $scope.modal.show();
  697. };
  698. //跳转我的跟进
  699. $scope.goActivtyScheduleHome = function () {
  700. var tempcompanylist = [];
  701. var tmepreqlist = [];
  702. angular.forEach($scope.cardlist, function (value, index) {
  703. tempcompanylist.push(value.name);
  704. if (angular.isDefined(value.themelist)) {
  705. angular.forEach(value.themelist, function (val, ind) {
  706. tmepreqlist.push(val.title);
  707. })
  708. }
  709. });
  710. if ($scope.roler.isCreator == 3) {
  711. $scope.go("ActivityScheduleAccount", {infoid: infoid});
  712. } else {
  713. $scope.go("ActivtyScheduleHome", {infoid: infoid, companylist: tempcompanylist, reqlist: tmepreqlist});
  714. }
  715. };
  716. $scope.goActivityReportAccount = function () {
  717. var role = $scope.roler.isCreator == 3 ? 3 : 0;
  718. $scope.go("ActivityReportAccount", {infoid: infoid, role: role});
  719. };
  720. });