xxggimg1.js 3.3 KB

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