search.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="box">
  3. <u-navbar title="搜索" :placeholder="true" :autoBack="true" bgColor="rgba(255,255,255,0)" titleStyle="font-weight:bold;color:#121212"></u-navbar>
  4. <view class="box_search">
  5. <u-search :shape="square" v-model="val" bgColor="#efefef" borderColor="#cccccc" :showAction="false" height="70rpx"></u-search>
  6. <view @click="searchBtn" class="sousuo">搜索</view>
  7. </view>
  8. <view class="box_22" @click="recommendBtn(index)" v-for="(item, index) in list" :key="item.id">
  9. <view class="block_5">
  10. <image style="width: 100%; height: 100%; border-radius: 0 50rpx 0 20rpx" :src="item.thumbnail"></image>
  11. <view class="tag_1">
  12. <text lines="1" class="text_9">{{ item.type_text }}</text>
  13. </view>
  14. <view class="tag_2">
  15. <text lines="1" class="text_10">{{ item.title }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. let that;
  23. export default {
  24. data() {
  25. return {
  26. val: '',
  27. main_body_id: '',
  28. model_id: '',
  29. list: []
  30. };
  31. },
  32. onLoad(o) {
  33. that = this;
  34. this.main_body_id = this.$db.get('main_body_id');
  35. this.model_id = o.id;
  36. },
  37. methods: {
  38. searchBtn() {
  39. this.$api.getContentList(
  40. {
  41. model_id: this.model_id,
  42. main_body_id: this.main_body_id,
  43. keywords: this.val,
  44. page: 1,
  45. pageSize: '10'
  46. },
  47. function (res) {
  48. that.list = res.data;
  49. }
  50. );
  51. },
  52. //精彩推荐内容
  53. recommendBtn(i) {
  54. this.$common.navigateTo(this.list[i].page);
  55. }
  56. }
  57. };
  58. </script>
  59. <style>
  60. .box {
  61. width: 100%;
  62. background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/shouhu/wyj-feiyi3-001.png');
  63. background-size: 100% 100%;
  64. background-attachment: fixed;
  65. background-repeat: repeat-y;
  66. height: 100%;
  67. padding-bottom: 50rpx;
  68. }
  69. .box_search {
  70. display: flex;
  71. margin: 40rpx 32rpx 0 46rpx;
  72. width: 650rpx;
  73. height: 80rpx;
  74. }
  75. .sousuo {
  76. width: 118rpx;
  77. height: 80rpx;
  78. text-align: center;
  79. color: #ffffff;
  80. line-height: 80rpx;
  81. background: #ca5642;
  82. border-radius: 10rpx;
  83. }
  84. .box_22 {
  85. height: 345rpx;
  86. display: flex;
  87. flex-direction: column;
  88. width: 686rpx;
  89. margin: 40rpx 0 0 47rpx;
  90. }
  91. .block_5 {
  92. position: relative;
  93. height: 345rpx;
  94. width: 645rpx;
  95. display: flex;
  96. flex-direction: column;
  97. margin-left: 9rpx;
  98. }
  99. .tag_1 {
  100. position: absolute;
  101. background-color: rgba(77, 113, 153, 1);
  102. border-radius: 9rpx 9rpx 32rpx 0rpx;
  103. height: 48rpx;
  104. display: flex;
  105. flex-direction: column;
  106. width: 86rpx;
  107. }
  108. .tag_2 {
  109. position: absolute;
  110. bottom: 36rpx;
  111. right: 20rpx;
  112. }
  113. .text_9 {
  114. width: 47rpx;
  115. height: 23rpx;
  116. overflow-wrap: break-word;
  117. color: rgba(255, 255, 255, 1);
  118. font-size: 24rpx;
  119. font-family: SourceHanSansCN-Bold;
  120. font-weight: 700;
  121. text-align: left;
  122. white-space: nowrap;
  123. line-height: 24rpx;
  124. margin: 12rpx 0 0 19rpx;
  125. }
  126. .text_10 {
  127. width: 147rpx;
  128. height: 29rpx;
  129. overflow-wrap: break-word;
  130. color: #ffffff;
  131. font-size: 34rpx;
  132. font-family: Adobe Heiti Std R;
  133. font-weight: normal;
  134. text-align: left;
  135. white-space: nowrap;
  136. line-height: 30rpx;
  137. }
  138. </style>