permissions.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { useUserStore } from '../store'
  2. import { storeToRefs } from 'pinia'
  3. import { computed } from 'vue'
  4. import { path } from 'node:path'
  5. export const usePermissions = () => {
  6. const userStore = useUserStore()
  7. const { isLogined, isDesigner, userInfo } = storeToRefs(userStore)
  8. const routes = [
  9. { path: '/pages/mine/homepage/index', meta: { canNotLogin: false, canNotDesigner: true } },
  10. {
  11. path: '/pages/material/mini-class/index',
  12. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  13. },
  14. {
  15. path: '/pages/material/recommend/index',
  16. meta: { canNotLogin: false, canNotDesigner: false, toLogin: true },
  17. },
  18. {
  19. path: '/pages/publish/moment/index',
  20. meta: { canNotLogin: false, canNotDesigner: false, toLogin: true },
  21. },
  22. {
  23. path: '/pages/messages/index',
  24. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  25. },
  26. {
  27. path: '/pages/mine/setting/index',
  28. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  29. },
  30. {
  31. path: '/pages/mine/homepage/statistics/index',
  32. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  33. },
  34. {
  35. path: '/pages/mine/points/index',
  36. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  37. },
  38. {
  39. path: '/pages/mine/coupons/index',
  40. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  41. },
  42. {
  43. path: '/pages/mine/orders/index',
  44. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  45. },
  46. {
  47. path: '/pages/mine/agents/index',
  48. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  49. },
  50. {
  51. path: '/pages/mine/invite/index',
  52. meta: { canNotLogin: false, canNotDesigner: false, toLogin: true },
  53. },
  54. {
  55. path: '/pages/mall/confirm-order/index',
  56. meta: { canNotLogin: false, canNotDesigner: true, toLogin: true },
  57. },
  58. ]
  59. const features = computed(() => ({
  60. /**
  61. * 1分钟了解筑巢荟
  62. */
  63. about: isDesigner.value,
  64. toDesignerHomePage: isLogined.value,
  65. checkInAtStoreTask: isDesigner.value,
  66. shareMoment: isLogined.value && isDesigner.value && userInfo.value.level.level > 1,
  67. /**
  68. * 微信代运营兑换
  69. */
  70. // wechatAgentExchange: isLogined.value,
  71. /**
  72. * 案例拍摄兑换
  73. */
  74. }))
  75. return { isLogined, isDesigner, routes, features }
  76. }