videosucaidetail.vue 2.4 KB
<template>
  <div class="containerbox">
    <div class="flextwo sharetopk" @click="back">
      <div class="leftrow leftrowkimg">
        <img src="../../../assets/leftrow.png" alt />
      </div>
      <div class="sharemiddle">视频详情</div>
      <div class="sharebtn">
        <!-- <img src="../../../assets/sharebtn.png" alt /> -->
      </div>
    </div>
    <div class="sucaidetailimg" @click="playvideo">
      <!-- <img src="../../../assets/sucaidetail.png" alt /> -->
      <video
        :poster="contentdetail.content_image"
        id="video"
        :src="contentdetail.content"
        loop="loop"
        controlslist="nodownload"
        height="100%"
        width="100%"
        controls="controls"
      ></video>
      <!-- <img src="../../../assets/anniu.png" alt class="detailplay" v-if="showbtn" /> -->
    </div>
    <div class="sucaitext">{{contentdetail.name}}</div>

    <div class="suciabot">
      <div
        class="sucaibtn"
        v-clipboard:copy="contentdetail.content"
        v-clipboard:success="onCopy"
      >下载素材</div>
    </div>
  </div>
</template>

<script>
import { Toast } from 'vant';
export default {
  data() {
    return {
      id: "",
      contentdetail: '',
      controls: false,
      showbtn: false,

    };
  },

  created() {
    document.title = '唐元集'
    this.id = this.$route.query.id;
    this.getvideodetail()
  },
  methods: {
    onCopy() {
      Toast("复制成功,请到浏览器下载")
    },

    getvideodetail() {
      let that = this;
      var url = "/api/user/material_detail";
      let param = {
        material_id: this.id
      };

      that.$axios
        .post(url, param)
        .then(function (res) {
          console.log(res);
          that.contentdetail = res.data.material;
          console.log(that.contentdetail)


        })
        .catch(function (err) {
          console.log(err);
        });
    },
    playvideo() {
      // var video = document.getElementById("video");
      // this.showbtn = false;
      // this.controls = true;
      // if (video.paused) {
      //   video.play();
      //   // this.controls = true

      // } else {
      //   video.pause();

      // }
      // console.log(video);
      this.$router.push({
        path: '/videoplay',
        query: {
          url: this.contentdetail.content
        }
      })
    },
    back() {
      this.$router.go(-1)
    },
  }
};
</script>

<style scoped>
@import "../../../style/usercenter.css";
</style>