index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="search">
  3. <view class="input_box">
  4. <u-search height="30" bgColor="#FFF" :showAction="false" :focus="true" placeholder="请输入剧名"
  5. searchIconColor="#000" v-model="keyword" @search="search"></u-search>
  6. </view>
  7. <view v-if="list && list.length" class="video_lists">
  8. <view class="list_item" v-for="(item,index) in list" :key="index" @click="toPlay(item)">
  9. <image :src="item.thumbnail" mode="aspectFill" loading="lazy"></image>
  10. <view class="innews">
  11. <text>{{ item.name }}</text>
  12. <text class="ellipsis-2">{{ item.description }}</text>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { getServerShipProgramPage } from '@/apis/index'
  20. export default {
  21. data(){
  22. return{
  23. keyword:'',
  24. list:[]
  25. }
  26. },
  27. methods: {
  28. // 获取视频节目分页
  29. async getVideoPage() {
  30. uni.showLoading()
  31. let params = {
  32. orderByColumn: "",
  33. orderByAsc: true,
  34. pageIndex: 1,
  35. pageSize: 10,
  36. keyword: this.keyword,
  37. shipCategoryId: '',
  38. }
  39. const res = await getServerShipProgramPage(params)
  40. this.list = res.list
  41. uni.hideLoading()
  42. console.log(res);
  43. },
  44. search(){
  45. this.getVideoPage()
  46. },
  47. toPlay(item){
  48. uni.redirectTo({
  49. url:'/pages/play/index?id='+ item.id+'&data='+JSON.stringify(item),
  50. })
  51. },
  52. },
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .search{
  57. background: #fff;
  58. padding-bottom: var(--window-bottom);
  59. .input_box{
  60. padding: 20rpx;
  61. }
  62. .video_lists{
  63. padding: 20rpx;
  64. background: #fff;
  65. .list_item{
  66. display: flex;
  67. padding: 20rpx;
  68. border-bottom: 1rpx solid #e2e1d0;
  69. image{
  70. flex-shrink: 0;
  71. width: 160rpx;
  72. height: 220rpx;
  73. margin-right: 30rpx;
  74. }
  75. .innews{
  76. padding: 10rpx 0;
  77. display: flex;
  78. flex-direction: column;
  79. justify-content: space-around;
  80. // justify-content: space-around;
  81. }
  82. }
  83. .list_item:nth-last-child(1){
  84. border: 0;
  85. }
  86. }
  87. }
  88. </style>