123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- var app = angular.module('app', [
- ]);
- app.controller("personalDataTabletop", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.userTypeEng = $.cookie("GlWorkPlatform-userTypeEng");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.CrossPage = window.parent.CrossPage;
- self.loading = false;
- ////加载用户的框架列表*******************************************************************************************
- self.imgColActive_code = "";
- self.frameArray = [];
- self.frameArray_active = {};
- self.ifHasDefault_frame = 0;
- self.getData_frame = function () {
- self.loading = true;
- var postData = { "userid": self.userId };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/frame/queryDataUserByUserid", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- self.loading = false;
- self.frameArray = res.data;
-
- angular.forEach(self.frameArray, function (item) {
- if (item.ISDEFAULT == "1") {
- self.ifHasDefault_frame = 1;
- self.imgColActive_code = item.CODE;
- self.frameArray_active = item;
- }
- });
- $timeout(function () {
- if (self.ifHasDefault_frame == 0) {
- self.frameArray_active = self.frameArray[0];
- self.imgColActive_code = self.frameArray[0].CODE;
- }
- },10)
-
- } else {
- self.loading = false;
- self.frameArray = [];
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.getData_frame();
- self.btnModify_frame = function () {
- sp.layer("#layer_frame", 1);
- };
- self.submit_frame = function () {
- var postData = {
- "userid": self.userId,
- "code": self.imgColActive_code
- };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/frame/updateDataUserDefault", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- sp.closeCenter('.sp-layer');
- self.getData_frame();
- sp.dialog("框架修改成功,请重新登陆!");
- $timeout(function () {
- //top.window.location.reload();
- top.location.href = "../../login.html";
- $.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
- $.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
- $.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
- sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
- localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
- localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
- localStorage.removeItem("GlWorkPlatform-AccessToken");
- localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
- }, 1000);
- } else {
- sp.closeCenter('.sp-layer');
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- }
- self.cancel_frame = function () {
- sp.closeCenter('#layer_frame');
- }
-
- self.frame_imgColClick = function (itemdata) {
- self.imgColActive_code = itemdata.CODE;
- }
- ////加载用户的框架列表*******************************************************************************************
- ////加载用户的桌面列表*******************************************************************************************
- self.imgColActive_code_desktop = "";
- self.desktopArray = [];
- self.desktopArray_active = {};
- self.ifHasDefault_desktop = 0;
- self.getData_desktop = function () {
- self.loading = true;
- var postData = { "userid": self.userId };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/desktop/queryDataUserByUserid", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- self.loading = false;
- self.desktopArray = res.data;
- angular.forEach(self.desktopArray, function (item) {
- if (item.ISDEFAULT == "1") {
- self.ifHasDefault_desktop = 1;
- self.imgColActive_code_desktop = item.CODE;
- self.desktopArray_active = item;
- }
- });
- $timeout(function () {
- if (self.ifHasDefault_desktop == 0) {
- self.desktopArray_active = self.desktopArray[0];
- self.imgColActive_code_desktop = self.desktopArray[0].CODE;
- }
- }, 10)
- } else {
- self.loading = false;
- self.desktopArray = [];
- self.desktopArray_active = {};
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.getData_desktop();
- self.btnModify_desktop = function () {
- sp.layer("#layer_desktop", 1);
- };
- self.submit_desktop = function () {
- var postData = {
- "userid": self.userId,
- "code": self.imgColActive_code_desktop
- };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/desktop/updateDataUserDefault", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- sp.closeCenter('.sp-layer');
- self.getData_desktop();
- //sp.dialog("桌面修改成功!");
- $timeout(function () {
- top.window.location.reload();
- //top.location.href = "../../login.html";
- //$.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
- //$.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
- //$.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
- //sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
- //localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
- //localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
- //localStorage.removeItem("GlWorkPlatform-AccessToken");
- //localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
- }, 10);
- } else {
- sp.closeCenter('.sp-layer');
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.cancel_desktop = function () {
- sp.closeCenter('#layer_desktop');
- };
- self.desktop_imgColClick = function (itemdata) {
- self.imgColActive_code_desktop = itemdata.CODE;
- }
- ////加载用户的桌面列表*******************************************************************************************
- ////加载背景图片*******************************************************************************************
- self.imgColActive_code_bkimage = "";
- self.bkimageArray = [];
- self.bkimageArray_active = {};
- self.ifHasDefault_bkimage = 0;
- self.getData_bkimage = function () {
- self.loading = true;
- var postData = { "userid": self.userId };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/bkimage/queryDataUserByUserid", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- self.loading = false;
- self.bkimageArray = res.data;
-
- angular.forEach(self.bkimageArray, function (item) {
- if (item.ISDEFAULT == "1") {
- self.ifHasDefault_bkimage = 1;
- self.imgColActive_code_bkimage = item.CODE;
- self.bkimageArray_active = item;
- }
- });
- $timeout(function () {
- if (self.ifHasDefault_bkimage == 0) {
- self.bkimageArray_active = self.bkimageArray[0];
- self.imgColActive_code_bkimage = self.bkimageArray[0].CODE;
- }
- }, 10);
- } else {
- self.loading = false;
- self.bkimageArray = [];
- self.bkimageArray_active = {};
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.getData_bkimage();
- self.btnModify_bkimage = function () {
- sp.layer("#layer_bkimage", 1);
- }
- self.submit_bkimage = function () {
- var postData = {
- "userid": self.userId,
- "code": self.imgColActive_code_bkimage
- };
- //console.log(postData);
- //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
- $http.post(apiurljs.login + "g2work/bkimage/updateDataUserDefault", JSON.stringify(postData), postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //console.log(JSON.stringify(res));
- if (res.success) {
- sp.closeCenter('.sp-layer');
- self.getData_bkimage();
- //sp.dialog("背景图片修改成功!");
- $timeout(function () {
- top.window.location.reload();
- //top.location.href = "../../login.html";
- //$.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
- //$.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
- //$.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
- //sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
- //localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
- //localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
- //localStorage.removeItem("GlWorkPlatform-AccessToken");
- //localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
- }, 10);
- } else {
- sp.closeCenter('.sp-layer');
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- }
- self.cancel_bkimage = function () {
- sp.closeCenter('#layer_bkimage');
- }
- self.bkimage_imgColClick = function (itemdata) {
- self.imgColActive_code_bkimage = itemdata.CODE;
-
- }
- ////加载背景图片*******************************************************************************************
- }]);
|