xxggimg1.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination',
  4. ]);
  5. app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) {
  6. var self = this;
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-username");
  9. self.userChineseName = $.cookie("GlWorkPlatform-chineseName")
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. };
  17. /*新闻*/
  18. self.getDataImg = function () {
  19. var data = {
  20. tablename: "WJFB_TPXW",
  21. pagesize: 5,
  22. pageno: 1,
  23. colums: "ID,BT,FBRQ,ROUTEINFOID",
  24. order: "FBRQ desc",
  25. sqlwhere: { FBZT: "1" },
  26. sqlorwhere: "",
  27. sqlinwhere: "",
  28. sqllikewhere: ""
  29. };
  30. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  31. .success(function (obj) {
  32. var res = strToJson(s4.decryptData_CBC(obj.data));
  33. self.newsImg = res.data;
  34. $.each(self.newsImg, function (index, item) {
  35. self.getImg(item)
  36. })
  37. if (self.newsImg.length > 1) {
  38. $timeout(function () {
  39. var swiper = new Swiper('.swiper-container', {
  40. autoplay: {
  41. delay: 2000,
  42. disableOnInteraction: false,
  43. },
  44. slidesPerView: 1,
  45. pagination: {
  46. el: '.swiper-pagination',
  47. clickable: true,
  48. }
  49. })
  50. }, 1)
  51. }
  52. })
  53. }
  54. self.getImg = function (parent) {
  55. var data = {
  56. tablename: "FILE_ATTACH",
  57. colums: "ID,FILEURL,ATTACHTYPE",
  58. order: "ID",
  59. sqlwhere: { ROUTEINFOID: parent.ROUTEINFOID},
  60. sqlorwhere: "",
  61. sqlinwhere: "",
  62. sqllikewhere: ""
  63. };
  64. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  65. .success(function (obj) {
  66. var res = strToJson(s4.decryptData_CBC(obj.data));
  67. for (var i = 0; i < res.data.length; i++) {
  68. if (res.data[i].ATTACHTYPE == "IMAGESDATA" || res.data[i].ATTACHTYPE == "IMAGESDATA") {
  69. parent.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + res.data[i].FILEURL)
  70. break
  71. }
  72. }
  73. })
  74. }
  75. self.getDataImg()
  76. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  77. self.openTab = function (id) {
  78. if (self.deviceType == "pad") {
  79. sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + id, "文件发布")
  80. } else {
  81. sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + id, "文件发布")
  82. }
  83. }
  84. }])