You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.5 KiB

3 months ago
  1. <template>
  2. <view>
  3. <view class="diy_video acea-row row-center-wrapper" :style="[boxStyle]">
  4. <video :style="[contantRadius]" :src="link" :show-mute-btn="pageGesture" :poster="cover" controls :autoplay="false" loop
  5. objectFit="cover"></video>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. // +----------------------------------------------------------------------
  11. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  12. // +----------------------------------------------------------------------
  13. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  14. // +----------------------------------------------------------------------
  15. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  16. // +----------------------------------------------------------------------
  17. // | Author: CRMEB Team <admin@crmeb.com>
  18. // +----------------------------------------------------------------------
  19. export default {
  20. name: 'pictureCube',
  21. props: {
  22. dataConfig: {
  23. type: Object,
  24. default: () => {}
  25. },
  26. },
  27. data() {
  28. return {
  29. pageGesture: true,
  30. onloadCode: ''
  31. };
  32. },
  33. created() {
  34. // #ifdef APP
  35. this.onloadCode =
  36. `this.contentWindow.document.body.innerHTML = '<video style="width: 100%;height: 100%" objectFit="cover" controls="controls" loop show-mute-btn="${this.pageGesture}" poster="${this.cover}" src="${this.link}"></video>';`
  37. // #endif
  38. },
  39. computed: {
  40. //视频封面
  41. cover() {
  42. return this.dataConfig.cover.url
  43. },
  44. //视频地址
  45. link() {
  46. if (this.dataConfig.tabConfig.tabVal === 0) {
  47. return this.dataConfig.uploadVideo.url
  48. } else {
  49. return this.dataConfig.link.val
  50. }
  51. },
  52. //最外层盒子的样式
  53. boxStyle() {
  54. return {
  55. borderRadius: this.dataConfig.bgStyle.val * 2 + 'rpx',
  56. background: `linear-gradient(${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`,
  57. margin: this.dataConfig.mbConfig.val * 2 + 'rpx' + ' ' + this.dataConfig.lrConfig.val * 2 + 'rpx' +
  58. ' ' + 0,
  59. padding: this.dataConfig.upConfig.val * 2 + 'rpx' + ' ' + 0 + ' ' + this.dataConfig.downConfig.val *
  60. 2 + 'rpx'
  61. }
  62. },
  63. contantRadius() {
  64. return { 'border-radius': this.dataConfig.contantStyle.val ? this.dataConfig.contantStyle.val + 'px' : '0' };
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .diy_video {
  71. iframe {
  72. border: none;
  73. body {
  74. margin: 0;
  75. }
  76. }
  77. video {
  78. width: 100%;
  79. height: 340rpx;
  80. border-radius: 14rpx;
  81. }
  82. }
  83. </style>