my.vue 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <view>
  3. <!-- 用户未登录时,显示登录组件 -->
  4. <my-login v-if="!token && token === ''"></my-login>
  5. <!-- 用户登录后,显示用户信息组件 -->
  6. <my-userinfo v-else></my-userinfo>
  7. </view>
  8. </template>
  9. <script>
  10. import badgeMix from '@/mixins/tabbar-badge.js'
  11. import { mapState, mapMutations } from 'vuex'
  12. export default {
  13. mixins: [badgeMix],
  14. computed: {
  15. ...mapState('m_user', ['token'])
  16. },
  17. data() {
  18. return {
  19. };
  20. },
  21. onReady() {
  22. this.findVerifyStatus()
  23. },
  24. onHide() {
  25. this.findVerifyStatus()
  26. },
  27. methods: {
  28. ...mapMutations('m_user', ['updateAuthentication']),
  29. // 查询是否通过了老师认证
  30. async findVerifyStatus() {
  31. const { data: result } = await uni.$http.get('/education/teacher-certifications/findVerifyStatus')
  32. const message = result.message
  33. this.updateAuthentication(message)
  34. },
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. </style>