Bind.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="绑定" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div main-content">
  13. <view class="div topList">
  14. <view class="div list">
  15. <view
  16. class="div item"
  17. v-for="(item, index) in items"
  18. :key="index"
  19. v-on:click="onClickItem(index)"
  20. >
  21. <label
  22. class="title"
  23. v-bind:class="{
  24. active: index === currentIndex,
  25. normal: index !== currentIndex
  26. }"
  27. >{{ getTitle(item) }}</label
  28. >
  29. </view>
  30. </view>
  31. </view>
  32. <bind-new v-if="currentIndex === 0" />
  33. <bind-old v-else-if="currentIndex === 1" />
  34. </view>
  35. </view></home-base>
  36. </template>
  37. <script>
  38. import {getFontSize} from '@/util/common'
  39. import TitleHeader from '../../TitleHeader'
  40. import HomeBase from '../HomeBase'
  41. import BindNew from './BindNew'
  42. import BindOld from './BindOld'
  43. export default {
  44. name: 'Register',
  45. components:{
  46. TitleHeader,
  47. HomeBase,
  48. BindNew,
  49. BindOld
  50. },
  51. mounted(){
  52. // #ifdef MP-WEIXIN
  53. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  54. // #endif
  55. },
  56. data(){
  57. return {
  58. navHeight: 0,
  59. currentIndex: 0,
  60. items: [
  61. {
  62. id: 1,
  63. title: '新用户'
  64. },
  65. {
  66. id: 2,
  67. title: '已有用户'
  68. }
  69. ]
  70. }
  71. },
  72. computed:{
  73. fontSize(){
  74. return getFontSize()
  75. },
  76. isFirstTab () {
  77. if (this.currentIndex === 0) {
  78. return true
  79. } else {
  80. return false
  81. }
  82. }
  83. },
  84. methods: {
  85. goBack () {
  86. uni.navigateBack({delta:1})
  87. },
  88. getTitle (item) {
  89. return item ? item.title : ''
  90. },
  91. isShowLine (index) {
  92. return index === this.currentIndex
  93. },
  94. onClickItem (index) {
  95. if (this.currentIndex !== index) {
  96. this.currentIndex = index
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .container {
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: flex-start;
  107. align-items: stretch;
  108. //background-color: $primaryColor;
  109. .main-content{background: #fff;padding:1rem 0;}
  110. }
  111. .topList {
  112. height:2rem;
  113. padding:1rem $pageSpace;
  114. .list {
  115. height: 100%;
  116. display: flex;
  117. flex-direction: row;
  118. justify-content: flex-start;
  119. align-content: center;
  120. align-items: stretch;
  121. background-color: #fff;
  122. }
  123. .item {
  124. padding:0 .5rem;
  125. position: relative;
  126. display: flex;
  127. flex-direction: column;
  128. justify-content: center;
  129. align-items: center;
  130. }
  131. .title {
  132. text-align: center;
  133. font-size:$h2;
  134. color: $formInputColor;
  135. }
  136. .active {
  137. color: $primaryColor;
  138. font-size:1.1rem;
  139. }
  140. .normal {
  141. color: #404245;
  142. }
  143. }
  144. </style>