xxggimg.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: "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. console.log(self.newsImg)
  35. $.each(self.newsImg, function (index, item) {
  36. if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") {
  37. console.log(JSON.parse(item.IMAGEDATA)[0].FILEURL)
  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. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  64. self.openTab = function (id) {
  65. if (self.deviceType == "pad") {
  66. window.top.jumpPageParent("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow")
  67. } else {
  68. window.top.sp.addTabNav("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow")
  69. }
  70. }
  71. }])