BLiveRank.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="rank">
  3. <div class="b-head">
  4. <ul class="b-slt-tab" data-initialized="true">
  5. <li v-for="(item, index) in tabTitle" @click="cutTab(index)" class="on">
  6. <span class="b-tab-text">{{item}}</span>
  7. </li>
  8. </ul>
  9. </div>
  10. <div class="b-body">
  11. <div class="r-list-body">
  12. <div class="r-list-wrapper">
  13. <ul class="r-list-live" >
  14. <BLiveRankItem v-for="(item, index ) in ranklist" :rank="item" :index="index"></BLiveRankItem>
  15. </ul>
  16. <ul class="r-list-live" style="display: none;">
  17. <li class="no-data">
  18. <span>没有数据</span>
  19. </li>
  20. </ul>
  21. <ul class="r-list-live">
  22. <div class="mini-preview-wrapper">
  23. <div class="mini-preview-list-wrapper">
  24. <ul class="mini-preview" ref="miniPreview">
  25. <li class="preview" v-for="pre in preview">
  26. <a href="" target="_blank">
  27. <img :src="pre.pic">
  28. </a>
  29. </li>
  30. </ul>
  31. </div>
  32. <div class="s-bottom">
  33. <div class="info">
  34. <div class="info-item" v-for="(pre, index) in preview" :class="{ show: count == index,hide: count !== index }">
  35. <a class="t" :href="pre.url" :title="pre.title" target="_blank">{{pre.title}}</a>
  36. </div>
  37. </div>
  38. <ul class="slider-bar">
  39. <li bar :class="{on: count == index}" v-for="(item, index) in preview" @mouseover="cutItem(index)">
  40. <a></a>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. <div class="live-pmt-live">
  46. <li v-for="anchor in recommendAnchor">
  47. <div class="pmt-item"><a class="preview" :href="anchor.link" target="_blank" :title="anchor.title"><img :src="anchor.face" :alt="anchor.link"><p class="title">{{anchor.uname}}</p></a></div>
  48. </li>
  49. </div>
  50. </ul>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import BLiveRankItem from 'components/live/BLiveRankItem'
  58. export default {
  59. data() {
  60. return {
  61. interval: Function,
  62. count: 0,
  63. tabTitle: ['直播排行', '关注的主播', '为你推荐']
  64. }
  65. },
  66. props: {
  67. ranklist: {
  68. type: Array
  69. },
  70. preview: {
  71. type: Array
  72. },
  73. recommendAnchor: {
  74. type: Array
  75. }
  76. },
  77. watch: {
  78. preview() {
  79. let size = 100 * this.preview.length
  80. let width = size + "%"
  81. this.$refs.miniPreview.style.width = width
  82. this.startInterval()
  83. }
  84. },
  85. mounted() {
  86. },
  87. methods: {
  88. cutItem(index) {
  89. this.count = index
  90. let distance = -100 * this.count
  91. let left = distance + "%"
  92. this.$refs.miniPreview.style.marginLeft = left
  93. clearInterval(this.interval)
  94. this.startInterval()
  95. },
  96. startInterval() {
  97. //轮播图定时滚动
  98. this.interval = setInterval(() => {
  99. this.count ++
  100. if (this.count === this.preview.length) {
  101. this.count = 0
  102. }
  103. let distance = -100 * this.count
  104. let left = distance + "%"
  105. if (this.$refs.miniPreview) {
  106. this.$refs.miniPreview.style.marginLeft = left
  107. }
  108. }, 5000)
  109. },
  110. cutTab(index) {
  111. }
  112. },
  113. components: {
  114. BLiveRankItem
  115. }
  116. }
  117. </script>
  118. <style lang="stylus">
  119. .rank
  120. .b-head
  121. position relative
  122. .b-slt-tab
  123. padding-left 0
  124. position relative
  125. display inline-block
  126. vertical-align middle
  127. li
  128. float left
  129. position relative
  130. padding 1px 0 2px
  131. border-bottom 1px solid transparent
  132. height 20px
  133. line-height 20px
  134. cursor pointer
  135. text-align center
  136. margin-left 15px
  137. &:first-child
  138. margin 0
  139. &.on
  140. background-color transparent
  141. border-color #00a1d6
  142. color #00aid6
  143. .b-tab-text
  144. color #00a1d6
  145. &:before
  146. content ''
  147. display block
  148. position absolute
  149. left 50%
  150. margin-left -3px
  151. bottom 0
  152. width 0
  153. height 0
  154. border 3px dashed #00a1d6
  155. border-bottom-style solid
  156. border-top 0
  157. border-left-color transparent
  158. border-right-color transparent
  159. &:after
  160. content ''
  161. display block
  162. visibility hidden
  163. font-size 0
  164. height 0
  165. clear both
  166. .b-body
  167. clear both
  168. .r-list-body
  169. zoom 1
  170. overflow hidden
  171. &:after
  172. content ''
  173. display block
  174. visibility hidden
  175. height 0
  176. font-size 0
  177. clear both
  178. .r-list-wrapper
  179. margin-left -100%
  180. width 200%
  181. &:after
  182. content ''
  183. display block
  184. visibility hidden
  185. font-size 0
  186. clear both
  187. height 0
  188. .r-list-live
  189. display block
  190. width 50%
  191. padding-top 20px
  192. float left
  193. .no-data
  194. text-align center!important
  195. width 100%!importang
  196. height 100%!important
  197. padding 0!important
  198. margin 0!important
  199. line-height 100px!important
  200. color #99a2aa!important
  201. float none!important
  202. span
  203. display inline-block
  204. vertical-align middle
  205. height 20px
  206. line-height 20px
  207. &:before
  208. content ''
  209. display inline-block
  210. vertical-align middle
  211. width 20px
  212. height 20px
  213. background url(../../assets/images/state.png) no-repeat center -598px
  214. margin-right 5px
  215. .mini-preview-wrapper
  216. position relative
  217. width 260px
  218. overflow hidden
  219. border-radius 4px
  220. .mini-preview-list-wrapper
  221. overflow hidden
  222. border-radius 4px
  223. .mini-preview
  224. width 100%
  225. margin-left 0%
  226. zoom 1
  227. transition .2s
  228. &:after
  229. content ''
  230. height 0
  231. display block
  232. clear both
  233. font-size 0
  234. li
  235. width 260px
  236. height 248px
  237. float left
  238. overflow hidden
  239. .s-bottom
  240. position absolute
  241. bottom 0px
  242. left 0px
  243. width 100%
  244. border-radius 0 0 4px 4px
  245. .info
  246. padding 5px 10px 2px
  247. line-height 20px
  248. background rgba(0,0,0,0.6)
  249. .show
  250. display block
  251. .hide
  252. display none
  253. a.t
  254. display block
  255. color #fff
  256. overflow hidden
  257. white-space nowrap
  258. text-overflow ellipsis
  259. .slider-bar
  260. overflow hidden
  261. text-align center
  262. background rgba(0,0,0,0.74)
  263. &.show
  264. display block
  265. &.hide
  266. display none
  267. li
  268. display inline-block
  269. vertical-align top
  270. cursor pointer
  271. height 6px
  272. padding 9px 0
  273. margin 0 2px
  274. a
  275. display block
  276. width 10px
  277. height 6px
  278. background-color #fff
  279. border-radius 5px
  280. transition .2s
  281. &.on
  282. a
  283. width 30px
  284. background-color #f25d8e
  285. .live-pmt-live
  286. padding-top 10px
  287. height 102px
  288. overflow hidden
  289. li
  290. float left
  291. margin 0 0 10px 12px
  292. &:first-child
  293. margin-left 0
  294. .pmt-item
  295. .preview
  296. display block
  297. width 56px
  298. height 56px
  299. position relative
  300. border-radius 4px
  301. overflow hidden
  302. &:hover .title
  303. height 100%
  304. line-height 22px
  305. padding 8px 5px
  306. box-sizing border-box
  307. word break-all
  308. img
  309. width 100%
  310. height 100%
  311. display block
  312. .title
  313. position absolute
  314. bottom 0px
  315. right 0px
  316. width 100%
  317. text-align center
  318. height 18px
  319. line-height 18px
  320. color #fff
  321. background rgba(0,0,0,0.5)
  322. &:after
  323. content ''
  324. display block
  325. visibility hidden
  326. font-size 0
  327. height 0
  328. clear both
  329. </style>