index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <!-- -->
  2. <template>
  3. <view class="page-app" >
  4. <view class="page-main">
  5. <view class="page-body">
  6. <!-- 页面内容插槽 -->
  7. <slot />
  8. </view>
  9. </view>
  10. <view class="page-modal">
  11. <!-- 全局授权弹窗 -->
  12. <authModal />
  13. <!-- 全局分享弹窗 -->
  14. <!-- <s-share-modal :shareInfo="shareInfo" /> -->
  15. <!-- 全局快捷入口 -->
  16. <!-- <s-menu-tools /> -->
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import authModal from './components/auth-modal.vue'
  22. import { useIM } from '@/hooks/useIM'
  23. import { watch } from 'vue'
  24. import { userStore } from '@/store/user'
  25. const emit = defineEmits(['loginSucceeded'])
  26. const { resetConfig } = useIM()
  27. const useUserStore = userStore()
  28. watch(() => useUserStore?.accountInfo?.userId, (newVal, oldVal) => {
  29. if (useUserStore.refreshToken) {
  30. // 监听登录状态
  31. resetConfig()
  32. emit('loginSucceeded')
  33. }
  34. })
  35. </script>
  36. <style lang="scss" scoped>
  37. .page-app {
  38. position: relative;
  39. // color: var(--ui-TC);
  40. // background-color: var(--ui-BG-1) !important;
  41. // z-index: 2;
  42. display: flex;
  43. width: 100%;
  44. height: 100vh;
  45. .page-main {
  46. position: absolute;
  47. z-index: 1;
  48. width: 100%;
  49. min-height: 100%;
  50. display: flex;
  51. flex-direction: column;
  52. .page-body {
  53. width: 100%;
  54. position: relative;
  55. z-index: 1;
  56. flex: 1;
  57. }
  58. }
  59. }
  60. </style>