Commit 349503e8f2acaa524bdfd1546b351190f9fbe69f

Authored by
1 parent 1d7251f4
Exists in master

视频播放

src/views/Yanxue/achievementsOne.vue
@@ -124,6 +124,7 @@ export default { @@ -124,6 +124,7 @@ export default {
124 .greyFont { 124 .greyFont {
125 color: #999; 125 color: #999;
126 font-size: 24px; 126 font-size: 24px;
  127 +
127 } 128 }
128 } 129 }
129 } 130 }
@@ -167,12 +168,13 @@ export default { @@ -167,12 +168,13 @@ export default {
167 .greyTime { 168 .greyTime {
168 color: #999; 169 color: #999;
169 font-size: 24px; 170 font-size: 24px;
170 - margin: 0 20px; 171 + margin: 0 ;
171 } 172 }
172 173
173 .greyFont { 174 .greyFont {
174 color: #999; 175 color: #999;
175 font-size: 24px; 176 font-size: 24px;
  177 + margin-left: 20px;
176 } 178 }
177 } 179 }
178 } 180 }
src/views/Yanxue/pageDetails.vue
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <!--视频--> 21 <!--视频-->
22 <div v-if="v.type == 2" class="typeTwo"> 22 <div v-if="v.type == 2" class="typeTwo">
23 <div class="videoTwo" v-for="(x, y) in v.videoList" :key="y"> 23 <div class="videoTwo" v-for="(x, y) in v.videoList" :key="y">
24 - <video controls > 24 + <video controls :poster='imgUrl' preload="none">
25 <source :src="x" type="video/mp4" /> 25 <source :src="x" type="video/mp4" />
26 </video> 26 </video>
27 </div> 27 </div>
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 import { ImagePreview } from "vant"; 39 import { ImagePreview } from "vant";
40 export default { 40 export default {
41 data() { 41 data() {
42 - return { arr: 0, modelList: [] ,background: ''}; 42 + return { arr: 0, modelList: [], background: "", imgUrl: "" };
43 }, 43 },
44 methods: { 44 methods: {
45 //获取数据 45 //获取数据
@@ -50,13 +50,15 @@ export default { @@ -50,13 +50,15 @@ export default {
50 }) 50 })
51 .then((res) => { 51 .then((res) => {
52 if (res.data.success) { 52 if (res.data.success) {
  53 + this.imgUrl = res.data.data.imgUrl;
53 if (!res.data.data.background) { 54 if (!res.data.data.background) {
54 this.background = res.data.data.imgUrl; 55 this.background = res.data.data.imgUrl;
55 - }else { 56 + } else {
56 this.background = res.data.data.background; 57 this.background = res.data.data.background;
57 } 58 }
58 let arr = JSON.parse(res.data.data.modelList); 59 let arr = JSON.parse(res.data.data.modelList);
59 this.modelList = arr; 60 this.modelList = arr;
  61 + // this.showFrame();
60 } else { 62 } else {
61 this.$message.warning(res.data.message); 63 this.$message.warning(res.data.message);
62 } 64 }
@@ -78,13 +80,32 @@ export default { @@ -78,13 +80,32 @@ export default {
78 id: this.$route.query.dataId, 80 id: this.$route.query.dataId,
79 }) 81 })
80 .then((res) => { 82 .then((res) => {
81 - if(res.data.success) {  
82 - console.log('阅读量成功')  
83 - }else {  
84 - console.log('阅读量失败') 83 + if (res.data.success) {
  84 + console.log("阅读量成功");
  85 + } else {
  86 + console.log("阅读量失败");
85 } 87 }
86 - })  
87 - } 88 + });
  89 + },
  90 + //视频
  91 + showFrame() {
  92 + const video = document.createElement("video");
  93 + console.log("sfsddf");
  94 + video.addEventListener("loadeddata", function (e) {
  95 + canvas.width = this.videoWidth;
  96 + canvas.height = this.videoHeight;
  97 + width = this.videoWidth;
  98 + height = this.videoHeight;
  99 + ctx.drawImage(this, 0, 0, width, height);
  100 + var src = canvas.toDataURL("image/jpeg");
  101 + console.log("sfsf");
  102 + img.src = src;
  103 +
  104 + // var currentTime = this.currentTime
  105 + // duration = this.duration
  106 + // var fps = duration / 30
  107 + });
  108 + },
88 }, 109 },
89 mounted() { 110 mounted() {
90 this.getTable(); 111 this.getTable();
@@ -137,7 +158,7 @@ export default { @@ -137,7 +158,7 @@ export default {
137 background-size: 100% 100%; 158 background-size: 100% 100%;
138 text-align: center; 159 text-align: center;
139 margin-bottom: 5vw; 160 margin-bottom: 5vw;
140 - color:#fff 161 + color: #fff;
141 } 162 }
142 163
143 .typeOne { 164 .typeOne {
@@ -158,8 +179,8 @@ export default { @@ -158,8 +179,8 @@ export default {
158 margin: 5vw; 179 margin: 5vw;
159 180
160 .videoTwo { 181 .videoTwo {
161 - width: 70vw;  
162 - height: 45vw; 182 + width: 80vw;
  183 + height: 50vw;
163 margin-bottom: 5vw; 184 margin-bottom: 5vw;
164 185
165 video { 186 video {