work on logs, timetable, stats
This commit is contained in:
		@ -1,3 +1,13 @@
 | 
			
		||||
import Vue from 'vue';
 | 
			
		||||
 | 
			
		||||
import './admin.scss';
 | 
			
		||||
 | 
			
		||||
import Statistics from './statistics.vue';
 | 
			
		||||
 | 
			
		||||
Vue.component('a-statistics', Statistics)
 | 
			
		||||
 | 
			
		||||
import 'public';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										39
									
								
								assets/admin/statistics.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								assets/admin/statistics.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <form ref="form">
 | 
			
		||||
        <slot :counts="counts"></slot>
 | 
			
		||||
    </form>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 | 
			
		||||
const splitReg = new RegExp(`,\s*`, 'g');
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    data() {
 | 
			
		||||
        return {
 | 
			
		||||
            counts: {},
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    methods: {
 | 
			
		||||
        update() {
 | 
			
		||||
            const items = this.$el.querySelectorAll('input[name="data"]:checked')
 | 
			
		||||
            const counts = {};
 | 
			
		||||
 | 
			
		||||
            console.log(items)
 | 
			
		||||
            for(var item of items)
 | 
			
		||||
                if(item.value)
 | 
			
		||||
                    for(var tag of item.value.split(splitReg))
 | 
			
		||||
                        counts[tag.trim()] = (counts[tag.trim()] || 0) + 1;
 | 
			
		||||
            this.counts = counts;
 | 
			
		||||
            console.log('counts', this.counts)
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.$refs.form.addEventListener('change', () => this.update())
 | 
			
		||||
        this.update()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user