resourcePrivateDetailsCtrl.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. angular.module('push')
  2. .controller('resourcePrivateDetailsCtrl', function ($scope, ResourceLibraryService, $stateParams, SearchResultService, UtilService, AuthorityService, $ionicModal,
  3. ShareService, CommentService, $sce, $timeout, UserService, $ionicActionSheet, $ionicSlideBoxDelegate) {
  4. //TODO
  5. if($scope.app){
  6. $scope.setStatusBar(0);
  7. }
  8. //1:需求,2:成果,6:企业,7:高校,8:人才
  9. var recourceid = $stateParams.recourceid;
  10. var recourcetype = $scope.type = $stateParams.recourcetype;
  11. // var recourceid = 1;
  12. // var recourcetype = 6;
  13. var recourcecomefrom = $stateParams.recourcecomefrom;
  14. var creator = $stateParams.creator;
  15. // var recourceid = "97024";
  16. // var recourcetype = $scope.type = "7";
  17. // var recourcecomefrom = "110100000";
  18. // var creator = 1359;
  19. var categorylabel = $stateParams.categorylabel;
  20. $scope.userid = UserService.id;
  21. $scope.viplevel = UserService.viplevel;
  22. $scope.comment = {content: ""};
  23. //获取相关资源
  24. $scope.getRelativeResource = function () {
  25. CommentService.getRelativeResource(0, $scope.resource.title, categorylabel, "", recourceid, "").then(function (response) {
  26. // console.log(response);
  27. $scope.relativelist = response.resourcelibrary;
  28. $scope.relativerecord = response.connectioninfoEntity;
  29. }, function () {
  30. })
  31. };
  32. var sharelink = "";
  33. //获取资源详情
  34. var getPublicResourceList = function () {
  35. ResourceLibraryService.getPrivateResourceDetail(recourceid, recourcetype, recourcecomefrom).then(function (response) {
  36. console.log("==============================");
  37. console.log(response);
  38. // 基本信息
  39. $scope.resource = response.data;
  40. //TODO
  41. /*//产品 6
  42. $scope.productlist = response.detailMap.company_product_lk;
  43. //需求 6
  44. $scope.techrequirementlist = response.detailMap.company_techrequirement_lk;
  45. //产学研经历 6
  46. $scope.iurlist1 = response.detailMap.company_iur_lk_1;
  47. //科研项目 6
  48. $scope.iurlist2 = response.detailMap.company_iur_lk_2;
  49. //成果 8
  50. $scope.researchfindinglist = response.detailMap.researchfinding;
  51. //专利表 6 8 2
  52. $scope.intprolist = response.detailMap.intellectualproperty;
  53. //专利表 7
  54. $scope.intellectualpropertylist = response.res.intellectualpropertylist;
  55. // 成果 7
  56. $scope.technicalinfolist = response.res.technicalinfolist;
  57. //人员 7
  58. $scope.signuplist = response.res.expertlibrarylist;
  59. //特色专业 7
  60. $scope.specialtylist = response.res.specialtylist;
  61. //论文列表 7
  62. $scope.paperlist = response.res.paperlist;
  63. //已合作企业 7
  64. $scope.coopenterpriselist = response.res.coopenterpriselist;
  65. //意向企业 7
  66. $scope.intentionalerpriselist = response.res.intentionalerpriselist;
  67. //实验室 7
  68. $scope.univlablist = response.res.univlablist;
  69. //产学研中心 7
  70. $scope.iurlist3 = response.res.iurlist;
  71. //附件 7
  72. $scope.orglibrarydoclist = response.res.orglibrarydoclist;
  73. //历年申报项目 6
  74. $scope.calendarlist = response.res.calendarlist;
  75. //获取相关资源
  76. $scope.getRelativeResource();
  77. $scope.contenthtml = $sce.trustAsHtml($scope.resource.content);
  78. //分享链接
  79. sharelink = response.res.sharelink;*/
  80. }, function () {
  81. })
  82. };
  83. getPublicResourceList();
  84. //获取热门评论
  85. var getHotCommentList = function () {
  86. CommentService.getHotCommentList(recourceid, recourcetype).then(function (response) {
  87. // console.log(response);
  88. $scope.commentlist = response.res.comment;
  89. $scope.MoreComment = response.MoreComment;
  90. }, function () {
  91. })
  92. };
  93. //TODO
  94. getHotCommentList();
  95. //提取当前用户是否有 查看/编辑 本记录权限
  96. var getVisitAuthority = function () {
  97. ResourceLibraryService.getVisitAuthority(1, recourceid, creator, recourcecomefrom, recourcetype).then(function (response) {
  98. // console.log(response);
  99. // isedit:是否可以编辑资源,isset:是否可以设置权限,bl:是否可以访问
  100. getPublicResourceList();
  101. $scope.roler = response;
  102. }, function () {
  103. })
  104. };
  105. //TODO
  106. getVisitAuthority();
  107. $scope.shareflg = false;
  108. $scope.openShare = function () {
  109. $scope.shareflg = true;
  110. };
  111. $scope.closeShare = function () {
  112. $scope.shareflg = false;
  113. };
  114. //关注用户 --已经关注是1,未关注是2
  115. $scope.focusUser = function () {
  116. var status = $scope.resource.Focus ? 1 : 2;
  117. SearchResultService.doFocus(status, $scope.resource.creator).then(function (response) {
  118. // console.log(response);
  119. if (response.status == true) {
  120. if ($scope.resource.Focus) {
  121. $scope.resource.Focus = false;
  122. UtilService.showMess("取消关注成功");
  123. } else {
  124. $scope.resource.Focus = true;
  125. UtilService.showMess("关注成功");
  126. }
  127. } else {
  128. UtilService.showMess("网络不给力,请重试");
  129. }
  130. }, function () {
  131. UtilService.showMess("网络不给力,请重试");
  132. });
  133. };
  134. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  135. $scope.shareMessage = function (type) {
  136. $scope.shareflg = false;
  137. $scope.showLoadingToast();
  138. CommentService.createShareRecord(sharelink, recourceid, recourcecomefrom, recourcetype).then(function (response) {
  139. // console.log(response);
  140. var imagurl = "http://test.ubitech.cn/000000000/themes/avatar_save/1490753632823.jpg";
  141. var tempcontent = $scope.resource.content.substring(0, 19);
  142. var message = {
  143. title: $scope.resource.title,
  144. description: tempcontent,
  145. url: response.shareurl,
  146. imageurl: imagurl
  147. };
  148. switch (type) {
  149. case 0:
  150. case 1:
  151. ShareService.shareToQQ(type, message).then(function () {
  152. UtilService.showMess("QQ分享成功");
  153. getCurrencyFromShare(response.clickid);
  154. $scope.hideLoadingToast();
  155. }, function (error) {
  156. UtilService.showMess(error);
  157. $scope.hideLoadingToast();
  158. });
  159. break;
  160. case 2:
  161. case 3:
  162. ShareService.shareToWechat(0, message).then(function () {
  163. UtilService.showMess("微信分享成功");
  164. getCurrencyFromShare(response.clickid);
  165. $scope.hideLoadingToast();
  166. }, function (error) {
  167. UtilService.showMess(error);
  168. $scope.hideLoadingToast();
  169. });
  170. break;
  171. case 4:
  172. ShareService.shareToWeibo(message).then(function () {
  173. UtilService.showMess("新浪微博分享成功");
  174. getCurrencyFromShare(response.clickid);
  175. $scope.hideLoadingToast();
  176. }, function (error) {
  177. UtilService.showMess(error);
  178. $scope.hideLoadingToast();
  179. });
  180. break;
  181. default:
  182. break;
  183. }
  184. $timeout(function () {
  185. $scope.hideLoadingToast();
  186. }, 10000);
  187. }, function () {
  188. $scope.hideLoadingToast();
  189. })
  190. };
  191. var getCurrencyFromShare = function (clickid) {
  192. CommentService.getCurrencyFromShare(clickid);
  193. };
  194. $scope.showbutton = true;
  195. //详情页评论
  196. $scope.showComment = true;
  197. $scope.publishComment = function () {
  198. $scope.showComment = true;
  199. var content = $scope.comment.content;
  200. //提交评论信息
  201. $scope.showLoadingToast();
  202. CommentService.publishComment(0, recourceid, recourcetype, "", "", content, recourcecomefrom).then(function () {
  203. UtilService.showMess("评论成功");
  204. $scope.comment.content = "";
  205. getHotCommentList();
  206. if ($scope.commentlist.length >= 3) {
  207. $timeout(function () {
  208. $scope.goCommentList();
  209. }, 650);
  210. }
  211. $scope.hideLoadingToast();
  212. }, function () {
  213. $scope.hideLoadingToast();
  214. });
  215. };
  216. //发表详细评论
  217. $scope.releaseComment = function () {
  218. $scope.go('releaseComment', {
  219. infoid: recourceid,
  220. infotype: recourcetype,
  221. comlen: $scope.commentlist.length,
  222. recourcecomefrom: recourcecomefrom
  223. })
  224. };
  225. //进入评论列表页
  226. $scope.goCommentList = function () {
  227. $timeout(function () {
  228. $scope.go('toolDiscuss', {
  229. infoid: recourceid,
  230. infotype: recourcetype,
  231. recourcecomefrom: recourcecomefrom,
  232. isedit: $scope.roler.isedit
  233. });
  234. }, 350);
  235. };
  236. //进入相关资源详情
  237. $scope.goRelativeResource = function (relative) {
  238. if (relative.type == 81) {
  239. $scope.go('cloudDockingdetail', {infoid: relative.id, creator: relative.creator});
  240. } else {
  241. if (relative.groupid == "0") {
  242. $scope.go('resourceDetails', {
  243. recourceid: relative.unique,
  244. recourcetype: relative.type,
  245. recourcecomefrom: relative.source,
  246. categorylabel: categorylabel
  247. });
  248. } else {
  249. $scope.go('resourcePrivateDetails', {
  250. recourceid: relative.unique,
  251. recourcetype: relative.type,
  252. recourcecomefrom: relative.source,
  253. creator: relative.clickthrough
  254. });
  255. }
  256. }
  257. };
  258. //关联跳转
  259. $scope.goRelResource = function (resource) {
  260. if (!UtilService.isDefined(resource.resourceid)) {
  261. return;
  262. }
  263. $scope.go('resourcePrivateDetails', {
  264. recourceid: resource.resourceid,
  265. recourcetype: resource.resourcetype,
  266. recourcecomefrom: resource.resourcecomefrom,
  267. creator: resource.resourcecreator
  268. });
  269. };
  270. //进入相关资源列表
  271. $scope.goResourceMatch = function (relative) {
  272. $scope.go('resourceMatch', {type: relative.type, title: $scope.resource.title, categorylabel: categorylabel});
  273. };
  274. $scope.goResourceApply = function () {
  275. if ($scope.viplevel == 1) {
  276. AuthorityService.isHasEnoughCount(1).then(function (response) {
  277. if (response.isHasEnoughCount == 1) {
  278. var tempdata = {
  279. title: $scope.resource.title,
  280. recourceid: recourceid,
  281. recourcetype: recourcetype,
  282. recourcecomefrom: recourcecomefrom
  283. };
  284. $scope.go("resourceApply", {authoritydata: angular.toJson(tempdata)})
  285. } else {
  286. UtilService.showMess("本月申请次数已用完");
  287. }
  288. }, function () {
  289. });
  290. } else {
  291. var tempdata = {
  292. title: $scope.resource.title,
  293. recourceid: recourceid,
  294. recourcetype: recourcetype,
  295. recourcecomefrom: recourcecomefrom
  296. };
  297. $scope.go("resourceApply", {authoritydata: angular.toJson(tempdata)})
  298. }
  299. };
  300. //资源点赞
  301. $scope.dianZan = function () {
  302. CommentService.clickFavour(recourceid, recourcetype, $scope.resource.source, recourcecomefrom).then(function (response) {
  303. // console.log(response);
  304. if (response.favourState == 1) {
  305. $scope.resource.favourcount++;
  306. $scope.resource.Like = true;
  307. } else {
  308. $scope.resource.favourcount--;
  309. $scope.resource.Like = false;
  310. }
  311. // UtilService.showMess(response.clickStatus);
  312. }, function () {
  313. UtilService.showMess("网络不给力,请重试");
  314. })
  315. };
  316. //评论点赞
  317. $scope.content_zan = function (comment, index) {
  318. CommentService.commentLike(comment.id, recourcetype).then(function (response) {
  319. // console.log(response);
  320. if (response.favourState == 1) {
  321. $scope.commentlist[index].favourcount++;
  322. $scope.commentlist[index].Like = true;
  323. } else {
  324. $scope.commentlist[index].favourcount--;
  325. $scope.commentlist[index].Like = false;
  326. }
  327. // UtilService.showMess(response.clickStatus);
  328. }, function () {
  329. })
  330. };
  331. //收藏
  332. $scope.collectResource = function () {
  333. CommentService.collectResource(recourceid, recourcetype, $scope.resource.source, 1).then(function (response) {
  334. // console.log(response);
  335. if (response.clickStatus == "收藏成功") {
  336. $scope.resource.Enshrine = true;
  337. } else {
  338. $scope.resource.Enshrine = false;
  339. }
  340. UtilService.showMess(response.clickStatus);
  341. }, function () {
  342. UtilService.showMess("网络不给力,请重试");
  343. })
  344. };
  345. //进入评论详情页
  346. $scope.goCommentDetail = function (comment) {
  347. $scope.go('resourceCommentReply', {
  348. comment: angular.toJson(comment),
  349. infoid: recourceid,
  350. infotype: recourcetype,
  351. recourcecomefrom: recourcecomefrom,
  352. isedit: $scope.roler.isedit
  353. });
  354. };
  355. //点击强沙发
  356. $scope.hadSoft = function () {
  357. $scope.showComment = false;
  358. };
  359. $scope.showComment = true;
  360. $scope.focus_write = function () {
  361. $scope.showComment = false;
  362. $(".my_comment").focus();
  363. };
  364. $scope.hiddenComment = function () {
  365. $scope.showComment = true;
  366. };
  367. //弹出评论框
  368. $scope.commentValue = function () {
  369. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  370. if ($scope.comment.content.length > 1000) {
  371. UtilService.showMess("您的评论已超过1000字!");
  372. $scope.comment.content = $scope.comment.content.substr(0, 1000);
  373. }
  374. if (search_history.val.length != 0) {
  375. $scope.commentNotnull = {
  376. "background-color": "#2a90d7",
  377. "text-decoration": "underline"
  378. };
  379. }
  380. };
  381. //删除自己刚刚发布或者以后的评论
  382. $scope.delectToolDis = function (commentid) {
  383. $scope.showLoadingToast();
  384. CommentService.deleteComment(commentid).then(function () {
  385. UtilService.showMess("删除成功");
  386. getHotCommentList();
  387. $scope.hideLoadingToast();
  388. }, function () {
  389. $scope.hideLoadingToast();
  390. });
  391. };
  392. //打开操作表
  393. $scope.openActionSheet = function () {
  394. // isedit:是否可以编辑资源,isset:是否可以设置权限
  395. var buttonlist = [];
  396. if ($scope.roler.isset) {
  397. buttonlist.push({text: '设置'})
  398. }
  399. $ionicActionSheet.show({
  400. buttons: buttonlist,
  401. cancelText: '取消',
  402. buttonClicked: function (index) {
  403. if (index == 0) {
  404. var tempdata = {
  405. title: $scope.resource.title,
  406. recourceid: recourceid,
  407. recourcetype: recourcetype,
  408. recourcecomefrom: recourcecomefrom,
  409. creator: creator
  410. };
  411. $scope.go("authorityRecordSet", {authoritydata: angular.toJson(tempdata)});
  412. }
  413. /*else if (index = 1) {
  414. console.log('编辑');
  415. $scope.go("editResourcePrivateDetails", {resource: angular.toJson($scope.resource), type: recourcetype});
  416. }*/
  417. return true;
  418. }
  419. });
  420. };
  421. //点击图片放大
  422. $scope.bigImage = false; //初始默认大图是隐藏的
  423. $scope.hideBigImage = function () {
  424. $timeout(function () {
  425. if($scope.app){
  426. $scope.setStatusBar(0);
  427. }
  428. $scope.bigImage = false;
  429. }, 400);
  430. };
  431. $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl)
  432. if($scope.app){
  433. $scope.setStatusBar(1);
  434. }
  435. // console.log(piclist);
  436. // console.log(index);
  437. $scope.commentpiclist = piclist;
  438. $scope.bigImage = true; //显示大图
  439. // console.log(index);
  440. $(function () {
  441. $('div.pinch-zoom').each(function () {
  442. new RTP.PinchZoom($(this), {});
  443. });
  444. });
  445. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  446. //图片总数量
  447. setTimeout(function () {
  448. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  449. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  450. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  451. //获取图片
  452. var imgObj = document.getElementsByClassName('bigimage');
  453. var n;
  454. for (n = 0; n < imgObj.length; n++) {
  455. // 获取图片的原始高度和宽度
  456. var oldWid = imgObj[n].naturalWidth;
  457. var oldHei = imgObj[n].naturalHeight;
  458. var screen = document.body.offsetWidth;
  459. var screenH = window.innerHeight;
  460. // console.log(oldWid/oldHei);
  461. // console.log(screen );
  462. var cc = screen / (oldWid / oldHei);
  463. imgObj[n].style.height = cc + 'px';
  464. if (cc < screenH) {
  465. imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
  466. // console.log("e:" + imgObj[n].style.marginTop);
  467. } else {
  468. imgObj[n].style.marginTop = 0 + 'px';
  469. // console.log((cc - screenH) + 'px')
  470. }
  471. }
  472. }, 0);
  473. };
  474. //查看原图
  475. $scope.viewOldImg = function (index) {
  476. // console.log($scope.commentpiclist[index]);
  477. // console.log("查看原图" + index);
  478. var url = UtilService.isDefined($scope.commentpiclist[index].source_name) ? $scope.commentpiclist[index].source_name : $scope.commentpiclist[index].photo_name;
  479. $(".bigimage").eq(index).attr("src", $scope.imgUrl + url);
  480. $timeout(function () {
  481. $scope.commentpiclist[index].loadsource = true;
  482. }, 20);
  483. };
  484. //请求SDK权限
  485. $scope.loadImg = function (pic) {
  486. if (UtilService.checkPlatform()) {
  487. window.imagePicker.verifyStorage(
  488. function (results) {
  489. if (results == "1") {
  490. downloadPicture(pic);
  491. }
  492. }, function (error) {
  493. }
  494. );
  495. } else {
  496. downloadPicture(pic);
  497. }
  498. };
  499. //图片下载
  500. var downloadPicture = function (pic) {
  501. $scope.showLoadingToast();
  502. var fileTransfer = new FileTransfer();
  503. var url = UtilService.isDefined(pic.source_name) ? pic.source_name : pic.photo_name;
  504. var imgname = url.substring(url.lastIndexOf('/') + 1);//图片名称
  505. var loadurl = $scope.imgUrl + url;//图片下载地址
  506. var fileURL = "";//下载后的地址
  507. if (UtilService.checkPlatform()) {
  508. fileURL = cordova.file.externalRootDirectory + "pushpicture/" + imgname;
  509. } else {
  510. fileURL = cordova.file.documentsDirectory + imgname;
  511. }
  512. // console.log(loadurl);
  513. // console.log(fileURL);
  514. fileTransfer.download(
  515. loadurl,
  516. fileURL,
  517. function (entry) {
  518. // console.log(entry);
  519. if (UtilService.checkPlatform()) {
  520. var tempstr = entry.toURL().replace("file://", "");
  521. UtilService.showMess("图片下载成功,地址:" + tempstr);
  522. } else {
  523. UtilService.showMess("图片下载成功");
  524. }
  525. $scope.hideLoadingToast();
  526. },
  527. function (error) {
  528. // console.log(error);
  529. $scope.hideLoadingToast();
  530. UtilService.showMess("网络不给力,请重试");
  531. },
  532. null, // or, pass false
  533. {
  534. //headers: {
  535. // "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
  536. //}
  537. }
  538. );
  539. };
  540. //拨打电话
  541. $scope.openTel = function (tel) {
  542. window.open("tel:" + tel);
  543. };
  544. //新增名片
  545. $scope.openCard1 = function () {
  546. $(".openCard1").toggleClass("upCardArrowEm");
  547. $(".openCardDiv1").toggle();
  548. };
  549. $scope.openCard2 = function () {
  550. $(".openCard2").toggleClass("upCardArrowEm");
  551. $(".openCardDiv2").toggle();
  552. };
  553. $scope.openCard3 = function () {
  554. $(".openCard3").toggleClass("upCardArrowEm");
  555. $(".openCardDiv3").toggle();
  556. };
  557. $scope.openCard4 = function () {
  558. $(".openCard4").toggleClass("upCardArrowEm");
  559. $(".openCardDiv4").toggle();
  560. };
  561. $scope.openCard5 = function () {
  562. $(".openCard5").toggleClass("upCardArrowEm");
  563. $(".openCardDiv5").toggle();
  564. };
  565. $scope.openCard6 = function () {
  566. $(".openCard6").toggleClass("upCardArrowEm");
  567. $(".openCardDiv6").toggle();
  568. };
  569. $scope.openCard7 = function () {
  570. $(".openCard7").toggleClass("upCardArrowEm");
  571. $(".openCardDiv7").toggle();
  572. };
  573. $scope.openCard8 = function () {
  574. $(".openCard8").toggleClass("upCardArrowEm");
  575. $(".openCardDiv8").toggle();
  576. };
  577. $scope.openCard9 = function () {
  578. $(".openCard9").toggleClass("upCardArrowEm");
  579. $(".openCardDiv9").toggle();
  580. };
  581. $scope.openCard10 = function () {
  582. $(".openCard10").toggleClass("upCardArrowEm");
  583. $(".openCardDiv10").toggle();
  584. };
  585. $scope.openCard11 = function () {
  586. $(".openCard11").toggleClass("upCardArrowEm");
  587. $(".openCardDiv11").toggle();
  588. };
  589. $scope.openCard12 = function () {
  590. $(".openCard12").toggleClass("upCardArrowEm");
  591. $(".openCardDiv12").toggle();
  592. };
  593. $scope.openCard13 = function () {
  594. $(".openCard13").toggleClass("upCardArrowEm");
  595. $(".openCardDiv13").toggle();
  596. };
  597. $scope.openCard14 = function () {
  598. $(".openCard14").toggleClass("upCardArrowEm");
  599. $(".openCardDiv14").toggle();
  600. };
  601. $scope.tttindex = 5;
  602. $scope.showMoreSignup = function () {
  603. $scope.tttindex = $scope.signuplist.length;
  604. };
  605. //关联跳转列表页
  606. $ionicModal.fromTemplateUrl('templates/moreresourcelist.html', {
  607. scope: $scope,
  608. animation: 'slide-in-up'
  609. }).then(function (modal) {
  610. $scope.modal = modal;
  611. });
  612. //关闭关联列表
  613. $scope.hideModel = function () {
  614. $scope.modal.hide();
  615. $scope.moreresourcelist = [];
  616. };
  617. //打开关联列表
  618. $scope.showModel = function () {
  619. $scope.modal.show();
  620. };
  621. //关联跳转人才
  622. $scope.goPersonResource = function (resource) {
  623. if (UtilService.isDefined(resource.resourcelibrary)) {
  624. if(resource.resourcelibrary.length==1){
  625. var tempobj = resource.resourcelibrary[0];
  626. $scope.go('resourcePrivateDetails', {
  627. recourceid: tempobj.unique,
  628. recourcetype: tempobj.type,
  629. recourcecomefrom: tempobj.source,
  630. creator: tempobj.clickthrough
  631. });
  632. }
  633. if(resource.resourcelibrary.length>1){
  634. $scope.modal.hide();
  635. $scope.moreresourcelist = resource.resourcelibrary;
  636. }
  637. }
  638. };
  639. });