diff --git a/src/views/dashboard/admin/components/PanelGroup.vue b/src/views/dashboard/admin/components/PanelGroup.vue
index 8b7394a..5b34ce2 100644
--- a/src/views/dashboard/admin/components/PanelGroup.vue
+++ b/src/views/dashboard/admin/components/PanelGroup.vue
@@ -6,8 +6,8 @@
-
New Visits
-
+
Total Mosquito
+
@@ -17,8 +17,8 @@
-
Messages
-
+
Daily Mosquito
+
@@ -28,8 +28,8 @@
-
Purchases
-
+
Online Device
+
@@ -39,8 +39,8 @@
-
Shoppings
-
+
Offline Device
+
@@ -51,6 +51,12 @@
import CountTo from 'vue-count-to'
export default {
+ props: {
+ totalCount: Number,
+ dailyCount: Number,
+ onlineCount: Number,
+ offlineCount: Number
+ },
components: {
CountTo
},
diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/admin/index.vue
index 20f19a3..325fecd 100644
--- a/src/views/dashboard/admin/index.vue
+++ b/src/views/dashboard/admin/index.vue
@@ -2,7 +2,14 @@
-
+
+
@@ -51,6 +58,7 @@ import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList'
import BoxCard from './components/BoxCard'
+import { fetchDeviceLogStatistic, fetchDeviceInfoStatistic } from '@/api/counter'
const lineChartData = {
newVisitis: {
@@ -86,13 +94,37 @@ export default {
},
data() {
return {
- lineChartData: lineChartData.newVisitis
+ lineChartData: lineChartData.newVisitis,
+ totalCount: 0,
+ dailyCount: 0,
+ onlineCount: 0,
+ offlineCount: 0
}
},
methods: {
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
+ },
+ getDeviceInfoStatistic() {
+ fetchDeviceInfoStatistic().then(response => {
+ const infoData = response.data
+ this.onlineCount = infoData['online_count']
+ this.offlineCount = infoData['offline_count']
+ console.log(this.totalCount)
+ })
+ },
+ getDeviceLogStatistic() {
+ fetchDeviceLogStatistic().then(response => {
+ const logData = response.data
+ this.totalCount = logData['total_count']
+ this.dailyCount = logData['daily_count']
+ console.log(this.onlineCount)
+ })
}
+ },
+ created() {
+ this.getDeviceInfoStatistic()
+ this.getDeviceLogStatistic()
}
}