xxgg.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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: 10,
  22. pageno: 1,
  23. colums: "ID,BT,FBRQ,IMAGEDATA",
  24. order: "ID",
  25. sqlwhere: { FBZT: "1" },
  26. sqlorwhere: "",
  27. sqlinwhere: "",
  28. sqllikewhere: ""
  29. };
  30. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg)
  31. .success(function (obj) {
  32. //var res = strToJson(s4.decryptData_CBC(obj.data));
  33. var res = obj;
  34. self.newsImg = res.data;
  35. console.log(self.newsImg)
  36. $.each(self.newsImg, function (index, item) {
  37. if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") {
  38. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL)
  39. } else {
  40. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL)
  41. }
  42. })
  43. if (self.newsImg.length > 1) {
  44. $timeout(function () {
  45. var swiper = new Swiper('.swiper-container', {
  46. loop: true,
  47. autoplay: {
  48. delay: 2000,
  49. disableOnInteraction: false,
  50. },
  51. slidesPerView: 1,
  52. centeredSlides: true,
  53. pagination: {
  54. el: '.swiper-pagination',
  55. clickable: true,
  56. }
  57. })
  58. }, 1)
  59. }
  60. })
  61. }
  62. self.getDataImg()
  63. $timeout(function () {
  64. var swiper = new Swiper('.swiper-container', {
  65. loop: true,
  66. autoplay: {
  67. delay: 3000,
  68. disableOnInteraction: false,
  69. },
  70. slidesPerView: 1,
  71. centeredSlides: true,
  72. spaceBetween: 30,
  73. pagination: {
  74. el: '.swiper-pagination',
  75. clickable: true,
  76. }
  77. })
  78. }, 1)
  79. $('#newsList').settabs({
  80. event: 'click'
  81. });
  82. self.check = 1;
  83. self.getData = function () {
  84. var sqlwhere = "", TABLENAME = "", BT = "";
  85. switch (self.check) {
  86. case 1: sqlwhere = { GGBK: "C03", FBZT: "1" }; BT = "GGBT,FBSJ"; TABLENAME = "SX_TZGG"; break;
  87. case 2: sqlwhere = { LX: "C04", FBZT: "1" }; BT = "WJBT,FBRQ"; TABLENAME = "WJFB_CB"; break;
  88. case 3: sqlwhere = { LX: "C12", FBZT: "1" }; BT = "WJBT,FBRQ"; TABLENAME = "WJFB_CB"; break;
  89. }
  90. var data = {
  91. tablename: TABLENAME,
  92. pagesize: 7,
  93. pageno: 1,
  94. colums: "ID," + BT,
  95. order: "ID",
  96. sqlwhere: sqlwhere,
  97. sqlorwhere: "",
  98. sqlinwhere: "",
  99. sqllikewhere: ""
  100. };
  101. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg)
  102. .success(function (obj) {
  103. //var res = strToJson(s4.decryptData_CBC(obj.data));
  104. var res = obj;
  105. self.list = res.data;
  106. self.list.forEach(function (item) {
  107. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  108. })
  109. })
  110. }
  111. self.getData()
  112. }])