xxgg.js 4.1 KB

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