role.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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: 4,
  45. iconPath: "bar-chart-box-fill",
  46. selectedIconPath: "bar-chart-box-fill",
  47. text: '优惠券记录',
  48. show: false,
  49. customIcon: true,
  50. pagePath2: "/pagesFinance/coupon/index",
  51. //权限
  52. only:true,
  53. role:[3],
  54. },
  55. {
  56. current: 3,
  57. iconPath: "account-pin-box-fill",
  58. selectedIconPath: "account-pin-box-fill",
  59. text: '我的',
  60. role:[-1],
  61. customIcon: true,
  62. pagePath2: "/pagesFinance/user/index",
  63. }
  64. ];
  65. var relist = []
  66. function role(info) {
  67. relist=[]
  68. var accountTopics=info.accountTopics?info.accountTopics:"0";
  69. for (var i in list) {
  70. var item = list[i]
  71. var sz =item.role;
  72. if(item.only){
  73. if(accountTopics==sz[0]){
  74. relist.push(item)
  75. }
  76. }else{
  77. var bl=false;
  78. for(var j in sz){
  79. var s=sz[j];
  80. if(accountTopics.indexOf(s)>=0){
  81. bl=true;
  82. }
  83. }
  84. if(bl||sz[0]==-1){
  85. relist.push(item)
  86. }
  87. }
  88. }
  89. }
  90. export function getToIndex(info) {
  91. role(info);
  92. return relist[0].pagePath2;
  93. }
  94. export function getList(info) {
  95. role(info);
  96. return relist;
  97. }