loading.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="box">
  3. <image class="img" src="https://minio.menduner.com/dev/fe9890be9b1176f84f2aa282b0f6adce300b133f65eb3d7b45ae057aa5698324.png"></image>
  4. <view class="color-primary font-size-20 font-weight-bold">门墩儿 专注顶尖招聘</view>
  5. <view class="icons">
  6. <uni-icons type="spinner-cycle" size="24" />
  7. </view>
  8. </view>
  9. </template>
  10. <script setup>
  11. import { onShow } from '@dcloudio/uni-app'
  12. import { getAccessToken } from '@/utils/request'
  13. import { showAuthModal } from '@/hooks/useModal'
  14. const tabBarControl = (show = false) => { // 显示/隐藏 TabBar
  15. console.log('TabBar:', show ? '展示' : '隐藏')
  16. const currentPage = getCurrentPages()
  17. if (!currentPage) return
  18. const currentTabBar = currentPage[0]?.getTabBar?.()
  19. currentTabBar?.setData({ show })
  20. }
  21. onShow(() => {
  22. tabBarControl(false)
  23. if (!getAccessToken()) {
  24. showAuthModal()
  25. uni.reLaunch({ url: '/pages/index/search' }) // redirectTo: 关闭当前页面,跳转(不可返回); reLaunch: 关闭所有页面,重新打开(完全重置导航栈)
  26. } else {
  27. // 检查是否是个人令牌
  28. if (uni.getStorageSync('token') && uni.getStorageSync('isPersonalToken')) {
  29. try {
  30. const url = uni.getStorageSync('entRegisterData') ? '/pages/register/review?hasData=true' : '/pages/register/index'
  31. uni.redirectTo({ url }) // redirectTo: 关闭当前页面,跳转(不可返回); reLaunch: 关闭所有页面,重新打开(完全重置导航栈)
  32. } catch (e) {
  33. console.error('Navigation error:', e)
  34. }
  35. }
  36. }
  37. })
  38. </script>
  39. <style lang="scss" scoped>
  40. .box {
  41. text-align: center;
  42. .img {
  43. width: 105px;
  44. height: 45px;
  45. margin-top: 30vh;
  46. margin-bottom: 16px;
  47. }
  48. .icons {
  49. position: fixed;
  50. bottom: 20vh;
  51. width: 100%;
  52. margin: 0 auto;
  53. }
  54. }
  55. </style>