hookehuyr

✨ feat(视频控件): 样式细节调整,播放全屏播放问题

1 <template> 1 <template>
2 - <div 2 + <div class="video-wrapper">
3 - style="margin: 1rem; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);"> 3 + <div class="video-div" :id="'mui-player-' + item.case_id"></div>
4 - <div :id="'mui-player-' + item.case_id" style="border-top-left-radius: 5px; border-top-right-radius: 5px;"></div> 4 + <div class="video-bar">
5 - <div style="color: #713610; padding: 1rem; padding-bottom: 0.5rem;">
6 <van-row> 5 <van-row>
7 - <van-col span="12"> 6 + <van-col span="12" @click="goTo">
8 <van-image round width="2rem" height="2rem" style="vertical-align: bottom;" 7 <van-image round width="2rem" height="2rem" style="vertical-align: bottom;"
9 src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg" />&nbsp; 8 src="https://cdn.jsdelivr.net/npm/@vant/assets/cat.jpeg" />&nbsp;
10 <span style="font-size: 1.05rem;">王忆慈</span> 9 <span style="font-size: 1.05rem;">王忆慈</span>
11 </van-col> 10 </van-col>
12 <van-col span="12"> 11 <van-col span="12">
13 <div style="padding: 0.25rem; padding-top: 0.75rem; text-align: right;"> 12 <div style="padding: 0.25rem; padding-top: 0.75rem; text-align: right;">
14 - <span @click="setCommit"> 13 + <span @click="setComment">
15 <van-icon :name="icon_liuyan" size="1.2rem" style="vertical-align: bottom;" /> 14 <van-icon :name="icon_liuyan" size="1.2rem" style="vertical-align: bottom;" />
16 67 15 67
17 </span> 16 </span>
...@@ -25,7 +24,7 @@ ...@@ -25,7 +24,7 @@
25 </van-col> 24 </van-col>
26 </van-row> 25 </van-row>
27 </div> 26 </div>
28 - <div style="color: #999999; padding: 0px 1rem 0.5rem;">杨浦民办科技幼稚园 | 藏语</div> 27 + <div @click="goTo" style="color: #999999; padding: 0px 1rem 0.5rem;">杨浦民办科技幼稚园 | 藏语</div>
29 </div> 28 </div>
30 </template> 29 </template>
31 30
...@@ -39,6 +38,16 @@ import 'mui-player/dist/mui-player.min.css' ...@@ -39,6 +38,16 @@ import 'mui-player/dist/mui-player.min.css'
39 import MuiPlayer from 'mui-player' 38 import MuiPlayer from 'mui-player'
40 import _ from 'lodash'; 39 import _ from 'lodash';
41 40
41 +import { useRoute, useRouter } from 'vue-router'
42 +const $route = useRoute();
43 +const $router = useRouter();
44 +
45 +const goTo = () => { // 跳转作品详情页
46 + $router.push({
47 + path: '/client/videoDetail'
48 + });
49 +}
50 +
42 onMounted(() => { 51 onMounted(() => {
43 }) 52 })
44 53
...@@ -60,7 +69,12 @@ export default { ...@@ -60,7 +69,12 @@ export default {
60 title: this.item.title, 69 title: this.item.title,
61 src: this.item.video.url, 70 src: this.item.video.url,
62 poster: this.item.cover.url, 71 poster: this.item.cover.url,
63 - autoFit: false 72 + autoFit: false,
73 + videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
74 + {attrKey:'webkit-playsinline',attrValue:'webkit-playsinline'},
75 + {attrKey:'playsinline',attrValue:'playsinline'},
76 + {attrKey:'x5-video-player-type',attrValue:'h5-page'},
77 + ]
64 }) 78 })
65 this.detail = _.cloneDeep(this.item) 79 this.detail = _.cloneDeep(this.item)
66 }, 80 },
...@@ -68,7 +82,7 @@ export default { ...@@ -68,7 +82,7 @@ export default {
68 setLike() { 82 setLike() {
69 this.detail.liked = !this.detail.liked 83 this.detail.liked = !this.detail.liked
70 }, 84 },
71 - setCommit() { 85 + setComment() {
72 console.warn('跳转详情页,移动到留言页'); 86 console.warn('跳转详情页,移动到留言页');
73 console.warn(this.detail.case_id); 87 console.warn(this.detail.case_id);
74 } 88 }
...@@ -77,4 +91,19 @@ export default { ...@@ -77,4 +91,19 @@ export default {
77 </script> 91 </script>
78 92
79 <style lang="less" scoped> 93 <style lang="less" scoped>
94 +.video-wrapper {
95 + margin: 1rem;
96 + border-bottom-left-radius: 5px;
97 + border-bottom-right-radius: 5px;
98 + box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
99 + .video-div {
100 + border-top-left-radius: 5px;
101 + border-top-right-radius: 5px;
102 + }
103 + .video-bar {
104 + color: #713610;
105 + padding: 1rem;
106 + padding-bottom: 0.5rem;
107 + }
108 +}
80 </style> 109 </style>
...\ No newline at end of file ...\ No newline at end of file
......