-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
executable file
·148 lines (137 loc) · 4.68 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
<div class="container">
<div>
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button @click="collapse=!collapse" type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<button @click="toggleMenuRight" type="button" class="navbar-toggle">
<span class="glyphicon glyphicon-hand-right" v-bind:class="[offcanvas ? 'glyphicon-hand-left' : 'glyphicon-hand-right']"></span>
</button>
<a class="navbar-brand" v-link="{name: 'home'}">Ngexplorer</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-collapse navbar-ex1-collapse" v-show="collapse" v-bind:class="[collapse ? '' : 'collapse']" transition="fade">
<ul class="nav navbar-nav">
<li v-link="{name: 'explorer',activeClass: 'active'}"><a>Explorar</a></li>
<li v-bind:class="[$route.name==='filter' ? 'active' : '']"><a v-link="{name: 'filter'}">Buscar</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a @click="showStadist()">Estadisticas</a></li>
<li v-bind:class="[$route.name==='charts' ? 'active' : '']"><a v-link="{name: 'charts'}">Charts</a></li>
<li><a @click="clearLocalStorage()">Reiniciar</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<modal title="Estadisticas Ngexplorer" :show.sync="zoomModal" effect="zoom" width="400">
<div slot="modal-body" class="modal-body">
<ul class="list-group">
<li class="list-group-item">
<span class="badge">{{ stadist.allUnique }}</span>
Visitas unicas
</li>
<li class="list-group-item">
<span class="badge">{{ stadist.allTotal }}</span>
Visitas totales
</li>
<li class="list-group-item">
<span class="badge">{{ stadist.todayUnique }}</span>
Visitas unicas hoy
</li>
<li class="list-group-item">
<span class="badge">{{ stadist.todayTotal }}</span>
Visitas totales hoy
</li>
<li class="list-group-item">
<span class="badge">{{ stadist.TotalFilters }}</span>
Numero de busquedas
</li>
<li class="list-group-item">
<span class="badge">{{ stadist.TotalFiles }}</span>
Numero de archivos
</li>
</ul>
{{ stadist| json }}
</div>
<div slot="modal-footer" class="modal-footer">
<a href="https://rice.uci.cu/" class="btn btn-default">Ir a rice</a>
</div>
</modal>
<div>
<router-view class="animated" transition="entern"></router-view>
</div>
</div>
</div>
</template>
<script>
var useragent = require('express-useragent');
/**
* @example navbar demos
* @for navbar
* @description
*/
module.exports = {
data: function() {
return {
counter:{},
zoomModal: false,
stadist:{},
collapse:false,
offcanvas:false
}
},
components: {
'modal': require('vue-strap').modal
},
methods: {
showStadist:function(){
this.zoomModal=true;
this.$http.get(localStorage.getItem('ngVueExplorer-serverRun')+'/user/counter', function(res) {
this.stadist=res;
});
},
toggleMenuRight:function(){
this.offcanvas=!this.offcanvas
this.$broadcast('offcanvas', this.offcanvas);
},
clearLocalStorage: function() {
var name = /^ngVueExplorer-/;
Object.keys(localStorage)
.forEach(function(key) {
if (name.test(key)) {
localStorage.removeItem(key);
}
});
window.location.reload();
},
counterVisit:function(data){
this.$http.post(localStorage.getItem('ngVueExplorer-serverRun')+'/user/counter', data, function(res) {
this.counter=res;
});
}
},
watch: {
offcanvas: function(newVal, oldVal) {
localStorage.setItem('ngVueExplorer-offcanvas', JSON.stringify(newVal));
}
},
created: function() {
var userAgent = useragent.parse(navigator.userAgent);
var data = {
browser: userAgent.browser,
browser_version: userAgent.version,
device: 'dsf',
os: userAgent.platform,
os_version: userAgent.os,
type: 'v'
}
this.offcanvas=JSON.parse(localStorage.getItem('ngVueExplorer-offcanvas'));
this.counterVisit(data);
}
};
</script>