my_lr.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. (function () {
  2. var userinfo = null;
  3. var page = {
  4. isScroll: true,
  5. init: function ($page) {
  6. // 获取登录者信息
  7. userinfo = renlian.storage.get('userinfo');
  8. $page.find('.name').text(userinfo.baseinfo.realName);
  9. $page.find('img').attr('src', config.webapi + 'renlian/adms/user/img?data=' + userinfo.baseinfo.userId);
  10. // 人员列表数据初始化
  11. renlian.clientdata.get('department', {
  12. key: userinfo.baseinfo.departmentId,
  13. callback: function (data) {
  14. $page.find('.subname').text(data.name || '总集团公司');
  15. }
  16. });
  17. $page.find('#outloginbtn').on('tap', function () {
  18. renlian.layer.confirm('确定要退出账号?', function (_index) {
  19. if (_index === '1') {
  20. renlian.isOutLogin = true;
  21. renlian.storage.set('logininfo', null);
  22. renlian.nav.go({ path: 'login', isBack: false, isHead: false });
  23. window.reload()
  24. }
  25. }, '', ['取消', '退出']);
  26. });
  27. $page.find('.lr-list-item-icon').on('tap', function () {
  28. var path ='my/' + $(this).attr('data-value');
  29. var title = $(this).text();
  30. renlian.nav.go({ path: path, title: title, type: 'right' });
  31. });
  32. $page.find('.userinfo').on('tap', function () {
  33. renlian.nav.go({ path: 'my/userInfo', title: '个人信息', type: 'right' });
  34. });
  35. },
  36. reload: function ($page, pageinfo) {
  37. // 获取登录者信息
  38. var newUserinfo = renlian.storage.get('userinfo');
  39. if (userinfo.baseinfo.userId != newUserinfo.baseinfo.userId) {
  40. userinfo = newUserinfo;
  41. $page.find('.name').text(userinfo.baseinfo.realName);
  42. $page.find('img').attr('src', config.webapi + 'renlian/adms/user/img?data=' + userinfo.baseinfo.userId);
  43. // 人员列表数据初始化
  44. renlian.clientdata.get('department', {
  45. key: userinfo.baseinfo.departmentId,
  46. callback: function (data) {
  47. $page.find('.subname').text(data.name || '总集团公司');
  48. }
  49. });
  50. }
  51. }
  52. };
  53. return page;
  54. })();