my.js 2.6 KB

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