role.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. var list = [{
  2. current: 0,
  3. iconPath: "bar-chart-box-fill",
  4. selectedIconPath: "bar-chart-box-fill",
  5. text: '统计',
  6. customIcon: true,
  7. pagePath2: "/pagesFinance/statistics/index",
  8. //权限 0默认,-1必有
  9. role:[0,1],
  10. },
  11. {
  12. current: 1,
  13. iconPath: "article-fill",
  14. selectedIconPath: "article-fill",
  15. text: '明细',
  16. midButton: true,
  17. customIcon: true,
  18. pagePath2: "/pagesFinance/detailed/index",
  19. role:[0,1],
  20. },
  21. {
  22. current: 2,
  23. iconPath: "money-cny-box-fill",
  24. selectedIconPath: "money-cny-box-fill",
  25. text: '分润',
  26. midButton: true,
  27. customIcon: true,
  28. pagePath2: "/pagesFinance/share/index",
  29. role:[0,1],
  30. },
  31. {
  32. current: 4,
  33. iconPath: "bar-chart-box-fill",
  34. selectedIconPath: "bar-chart-box-fill",
  35. text: '企业充电',
  36. show: false,
  37. customIcon: true,
  38. pagePath2: "/pagesFinance/accountType8/chagingrecord/index",
  39. //权限
  40. only:true,
  41. role:[2],
  42. },
  43. {
  44. current: 3,
  45. iconPath: "account-pin-box-fill",
  46. selectedIconPath: "account-pin-box-fill",
  47. text: '我的',
  48. role:[-1],
  49. customIcon: true,
  50. pagePath2: "/pagesFinance/user/index",
  51. }
  52. ];
  53. var relist = []
  54. function role(info) {
  55. relist=[]
  56. var accountTopics=info.accountTopics?info.accountTopics:"0";
  57. for (var i in list) {
  58. var item = list[i]
  59. var sz =item.role;
  60. if(item.only){
  61. if(accountTopics==sz[0]){
  62. relist.push(item)
  63. }
  64. }else{
  65. var bl=false;
  66. for(var j in sz){
  67. var s=sz[j];
  68. if(accountTopics.indexOf(s)>=0){
  69. bl=true;
  70. }
  71. }
  72. if(bl||sz[0]==-1){
  73. relist.push(item)
  74. }
  75. }
  76. }
  77. }
  78. export function getToIndex(info) {
  79. role(info);
  80. return relist[0].pagePath2;
  81. }
  82. export function getList(info) {
  83. role(info);
  84. return relist;
  85. }