App.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div id="app">
  3. <div class="router-wrap" :class="{'has-pub-nav': navShow,'inputing':chatInputFocus}">
  4. <router-view></router-view>
  5. </div>
  6. <div class="pub-nav" v-show="navShow">
  7. <div :class="['nav-item',{'active':$route.name == 'chatList'}]" @click="$router.replace('/')">
  8. <i class="chat-icon"></i>
  9. <span class="title">{{$t('h5.chat')}}</span>
  10. </div>
  11. <div :class="['nav-item',{'active':$route.name == 'discover'}]" @click="$router.replace('/discover')">
  12. <i class="dis-icon"></i>
  13. <span class="title">{{$t('h5.discover')}}</span>
  14. </div>
  15. <div :class="['nav-item',{'active':$route.name == 'aboutMe'}]" @click="$router.replace('/me')">
  16. <i class="me-icon"></i>
  17. <span class="title">{{$t('h5.mine')}}</span>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import { accountLoginMixin } from '@/mixins/login'
  24. import { mapState } from 'vuex'
  25. export default {
  26. name: 'App',
  27. mixins: [accountLoginMixin],
  28. computed: {
  29. ...mapState({
  30. toApp: state => state.chat.toApp,
  31. chatInputFocus: state => state.group.chatInputFocus
  32. }),
  33. navShow () {
  34. return this.$route.name == 'discover' || this.$route.name == 'chatList' || this.$route.name == 'aboutMe'
  35. }
  36. },
  37. methods: {},
  38. mounted () {
  39. },
  40. async created () {
  41. let isLogin = await this.checkLocalLogin()
  42. if (!isLogin) this.$router.replace('/login')
  43. else if (location.hash === '#/login') this.$router.replace('/')
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. @import "@/style/base.scss";
  49. @import "@/style/h5.scss";
  50. .fade-enter-active,
  51. .fade-leave-active {
  52. transition: opacity 0.3s ease;
  53. }
  54. .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  55. opacity: 0;
  56. }
  57. html {
  58. height: 100%;
  59. }
  60. body {
  61. min-height: 100%;
  62. background: #f2f2f2;
  63. }
  64. .router-wrap {
  65. padding-bottom: px2rem(104);
  66. background-color: #f2f2f2;
  67. @media #{$iphonex} {
  68. height: px2rem(146);
  69. }
  70. }
  71. .inputing {
  72. .box-ft{
  73. padding-bottom: 0 !important;
  74. }
  75. }
  76. .pub-nav {
  77. position: fixed;
  78. left: 0;
  79. right: 0;
  80. bottom: 0;
  81. z-index: 100;
  82. height: px2rem(106);
  83. background-color: #fafafa;
  84. border-top: 1px solid #e5e5e5;
  85. display: flex;
  86. @media #{$iphonex} {
  87. height: px2rem(146);
  88. }
  89. .dis-icon {
  90. background: url("../../assets/h5/nav-dis-icon1.png") no-repeat;
  91. width: px2rem(45);
  92. height: px2rem(44);
  93. background-size: 100%;
  94. }
  95. .chat-icon {
  96. background: url("../../assets/h5/nav-chat-icon1.png") no-repeat;
  97. width: px2rem(48);
  98. height: px2rem(41);
  99. background-size: 100%;
  100. }
  101. .me-icon {
  102. background: url("../../assets/h5/nav-me-icon1.png") no-repeat;
  103. width: px2rem(37);
  104. height: px2rem(41);
  105. background-size: 100%;
  106. }
  107. .title {
  108. display: block;
  109. text-align: center;
  110. font-size: px2rem(20);
  111. color: #a5b5ce;
  112. margin-top: px2rem(10);
  113. }
  114. .nav-item {
  115. flex: 1;
  116. box-sizing: border-box;
  117. padding-top: px2rem(22);
  118. text-decoration: none;
  119. &.active {
  120. .dis-icon {
  121. background: url("../../assets/h5/nav-dis-icon.png") no-repeat;
  122. background-size: 100%;
  123. }
  124. .chat-icon {
  125. background: url("../../assets/h5/nav-chat-icon.png") no-repeat;
  126. background-size: 100%;
  127. }
  128. .me-icon {
  129. background: url("../../assets/h5/nav-me-icon.png") no-repeat;
  130. background-size: 100%;
  131. }
  132. .title {
  133. color: #32a1f7;
  134. }
  135. }
  136. i {
  137. display: block;
  138. margin: 0 auto;
  139. }
  140. }
  141. }
  142. </style>