This commit is contained in:
sco
2021-12-15 01:25:28 +00:00
parent 7adf56aea1
commit 4144f28a3e
3 changed files with 451 additions and 15443 deletions
+426 -15421
View File
File diff suppressed because it is too large Load Diff
+14 -11
View File
@@ -73,15 +73,14 @@
:class="['column', `is-${12 / config.columns}`]" :class="['column', `is-${12 / config.columns}`]"
/> />
</template> </template>
<template v-for="group in external"> <template v-for="group in wsdata">
<h2 v-if="group.name" v-bind:key="group.name" class="column is-full group-title"> <h2 v-if="group.name" v-bind:key="group.name" class="column is-full group-title">
<i v-if="group.icon" :class="group.icon"></i> <i v-if="group.icon" :class="group.icon"></i>
{{ group.name }} {{ group.name }}
</h2> </h2>
<External <External
v-for="item in group.items" v-bind:item="group.data"
:key="item.name" :key="group.id"
v-bind:item="item"
:class="['column', `is-${12 / config.columns}`]" :class="['column', `is-${12 / config.columns}`]"
/> />
</template> </template>
@@ -182,6 +181,9 @@ export default {
showMenu: true, showMenu: true,
wsconnection: null, wsconnection: null,
wsapi: null, wsapi: null,
dvbtuner: null,
sysstat: null,
wsdata:[],
}; };
}, },
created: async function () { created: async function () {
@@ -192,21 +194,22 @@ export default {
this.external = this.config.external; this.external = this.config.external;
document.title = `${this.config.title} | ${this.config.subtitle}`; document.title = `${this.config.title} | ${this.config.subtitle}`;
// ws section // ws section
let that = this;
this.wsconnection = new WebSocket("wss://sco.snakes.wtf/api"); this.wsconnection = new WebSocket("wss://sco.snakes.wtf/api");
this.wsconnection.onmessage = function(event) { this.wsconnection.onmessage = function(event) {
console.log(event.data) let tmp = JSON.parse(event.data);
} that.wsdata[tmp.id] = tmp;
this.wsconnection.onopen = function(event) { console.log("recv(onmessage)",JSON.parse(event.data)) //recv
console.log(event)
this.sendMessage("onopen");
} }
// this.wsconnection.onopen = function(event) {}
//that.sendMessage("helo");
// }
}, },
methods: { methods: {
sendMessage: function(message) { sendMessage: function(message) {
console.log(this.connection); this.wsconnection.send(message);
this.connection.send(message);
}, },
getConfig: function (path = "config.yml") { getConfig: function (path = "config.yml") {
return fetch(path).then((response) => { return fetch(path).then((response) => {
+9 -9
View File
@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div v-for="diocane in response" :key="diocane.id" class="card"> <div v-for="diocane in item" :key="diocane.id" class="card">
<a href="#" :target="item.target" rel="noreferrer"> <a href="#" :target="item.target" rel="noreferrer">
<div class="card-content"> <div class="card-content">
<div class="media"> <div class="media">
@@ -34,8 +34,8 @@ export default {
}; };
}, },
mounted: function () { mounted: function () {
this.fetchList(); // this.fetchList();
this.timer = setInterval(this.fetchList, 10000); // this.timer = setInterval(this.fetchList, 10000);
}, },
methods: { methods: {
fetchList: async function () { fetchList: async function () {
@@ -52,13 +52,13 @@ export default {
//console.error(this.response.stderr); //console.error(this.response.stderr);
} }
}, },
cancelAutoUpdate: function () { // cancelAutoUpdate: function () {
clearInterval(this.timer); // clearInterval(this.timer);
} // }
},
beforeDestroy() {
this.cancelAutoUpdate();
}, },
// beforeDestroy() {
// this.cancelAutoUpdate();
// },
}; };
</script> </script>