news.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <u-navbar title=" " @leftClick="leftClick" height="44px" bgColor="rgb(255,255,255)" :placeholder="true">
  5. <view class="u-nav-slot" slot="center">
  6. <u-input v-model="keyword" type="text" :border="true" placeholder="搜索关键词" shape="circle"
  7. prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" @focus="search">
  8. <template slot="suffix">
  9. <view @click="search">搜索</view>
  10. </template>
  11. </u-input>
  12. </view>
  13. </u-navbar>
  14. </view>
  15. <view class="boxs">
  16. <u-tabs :list="tabs" @click="changeTaaba"
  17. :scrollable = "false"
  18. :activeStyle="{
  19. color: '#000',
  20. }" :inactiveStyle="{
  21. color: '#888888'
  22. }"></u-tabs>
  23. </view>
  24. <view class="boxs" v-if="pageList.length > 0">
  25. <news-module :pageList="pageList" @toDetail="toDetail"></news-module>
  26. </view>
  27. <!-- <view class="boxs" v-else>
  28. <u-empty icon="https://ship-expert.zhousi.hdlkeji.com/common/zhan.png" text="暂时没有数据哦">
  29. </view> -->
  30. </view>
  31. </template>
  32. <script>
  33. import $api from '@/static/js/api.js'
  34. var that = ''
  35. export default {
  36. data() {
  37. return {
  38. keyword: '',
  39. tabs: [
  40. {
  41. name: '推荐',
  42. },
  43. {
  44. name: '发现',
  45. },
  46. {
  47. name: '资讯',
  48. },
  49. {
  50. name: '实时',
  51. },
  52. {
  53. name: '娱乐',
  54. },
  55. {
  56. name: '美食',
  57. }
  58. ],
  59. pageList: [
  60. {
  61. title: '2022年上半年十部好剧,《开端》第7名,《人世间》第4名,值得观看',
  62. imgs: [
  63. "/static/images/index/class_img1.png",
  64. "/static/images/index/class_img1.png",
  65. "/static/images/index/class_img1.png"
  66. ],
  67. type: '资讯',
  68. client: '澎湃新闻客户端',
  69. comment: 77
  70. }
  71. ],
  72. }
  73. },
  74. onLoad(options) {
  75. that = this
  76. that.keyword = options.value
  77. },
  78. methods: {
  79. // 返回
  80. leftClick() {
  81. console.log('返回');
  82. $api.jump(-1)
  83. },
  84. // 切换tabs
  85. changeTaaba(e) {
  86. console.log(e);
  87. },
  88. toDetail(index) {
  89. if(that.pageList[index].ctype == 1) {
  90. $api.jump('/page_index/pages/index/newDetail?id=' + that.pageList[index].id)
  91. }
  92. },
  93. },
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .content::v-deep {
  98. .top {
  99. box-sizing: border-box;
  100. // padding: 30rpx;
  101. // height: 540rpx;
  102. .u-nav-slot {
  103. position: absolute;
  104. top: 8rpx;
  105. left: 84rpx;
  106. width: 470rpx;
  107. }
  108. .u-input {
  109. background-color: #fff;
  110. height: 64rpx;
  111. padding: 0 0 0 18rpx !important;
  112. border: 1rpx solid #506Dff;
  113. margin-bottom: 12rpx;
  114. }
  115. .u-input__content__subfix-icon {
  116. width: 128rpx;
  117. height: 64rpx;
  118. background-color: #506Dff;
  119. border-radius: 32rpx;
  120. color: #fff;
  121. font-size: 28rpx;
  122. text-align: center;
  123. line-height: 64rpx;
  124. }
  125. }
  126. .boxs {
  127. width: 100%;
  128. box-sizing: border-box;
  129. padding: 0 30rpx;
  130. margin: 24rpx 0 0;
  131. }
  132. }
  133. </style>