'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ]); app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) { 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 } }; self.num = { dwfw: 0, xzfw: 0, sxdb: 0, yzgl: 0, hysq: 0, clpq: 0 } self.getData1 = function () { var data = { "flowid": "AA18|AA16|AA02|AA17", "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.num.swbl = res.meta.totalCount; self.getData2() }) } self.getData2 = function () { var data = { "flowid": "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80", "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.num.xzfw = res.meta.totalCount; self.getData3() }) } self.getData3 = function () { var data = { "flowid": "AA88|AA89|AA46|AA22|AA54|AA58", "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.num.dwfw = res.meta.totalCount; self.getData4() }) } self.getData4 = function () { var data = { "flowid": "AA73|AA82", "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.num.sxdb = res.meta.totalCount; self.getData5() }) } self.getData5 = function () { var data = { "flowid": "AA27|AA71|AA72", "userid": self.userId, "pageno": 0, "pagesize": 0 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.num.xfbl = res.meta.totalCount; }) } self.getData1() self.deviceType = ""; window.addEventListener('message', function (event) { //通过origin属性判断消息来源地址 if (event.data.name == "deviceType") { //jzsetLat(event.data.arg); var getJson = event.data.arg; self.deviceType = getJson.ctype; } }, false); self.openTab = function (n) { if (self.deviceType == "pad") { if (n == 1) { window.top.jumpPageParent('FZC02', '党委发文', 'tpl/shouwenbg/list.html') } else if (n == 2) { window.top.jumpPageParent('FZC01', '行政发文', 'tpl/fawenbg/list.html') } else if (n == 3) { window.top.jumpPageParent('FZC02', '党委发文', 'tpl/fawendw/list.html') } else if (n == 4) { window.top.jumpPageParent('FZD01', '事项督办', 'tpl/shixiangdb/list.html') } else if (n == 5) { window.top.jumpPageParent("http://192.168.2.126/Portal/polish/Login"); } else { window.top.jumpPageParent('FZI02', '信访办理', 'tpl/xinfangbg/list.html') } } else { if (n == 1) { window.top.sp.addTabNav('FZC02', '党委发文', 'tpl/shouwenbg/list.html') } else if (n == 2) { window.top.sp.addTabNav('FZC01', '行政发文', 'tpl/fawenbg/list.html') } else if (n == 3) { window.top.sp.addTabNav('FZC02', '党委发文', 'tpl/fawendw/list.html') } else if (n == 4) { window.top.sp.addTabNav('FZD01', '事项督办', 'tpl/shixiangdb/list.html') } else if (n == 5) { window.open('http://192.168.2.126/Portal/polish/Login', 'newwindow', 'toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') } else { window.top.sp.addTabNav('FZI02', '信访办理', 'tpl/xinfangbg/list.html') } } } }])