'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"); self.login="http://192.168.3.152:8088/glwork1/"; var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; /*新闻*/ self.getDataImg = function () { var data = { tablename: "WJFB_TPXW", pagesize: 10, pageno: 1, colums: "ID,BT,FBRQ,ROUTEINFOID", 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) { self.getImg(item) }) if (self.newsImg.length > 1) { $timeout(function () { var swiper = new Swiper('.swiper-container', { autoplay: { delay: 2000, disableOnInteraction: false, }, slidesPerView: 1, pagination: { el: '.swiper-pagination', clickable: true, } }) }, 1) } }) } self.getImg = function (parent) { var data = { tablename: "FILE_ATTACH", colums: "ID,FILEURL,ATTACHTYPE", order: "ID", sqlwhere: { ROUTEINFOID: parent.ROUTEINFOID}, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" }; $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", data, postCfg) .success(function (obj) { // var res = strToJson(s4.decryptData_CBC(obj.data)); var res = obj; for (var i = 0; i < res.data.length; i++) { if (res.data[i].ATTACHTYPE == "IMAGESDATA" || res.data[i].ATTACHTYPE == "IMAGESDATA") { parent.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + res.data[i].FILEURL) break } } }) } self.getDataImg() self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType"); self.openTab = function (id) { if (self.deviceType == "pad") { sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + id, "文件发布") } else { sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + id, "文件发布") } } }])