my.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. (function () {
  2. var userinfo = null;
  3. var page = {
  4. isScroll: true,
  5. init: function ($page) {
  6. // 获取登录者信息
  7. userinfo = learun.storage.get('userinfo');
  8. //console.log(userinfo);
  9. $page.find('.name').text(userinfo.baseinfo.realName);
  10. //$page.find('img').attr('src', config.webapi + 'learun/adms/user/img?data=' + userinfo.baseinfo.userId);
  11. //user_info = '{"baseinfo":{"photoUrl":"http://rltest.oss-cn-hangzhou.aliyuncs.com/fd-images/20190109/5c35c13da4e734.14062420.png","userId":"System","enCode":"System","account":"System","password":null,"secretkey":null,"realName":"测试","nickName":null,"headIcon":".jpg","gender":1,"mobile":null,"telephone":null,"email":null,"oICQ":null,"weChat":null,"companyId":"","companyIds":[],"departmentId":"sys","departmentIds":[],"openId":null,"roleIds":"","postIds":"","isSystem":true,"appId":"Learun_ADMS_6.1_App","logTime":"2019-02-22 09:58:50","iPAddress":"115.194.188.126","browser":"Safari 11.0","loginMark":"594b7a78_2302_4b3d_1168_84f3dc63a476","token":"86d56cce-3662-4de3-a335-196f6e7b30cf","imUrl":null,"imOpen":null,"wfProcessId":null},"post":[],"role":[]}';
  12. //userinfo = JSON.parse(user_info);
  13. //console.log(userinfo);
  14. //$page.find('.name').text(userinfo.baseinfo.realName);
  15. if(userinfo.baseinfo.photoUrl){
  16. $page.find('img').attr('src', userinfo.baseinfo.photoUrl);
  17. }
  18. // 人员列表数据初始化
  19. learun.clientdata.get('department', {
  20. key: userinfo.baseinfo.departmentId,
  21. callback: function (data) {
  22. $page.find('.subname').text(data.name || '总集团公司');
  23. }
  24. });
  25. $page.find('#outloginbtn').on('tap', function () {
  26. learun.layer.confirm('确定要退出账号?', function (_index) {
  27. if (_index === '1') {
  28. learun.isOutLogin = true;
  29. learun.storage.set('logininfo', null);
  30. learun.nav.go({ path: 'login', isBack: false, isHead: false });
  31. learun.nav.getpage('amap').destroy()
  32. }
  33. }, '', ['取消', '退出']);
  34. });
  35. $page.find('.lr-list-item-icon').on('tap', function () {
  36. var path ='my/' + $(this).attr('data-value');
  37. var title = $(this).text();
  38. learun.nav.go({ path: path, title: title, type: 'right' });
  39. });
  40. $page.find('.userinfo').on('tap', function () {
  41. learun.nav.go({ path: 'my/userInfo', title: '个人信息', type: 'right' });
  42. });
  43. },
  44. reload: function ($page, pageinfo) {
  45. // 获取登录者信息
  46. var newUserinfo = learun.storage.get('userinfo');
  47. if (userinfo.baseinfo.userId != newUserinfo.baseinfo.userId) {
  48. userinfo = newUserinfo;
  49. $page.find('.name').text(userinfo.baseinfo.realName);
  50. if(userinfo.baseinfo.photoUrl){
  51. $page.find('img').attr('src', userinfo.baseinfo.photoUrl);
  52. }
  53. // 人员列表数据初始化
  54. learun.clientdata.get('department', {
  55. key: userinfo.baseinfo.departmentId,
  56. callback: function (data) {
  57. $page.find('.subname').text(data.name || '总集团公司');
  58. }
  59. });
  60. }
  61. }
  62. };
  63. return page;
  64. })();