userInfo.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (function () {
  2. var page = {
  3. isScroll: true,
  4. init: function ($page) {
  5. // 获取登录者信息
  6. var userinfo = renlian.storage.get('userinfo');
  7. var baseinfo = userinfo.baseinfo;
  8. //$page.find('img').attr('src', config.webapi + 'renlian/adms/user/img?data=' + baseinfo.userId);
  9. if(userinfo.baseinfo.photoUrl){
  10. $page.find('img').attr('src', userinfo.baseinfo.photoUrl);
  11. }
  12. $page.find('.account').text(baseinfo.account);
  13. $page.find('.my-plate').text(baseinfo.plate);
  14. $page.find('.my-gpsNumber').text(baseinfo.gpsNumber);
  15. $page.find('.enCode').text(baseinfo.enCode);
  16. $page.find('.realName').text(baseinfo.realName);
  17. $page.find('.gender').text(baseinfo.gender == 1 ? '女' : '男');
  18. console.log(baseinfo.gender);
  19. if (baseinfo.companyId) {
  20. renlian.clientdata.get('company', {
  21. key: baseinfo.companyId,
  22. callback: function (data) {
  23. $page.find('.company').text(data.name);
  24. }
  25. });
  26. }
  27. if (baseinfo.departmentId) {
  28. renlian.clientdata.get('department', {
  29. key: baseinfo.departmentId,
  30. callback: function (data) {
  31. $page.find('.department').text(data.name);
  32. }
  33. });
  34. }
  35. var post = [];
  36. var role = [];
  37. $.each(userinfo.post, function (id, item) {
  38. post.push(item.F_Name);
  39. });
  40. $.each(userinfo.role, function (id, item) {
  41. role.push(item.F_FullName);
  42. });
  43. $page.find('.post').text(String(post));
  44. $page.find('.role').text(String(role));
  45. }
  46. };
  47. return page;
  48. })();