home.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view id="home">
  3. <manage-home v-if="userType==1" ref="manage"></manage-home>
  4. <user-home v-if="userType==2"></user-home>
  5. <supplier-home v-if="userType==3"></supplier-home>
  6. <tab-bar v-if="userType!=3"></tab-bar>
  7. </view>
  8. </template>
  9. <script>
  10. // #ifdef MP-WEIXIN
  11. import {
  12. manageHome
  13. } from '@/pages/home/manageWorkbench'
  14. import {
  15. userHome
  16. } from '@/pages/home/studentWorkbench.vue'
  17. import {
  18. supplierHome
  19. } from '@/pages/home/supplierWorkbench.vue'
  20. import {
  21. tabBar
  22. } from '@/component/tabBar.vue'
  23. // #endif
  24. export default {
  25. name: "home",
  26. // #ifdef MP-WEIXIN
  27. components: {
  28. manageHome,
  29. userHome,
  30. supplierHome,
  31. tabBar
  32. },
  33. // #endif
  34. // #ifdef H5
  35. components: {
  36. "manageHome": () => import('@/pages/home/manageWorkbench.vue'),
  37. "userHome": () => import('@/pages/home/studentWorkbench.vue'),
  38. "supplierHome": () => import('@/pages/home/supplierWorkbench.vue'),
  39. "tabBar": () => import('@/component/tabBar.vue'),
  40. },
  41. // #endif
  42. data() {
  43. return {
  44. userType: 0,
  45. }
  46. },
  47. onLoad() {
  48. console.log('permissionsVerify', this.permissionsVerify)
  49. },
  50. onShow() {
  51. if (uni.getStorageSync('token') && uni.getStorageSync('userId') && uni.getStorageSync('userType')) {
  52. this.userType = uni.getStorageSync('userType')
  53. } else {
  54. uni.removeStorageSync('token');
  55. uni.removeStorageSync('userId');
  56. uni.removeStorageSync('userType');
  57. uni.redirectTo({
  58. url: '/pages/login/login',
  59. });
  60. }
  61. },
  62. methods: {
  63. },
  64. onHide() {
  65. this.userType = 0;
  66. },
  67. onUnload() {
  68. this.userType = 0;
  69. }
  70. }
  71. </script>
  72. <style lang="stylus" scoped>
  73. #home {
  74. height: 100%;
  75. }
  76. </style>