personalData.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. var app = angular.module('app', [
  2. ]);
  3. app.controller("personalData", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
  4. var self = this;
  5. var s4 = new SM4Util();
  6. self.userId = $.cookie("GlWorkPlatform-userid");
  7. self.userName = $.cookie("GlWorkPlatform-username");
  8. self.userCName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.userTypeEng = $.cookie("GlWorkPlatform-userTypeEng");
  11. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. };
  17. self.CrossPage = window.parent.CrossPage;
  18. self.loading = false;
  19. ////加载用户头像数据*******************************************************************************************
  20. self.frameArray_userPhoto = "";
  21. self.getData_userPhoto = function () {
  22. self.loading = true;
  23. var postData = { "userid": self.userId };
  24. //console.log(postData);
  25. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  26. $http.post(apiurljs.login + "g2work/user/queryUserinfoImgsrc", JSON.stringify(postData), postCfg)
  27. .success(function (obj) {
  28. var res = strToJson(s4.decryptData_CBC(obj.data));
  29. //var res = obj;
  30. //console.log(JSON.stringify(res));
  31. if (res.success) {
  32. self.loading = false;
  33. self.frameArray_userPhoto = res.data.IMGSRC;
  34. } else {
  35. self.loading = false;
  36. self.frameArray = [];
  37. self.frameArray_userPhoto = "data:image/png;base64,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";
  38. }
  39. })
  40. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  41. if (textStatus != 200) {
  42. self.loading = false;
  43. }
  44. })
  45. };
  46. self.getData_userPhoto();
  47. self.userPhoto = {
  48. imagesmall:""
  49. };
  50. self.btnModify_userPhoto = function () {
  51. $("#btnfile").val(""); //文件
  52. self.userPhoto.imagesmall = "";
  53. $(".sp-upload-img").attr("src", "");
  54. sp.layer("#layer_userPhoto", 1);
  55. };
  56. //图片文件转base64
  57. var imgBaseArr, fileSize;
  58. self.upload = function () {
  59. $("#btnfile").change(function (e) {
  60. //获取图片大小,字节
  61. var fileMsg = e.currentTarget.files;
  62. if (fileMsg[0].type.indexOf('image') !== -1) {
  63. //console.log(fileMsg[0].type);
  64. fileSize = fileMsg[0].size;//不能超过2668484,大约为2.6MB
  65. if (fileSize > 0.5 * 1024 * 1024) {
  66. alert("选择的图像文件不能超过500K,请重新选择!");
  67. $("#btnfile").val(""); //文件
  68. self.userPhoto.imagesmall = "";
  69. $(".sp-upload-img").attr("src", "");
  70. } else {
  71. var reader = new FileReader();
  72. reader.onload = function (e) {
  73. //console.log(e)
  74. var imgBase = reader.result; //这个就是base64的编码
  75. imgBaseArr = imgBase;
  76. //截取掉前面的内容“data:image/png;base64”,
  77. //if (imgBase.split(',')[0].indexOf('base64') >= 0) {
  78. // imgBaseArr = imgBase.split(',')[1];
  79. //}
  80. self.userPhoto.imagesmall = imgBaseArr;
  81. $(".sp-upload-img").attr("src", imgBaseArr);
  82. }
  83. reader.readAsDataURL(this.files[0]);
  84. }
  85. } else {
  86. alert("仅能上传图片");
  87. }
  88. })
  89. };
  90. self.upload();
  91. ///提交保存--用户头像
  92. self.submit_userPhoto = function () {
  93. var postData = {
  94. "userid": self.userId,
  95. "imgsrc": self.userPhoto.imagesmall
  96. };
  97. //console.log(postData);
  98. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  99. $http.post(apiurljs.login + "g2work/user/saveUserinfoImgsrc", JSON.stringify(postData), postCfg)
  100. .success(function (obj) {
  101. var res = strToJson(s4.decryptData_CBC(obj.data));
  102. //var res = obj;
  103. //console.log(JSON.stringify(res));
  104. if (res.success) {
  105. sp.closeCenter('.sp-layer');
  106. $timeout(function () {
  107. self.getData_userPhoto();
  108. }, 210);
  109. } else {
  110. sp.closeCenter('.sp-layer');
  111. sp.dialog(res.message);
  112. }
  113. })
  114. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  115. if (textStatus != 200) {
  116. self.loading = false;
  117. }
  118. })
  119. }
  120. self.cancel_userPhoto = function () {
  121. sp.closeCenter('#layer_userPhoto');
  122. }
  123. ////加载用户头像数据*******************************************************************************************
  124. ////加载用户的账号信息***********************************************************************************
  125. self.frameArray_UserinfoAccount = "";///原账号
  126. self.frameArray_UserinfoAccount_new = "";///新账号
  127. self.getData_UserinfoAccount = function () {
  128. //self.loading = true;
  129. var postData = { "userid": self.userId };
  130. //console.log(postData);
  131. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  132. $http.post(apiurljs.login + "g2work/user/queryUserinfoAccount", JSON.stringify(postData), postCfg)
  133. .success(function (obj) {
  134. var res = strToJson(s4.decryptData_CBC(obj.data));
  135. //var res = obj;
  136. //console.log(JSON.stringify(res));
  137. if (res.success) {
  138. //self.loading = false;
  139. self.frameArray_UserinfoAccount = res.data.UINPUTNAME;
  140. } else {
  141. //self.loading = false;
  142. self.frameArray_UserinfoAccount = self.userName;
  143. }
  144. })
  145. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  146. if (textStatus != 200) {
  147. self.loading = false;
  148. }
  149. })
  150. };
  151. self.getData_UserinfoAccount();
  152. self.btnModify_UserinfoAccount = function () {
  153. self.frameArray_UserinfoAccount_new = "";///新账号
  154. sp.layer("#layer_UserinfoAccount", 1);
  155. }
  156. self.submit_UserinfoAccount = function () {
  157. if (spngvld.submit("#layer_UserinfoAccount")) {
  158. var postData = {
  159. "userid": self.userId,
  160. "account": self.frameArray_UserinfoAccount_new,
  161. "token": localStorage.getItem("main-token")
  162. };
  163. //$http.post(apiurljs.login + "g2work/user/saveUserinfoAccount", JSON.stringify(postData), postCfg)
  164. $http.post(apiurljs.login + "g2app/usercertification/saveUserinfoAccount", JSON.stringify(postData), postCfg)
  165. .success(function (obj) {
  166. var res = strToJson(s4.decryptData_CBC(obj.data));
  167. //var res = obj;
  168. //console.log(JSON.stringify(res));
  169. if (res.success) {
  170. sp.closeCenter('.sp-layer');
  171. sp.dialog("账号修改成功,请重新登录!");
  172. $timeout(function () {
  173. top.location.href = "../../login.html";
  174. $.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
  175. $.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
  176. $.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
  177. sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
  178. localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
  179. localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
  180. localStorage.removeItem("GlWorkPlatform-AccessToken");
  181. localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
  182. }, 1500);
  183. } else {
  184. sp.closeCenter('.sp-layer');
  185. sp.dialog(res.message);
  186. }
  187. })
  188. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  189. if (textStatus != 200) {
  190. self.loading = false;
  191. }
  192. })
  193. }
  194. }
  195. self.cancel_UserinfoAccount = function () {
  196. spngvld.clear("#layer_UserinfoAccount");
  197. sp.closeCenter('#layer_UserinfoAccount');
  198. }
  199. ////加载用户的账号信息***********************************************************************************
  200. ////加载用户名称***********************************************************************************
  201. self.frameArray_UserinfoUsername = "";///原账号
  202. self.frameArray_UserinfoUsername_new = "";///新账号
  203. self.getData_UserinfoUsername = function () {
  204. //self.loading = true;
  205. var postData = { "userid": self.userId };
  206. //console.log(postData);
  207. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  208. $http.post(apiurljs.login + "g2work/user/queryUserinfoUsername", JSON.stringify(postData), postCfg)
  209. .success(function (obj) {
  210. var res = strToJson(s4.decryptData_CBC(obj.data));
  211. //var res = obj;
  212. //console.log(JSON.stringify(res));
  213. if (res.success) {
  214. //self.loading = false;
  215. self.frameArray_UserinfoUsername = res.data.USHOWNAME;
  216. } else {
  217. //self.loading = false;
  218. self.frameArray_UserinfoUsername = self.userCName;
  219. }
  220. })
  221. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  222. if (textStatus != 200) {
  223. self.loading = false;
  224. }
  225. })
  226. };
  227. self.getData_UserinfoUsername();
  228. self.btnModify_UserinfoUsername = function () {
  229. self.frameArray_UserinfoUsername_new = "";///新账号
  230. sp.layer("#layer_UserinfoUsername", 1);
  231. }
  232. self.submit_UserinfoUsername = function () {
  233. if (spngvld.submit("#layer_UserinfoUsername")) {
  234. var postData = {
  235. "userid": self.userId,
  236. "username": self.frameArray_UserinfoUsername_new.replace(/\s+/g, "")
  237. };
  238. $http.post(apiurljs.login + "g2work/user/saveUserinfoUsername", JSON.stringify(postData), postCfg)
  239. .success(function (obj) {
  240. var res = strToJson(s4.decryptData_CBC(obj.data));
  241. //var res = obj;
  242. //console.log(JSON.stringify(res));
  243. if (res.success) {
  244. sp.closeCenter('.sp-layer');
  245. sp.dialog("用户名称修改成功,请重新登录!");
  246. $timeout(function () {
  247. top.location.href = "../../login.html";
  248. $.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
  249. $.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
  250. $.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
  251. sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
  252. localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
  253. localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
  254. localStorage.removeItem("GlWorkPlatform-AccessToken");
  255. localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
  256. }, 1500);
  257. } else {
  258. sp.closeCenter('.sp-layer');
  259. sp.dialog(res.message);
  260. }
  261. })
  262. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  263. if (textStatus != 200) {
  264. self.loading = false;
  265. }
  266. })
  267. }
  268. }
  269. self.cancel_UserinfoUsername = function () {
  270. spngvld.clear("#layer_UserinfoUsername");
  271. sp.closeCenter('#layer_UserinfoUsername');
  272. }
  273. ////加载用户名称***********************************************************************************
  274. ////用户的手机号***********************************************************************************
  275. self.frameArray_UserinfoCellphone = "";///原账号
  276. self.frameArray_UserinfoCellphone_new = "";///新账号
  277. self.getData_UserinfoCellphone = function () {
  278. //self.loading = true;
  279. var postData = { "userid": self.userId };
  280. //console.log(postData);
  281. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  282. $http.post(apiurljs.login + "g2work/user/queryUserinfoCellphone", JSON.stringify(postData), postCfg)
  283. .success(function (obj) {
  284. var res = strToJson(s4.decryptData_CBC(obj.data));
  285. //var res = obj;
  286. //console.log(JSON.stringify(res));
  287. if (res.success) {
  288. //self.loading = false;
  289. self.frameArray_UserinfoCellphone = res.data.CELLPHONE;
  290. } else {
  291. //self.loading = false;
  292. self.frameArray_UserinfoCellphone = "";
  293. }
  294. })
  295. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  296. if (textStatus != 200) {
  297. self.loading = false;
  298. }
  299. })
  300. };
  301. self.getData_UserinfoCellphone();
  302. self.btnModify_UserinfoCellphone = function () {
  303. self.frameArray_UserinfoUsername_new = "";///新账号
  304. sp.layer("#layer_UserinfoCellphone", 1);
  305. };
  306. self.submit_UserinfoCellphone = function () {
  307. if (sp.isval(self.frameArray_UserinfoCellphone_new)) {
  308. if (spngvld.submit("#layer_UserinfoCellphone")) {
  309. var postData = {
  310. "userid": self.userId,
  311. "cellphone": self.frameArray_UserinfoCellphone_new.toString()
  312. };
  313. //console.log(JSON.stringify(postData));
  314. $http.post(apiurljs.login + "g2work/user/saveUserinfoCellphone", JSON.stringify(postData), postCfg)
  315. .success(function (obj) {
  316. var res = strToJson(s4.decryptData_CBC(obj.data));
  317. //var res = obj;
  318. //console.log(JSON.stringify(res));
  319. if (res.success) {
  320. sp.closeCenter('.sp-layer');
  321. $timeout(function () {
  322. self.getData_UserinfoCellphone();
  323. }, 200);
  324. } else {
  325. sp.closeCenter('.sp-layer');
  326. sp.dialog(res.message);
  327. }
  328. })
  329. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  330. if (textStatus != 200) {
  331. self.loading = false;
  332. }
  333. });
  334. }
  335. } else {
  336. alert("手机号码不能为空!");
  337. }
  338. };
  339. self.cancel_UserinfoCellphone = function () {
  340. spngvld.clear("#layer_UserinfoCellphone_table");
  341. sp.closeCenter('#layer_UserinfoCellphone');
  342. };
  343. ////用户的手机号***********************************************************************************
  344. ////重置口令***********************************************************************************
  345. //
  346. var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgUCcDOMnAD6DXdRhPv7rsV3r9BTjFSog8IijWC9HqxxO2KrzQa_lDi9ox5_fwCSueifWykEfR55JyLdG-gnDywbErrdCMoNlq4-5aSFiieY1-0GsZYUmpN5FSvx_zPyjHzOQZgjoZ4ugzNG4cscRWbE6xH_BRfjUwQwhsecBBbzUw36KsXgpJD8UOadtx6LQTnHy93fWm1n-zmyiq3fuAOjv2VuJ8XOqfoVv6qljH_DgZ_e7CSGnhTEeKjGdys_qm2AVll3PejG4ufmj_bjMXIr0QY6YfQILK2NsLBLduqNWnH_wi8DTg4xfbcJi_Dm8SlXP4NiX8IVTTdlj4o-soQIDAQAB";
  347. var jsencrypt = new JSEncrypt()
  348. jsencrypt.setPublicKey(key)
  349. self.info = {
  350. oldPwd: '',
  351. newPwd: '',
  352. newPwdConfirm: ''
  353. };
  354. self.btnModify_Pwd = function () {
  355. self.info = {
  356. oldPwd: '',
  357. newPwd: '',
  358. newPwdConfirm: ''
  359. };
  360. sp.layer("#layer_Pwd", 1);
  361. };
  362. self.submit_Pwd = function () {
  363. if (spngvld.submit("#layer_Pwd")) {
  364. //大小写字母、数字、特殊符号,8位以上
  365. var pwdReg = !!self.info.newPwd.match(/^(?![A-Za-z0-9]+$)(?![a-z0-9\W]+$)(?![A-Za-z\W]+$)(?![A-Z0-9\W]+$)[a-zA-Z0-9\W]{8,16}$/);//验证包含大小写字母、数字、特殊符号
  366. //var pwdReg = !!self.info.newPwd.match(/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){8,16}$/);//验证包含大小写字母、数字、特殊符号任意两种规则
  367. if (pwdReg == false) {
  368. alert("密码必须同时包含:数字、大写字母、小写字母、特殊符号,并且8~16位");
  369. } else if (self.info.newPwd !== self.info.newPwdConfirm) {
  370. alert("两次新密码输入不一致");
  371. } else {
  372. //var postPwdData = {
  373. // "userid": self.userId,
  374. // "oldpassword": self.info.oldPwd,
  375. // "get_password": jsencrypt.encrypt(self.info.newPwd),
  376. // "newpassword": self.info.newPwd
  377. //}
  378. var postPwdData = {
  379. "token": localStorage.getItem("main-token"),
  380. "oldpassword": self.info.oldPwd,
  381. "rsapassword": jsencrypt.encrypt(self.info.newPwd),
  382. "newpassword": self.info.newPwd
  383. }
  384. //$http.post(apiurljs.login + "g2work/user/updatePasswordByUserid", { data: s4.encryptData_CBC(JSON.stringify(postPwdData)) }, postCfg)
  385. $http.post(apiurljs.login + "g2app/usercertification/updatePasswordByUserid", { data: s4.encryptData_CBC(JSON.stringify(postPwdData)) }, postCfg)
  386. .success(function (obj) {
  387. var res = strToJson(s4.decryptData_CBC(obj.data));
  388. //var res = obj;
  389. //console.log(JSON.stringify(res));
  390. if (res.success) {
  391. sp.closeCenter('.sp-layer');
  392. sp.dialog("口令重置成功,请重新登录!");
  393. var data = {
  394. tablename: "LOGIN_STATISTICS_TAB",
  395. data: {
  396. USERID: $.cookie("GlWorkPlatform-userid"),
  397. USHOWNAME: decodeURI($.cookie("GlWorkPlatform-chineseName")),
  398. UINPUTNAME: $.cookie("GlWorkPlatform-username"),
  399. OPERATIONTIME: sp.getLocalDate(),
  400. ONLINEMARK: "out"
  401. }
  402. }
  403. $http.post(apiurljs.login + "g2app/DangJian/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  404. .success(function (res) { })
  405. $timeout(function () {
  406. top.location.href = "../../login.html";
  407. $.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
  408. $.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
  409. $.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
  410. sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
  411. localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
  412. localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
  413. localStorage.removeItem("GlWorkPlatform-AccessToken");
  414. localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
  415. }, 1500);
  416. } else {
  417. sp.closeCenter('.sp-layer');
  418. sp.dialog(res.message);
  419. }
  420. })
  421. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  422. if (textStatus != 200) {
  423. self.loading = false;
  424. }
  425. })
  426. }
  427. }
  428. }
  429. self.cancel_Pwd = function () {
  430. spngvld.clear("#layer_Pwd");
  431. sp.closeCenter('#layer_Pwd');
  432. }
  433. ////重置口令***********************************************************************************
  434. }]);