index.js 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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: '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/task_hall.png', url: '../getTask/getTask', code: 'creator admin employee' },
  27. ]
  28. },
  29. {
  30. code: '统计分析', child: [
  31. { name: '排行榜', imgUrl: '../../../image/att_statistics.png', url: '../userRamking/userRamking', code: 'creator admin ' },
  32. { name: '考勤分排名', imgUrl: '../../../image/att_statistics.png', url: '../check_top/check_top', code: 'creator admin employee' },
  33. { name: '积分事件', imgUrl: '../../../image/event_list_a.png', url: '../integralEvent/integralEvent', code: 'creator admin employee' },
  34. ]
  35. },
  36. {
  37. code: '其他', child: [
  38. { name: '组织架构', imgUrl: '../../../image/dept.png', url: '../../deploy/organization/organization', code: 'creator admin employee' },
  39. { name: '积分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/integralRule/integralRule', code: 'creator admin employee' },
  40. { name: '考勤分规则', imgUrl: '../../../image/rule.png', url: '../../deploy/setCheck/setCheck', code: 'creator admin employee' },
  41. // { name: '工作汇报分规则', imgUrl: '../../../image/e66f.jpg', url: '../my_approve/my_approve', code: 'creator admin employee' },
  42. ]
  43. },
  44. ]
  45. },
  46. onLoad() {
  47. that = this;
  48. dd.setNavigationBar({ title: "工作台" });
  49. this.setData({ isAdministrator: app.globalData.isAdministrator })
  50. if(app.globalData.isCreator){
  51. that.setMenuList("creator");
  52. }else if(app.globalData.isAdministrator){
  53. that.setMenuList("admin");
  54. }else if(!app.globalData.isCreator&&!app.globalData.isAdministrator){
  55. that.setMenuList("employee");
  56. }
  57. },
  58. openUrl(e){
  59. dd.navigateTo({
  60. url:e.target.dataset.url
  61. })
  62. },
  63. setMenuList(str){
  64. var arr=[];
  65. that.data.menuList.forEach(item=>{
  66. var obj={};
  67. obj.code=item.code
  68. obj.child=[];
  69. item.child.forEach(childItem=>{
  70. if(childItem.code.indexOf(str)>=0){
  71. obj.child.push(childItem)
  72. }
  73. })
  74. arr.push(obj);
  75. })
  76. that.setData({
  77. menuList:arr
  78. })
  79. },
  80. //跳转
  81. openView(e) {
  82. var index = e.target.dataset.index - 1;
  83. var urls = [
  84. { url: '../my_PrizeBuckle/my_PrizeBuckle', query: "index=" },
  85. { url: '../my_apply/my_apply', query: "index=" },
  86. { url: '../glz_execute/glz_execute', query: '' },
  87. { url: '../integralEvent/integralEvent', query: '' },
  88. { url: '../check_top/check_top', query: '' },
  89. { url: '../sectionRanking/sectionRanking', query: '' },
  90. { url: '../B_ranking/B_ranking', query: '' },
  91. { url: '../customRamking/customRamking', query: '' },
  92. ];
  93. dd.navigateTo({
  94. url: urls[index].url + '?' + urls[index].query
  95. })
  96. },
  97. });