Fixed single proxy display error

This commit is contained in:
Peng-YM 2020-09-23 18:00:04 +08:00
parent 3d208c9e9f
commit d30ece21ae
6 changed files with 73 additions and 9 deletions

View File

@ -45,7 +45,7 @@ function initStore(store) {
export default { export default {
components: { components: {
TopToolbar, TopToolbar,
BottomNav BottomNav,
}, },
created() { created() {

View File

@ -68,6 +68,14 @@
> >
<v-card-title> <v-card-title>
{{ info.name }} {{ info.name }}
<v-spacer></v-spacer>
<v-btn
icon
color="white"
@click="copyLink()"
>
<v-icon>content_copy</v-icon>
</v-btn>
</v-card-title> </v-card-title>
<v-card-text <v-card-text
align="center" align="center"
@ -103,7 +111,8 @@ export default {
region: "", region: "",
ip: "" ip: ""
}, },
qr: "" qr: "",
link: ""
} }
}, },
methods: { methods: {
@ -115,8 +124,8 @@ export default {
async fetch() { async fetch() {
await axios.get(this.url).then(resp => { await axios.get(this.url).then(resp => {
const {data} = resp; let {data} = resp;
if (data.indexOf("\n") !== -1) if (data instanceof String && data.indexOf("\n") !== -1)
this.proxies = data.split("\n").map(p => JSON.parse(p)); this.proxies = data.split("\n").map(p => JSON.parse(p));
else else
this.proxies = [data]; this.proxies = [data];
@ -126,7 +135,7 @@ export default {
await axios.get(`${this.url}?target=URI`).then(resp => { await axios.get(`${this.url}?target=URI`).then(resp => {
const {data} = resp; const {data} = resp;
if (data.indexOf("\n") !== -1) if (data instanceof String && data.indexOf("\n") !== -1)
this.uris = data.split("\n"); this.uris = data.split("\n");
else else
this.uris = [data]; this.uris = [data];
@ -150,8 +159,14 @@ export default {
this.dialog = true this.dialog = true
}, },
async showQRCode(idx) { copyLink() {
this.$clipboard(this.link);
this.$store.commit("SET_SUCCESS_MESSAGE", `节点链接已复制到剪贴板!`);
},
showQRCode(idx) {
this.qr = this.uris[idx]; this.qr = this.uris[idx];
this.link = this.uris[idx];
this.info.name = this.proxies[idx].name; this.info.name = this.proxies[idx].name;
this.showQR = true; this.showQR = true;
} }

View File

@ -0,0 +1,48 @@
<template>
<v-fab-transition>
<v-speed-dial
v-model="opened"
direction="top"
left
fab
absolute
bottom
small
transition="slide-y-reverse-transition"
>
<template #activator>
<v-btn
fab
>
<v-icon v-if="opened">mdi-close</v-icon>
<v-icon v-else>apps</v-icon>
</v-btn>
</template>
<v-btn
fab
color="primary"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
<v-btn
fab
color="primary"
>
<v-icon>create_new_folder</v-icon>
</v-btn>
</v-speed-dial>
</v-fab-transition>
</template>
<script>
export default {
data() {
return {
opened: false,
}
},
computed: {
}
}
</script>

View File

@ -48,7 +48,6 @@ const router = new Router({
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const {meta} = to; const {meta} = to;
// document.title = to.meta.title
store.commit("SET_NAV_TITLE", meta.title); store.commit("SET_NAV_TITLE", meta.title);
next(); next();
}) })

View File

@ -1,4 +1,5 @@
import Axios from 'axios'; import Axios from 'axios';
import Vue from 'vue';
import store from "@/store"; import store from "@/store";
import {BACKEND_BASE} from "@/config"; import {BACKEND_BASE} from "@/config";
@ -7,6 +8,8 @@ export const axios = Axios.create({
timeout: 10000 timeout: 10000
}); });
export const EventBus = new Vue();
export function isEmptyObj(obj) { export function isEmptyObj(obj) {
return Object.keys(obj).length === 0; return Object.keys(obj).length === 0;
} }

View File

@ -98,11 +98,10 @@
v-if="!showProxyList" v-if="!showProxyList"
v-model="opened" v-model="opened"
direction="top" direction="top"
right left
fab fab
absolute absolute
bottom bottom
small
transition="slide-y-reverse-transition" transition="slide-y-reverse-transition"
> >
<template #activator> <template #activator>