oneIndex.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view>
  3. <view class="searchType" style="background: #fff;">
  4. <view class="input-view">
  5. <uni-icon type="search" size="22" color="#666666" />
  6. <input confirm-type="search" class="input" type="text" placeholder="搜索文章" @confirm="confirm" />
  7. </view>
  8. </view>
  9. <view>
  10. <van-tabs :active="active" @change="onChange">
  11. <van-tab v-for="(item,index) in typelist" :key="index" :name="index" :title="item.ac_name"></van-tab>
  12. </van-tabs>
  13. </view>
  14. <!-- refresher-enabled 开启自定义下拉-->
  15. <scroll-view class="floor-list"
  16. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  17. @refresherabort="onAbort"
  18. @refresherrefresh="onRefresh"
  19. @refresherpulling="onPulling"
  20. refresher-enabled="true">
  21. <view>
  22. <view class="hotelList">
  23. <view class="hotleLeft">
  24. <image style="width: 214upx;height: 152upx;" src=""/>
  25. </view>
  26. <view class="hotelright">
  27. <view style="font-size: 28upx;color: #303133;">华南城市酒店</view>
  28. <view>
  29. 07-05 14:58
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </scroll-view>
  35. </view>
  36. </template>
  37. <script>
  38. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  39. export default {
  40. components: {
  41. uniIcon
  42. },
  43. data() {
  44. return {
  45. page: 1,
  46. page_size: 10,
  47. ac_id:'',
  48. keyword:'',
  49. active: 0,
  50. scrollTop: 0,
  51. old: {
  52. scrollTop: 0
  53. },
  54. typelist:[]
  55. }
  56. },
  57. onLoad() {
  58. this.getype(); // 获取文章分类
  59. this.getlist(); // 获取文章列表
  60. },
  61. methods: {
  62. getype() {
  63. this.request({
  64. url: '/v1/entry/news_cate',
  65. success: (res) => {
  66. let array = [{ac_name:'全部'}];
  67. this.typelist = array.concat(res.data.data);
  68. console.log(this.typelist);
  69. }
  70. })
  71. },
  72. getlist() {
  73. this.request({
  74. url: '',
  75. method:'POST'
  76. })
  77. },
  78. confirm() {
  79. },
  80. onChange(event,) {
  81. console.log(event);
  82. this.active = event.detail.name;
  83. },
  84. // 自定义下拉控件被触发
  85. onPulling() {
  86. },
  87. // 自定义下拉刷新被触发
  88. onRefresh() {
  89. },
  90. // 自定义下拉刷新被中止
  91. onAbort() {
  92. },
  93. // 滚动到顶部
  94. upper(e) {
  95. console.log(e)
  96. console.log("顶部")
  97. },
  98. // 滚到底部
  99. lower(e) {
  100. console.log("底部")
  101. },
  102. // 滚动时触发
  103. scroll(e) {
  104. this.old.scrollTop = e.detail.scrollTop
  105. },
  106. }
  107. }
  108. </script>
  109. <style>
  110. .hotelList {
  111. display: flex;
  112. flex-direction: row;
  113. padding: 24upx 32upx;
  114. }
  115. .hotleLeft {
  116. width: 214upx;
  117. height: 152upx;
  118. background-color: #007AFF;
  119. }
  120. .hotelright {
  121. padding-left: 16upx;
  122. display: flex;
  123. flex-direction: column;
  124. width: 100%;
  125. }
  126. .searchType .input-view {
  127. width: 85%;
  128. display: flex;
  129. background-color: #e7e7e7;
  130. height: 30px;
  131. border-radius: 15px;
  132. padding: 0 4%;
  133. flex-wrap: nowrap;
  134. margin: 7px 0;
  135. line-height: 30px;
  136. margin: 24upx auto;
  137. }
  138. .searchType .input-view .uni-icon {
  139. line-height: 30px !important;
  140. }
  141. .searchType .input-view .input {
  142. height: 30px;
  143. line-height: 30px;
  144. width: 94%;
  145. padding: 0 3%;
  146. }
  147. </style>