灵活用工项目

index.vue 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="chat-root">
  3. <view v-if="booting" class="chat-boot">
  4. <view class="chat-boot__spinner" />
  5. <text class="chat-boot__text">加载中...</text>
  6. </view>
  7. <EnterpriseHome v-else ref="enterpriseHome" :active="true" />
  8. </view>
  9. </template>
  10. <script>
  11. import EnterpriseHome from '@/packageA/components/home/EnterpriseHome.vue'
  12. import store from '@/common/store.js'
  13. import { getToken } from '@/utils/request.js'
  14. export default {
  15. components: { EnterpriseHome },
  16. data() {
  17. return {
  18. booting: true
  19. }
  20. },
  21. onLoad() {
  22. this.bootstrap()
  23. },
  24. onShareAppMessage() {
  25. const home = this.$refs.enterpriseHome
  26. if (home && typeof home.getShareAppMessage === 'function') {
  27. return home.getShareAppMessage()
  28. }
  29. return {
  30. title: '用工邀请',
  31. path: '/pages/worker/job-offer?scene=',
  32. imageUrl: '/static/images/job.jpg'
  33. }
  34. },
  35. methods: {
  36. bootstrap() {
  37. if (!getToken()) {
  38. uni.reLaunch({ url: '/packageA/auth/login' })
  39. return
  40. }
  41. const s = store.getState()
  42. if (s.role === 'worker') {
  43. uni.reLaunch({ url: '/packageA/home/index' })
  44. return
  45. }
  46. this.booting = false
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .chat-root {
  53. width: 100%;
  54. height: 100vh;
  55. overflow: hidden;
  56. background: $fe-bg;
  57. }
  58. .chat-boot {
  59. height: 100%;
  60. display: flex;
  61. flex-direction: column;
  62. align-items: center;
  63. justify-content: center;
  64. gap: 24rpx;
  65. background: $fe-surface;
  66. }
  67. .chat-boot__spinner {
  68. width: 56rpx;
  69. height: 56rpx;
  70. border: 4rpx solid $fe-gray-200;
  71. border-top-color: $fe-primary;
  72. border-radius: 50%;
  73. animation: chat-spin 0.8s linear infinite;
  74. }
  75. .chat-boot__text {
  76. font-size: 28rpx;
  77. color: $fe-gray-500;
  78. }
  79. @keyframes chat-spin {
  80. to {
  81. transform: rotate(360deg);
  82. }
  83. }
  84. </style>