'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) { var self = this; var s4 = new SM4Util(); self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-chineseName"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno"); self.get_type = sp.getUrlName("type"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.type = self.get_type != "" ? self.get_type : "1"; self.noDataTip = 1;//没有数据时赋变量为0,先默认为1 self.pageno = 1; self.total_count = 0; self.itemsPerPage = 10; self.pageOptions = [10, 20, 30, 40]; self.getData = function (pageno) { var data = { userid: self.userId, msgkind: "公文事项办理", mark: self.type == 1 ? "未读" : "已读" } $http.post(apiurljs.login + "g2work/routeinfo/queryDataMessage", data, postCfg) .success(function (obj) { // var res = strToJson(s4.decryptData_CBC(obj.data)); var res = obj; self.list = res.data; console.log(self.list) }) } self.load = function () { if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") { self.getData(self.pageno); } else { $timeout(function () { self.getData(self.get_lastReturnPageno); }, 1) } } self.changeType = function (str) { if (self.type == str) { return; } else { self.type = str; self.getData(1) } } self.load(); self.refresh = function () { self.getData(self.pageno); } self.goUrl = function (item) { if (item.MARK == "未读") { var data = { id: item.ID } $http.post(apiurljs.login + "g2work/routeinfo/updateDataMessage", data, postCfg) .success(function (obj) { // var res = strToJson(s4.decryptData_CBC(obj.data)); var res = obj; self.getData(self.pageno) sp.openNewWindow("../../" + item.DURL, item.CONTENTS) }) } else { sp.openNewWindow("../../" + item.DURL, item.CONTENTS) } } //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }])