luvideo.vue 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="hvideo bgf">
  3. <view class="hvlist" v-for="(ite,idx) in videoList" :key="idx">
  4. <view class="hvlistl">
  5. <view :class="ite.txt==1?'cir1 cir':'cir2 cir'"></view>
  6. <view class="tit mb6">{{ite.tit}}</view>
  7. <view class="txt">当前路况<text :class="ite.txt==1?'co5c':'coeb'">{{ite.txt==1?'畅通':'拥堵'}}</text></view>
  8. </view>
  9. <video class="hvlistr" :id="`video${idx}`" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" :controls='controls' @play='videoPlay(idx)'>
  10. </video>
  11. <!-- controls -->
  12. <!-- <video id="myVideo" class="hvlistr" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4"
  13. @fullscreenchange="fullscreenchange" @play='videoPlay(idx)' controls></video> -->
  14. </view>
  15. <!-- -->
  16. <view class="hmore">
  17. 查看更多
  18. <image :src="moreimg"></image>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. // import tabSearch from "@/components/toptab/search.vue"
  24. export default {
  25. data(){
  26. return{
  27. src: '',
  28. videoList:[{tit:'黄山路与潜山路交口路况',txt:'1'},{tit:'黄山路与潜山路交口路况',txt:'2'}],
  29. moreimg:require('@/static/images/hmore.png'),
  30. playIdx:'',
  31. controls:true,
  32. videoContext:''
  33. }
  34. },
  35. methods:{
  36. videoPlay(idx) {
  37. if (this.playIdx !== '') {
  38. console.log(`暂停上一个下标为${this.playIdx}的视频`);
  39. let videoContext = uni.createVideoContext(`video${this.playIdx}`)
  40. videoContext .pause()
  41. }
  42. this.playIdx = idx
  43. },
  44. fullscreenchange (e){
  45. if(!e.detail.fullScreen){
  46. this.videoContext.stop()
  47. }
  48. }
  49. },
  50. onLoad: function() {
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .hvideo{margin: 0rpx 36rpx;padding: 28rpx 24rpx;box-sizing: border-box;
  56. .hvlist{margin-bottom: 28rpx;min-height: 146rpx;background: #F3F3FD;
  57. border-radius: 14rpx;padding: 11rpx;box-sizing: border-box;display: flex;align-items: center;
  58. &:last-child{margin-bottom: 0;}
  59. }
  60. .hvlistl{flex: 1;position: relative;padding-left: 40rpx;
  61. .tit{font-size: 30rpx;font-weight: bold;
  62. color: #161616;}
  63. .txt{font-size: 28rpx;color: #666666;}
  64. .cir{width: 12rpx;height: 12rpx;border-radius: 50%;position: absolute;left: 12rpx;top:14rpx ;
  65. &.cir1{background-color: #5CC37D;}
  66. &.cir2{background-color: #EB5663;}
  67. }
  68. }
  69. .hvlistr{width: 217rpx;height: 125rpx;border-radius: 14rpx;flex: 0 0 auto;flex: 0 0 auto;}
  70. }
  71. .hmore{font-size: 30rpx;font-weight: 500;text-align: center;
  72. color: #AAAAAA;
  73. image{width: 26rpx;height: 22rpx;margin: 12rpx auto 0;}
  74. }
  75. </style>