apps.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. let authList = {};
  2. //通用
  3. function getapps() {
  4. const paths = [{
  5. name: "服务受理",
  6. path: "/bgj/handling/index",
  7. imgUrl:"/utils/work/imgs/fwsl.svg"
  8. }, {
  9. name: "服务工单",
  10. path: "/bgj/workOrder/index",
  11. imgUrl:"/utils/work/imgs/fwgd.svg"
  12. }, {
  13. name: "客户档案",
  14. path: "/bgj/customerArchive/index",
  15. imgUrl:"/utils/work/imgs/khda.svg"
  16. }, {
  17. name: "积分商城",
  18. path: "/bgj/workerHome/index",
  19. imgUrl:"/utils/work/imgs/jfsc.svg"
  20. }, {
  21. name: "质保卡",
  22. path: "/bgj/warrantyCard/index",
  23. imgUrl:"/utils/work/imgs/zbk.svg"
  24. }];
  25. let app = [...getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['班管家'], ['班管家'])],
  26. list = [];
  27. app.forEach((v, i) => {
  28. v.apps.forEach(s => {
  29. authList[s.name] = {
  30. options: s.meta.auth.map(a => a.option),
  31. optionnames: s.meta.auth.map(a => a.optionname),
  32. istask: s.istask == 1,
  33. isdatafollowup: s.isdatafollowup == 1,
  34. isdatatag: s.isdatatag == 1,
  35. isdatateam: s.isdatateam == 1,
  36. }
  37. if (authList[s.name].options.some(s => s == "read")) {
  38. let i = paths.findIndex(k => k.name == s.meta.title);
  39. if (i != -1) {
  40. paths[i].index = i;
  41. paths[i].appName = s.name;
  42. paths[i].remarks = s.remarks;
  43. list.push(paths[i])
  44. }
  45. }
  46. })
  47. });
  48. return list.sort((a, b) => a.index - b.index)
  49. };
  50. module.exports = {
  51. getapps,
  52. authList
  53. };