App.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import ColFooter from '@/components/col-footer'
  2. import ColHeader from '@/components/col-header'
  3. import TheAuth from '@/components/TheAuth/index.vue'
  4. import { ElConfigProvider, ElDialog } from 'element-plus'
  5. import { zhCn } from '@/helpers/zhCn'
  6. import { defineComponent } from 'vue'
  7. import { RouterView } from 'vue-router'
  8. import Login from './login'
  9. import styles from './App.module.less'
  10. import { getUserInfo, state } from '@/state'
  11. import silder from '@/components/silder'
  12. // 加载样式放到main文件里面会导致打包卡顿,打包时间过长
  13. import '../style/index.css'
  14. import 'normalize.css'
  15. import 'element-plus/dist/index.css'
  16. import 'vue3-lottie/dist/style.css'
  17. import { useSubjectClearly } from '@/helpers/hooks'
  18. import { eventGlobal } from '@/helpers/utils'
  19. export default defineComponent({
  20. components: { silder },
  21. name: 'App',
  22. async created() {
  23. // console.log('user start')
  24. try {
  25. if (state.user.data?.userId) {
  26. // 获取用户信息
  27. await getUserInfo()
  28. } else {
  29. // useSubjectClearly()
  30. }
  31. } catch {}
  32. // console.log('user end')
  33. },
  34. render() {
  35. // 判断是否显示证书提示
  36. eventGlobal.on('auth-not-installed', () => {
  37. state.authVisibleShow = true
  38. })
  39. return (
  40. <>
  41. {/* 263.5 footer, 70 header */}
  42. <ColHeader />
  43. <div
  44. style={{
  45. minHeight: 'calc(100vh - 422px)',
  46. background: '#fff'
  47. }}
  48. >
  49. <ElConfigProvider locale={zhCn} message={{ max: 1 }}>
  50. <RouterView></RouterView>
  51. </ElConfigProvider>
  52. </div>
  53. <silder></silder>
  54. <ColFooter />
  55. {/* 登录弹窗 */}
  56. <div class={styles.loginContainer}>
  57. <ElDialog
  58. modelValue={state.loginPopupStatus}
  59. onUpdate:modelValue={val => (state.loginPopupStatus = val)}
  60. closeOnClickModal={false}
  61. closeOnPressEscape={false}
  62. >
  63. {state.loginPopupStatus && (
  64. <Login
  65. onClose={() => {
  66. clearTimeout(state.loginPopupTimer)
  67. state.loginPopupStatus = false
  68. }}
  69. />
  70. )}
  71. </ElDialog>
  72. </div>
  73. {/* <el-dialog
  74. v-model="authVisibleShow"
  75. width="724px"
  76. :show-close="false"
  77. :destroy-on-close="true"
  78. :close-on-press-escape="false"
  79. custom-class="theAuthDialog"
  80. class="theAuthDialog"
  81. >
  82. <TheAuth @close="authVisibleShow = false" />
  83. </el-dialog> */}
  84. <ElDialog
  85. modelValue={state.authVisibleShow}
  86. onUpdate:modelValue={val => (state.authVisibleShow = val)}
  87. showClose={false}
  88. destroyOnClose={true}
  89. closeOnPressEscape={false}
  90. closeOnClickModal={false}
  91. custom-class="theAuthDialog"
  92. class="theAuthDialog"
  93. >
  94. <TheAuth onClose={() => (state.authVisibleShow = false)} />
  95. </ElDialog>
  96. </>
  97. )
  98. }
  99. })