index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <page-meta>
  3. <navigation-bar :title="title" background-color="#4fc08d" />
  4. </page-meta>
  5. <van-transition :show="active==0" name='fade' duration='1000'>
  6. <component v-show="active==0" is="find"></component>
  7. </van-transition>
  8. <van-transition :show="active==1" name='fade' duration='1000'>
  9. <applist v-show="active==1" ref='applist' />
  10. </van-transition>
  11. <van-transition :show="active==2" name='fade' duration='1000'>
  12. <component v-show="active==2" is="user"></component>
  13. </van-transition>
  14. <van-tabbar :active="active" @change="onChange" :placeholder='true' active-color="#0F0404" inactive-color="#999999">
  15. <van-tabbar-item>
  16. <van-icon slot="icon" name="/static/imgs/发现-灰.png" />
  17. <van-icon slot="icon-active" name="/static/imgs/发现.png" />
  18. 学车
  19. </van-tabbar-item>
  20. <van-tabbar-item>
  21. <van-icon slot="icon" name="/static/imgs/专题灰.png" />
  22. <van-icon slot="icon-active" name="/static/imgs/专题、.png" />
  23. 发现
  24. </van-tabbar-item>
  25. <van-tabbar-item>
  26. <van-icon slot="icon" name="/static/imgs/我的灰.png" />
  27. <van-icon slot="icon-active" name="/static/imgs/我的.png" />
  28. 我的
  29. </van-tabbar-item>
  30. </van-tabbar>
  31. <van-toast id="van-toast" />
  32. </template>
  33. <script>
  34. import applist from './components/applist/index.vue'
  35. import find from './components/find/index.vue'
  36. import user from './components/user/index.vue'
  37. import topic from './components/topic/index.vue'
  38. export default {
  39. components: {
  40. applist,
  41. find,
  42. user,
  43. topic
  44. },
  45. data() {
  46. return {
  47. comname: 'xueche',
  48. active: 2,
  49. info: [{
  50. colorClass: 'uni-bg-red',
  51. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  52. content: '内容 A'
  53. },
  54. {
  55. colorClass: 'uni-bg-green',
  56. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  57. content: '内容 B'
  58. },
  59. {
  60. colorClass: 'uni-bg-blue',
  61. url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
  62. content: '内容 C'
  63. }
  64. ],
  65. current: 1,
  66. mode: 'round',
  67. }
  68. },
  69. onLoad() {
  70. },
  71. onReachBottom(){
  72. if(this.active==1){
  73. console.log(this.$refs.applist)
  74. this.$refs.applist.onBottom()
  75. }
  76. },
  77. computed: {
  78. title() {
  79. switch (this.active) {
  80. case 0:
  81. return '学车';
  82. case 1:
  83. return '发现';
  84. case 2:
  85. return '我的';
  86. }
  87. }
  88. },
  89. methods: {
  90. onChange(event) {
  91. // event.detail 的值为当前选中项的索引
  92. this.active = event.detail
  93. },
  94. scanCode() {
  95. // 允许从相机和相册扫码
  96. uni.scanCode({
  97. success: function(res) {
  98. console.log('条码类型:' + res.scanType);
  99. console.log('条码内容:' + res.result);
  100. }
  101. });
  102. },
  103. change(e) {
  104. this.current = e.detail.current;
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .content {
  111. background-color: #F1F1F1;
  112. }
  113. .grid {
  114. display: flex;
  115. justify-content: space-between;
  116. padding: 1% 2%;
  117. margin-bottom: 2%;
  118. border-bottom-left-radius: 10px;
  119. border-bottom-right-radius: 10px;
  120. .grid-item {
  121. width: 50px;
  122. height: 50px;
  123. display: flex;
  124. justify-content: center;
  125. flex-direction: column;
  126. align-items: center;
  127. font-size: 12px;
  128. }
  129. }
  130. .swiper-box {
  131. width: 100vw;
  132. height: 56.25vw;
  133. .image {
  134. width: 100%;
  135. }
  136. }
  137. .sticky {
  138. position: sticky;
  139. top: 54px;
  140. left: 0;
  141. background-color: #fff;
  142. z-index: 9;
  143. }
  144. .sticky-top {
  145. position: sticky;
  146. top: 0px;
  147. left: 0;
  148. background-color: #4fc08d;
  149. z-index: 10;
  150. display: flex;
  151. justify-content: center;
  152. align-items: center;
  153. // border-top-left-radius: 14px;
  154. // border-top-right-radius: 14px;
  155. padding-right: 3%;
  156. .top-search {
  157. flex: 1;
  158. }
  159. }
  160. .sticky-bottom {
  161. position: sticky;
  162. bottom: 0;
  163. left: 0;
  164. background-color: #fff;
  165. z-index: 10;
  166. }
  167. .fadeIn {
  168. animation: fadeIn 5s linear 2s infinite alternate;
  169. }
  170. @keyframes fadeIn {
  171. from {
  172. opacity: 0;
  173. }
  174. to {
  175. opacity: 1;
  176. }
  177. }
  178. </style>