'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ]); app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) { var self = this; self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-username"); self.userChineseName = $.cookie("GlWorkPlatform-chineseName") self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; /*新闻*/ console.log("新闻"); self.getDataImg = function () { var data = { tablename: "WJFB_TPXW", pagesize: 10, pageno: 1, colums: "ID,BT,FBRQ,IMAGEDATA", order: "FBRQ desc", sqlwhere: { FBZT: "1" }, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" }; $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg) .success(function (obj) { // var res = strToJson(s4.decryptData_CBC(obj.data)); var res = obj; self.newsImg = res.data; $.each(self.newsImg, function (index, item) { if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") { console.log(JSON.parse(item.IMAGEDATA)[0].FILEURL) item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL) } else { item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL) } }) if (self.newsImg.length > 1) { $timeout(function () { var swiper = new Swiper('.swiper-container', { loop: true, autoplay: { delay: 2000, disableOnInteraction: false, }, slidesPerView: 1, centeredSlides: true, pagination: { el: '.swiper-pagination', clickable: true, } }) }, 1) } }) } self.getDataImg() self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType"); self.openTab = function (id) { if (self.deviceType == "pad") { window.top.jumpPageParent("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow") } else { window.top.sp.addTabNav("FZE01", "文件发布", "tpl/wenjianbg/WJFBB1/detail.html?id=" + id + "&formPage=wenjianshow") } } }])