followUs.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="container container-follow-us">
  3. <view class="content">
  4. <video
  5. v-if="isPlay"
  6. autoplay
  7. id="myVideo"
  8. src="https://hzstatic.hzinsights.com/static/yb/video/8617330c2a76e0c35999f6466b4470c4.mp4"
  9. @ended="handleVideoEnd"
  10. ></video>
  11. <image class="video-img" @click="playHandler" v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/my_video.png"></image>
  12. <view class="text-introduce">三分钟了解弘则研究体系和方法论</view>
  13. </view>
  14. <view class="my-log">
  15. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/my_log.png"></image>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { Mine } from "@/config/api";
  21. export default {
  22. data() {
  23. return {
  24. videoContext: null,
  25. isPlay: false,
  26. };
  27. },
  28. methods: {
  29. // 播放结束退出全屏
  30. handleVideoEnd() {
  31. this.videoContext.exitFullScreen();
  32. },
  33. // 点击了播放
  34. async playHandler() {
  35. this.isPlay = true;
  36. const res = await Mine.addHistory();
  37. },
  38. },
  39. onReady() {
  40. this.videoContext = wx.createVideoContext("myVideo");
  41. },
  42. async onShow() {
  43. await this.$store.dispatch("checkHandle");
  44. },
  45. };
  46. </script>
  47. <style lang="scss" scoped>
  48. .container-follow-us {
  49. padding: 20rpx 10rpx;
  50. background-color: #f7f7f7;
  51. .content {
  52. background-color: #fff;
  53. }
  54. .video-img {
  55. width: 100%;
  56. height: 340rpx;
  57. }
  58. video {
  59. width: 100%;
  60. height: 340rpx;
  61. }
  62. .text-introduce {
  63. color: #333333;
  64. font-weight: 500;
  65. font-size: 28rpx;
  66. line-height: 39rpx;
  67. text-align: center;
  68. }
  69. .my-log {
  70. width: 100%;
  71. height: 311rpx;
  72. margin-top: 230rpx;
  73. display: flex;
  74. justify-content: center;
  75. image {
  76. width: 303rpx;
  77. height: 311rpx;
  78. }
  79. }
  80. }
  81. </style>