index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="container">
  3. <!--search-->
  4. <view class="search-box main-center cross-center">
  5. <u-input
  6. v-model="keywords"
  7. placeholder="请输入剧名"
  8. color="#fff"
  9. border="none"
  10. prefix-icon="search"
  11. :prefix-icon-style="{
  12. color: $colors.primaryColor,
  13. fontSize: '50rpx',
  14. fontWeight: 500,
  15. lineHeight: '50rpx'
  16. }"
  17. :custom-style="{
  18. backgroundColor: '#1B203C',
  19. padding: '14rpx 30rpx',
  20. width: '700rpx',
  21. borderRadius: '36rpx',
  22. color: '#fff'
  23. }"
  24. @confirm="handleSearch"
  25. />
  26. </view>
  27. <!--swpier-->
  28. <swiper-box />
  29. <!--栏目分类-->
  30. <nav-bar />
  31. <!--分类-->
  32. <template v-for="(item,index) in homeColumn">
  33. <episode-box
  34. v-if="item.type !== homeColumnType[2]"
  35. :key="index"
  36. :title="item.name"
  37. :type="item.type"
  38. />
  39. </template>
  40. <!--tab bar-->
  41. <tab-bar />
  42. <!--最近播放-->
  43. <recent />
  44. </view>
  45. </template>
  46. <script>
  47. import SwiperBox from '../../components/SwiperBox/index'
  48. import EpisodeBox from './components/EpisodeBox'
  49. import TabBar from '../../components/TabBar/index'
  50. import NavBar from '../../components/NavBar/index'
  51. import Recent from './components/Recent'
  52. export default {
  53. components: { Recent, NavBar, TabBar, EpisodeBox, SwiperBox },
  54. data() {
  55. return {
  56. keywords: '',
  57. homeColumnType: {
  58. 1: 'recommend',
  59. 2: 'todayRecommend',
  60. 3: 'news',
  61. 4: 'rank'
  62. },
  63. homeColumn: []
  64. }
  65. },
  66. computed: {
  67. },
  68. onLoad(options) {
  69. this.getHomeColumn()
  70. },
  71. methods: {
  72. handleSearch() {
  73. if (!this.keywords) {
  74. this.$u.toast('请输入剧集名称')
  75. return
  76. }
  77. this.$u.route({
  78. url: '/pages/index/search',
  79. params: {
  80. keywords: this.keywords
  81. }
  82. })
  83. },
  84. getHomeColumn() {
  85. this.$api.setting.homeColumn().then(res => {
  86. this.homeColumn = res.data
  87. this.homeColumn.forEach(obj => {
  88. obj.type = this.homeColumnType[obj.type]
  89. })
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .container{
  97. padding: 0 20rpx 160px;
  98. .search-box{
  99. margin-top: 30rpx;
  100. }
  101. .category-box{
  102. .category-item{
  103. flex: 1;
  104. font-size: 32rpx;
  105. .icon{
  106. image{
  107. width: 100rpx;
  108. height: 100rpx;
  109. }
  110. }
  111. text{
  112. color: #fff;
  113. }
  114. }
  115. }
  116. }
  117. </style>