publicResourceCtrl.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. angular.module('push')
  2. .controller('publicResourceCtrl', function ($scope, $ionicActionSheet, $ionicSlideBoxDelegate, ResourceLibraryService, $stateParams, $timeout, $ionicScrollDelegate,
  3. UtilService, $ionicPopup, resourceLibraryTempData, ShareService, $ionicListDelegate, AuthorityService, UserService) {
  4. if($scope.app){
  5. $scope.setStatusBar(0);
  6. }
  7. //1:需求,2:成果,6:企业,8:人才
  8. var libtype = $stateParams.libtype;
  9. var modlibid = $stateParams.modlibid;
  10. $scope.libtype = libtype;
  11. $scope.name = $stateParams.name;
  12. var checkedresource = {};//单个分享时选中的资源
  13. var checkedindex = -1;//多个分享时第一个选择的索引
  14. $scope.checkedresourcelist = [];//多个分享时选中的资源
  15. $scope.tabs = [];
  16. var chooseIndex = resourceLibraryTempData.getCategoryIndex();//当前频道索引
  17. $scope.index = chooseIndex;
  18. $scope.checked = resourceLibraryTempData.getChecked();
  19. $scope.checked.classificationType = libtype;
  20. //排序初始化
  21. $scope.sorts = [
  22. {name: "热门", type: 0, value: "popular,DESC"},
  23. {name: "最新", type: 1, value: "time,DESC"},
  24. {name: "综合", type: 2, value: "complex,DESC"}
  25. ];
  26. var checkedsort = $scope.sorts[0].value;
  27. //地区初始化
  28. /*$scope.checkedlocationtype = 1;
  29. $scope.chooeslocation = [
  30. {name: "不限"},
  31. {name: "常州"},
  32. {name: "定位"}
  33. ];*/
  34. if (libtype == 2) {
  35. // $scope.contentlist = resourceLibraryTempData.getAchievementList();
  36. //成熟度初始化
  37. $scope.chooesMaturity = [
  38. {name: "不限", type: 0},
  39. {name: "正在研发", type: 1},
  40. {name: "已有小样", type: 2},
  41. {name: "通过小试", type: 3},
  42. {name: "通过中试", type: 4},
  43. {name: "可以量产", type: 5}
  44. ];
  45. //知识产权初始化
  46. $scope.chooesRight = [
  47. {name: "不限", type: 0},
  48. {name: "有", type: 1},
  49. {name: "无", type: 2}
  50. ];
  51. //合作模式初始化
  52. $scope.chooesModel = [
  53. {name: "不限", type: 0},
  54. {name: "委托开发", type: 1},
  55. {name: "合作研发", type: 2},
  56. {name: "成果转让", type: 3},
  57. {name: "技术入股", type: 4},
  58. {name: "技术咨询", type: 5},
  59. {name: "其他", type: 6}
  60. ];
  61. } else if (libtype == 1) {
  62. // $scope.contentlist = resourceLibraryTempData.getRequirementList();
  63. //合作模式初始化
  64. $scope.chooesModel = [
  65. {name: "不限", type: 0},
  66. {name: "委托开发", type: 1},
  67. {name: "合作研发", type: 2},
  68. {name: "成果转让", type: 3},
  69. {name: "技术入股", type: 4},
  70. {name: "技术咨询", type: 5},
  71. {name: "其他", type: 6}
  72. ];
  73. //投入预算
  74. $scope.inputBudget = [
  75. {name: "不限", type: 0},
  76. {name: "1000万以上", type: 9},
  77. {name: "500万-1000万", type: 8},
  78. {name: "200万-500万", type: 7},
  79. {name: "100万-200万", type: 6},
  80. {name: "50万-100万", type: 5},
  81. {name: "10万-50万", type: 4},
  82. {name: "10万以下", type: 3},
  83. {name: "面议", type: 2}
  84. ]
  85. } else if (libtype == 6) {
  86. // $scope.contentlist = resourceLibraryTempData.getEenterpriseList();
  87. //企业规模
  88. $scope.enterpriseScale = [
  89. {name: "不限", type: 0},
  90. {name: "少于50人", type: 1},
  91. {name: "50-150人", type: 2},
  92. {name: "150-500人", type: 3},
  93. {name: "500-1000人", type: 4},
  94. {name: "1000-5000人", type: 5},
  95. {name: "5000-10000人", type: 6},
  96. {name: "10000人以上", type: 7}
  97. ];
  98. //企业类型
  99. $scope.enterpriseType = [
  100. {name: "不限", type: 0},
  101. {name: "国有企业", type: 1},
  102. {name: "集体所有制企业", type: 2},
  103. {name: "私营企业", type: 3},
  104. {name: "股份制企业", type: 4},
  105. {name: "联营企业", type: 5},
  106. {name: "外商投资企业", type: 6},
  107. {name: "港澳台企业", type: 7},
  108. {name: "股份合作企业", type: 8}
  109. ];
  110. } else if (libtype == 8) {
  111. // $scope.contentlist = resourceLibraryTempData.getPersonnelList();
  112. //学位
  113. $scope.academicDegree = [
  114. {name: "不限", type: 0},
  115. {name: "博士后", type: 7},
  116. {name: "博士", type: 6},
  117. {name: "硕士", type: 5},
  118. {name: "学士", type: 4},
  119. {name: "其他", type: 8}
  120. ];
  121. //职称
  122. $scope.occupationalTitle = [
  123. {name: "不限", type: 0},
  124. {name: "正高", type: 1},
  125. {name: "副高", type: 2},
  126. {name: "中级", type: 3},
  127. {name: "副级", type: 4},
  128. {name: "无", type: 5}
  129. ];
  130. } else if (libtype == 7) {
  131. //学校类别
  132. $scope.universitytype = [
  133. {name: "不限", type: 0},
  134. {name: "985工程院校暨211工程院校", type: 600},
  135. {name: "985工程院校", type: 601},
  136. {name: "211工程院校", type: 602},
  137. {name: "普通本科院校", type: 604},
  138. {name: "高职专科院校", type: 606}
  139. ];
  140. }
  141. $scope.contentlist = [];
  142. // 获取资源库下行业分类列表
  143. var getCategoryList = function () {
  144. ResourceLibraryService.getCategoryList(libtype, $stateParams.reclibid, modlibid).then(function (response) {
  145. // console.log(response);
  146. $scope.categorylist = response.channelList;
  147. // resourceLibraryTempData.setCategoryList(response.channelList);
  148. angular.forEach(response.channelList, function (value, index) {
  149. $scope.contentlist.push({isload: false, currentPage: 1, reslist: []});
  150. });
  151. // resourceLibraryTempData.initContent(libtype, response.channelList);
  152. if ($scope.categorylist.length > 0) {
  153. $timeout(function () {
  154. $ionicSlideBoxDelegate.slide(chooseIndex);
  155. $scope.getPublicResourceList();
  156. }, 100);
  157. }
  158. }, function () {
  159. UtilService.showMess("网络不给力,请重试");
  160. })
  161. };
  162. //获取资源列表
  163. $scope.getPublicResourceList = function () {
  164. $scope.showLoadingToast();
  165. var category = "";
  166. if (libtype != 7) {
  167. category = $scope.categorylist[chooseIndex].by1
  168. }
  169. ResourceLibraryService.getFirstResourceList(libtype, $scope.checked, checkedsort, category, "", 0, 0).then(function (response) {
  170. // console.log(response);
  171. var tempreslib = angular.fromJson(response.resourcelibrary);
  172. // console.log(tempreslib);
  173. var temppage = angular.fromJson(response.page);
  174. var totalPage = Math.ceil(temppage.totalCount / 10);
  175. $scope.contentlist[chooseIndex].reslist = tempreslib;
  176. var trHtml = "<div class='refresh_tip_div'>更新了" + $scope.contentlist[chooseIndex].reslist.length + "条内容</div>";
  177. $timeout(function () {
  178. $(".resourcelistDiv .list").prepend(trHtml);
  179. $(".refresh_tip_div").animate({width: 100 + "%"}, 150);
  180. }, 800);
  181. $timeout(function () {
  182. $(".refresh_tip_div").slideUp();
  183. }, 1200);
  184. //判断是否有下一页
  185. $timeout(function () {
  186. $timeout(function () {
  187. if ($scope.contentlist[chooseIndex].currentPage >= totalPage) {
  188. $scope.contentlist[chooseIndex].isload = false;
  189. } else {
  190. $scope.contentlist[chooseIndex].isload = true;
  191. }
  192. $scope.contentlist[chooseIndex].currentPage = 2;
  193. }, 1000);
  194. $scope.hideLoadingToast();
  195. $ionicSlideBoxDelegate.update();
  196. $ionicScrollDelegate.$getByHandle("resourceContent").scrollTo(0, 0);
  197. }, 50);
  198. }, function () {
  199. $scope.hideLoadingToast();
  200. }).finally(function () {
  201. $scope.$broadcast('scroll.refreshComplete');
  202. });
  203. };
  204. //加载更多资源列表
  205. $scope.loadMore = function () {
  206. $scope.contentlist[chooseIndex].isload = false;
  207. $scope.loadmore = true;
  208. // $scope.showLoadingToast();
  209. var category = "";
  210. if (libtype != 7) {
  211. category = $scope.categorylist[chooseIndex].by1
  212. }
  213. ResourceLibraryService.getSecondResourceList(libtype, $scope.checked, checkedsort, category, "", $scope.contentlist[chooseIndex].currentPage, 0, 0).then(function (response) {
  214. // console.log(response);
  215. var tempreslib = angular.fromJson(response.resourcelibrary);
  216. var temppage = angular.fromJson(response.page);
  217. var totalPage = Math.ceil(temppage.totalCount / 10);
  218. //加载数据,更新当前页数
  219. $timeout(function () {
  220. if (tempreslib.length > 0) {
  221. $scope.contentlist[chooseIndex].reslist = $scope.contentlist[chooseIndex].reslist.concat(tempreslib);
  222. }
  223. $scope.loadmore = false;
  224. }, 2000);
  225. // $scope.hideLoadingToast();
  226. //判断是否有下一页
  227. $timeout(function () {
  228. if ($scope.contentlist[chooseIndex].currentPage >= totalPage) {
  229. $scope.contentlist[chooseIndex].isload = false;
  230. } else {
  231. $scope.contentlist[chooseIndex].isload = true;
  232. }
  233. $scope.contentlist[chooseIndex].currentPage++;
  234. }, 2000);
  235. if (selectflg) {
  236. $timeout(function () {
  237. $(".item-options").addClass("invisible");
  238. $(".resource_wrap").css("left", "10%");
  239. $(".pay_list_c2").css("left", "4%");
  240. $(".item-content").css("transform", "translate3d(0px, 0px, 0px)");
  241. $("#collect-bottom").css("display", "block");
  242. }, 20);
  243. }
  244. }, function () {
  245. // $scope.hideLoadingToast();
  246. $scope.loadmore = false;
  247. }).finally(function () {
  248. $scope.$broadcast('scroll.infiniteScrollComplete');
  249. });
  250. };
  251. if (libtype == 7) {
  252. $scope.listtop = "0px";
  253. $scope.contentlist = [{isload: false, currentPage: 1, reslist: []}];
  254. $scope.getPublicResourceList();
  255. } else {
  256. $scope.listtop = "33px";
  257. getCategoryList();
  258. }
  259. $scope.goResourceDetail = function (resource, ind) {
  260. if (selectflg) {
  261. selectResource(resource, ind);
  262. } else {
  263. resourceLibraryTempData.setCategoryIndex(chooseIndex);
  264. resourceLibraryTempData.setChecked($scope.checked);
  265. var category = "";
  266. if (libtype != 7) {
  267. category = $scope.categorylist[chooseIndex].by1
  268. }
  269. $scope.go('resourceDetails', {
  270. recourceid: resource.unique,
  271. recourcetype: resource.type,
  272. recourcecomefrom: resource.source,
  273. categorylabel: category
  274. });
  275. }
  276. };
  277. var editSlide = function (index) {
  278. var tablength = $scope.categorylist.length;//标题个数
  279. var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般
  280. var OffLeft = $(".Chanel_scroll_a").eq(index).offset().left;//获取当前点击标题距离父容器左边框的距离
  281. var SelfWidth = $(".Chanel_scroll_a").eq(index).width();//获取当前点击标题宽度
  282. var startTranform = $("#p_Chanel .scroll").offset().left;
  283. var movewidth = OffLeft - middlewidth + SelfWidth / 2;
  284. startTranform -= movewidth;
  285. if (startTranform <= 0) {
  286. if (index < tablength - 2) {
  287. $('#p_Chanel .scroll').css({
  288. 'transform': 'translate3d(' + startTranform + 'px,0,0)'
  289. });
  290. }
  291. } else if (index < 4) {
  292. $('#p_Chanel .scroll').css({
  293. 'transform': 'translate3d(0,0,0)'
  294. });
  295. }
  296. $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  297. };
  298. $scope.selectCategory = function (index) {
  299. if (selectflg) {
  300. UtilService.showMess("当前处于编辑状态,无法切换行业");
  301. return;
  302. }
  303. editSlide(index);
  304. $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  305. if (index == chooseIndex) {
  306. return;
  307. }
  308. chooseIndex = index;
  309. editSlide(index);
  310. // $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  311. $scope.index = chooseIndex;
  312. $scope.getPublicResourceList();
  313. // $ionicSlideBoxDelegate.slide(index);
  314. };
  315. //资源库搜索
  316. $scope.goResourceSearch = function () {
  317. resourceLibraryTempData.setCategoryIndex(chooseIndex);
  318. resourceLibraryTempData.setChecked($scope.checked);
  319. //1:需求,2:成果,6:企业,8:人才
  320. var tabindex = 3;
  321. if (libtype == 1) {
  322. tabindex = 4;
  323. } else if (libtype == 2) {
  324. tabindex = 3;
  325. } else if (libtype == 6) {
  326. tabindex = 5;
  327. } else if (libtype == 8) {
  328. tabindex = 6;
  329. }
  330. $timeout(function () {
  331. $scope.go('resourceSearch', {resourcetype: libtype, tabindex: tabindex});
  332. }, 350);
  333. };
  334. $scope.shareflg = false;
  335. $scope.openShare = function (tempobj, ind) {
  336. $scope.go('chooseShareResource', {
  337. chereslist: angular.toJson([tempobj.unique]),
  338. folderid: $stateParams.reclibid,
  339. isCloud: 1,
  340. recourcetype: tempobj.type,
  341. recourcecomefrom: tempobj.source
  342. });
  343. /*$scope.shareflg = true;
  344. $(".resource_wrap").css("left", "0%");
  345. $(".pay_list_c2").css("left", "-35px");
  346. $("#collect-bottom").css("display", "none");
  347. checkedresource = tempobj;
  348. checkedindex = ind;*/
  349. };
  350. $scope.closeShare = function () {
  351. $timeout(function () {
  352. $ionicListDelegate.closeOptionButtons();
  353. }, 10);
  354. $scope.shareflg = false;
  355. };
  356. //选择排序
  357. $scope.chooseSort = function (b) {
  358. $scope.checked.SortType = b.type;
  359. checkedsort = b.value;
  360. };
  361. //地区
  362. /*$scope.chooseActionlocation = function (index) {
  363. $(".locationclassfile ul li").eq(index).addClass("specialSpan").siblings().removeClass("specialSpan");
  364. if (index != 0) {
  365. $(".locationclassfile ul li:first-child").css({"color": "#000", "border": "none"});
  366. } else {
  367. $(".locationclassfile ul li:first-child").css({"color": "#3385ff", "border": "#3385ff .5px solid"});
  368. $(".locationclassfile ul li").removeClass("specialSpan");
  369. }
  370. };*/
  371. //选择成熟度
  372. $scope.chooseActionMaturity = function (s) {
  373. $scope.checked.MaturityType = s.type;
  374. };
  375. //选择知识产产权
  376. $scope.chooseActionRight = function (r) {
  377. $scope.checked.RightType = r.type;
  378. };
  379. //选择合作模式
  380. $scope.chooseActionModel = function (m) {
  381. $scope.checked.ModelType = m.type;
  382. };
  383. //选择投入预算
  384. $scope.chooseInputBudget = function (budget) {
  385. $scope.checked.BudgetType = budget.type;
  386. };
  387. //选择企业规模
  388. $scope.chooseEenterpriseScale = function (scale) {
  389. $scope.checked.ScaleType = scale.type;
  390. };
  391. //选择企业类型
  392. $scope.chooseEnterpriseType = function (enterprise) {
  393. $scope.checked.EnterpriseType = enterprise.type;
  394. };
  395. //选择学位
  396. $scope.chooseAcademicDegree = function (degree) {
  397. $scope.checked.DegreeType = degree.type;
  398. };
  399. //选择职称
  400. $scope.chooseOccupationalTitle = function (title) {
  401. $scope.checked.TitleType = title.type;
  402. };
  403. //选择学校类别
  404. $scope.chooseUniversityType = function (university) {
  405. $scope.checked.UniversityType = university.type;
  406. };
  407. //展开/收起排序
  408. $scope.toggleSort = function () {
  409. $(".sort ul").toggle();
  410. $(".sort h3 i").toggleClass("transformArrow");
  411. };
  412. //展开/收起地区
  413. /*$scope.toggleClassfilelocation = function () {
  414. $(".locationclassfile ul").toggle();
  415. $(".locationclassfile h3 i").toggleClass("transformArrow");
  416. };*/
  417. //展开/收起成熟度
  418. $scope.toggleClassfileMaturity = function () {
  419. $(".Maturityclassfile ul").toggle();
  420. $(".Maturityclassfile h3 i").toggleClass("transformArrow");
  421. };
  422. //展开/收起知识产权
  423. $scope.toggleClassfileRight = function () {
  424. $(".Rightclassfile ul").toggle();
  425. $(".Rightclassfile h3 i").toggleClass("transformArrow");
  426. };
  427. //展开/收起合作模式
  428. $scope.toggleClassfileModel = function () {
  429. $(".Modelclassfile ul").toggle();
  430. $(".Modelclassfile h3 i").toggleClass("transformArrow");
  431. };
  432. //展开/收起投入预算
  433. $scope.toggleInputBudget = function () {
  434. $(".InputBudget ul").toggle();
  435. $(".InputBudget h3 i").toggleClass("transformArrow");
  436. };
  437. //展开/收起企业规模
  438. $scope.toggleEenterpriseScale = function () {
  439. $(".EenterpriseScale ul").toggle();
  440. $(".EenterpriseScale h3 i").toggleClass("transformArrow");
  441. };
  442. //展开/收起企业类型
  443. $scope.toggleEnterpriseType = function () {
  444. $(".EnterpriseType ul").toggle();
  445. $(".EnterpriseType h3 i").toggleClass("transformArrow");
  446. };
  447. //展开/收起学位
  448. $scope.toggleAcademicDegree = function () {
  449. $(".AcademicDegree ul").toggle();
  450. $(".AcademicDegree h3 i").toggleClass("transformArrow");
  451. };
  452. //展开/收起职称
  453. $scope.toggleOccupationalTitle = function () {
  454. $(".OccupationalTitle ul").toggle();
  455. $(".OccupationalTitle h3 i").toggleClass("transformArrow");
  456. };
  457. //展开/收起学校类别
  458. $scope.toggleUniversityType = function () {
  459. $(".UniversityType ul").toggle();
  460. $(".UniversityType h3 i").toggleClass("transformArrow");
  461. };
  462. $scope.finishShow = false;
  463. //展开筛选
  464. $scope.menueFilter = function () {
  465. $scope.finishShow = true;
  466. };
  467. //完成选择,刷新数据
  468. $scope.finishDone = function () {
  469. $scope.finishShow = false;
  470. $scope.getPublicResourceList();
  471. };
  472. //重置选择数据
  473. $scope.reseChecked = function () {
  474. $scope.checked = {
  475. SortType: 0,
  476. classificationType: libtype,
  477. starType: 0,
  478. MaturityType: 0,
  479. RightType: 0,
  480. ModelType: 0,
  481. BudgetType: 0,
  482. ScaleType: 0,
  483. EnterpriseType: 0,
  484. DegreeType: 0,
  485. sexType: 0,
  486. TitleType: 0,
  487. UniversityType: 0
  488. };
  489. checkedsort = $scope.sorts[0].value;
  490. };
  491. //点击空白灰色选择条件隐藏
  492. $scope.hideSortDiv = function () {
  493. $scope.finishShow = false;
  494. $scope.getPublicResourceList();
  495. };
  496. //分享选择操作表
  497. var selectflg = false;//列表选择打开标志
  498. $scope.openCollectShare = function () {
  499. selectflg = true;
  500. $scope.contentlist[$scope.index].reslist[checkedindex].value = true;
  501. var tempres = {
  502. infoid: checkedresource.unique,
  503. infocomefrom: checkedresource.source,
  504. infoType: checkedresource.type
  505. };
  506. $scope.checkedresourcelist.push(tempres);
  507. $(".item-options").addClass("invisible");
  508. $(".resource_wrap").css("left", "10%");
  509. $(".pay_list_c2").css("left", "4%");
  510. $(".item-content").css("transform", "translate3d(0px, 0px, 0px)");
  511. $("#collect-bottom").css("display", "block");
  512. $scope.closeShare();
  513. };
  514. //取消分享
  515. $scope.cancelShare = function () {
  516. angular.forEach($scope.contentlist[$scope.index].reslist, function (value, ind) {
  517. $scope.contentlist[$scope.index].reslist[ind].value = false;
  518. });
  519. $scope.checkedresourcelist = [];
  520. $(".resource_wrap").css("left", "0%");
  521. $(".pay_list_c2").css("left", "-35px");
  522. $("#collect-bottom").css("display", "none");
  523. selectflg = false;
  524. };
  525. var selectResource = function (resource, ind) {
  526. var tempres = {
  527. infoid: resource.unique,
  528. infocomefrom: resource.source,
  529. infoType: resource.type
  530. };
  531. var chind = -1;
  532. angular.forEach($scope.checkedresourcelist, function (value, index) {
  533. if (value.infoid == resource.unique) {
  534. chind = index;
  535. }
  536. });
  537. if (chind == -1) {
  538. $scope.contentlist[$scope.index].reslist[ind].value = true;
  539. $scope.checkedresourcelist.unshift(tempres);
  540. } else {
  541. $scope.contentlist[$scope.index].reslist[ind].value = false;
  542. $scope.checkedresourcelist.splice(chind, 1);
  543. }
  544. // console.log($scope.checkedresourcelist);
  545. };
  546. $scope.shareResourceToPrilib = function () {
  547. $scope.go('chooseShareResource', {chereslist: angular.toJson($scope.checkedresourcelist)});
  548. };
  549. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  550. $scope.shareMessage = function (type) {
  551. $scope.shareflg = false;
  552. $scope.showLoadingToast();
  553. var message = {
  554. title: checkedresource.title,
  555. description: checkedresource.title.substring(0, 19),
  556. url: checkedresource.sharelink,
  557. imageurl: $scope.imgUrl + checkedresource.logo
  558. };
  559. switch (type) {
  560. case 0:
  561. case 1:
  562. ShareService.shareToQQ(type, message).then(function () {
  563. UtilService.showMess("QQ分享成功");
  564. $scope.hideLoadingToast();
  565. }, function (error) {
  566. UtilService.showMess(error);
  567. $scope.hideLoadingToast();
  568. });
  569. break;
  570. case 2:
  571. case 3:
  572. ShareService.shareToWechat(0, message).then(function () {
  573. UtilService.showMess("微信分享成功");
  574. $scope.hideLoadingToast();
  575. }, function (error) {
  576. UtilService.showMess(error);
  577. $scope.hideLoadingToast();
  578. });
  579. break;
  580. default:
  581. break;
  582. }
  583. $timeout(function () {
  584. $scope.hideLoadingToast();
  585. }, 10000);
  586. };
  587. });