From a75e1d4c0e5e051250225671ef24ada5b2f7f4b1 Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Sun, 5 Jul 2020 14:16:55 +0800 Subject: [PATCH] :sparkles:Add copy button to video page --- src/assets/style/theme/acrou/index.scss | 31 +++++++++++++++++-------- src/locales/en.json | 1 + src/locales/zh-chs.json | 1 + src/locales/zh-cht.json | 1 + src/views/page/GoList.vue | 16 +------------ src/views/page/GoVideo.vue | 21 ++++++++++++++--- 6 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/assets/style/theme/acrou/index.scss b/src/assets/style/theme/acrou/index.scss index 8701609..61fc82b 100644 --- a/src/assets/style/theme/acrou/index.scss +++ b/src/assets/style/theme/acrou/index.scss @@ -1,11 +1,12 @@ @font-face { - 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?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_1760192_tl9awsq3di.woff2') format('woff2'), - url('//at.alicdn.com/t/font_1760192_tl9awsq3di.woff') format('woff'), - url('//at.alicdn.com/t/font_1760192_tl9awsq3di.ttf') format('truetype'), - url('//at.alicdn.com/t/font_1760192_tl9awsq3di.svg#iconfont') format('svg'); + 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?#iefix") + format("embedded-opentype"), + url("//at.alicdn.com/t/font_1760192_tl9awsq3di.woff2") format("woff2"), + url("//at.alicdn.com/t/font_1760192_tl9awsq3di.woff") format("woff"), + url("//at.alicdn.com/t/font_1760192_tl9awsq3di.ttf") format("truetype"), + url("//at.alicdn.com/t/font_1760192_tl9awsq3di.svg#iconfont") format("svg"); } body { @@ -180,14 +181,24 @@ body { left: 7px; } - // bulma-divider .is-divider, .is-divider-vertical { - border-top: .1rem solid #f5f5f5; + border-top: 0.1rem solid #f5f5f5; } .is-divider-vertical[data-content]::after, .is-divider[data-content]::after { color: #919191; -} \ No newline at end of file +} + +.index-button-copy { + background: 0 0; + border: none; + color: #4a4a4a; + cursor: pointer; + font-size: 0.625rem; + outline: 0; + padding-bottom: 0; + padding-top: 0; +} diff --git a/src/locales/en.json b/src/locales/en.json index 10d20b9..86c41b5 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -7,6 +7,7 @@ "title": "Notify" }, "copy": { + "text": "Copy", "success": "Copy successful", "error": "Copy failed" }, diff --git a/src/locales/zh-chs.json b/src/locales/zh-chs.json index ed3659b..2b80f15 100644 --- a/src/locales/zh-chs.json +++ b/src/locales/zh-chs.json @@ -7,6 +7,7 @@ "title": "提示" }, "copy": { + "text": "复制", "success": "复制成功", "error": "复制失败" }, diff --git a/src/locales/zh-cht.json b/src/locales/zh-cht.json index 40e0ca5..d516739 100644 --- a/src/locales/zh-cht.json +++ b/src/locales/zh-cht.json @@ -7,6 +7,7 @@ "title": "提示" }, "copy": { + "text": "復制", "success": "復制成功", "error": "復制失敗" }, diff --git a/src/views/page/GoList.vue b/src/views/page/GoList.vue index e22dc93..ec333fc 100644 --- a/src/views/page/GoList.vue +++ b/src/views/page/GoList.vue @@ -247,21 +247,7 @@ export default { copy(path) { let origin = window.location.origin; path = origin + encodeURI(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" - }); - }); + this.$copyText(path); }, thum(url) { return url ? `/${this.$route.params.id}:view?url=${url}` : ""; diff --git a/src/views/page/GoVideo.vue b/src/views/page/GoVideo.vue index 070c33a..a18688c 100644 --- a/src/views/page/GoVideo.vue +++ b/src/views/page/GoVideo.vue @@ -18,7 +18,13 @@ @@ -38,7 +44,12 @@
- +
@@ -117,6 +128,9 @@ export default { loadSub(path, index) { this.subtitle = path.substring(0, index) + ".vtt"; }, + copy() { + this.$copyText(this.downloadUrl); + }, }, computed: { options() { @@ -141,7 +155,8 @@ export default { "download", "fullscreen", ], - settings: options.settings || ["quality", "speed", "loop"] + settings: options.settings || ["quality", "speed", "loop"], + captions: { active: true, language: "default", ...options.captions }, }; }, player() {