xxggimg.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. console.log("新闻");
  19. self.getDataImg = function () {
  20. var data = {
  21. tablename: "WJFB_TPXW",
  22. pagesize: 10,
  23. pageno: 1,
  24. colums: "ID,BT,FBRQ,IMAGEDATA",
  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. if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") {
  38. console.log(JSON.parse(item.IMAGEDATA)[0].FILEURL)
  39. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL)
  40. } else {
  41. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL)
  42. }
  43. })
  44. if (self.newsImg.length > 1) {
  45. $timeout(function () {
  46. var swiper = new Swiper('.swiper-container', {
  47. loop: true,
  48. autoplay: {
  49. delay: 2000,
  50. disableOnInteraction: false,
  51. },
  52. slidesPerView: 1,
  53. centeredSlides: true,
  54. pagination: {
  55. el: '.swiper-pagination',
  56. clickable: true,
  57. }
  58. })
  59. }, 1)
  60. }
  61. })
  62. }
  63. self.getDataImg()
  64. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  65. self.openTab = function (id) {
  66. if (self.deviceType == "pad") {
  67. window.top.jumpPageParent("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow")
  68. } else {
  69. window.top.sp.addTabNav("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow")
  70. }
  71. }
  72. }])