This commit is contained in:
2020-09-19 16:59:01 +02:00
parent b4420e6d57
commit bf3c4b7121
10 changed files with 5080 additions and 4438 deletions

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"semi": false,
"arrowParens": "always",
"singleQuote": true,
"printWidth": 120,
"trailingComma": "none"
}

9438
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,19 +13,20 @@
"express": "^4.17.1", "express": "^4.17.1",
"highcharts": "^7.1.2", "highcharts": "^7.1.2",
"mongodb": "^3.2.7", "mongodb": "^3.2.7",
"vue": "^2.6.10", "vue": "^3.0.0",
"vue-router": "^3.0.3", "vue-router": "^4.0.0-beta.10",
"vuex": "^3.0.1" "vuex": "^4.0.0-beta.4"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0", "@vue/cli-plugin-babel": "^4.5.4",
"@vue/cli-plugin-eslint": "^3.8.0", "@vue/cli-plugin-eslint": "^4.5.4",
"@vue/cli-service": "^3.8.0", "@vue/cli-service": "^4.5.4",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-standard": "^4.0.0", "@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.1.0",
"bulma": "^0.7.5", "bulma": "^0.7.5",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0", "eslint-plugin-vue": "^7.0.0-beta.3",
"node-sass": "^4.9.0", "node-sass": "^4.9.0",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
@@ -36,7 +37,7 @@
"node": true "node": true
}, },
"extends": [ "extends": [
"plugin:vue/essential", "plugin:vue/vue3-essential",
"@vue/standard" "@vue/standard"
], ],
"rules": { "rules": {

View File

@@ -1,8 +1,8 @@
<template> <template>
<div id="app"> <div id="app">
<NavBar :activeType="type" @setType="setType"></NavBar> <NavBar :activeType="type" @set-type="setType"></NavBar>
<section class="section"> <section class="section">
<TimeWindows :activeWindow="window" @setWindow="setWindow"></TimeWindows> <TimeWindows :activeWindow="window" @set-window="setWindow"></TimeWindows>
<Chart :window="window" :type="type"></Chart> <Chart :window="window" :type="type"></Chart>
</section> </section>
</div> </div>
@@ -39,13 +39,15 @@ export default {
}, },
updateRoute() { updateRoute() {
if (this.type) { if (this.type) {
this.$router.push({ const route = {
name: 'view', name: 'view',
params: { params: {
type: this.type, type: this.type,
window: this.window.label ? this.window.label.replace(' ', '-') : undefined window: this.window.label ? this.window.label.replace(' ', '-') : undefined
} }
}) }
console.log(route)
this.$router.push(route)
} }
} }
} }

View File

@@ -28,6 +28,7 @@ export default {
}, },
methods: { methods: {
async fetchData() { async fetchData() {
console.log('fetch data')
if (this.window.label) { if (this.window.label) {
this.loading = true this.loading = true
const typeApi = { const typeApi = {

View File

@@ -46,7 +46,7 @@ export default {
}, },
mounted() { mounted() {
if (!this.activeType) { if (!this.activeType) {
this.$emit('setType', this.navTypes[0]) this.$emit('set-type', this.navTypes[0])
} }
}, },
methods: { methods: {
@@ -58,7 +58,7 @@ export default {
}, },
setType(type) { setType(type) {
this.toggled = false this.toggled = false
this.$emit('setType', type) this.$emit('set-type', type)
} }
} }
} }

View File

@@ -4,7 +4,7 @@
<li <li
v-for="window in windows" v-for="window in windows"
:key="window.label" :key="window.label"
@click="$emit('setWindow', window)" @click="$emit('set-window', window)"
:class="{'is-active': window.label === activeWindow.label}" :class="{'is-active': window.label === activeWindow.label}"
> >
<a>{{window.label}}</a> <a>{{window.label}}</a>
@@ -68,11 +68,12 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('mounted')
if (typeof this.activeWindow === 'string') { if (typeof this.activeWindow === 'string') {
const window = this.windows.find(w => w.label === this.activeWindow.replace('-', ' ')) const window = this.windows.find(w => w.label === this.activeWindow.replace('-', ' '))
this.$emit('setWindow', window) this.$emit('set-window', window)
} else if (!this.activeWindow.label) { } else if (!this.activeWindow.label) {
this.$emit('setWindow', this.windows[1]) this.$emit('set-window', this.windows[1])
} }
} }
} }

View File

@@ -1,13 +1,8 @@
import Vue from 'vue' import { createApp } from 'vue'
import App from '@/App' import App from '@/App'
import router from '@/router' import router from '@/router'
import store from '@/store'
import '@/style/style.scss' import '@/style/style.scss'
Vue.config.productionTip = false const app = createApp(App)
app.use(router)
new Vue({ app.mount('body')
router,
store,
render: h => h(App)
}).$mount('#app')

View File

@@ -1,15 +1,13 @@
import Vue from 'vue' import { createRouter, createWebHistory } from 'vue-router'
import Router from 'vue-router' import App from '@/App'
export default createRouter({
Vue.use(Router) history: createWebHistory(),
export default new Router({
mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes: [ routes: [
{ {
path: '/:type/:window?', path: '/:type/:window?',
name: 'view' name: 'view',
component: App
} }
] ]
}) })

View File

@@ -1,7 +1,4 @@
import Vue from 'vue' import { createStore } from 'vuex'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {