index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. var app = getApp();
  2. var that;
  3. Page({
  4. data: {
  5. incidentList: [1, 2, 2, 2, 2, 2, 2, 2, 2],
  6. isAdministrator: false,//是否管理员角色
  7. ding_enable: true,
  8. menuList: [
  9. {
  10. code: '积分执行', child: [
  11. { name: '奖扣B分', imgUrl: '../../../image/point_entry.png', url: '../../workbench/jk_B/jk_B?type=B', code: 'creator admin ' },
  12. { name: '奖扣A分', imgUrl: '../../../image/a_entry.png', url: '../../workbench/jk_B/jk_B?type=A', code: 'creator admin ' },
  13. { name: '我奖扣的', imgUrl: '../../../image/entry_list.png', url: '../my_PrizeBuckle/my_PrizeBuckle?index=', code: 'creator admin ' },
  14. { name: '申请积分', imgUrl: '../../../image/a_apply.png', url: '../../workbench/apply/apply', code: 'admin employee' },
  15. { name: '我申请的', imgUrl: '../../../image/apply_list.png', url: '../my_apply/my_apply?index=', code: 'admin employee' },
  16. // { name: '发放奖票', imgUrl: '../../../image/add_ticket.png', url: '../grant/grant', code: 'creator admin ' },
  17. // { name: '我的奖票', imgUrl: '../../../image/my_ticket.png', url: '../myGrant/myGrant', code: 'creator admin employee' },
  18. ]
  19. },
  20. {
  21. code: '任务管理', child: [
  22. { name: '指派任务', imgUrl: '../../../image/my_publish.png', url: '../assaign/assaign', code: 'creator admin' },
  23. { name: '发布抢单', imgUrl: '../../../image/caback6.png', url: '../offerAreward/offerAreward', code: 'creator admin ' },
  24. { name: '我发布的', imgUrl: '../../../image/my_publish.png', url: '../my_issue/my_issue', code: 'creator admin ' },
  25. { name: '我的任务', imgUrl: '../../../image/my_task.png', url: '../my_task/my_task', code: 'admin employee' },
  26. { name: '我审批的', imgUrl: '../../../image/my_examine.png', url: '../my_sp/my_sp', code: 'creator admin' },
  27. { name: '抢任务', imgUrl: '../../../image/task_hall.png', url: '../getTask/getTask', code: 'creator admin employee' },
  28. { name: '全部任务', imgUrl: '../../../image/apply_list.png', url: '../allTask/allTask', code: 'creator admin' },
  29. ]
  30. },
  31. {
  32. code: '奖票', child: [
  33. { name: '发放奖票', imgUrl: '../../../image/add_ticket.png', url: '../grantAward/grantAward', code: 'creator admin' },
  34. { name: '我发放的', imgUrl: '../../../image/caback6.png', url: '../awardJl/awardJl', code: 'creator admin ' },
  35. { name: '我的奖票', imgUrl: '../../../image/my_ticket.png', url: '../myGrant/myGrant', code: 'creator admin employee' },
  36. { name: '奖票统计', imgUrl: '../../../image/integral_rank.png', url: '../awardTj/awardTj', code: 'creator admin' },
  37. ]
  38. },
  39. {
  40. code: '统计分析', child: [
  41. { name: '排行榜', imgUrl: '../../../image/integral_rank.png', url: '../userRamking/userRamking', code: 'creator admin ' },
  42. { name: '考勤分', imgUrl: '../../../image/att_sign.png', url: '../check_top/check_top', code: 'creator admin employee' },
  43. { name: '日志分', imgUrl: '../../../image/log1.png', url: '../log_rank/log_rank', code: 'creator admin employee' },
  44. { name: '任务分', imgUrl: '../../../image/log2.png', url: '../task_rank/task_rank', code: 'creator admin employee' },
  45. { name: '任务统计', imgUrl: '../../../image/att_statistics.png', url: '../taskStatistical/taskStatistical', code: 'creator admin employee',new:false },
  46. { name: '积分事件', imgUrl: '../../../image/event_list_a.png', url: '../integralEvent/integralEvent', code: 'creator admin employee' },
  47. { name: '积分周报', imgUrl: '../../../image/length_point.png', url: '../../reportBox/report/report', code: 'admin' },
  48. ]
  49. },
  50. {
  51. code: '其他', child: [
  52. { name: '组织架构', imgUrl: '../../../image/dept.png', url: '../../deploy/organization/organization', code: 'creator admin employee' },
  53. { name: '积分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/integralRule/integralRule', code: 'creator admin employee' },
  54. { name: '考勤分规则', imgUrl: '../../../image/log1.png', url: '../../deploy/setCheck/setCheck', code: 'creator admin employee' },
  55. // { name: '福利兑换', imgUrl: '../../../image/fl.png', url: '../../exchange/exchange/exchange', code: 'creator admin employee' },
  56. // { name: '工作汇报分规则', imgUrl: '../../../image/e66f.jpg', url: '../my_approve/my_approve', code: 'creator admin employee' },
  57. ]
  58. },
  59. ]
  60. },
  61. onLoad() {
  62. that = this;
  63. dd.setNavigationBar({ title: "工作台" });
  64. this.setData({ isAdministrator: app.globalData.isAdministrator })
  65. if(app.globalData.isCreator){
  66. that.setMenuList("creator");
  67. }else if(app.globalData.isAdministrator){
  68. that.setMenuList("admin");
  69. }else if(!app.globalData.isCreator&&!app.globalData.isAdministrator){
  70. that.setMenuList("employee");
  71. }
  72. },
  73. openUrl(e){
  74. dd.navigateTo({
  75. url:e.target.dataset.url
  76. })
  77. },
  78. setMenuList(str){
  79. var arr=[];
  80. that.data.menuList.forEach(item=>{
  81. var obj={};
  82. obj.code=item.code
  83. obj.child=[];
  84. item.child.forEach(childItem=>{
  85. if(childItem.code.indexOf(str)>=0){
  86. obj.child.push(childItem)
  87. }
  88. })
  89. arr.push(obj);
  90. })
  91. that.setData({
  92. menuList:arr
  93. })
  94. },
  95. //跳转
  96. openView(e) {
  97. var index = e.target.dataset.index - 1;
  98. var urls = [
  99. { url: '../my_PrizeBuckle/my_PrizeBuckle', query: "index=" },
  100. { url: '../my_apply/my_apply', query: "index=" },
  101. { url: '../glz_execute/glz_execute', query: '' },
  102. { url: '../integralEvent/integralEvent', query: '' },
  103. { url: '../check_top/check_top', query: '' },
  104. { url: '../sectionRanking/sectionRanking', query: '' },
  105. { url: '../B_ranking/B_ranking', query: '' },
  106. { url: '../customRamking/customRamking', query: '' },
  107. ];
  108. dd.navigateTo({
  109. url: urls[index].url + '?' + urls[index].query
  110. })
  111. },
  112. });