Add copy button to video page

This commit is contained in:
Aicirou 2020-07-05 14:16:55 +08:00
parent 29be793c48
commit a75e1d4c0e
6 changed files with 43 additions and 28 deletions

View File

@ -1,11 +1,12 @@
@font-face { @font-face {
font-family: 'iconfont'; /* project id 1760192 */ font-family: "iconfont"; /* project id 1760192 */
src: url('//at.alicdn.com/t/font_1760192_tl9awsq3di.eot'); src: url("//at.alicdn.com/t/font_1760192_tl9awsq3di.eot");
src: url('//at.alicdn.com/t/font_1760192_tl9awsq3di.eot?#iefix') format('embedded-opentype'), src: url("//at.alicdn.com/t/font_1760192_tl9awsq3di.eot?#iefix")
url('//at.alicdn.com/t/font_1760192_tl9awsq3di.woff2') format('woff2'), format("embedded-opentype"),
url('//at.alicdn.com/t/font_1760192_tl9awsq3di.woff') format('woff'), url("//at.alicdn.com/t/font_1760192_tl9awsq3di.woff2") format("woff2"),
url('//at.alicdn.com/t/font_1760192_tl9awsq3di.ttf') format('truetype'), url("//at.alicdn.com/t/font_1760192_tl9awsq3di.woff") format("woff"),
url('//at.alicdn.com/t/font_1760192_tl9awsq3di.svg#iconfont') format('svg'); url("//at.alicdn.com/t/font_1760192_tl9awsq3di.ttf") format("truetype"),
url("//at.alicdn.com/t/font_1760192_tl9awsq3di.svg#iconfont") format("svg");
} }
body { body {
@ -180,14 +181,24 @@ body {
left: 7px; left: 7px;
} }
// bulma-divider // bulma-divider
.is-divider, .is-divider,
.is-divider-vertical { .is-divider-vertical {
border-top: .1rem solid #f5f5f5; border-top: 0.1rem solid #f5f5f5;
} }
.is-divider-vertical[data-content]::after, .is-divider-vertical[data-content]::after,
.is-divider[data-content]::after { .is-divider[data-content]::after {
color: #919191; color: #919191;
} }
.index-button-copy {
background: 0 0;
border: none;
color: #4a4a4a;
cursor: pointer;
font-size: 0.625rem;
outline: 0;
padding-bottom: 0;
padding-top: 0;
}

View File

@ -7,6 +7,7 @@
"title": "Notify" "title": "Notify"
}, },
"copy": { "copy": {
"text": "Copy",
"success": "Copy successful", "success": "Copy successful",
"error": "Copy failed" "error": "Copy failed"
}, },

View File

@ -7,6 +7,7 @@
"title": "提示" "title": "提示"
}, },
"copy": { "copy": {
"text": "复制",
"success": "复制成功", "success": "复制成功",
"error": "复制失败" "error": "复制失败"
}, },

View File

@ -7,6 +7,7 @@
"title": "提示" "title": "提示"
}, },
"copy": { "copy": {
"text": "復制",
"success": "復制成功", "success": "復制成功",
"error": "復制失敗" "error": "復制失敗"
}, },

View File

@ -247,21 +247,7 @@ export default {
copy(path) { copy(path) {
let origin = window.location.origin; let origin = window.location.origin;
path = origin + encodeURI(path); path = origin + encodeURI(path);
this.$copyText(path) this.$copyText(path);
.then(() => {
this.$notify({
title: "notify.title",
message: "copy.success",
type: "success",
});
})
.catch(() => {
this.$notify({
title: "notify.title",
message: "copy.error",
type: "error"
});
});
}, },
thum(url) { thum(url) {
return url ? `/${this.$route.params.id}:view?url=${url}` : ""; return url ? `/${this.$route.params.id}:view?url=${url}` : "";

View File

@ -18,7 +18,13 @@
<vue-plyr ref="plyr" :options="options"> <vue-plyr ref="plyr" :options="options">
<video controls crossorigin playsinline> <video controls crossorigin playsinline>
<source :src="videoUrl" type="video/mp4" /> <source :src="videoUrl" type="video/mp4" />
<track kind="captions" :src="subtitle" default /> <track
kind="captions"
label="Default"
srclang="default"
:src="subtitle"
default
/>
</video> </video>
</vue-plyr> </vue-plyr>
</div> </div>
@ -38,7 +44,12 @@
<div class="card-content"> <div class="card-content">
<div class="content"> <div class="content">
<div class="field"> <div class="field">
<label class="label">{{ $t("page.video.link") }}</label> <label class="label">
{{ $t("page.video.link") }}
<a class="button is-text index-button-copy" @click="copy">
{{ $t("copy.text") }}
</a>
</label>
<div class="control"> <div class="control">
<input class="input" type="text" :value="downloadUrl" /> <input class="input" type="text" :value="downloadUrl" />
</div> </div>
@ -117,6 +128,9 @@ export default {
loadSub(path, index) { loadSub(path, index) {
this.subtitle = path.substring(0, index) + ".vtt"; this.subtitle = path.substring(0, index) + ".vtt";
}, },
copy() {
this.$copyText(this.downloadUrl);
},
}, },
computed: { computed: {
options() { options() {
@ -141,7 +155,8 @@ export default {
"download", "download",
"fullscreen", "fullscreen",
], ],
settings: options.settings || ["quality", "speed", "loop"] settings: options.settings || ["quality", "speed", "loop"],
captions: { active: true, language: "default", ...options.captions },
}; };
}, },
player() { player() {