add basic QR functionality (#126)

This commit is contained in:
Jack Klika 2019-03-20 23:51:23 +08:00 committed by 1138-4EB
parent ed0ea34161
commit 4e15b82896
3 changed files with 34 additions and 0 deletions

25
package-lock.json generated
View File

@ -4419,6 +4419,26 @@
"flat-cache": "^2.0.1"
}
},
"flat-cache": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
"integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
"dev": true,
"requires": {
"chardet": "^0.7.0",
"iconv-lite": "^0.4.24",
"tmp": "^0.0.33"
}
},
"file-entry-cache": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
"integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
"dev": true,
"requires": {
"flat-cache": "^2.0.1"
}
},
"flat-cache": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
@ -8976,6 +8996,11 @@
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
"dev": true
},
"qrcode.vue": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/qrcode.vue/-/qrcode.vue-1.6.1.tgz",
"integrity": "sha512-Qo0zpAQVTdRZsmquppZShMQOaxg/JhzTsoQtlIxTTgwHr2oVg4mhCah41MtBYi67O00D342dzgU4YyECSK04FA=="
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",

View File

@ -17,6 +17,7 @@
"moment": "^2.24.0",
"normalize.css": "^8.0.1",
"noty": "^3.2.0-beta",
"qrcode.vue": "^1.6.1",
"vue": "^2.6.9",
"vue-i18n": "^8.9.0",
"vue-router": "^3.0.2",

View File

@ -14,6 +14,7 @@
<path d="M0 0h24v24H0z" fill="none"/>
</svg>
<h1 class="share__box__title">{{ file.name }}</h1>
<qrcode-vue :value="fullLink" size="200" level="M"></qrcode-vue>
</div>
</div>
</a>
@ -23,9 +24,13 @@
<script>
import { share as api } from '@/api'
import { baseURL } from '@/utils/constants'
import QrcodeVue from 'qrcode.vue'
export default {
name: 'share',
components: {
QrcodeVue
},
data: () => ({
loaded: false,
notFound: false,
@ -44,6 +49,9 @@ export default {
link: function () {
return `${baseURL}/api/public/dl/${this.hash}`
},
fullLink: function () {
return window.location.origin + this.link
},
},
methods: {
fetchData: async function () {