home.vue 1.8 KB

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