裂变星小程序-25.03.04
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.

141 lines
3.4 KiB

  1. <template>
  2. <view class="page">
  3. <navbar leftClick @leftClick="$utils.navigateBack" />
  4. <view class="content">
  5. <video class="video"
  6. id="video"
  7. :src="detail.videoUrl"
  8. autoplay
  9. :show-fullscreen-btn="false"
  10. @timeupdate="onTimeupdate"
  11. ></video>
  12. <view class="info">
  13. <view class="author">{{ detail.author }}</view>
  14. <view class="title">{{ detail.title }}</view>
  15. <view class="desc">{{ detail.description }}</view>
  16. </view>
  17. </view>
  18. <popupUnlock ref="popupUnlock" src="../static/sharing/unlock-video.png"></popupUnlock>
  19. <popupQrCode ref="popupQrCode" :src="detail.qrCode"></popupQrCode>
  20. </view>
  21. </template>
  22. <script>
  23. import popupUnlock from '../components/popupUnlock.vue'
  24. import popupQrCode from '../components/popupQrCode.vue'
  25. export default {
  26. components: {
  27. popupUnlock,
  28. popupQrCode,
  29. },
  30. data() {
  31. return {
  32. detail: {
  33. id: null,
  34. title: null,
  35. videoUrl: null,
  36. times: 10,
  37. qrCode: null,
  38. description: null,
  39. },
  40. isLocked: true,
  41. videoContext: null
  42. }
  43. },
  44. async onLoad(option) {
  45. console.log('--option', option)
  46. const { id } = option
  47. await this.fetchSharingDetail(id)
  48. this.videoContext = uni.createVideoContext('video');
  49. console.log('--videoContext', this.videoContext)
  50. // this.videoContext.requestFullScreen()
  51. },
  52. onShareAppMessage(res) {
  53. const {
  54. title,
  55. coverImageUrl,
  56. } = this.detail
  57. // todo: check
  58. let o = {
  59. title : title,
  60. imageUrl: coverImageUrl,
  61. query: `id=${this.detail.id}`,
  62. }
  63. // todo: check callback? settimeout?
  64. // todo: get times and check is unlocked
  65. this.isLocked = false
  66. this.$refs.popupQrCode.open()
  67. return o
  68. },
  69. methods: {
  70. async fetchSharingDetail(id) {
  71. // todo: init data by id
  72. this.detail = {
  73. id: '001',
  74. author: '@裂变星',
  75. coverImageUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280',
  76. videoUrl: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400',
  77. mins: 10,
  78. times: 10,
  79. qrCode: '../static/temp-qrcode.png',
  80. title: '20秒学会日赚1000+,全自动获客',
  81. description: '裂变获客,轻松引流!',
  82. auditStatus: 2,
  83. createTime: '2025年2月1日',
  84. state: 1,
  85. }
  86. },
  87. onTimeupdate(e) {
  88. const { currentTime } = e.target
  89. if (currentTime >= this.detail.mins) {
  90. this.videoContext.pause()
  91. if (this.isLocked) {
  92. this.$refs.popupUnlock.open();
  93. } else {
  94. this.$refs.popupQrCode.open()
  95. }
  96. }
  97. },
  98. },
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .video {
  103. width: 100%;
  104. height: calc(100vh - #{$navbar-height} - var(--status-bar-height) - 20rpx);
  105. }
  106. .info {
  107. color: #FFFFFF;
  108. font-size: 28rpx;
  109. position: fixed;
  110. left: 40rpx;
  111. bottom: 100rpx;
  112. .title {
  113. font-size: 32rpx;
  114. margin: 5rpx 0;
  115. }
  116. }
  117. </style>