role.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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: 1,
  23. iconPath: "file-text-fill",
  24. selectedIconPath: "file-text-fill",
  25. text: '充值',
  26. midButton: true,
  27. customIcon: false,
  28. pagePath2: "/pagesFinance/statistics/recharge",
  29. role:[],
  30. accountType:true,
  31. },
  32. {
  33. current: 2,
  34. iconPath: "money-cny-box-fill",
  35. selectedIconPath: "money-cny-box-fill",
  36. text: '分润',
  37. midButton: true,
  38. customIcon: true,
  39. pagePath2: "/pagesFinance/share/index",
  40. role:[0,1],
  41. },
  42. {
  43. current: 4,
  44. iconPath: "bar-chart-box-fill",
  45. selectedIconPath: "bar-chart-box-fill",
  46. text: '企业充电',
  47. show: false,
  48. customIcon: true,
  49. pagePath2: "/pagesFinance/accountType8/chagingrecord/index",
  50. //权限
  51. only:true,
  52. role:[2],
  53. },
  54. {
  55. current: 4,
  56. iconPath: "bar-chart-box-fill",
  57. selectedIconPath: "bar-chart-box-fill",
  58. text: '优惠券记录',
  59. show: false,
  60. customIcon: true,
  61. pagePath2: "/pagesFinance/coupon/index",
  62. //权限
  63. //only:true,
  64. role:[3],
  65. },
  66. {
  67. current: 3,
  68. iconPath: "account-pin-box-fill",
  69. selectedIconPath: "account-pin-box-fill",
  70. text: '我的',
  71. role:[-1],
  72. customIcon: true,
  73. pagePath2: "/pagesFinance/user/index",
  74. }
  75. ];
  76. var relist = []
  77. function role(info) {
  78. relist=[]
  79. var accountTopics=info.accountTopics?info.accountTopics:"0";
  80. for (var i in list) {
  81. var item = list[i]
  82. var sz =item.role;
  83. if(item.accountType){
  84. if(info.accountType==1){
  85. relist.push(item)
  86. }
  87. }else if(item.only){
  88. if(accountTopics==sz[0]){
  89. relist.push(item)
  90. }
  91. }else{
  92. var bl=false;
  93. for(var j in sz){
  94. var s=sz[j];
  95. if(accountTopics.indexOf(s)>=0){
  96. bl=true;
  97. }
  98. }
  99. if(bl||sz[0]==-1){
  100. relist.push(item)
  101. }
  102. }
  103. }
  104. }
  105. export function getToIndex(info) {
  106. role(info);
  107. return relist[0].pagePath2;
  108. }
  109. export function getList(info) {
  110. role(info);
  111. return relist;
  112. }