index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view>
  3. <view class="img-bg" @click="closePreview">
  4. <view class="banner">
  5. <video style="background: red;" id="myVideo" :src="src" @fullscreenchange="fullscreenchange"></video>
  6. </view>
  7. <view class="full ddflex" @click.stop="fullscreen">
  8. <image style="width: 37rpx;height: 32rpx;margin-right: 10rpx;" src="../../static/images/m_qp.png"></image>
  9. 全屏观看
  10. </view>
  11. <view class="img-content" :style="(isShowAll?'background-color: rgba(255,255,255,0.1);':'')+(true?'bottom:calc(30rpx + 106rpx);':'')">
  12. <view :class="isShowAll||content.length<12?'':'img-content-tovers'">
  13. <view :style="isShowAll?'white-space: pre-wrap;':''">{{styleContent(content)}}</view>
  14. <view style="height: 46rpx;" v-if="isShowAll"></view>
  15. <view v-if="content.length>12" class="img-content-more" :style="isShowAll?'padding-bottom:10rpx;':''" @click.stop="showAll">{{isShowAll?'收起':'展开'}}</view>
  16. </view>
  17. </view>
  18. <view class="img-btn" :style="product?'bottom:calc(30rpx + 106rpx);':''" @click="btnClick">一键转发</view>
  19. <view class="video-pro ddflex" v-if="product" @click.stop="jumpUrl('/product/detail/detail?id='+product.id)">
  20. <image class="video-pro-pic" :src="product.icon" mode="aspectFill"></image>
  21. <view class="fflex tover video-pro-title">{{product.title}}</view>
  22. <view class="ddflex video-pro-btn">
  23. 视频同款
  24. <image class="video-pro-btn-icon" src="/static/images/more3.png"></image>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. const app = getApp();
  32. const req = require("../../../utils/request.js");
  33. export default {
  34. components: {},
  35. props: {
  36. imageList:{
  37. type:Array,
  38. default:()=>{return []}
  39. },
  40. previewIndex:{
  41. type:Number,
  42. default:0
  43. },
  44. content:{
  45. type:String,
  46. default:''
  47. },
  48. product:{
  49. type:Object,
  50. default:null
  51. },
  52. src:{
  53. type:String,
  54. default:''
  55. },
  56. material:{
  57. type:Object,
  58. default:()=>{return {}}
  59. }
  60. },
  61. data() {
  62. return {
  63. swiperCurrent:0,
  64. isShowAll:false
  65. }
  66. },
  67. onLoad(options) {
  68. },
  69. onShow() {
  70. },
  71. mounted() {
  72. if(this.previewIndex){
  73. this.swiperCurrent = this.previewIndex
  74. }
  75. this.videoContext = uni.createVideoContext('myVideo', this)
  76. this.videoContext.play()
  77. },
  78. methods: {
  79. jumpUrl(url){
  80. this.videoContext.pause()
  81. uni.navigateTo({
  82. url:url
  83. })
  84. },
  85. fullscreen() {
  86. this.videoContext.requestFullScreen()
  87. if(this.material.params.videoType==2){
  88. plus.screen.lockOrientation('landscape-primary')
  89. }else{
  90. plus.screen.lockOrientation('portrait-primary')
  91. }
  92. },
  93. fullscreenchange(e){
  94. if(!e.detail.fullScreen){
  95. plus.screen.lockOrientation('portrait-primary')
  96. }
  97. },
  98. showAll(){
  99. this.isShowAll = !this.isShowAll
  100. },
  101. closePreview(){
  102. this.$emit('videoPreviewClose')
  103. },
  104. btnClick(){
  105. this.$emit('videoPreviewClick')
  106. },
  107. styleContent(value){
  108. return value.replace(/<br\/>/g, "\n")
  109. }
  110. },
  111. }
  112. </script>
  113. <style>
  114. @import "./index.css";
  115. </style>