From e48fa711a3664bece9b3e58840a75fe7c05bc47c Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期六, 08 五月 2021 17:14:05 +0800
Subject: [PATCH] 添加截图(快照)功能

---
 web_src/src/components/devicePosition.vue |   83 +++++++++++++++++++++++++----------------
 1 files changed, 50 insertions(+), 33 deletions(-)

diff --git a/web_src/src/components/devicePosition.vue b/web_src/src/components/devicePosition.vue
index 2910623..777b11e 100644
--- a/web_src/src/components/devicePosition.vue
+++ b/web_src/src/components/devicePosition.vue
@@ -81,7 +81,7 @@
             parentChannelId: this.$route.params.parentChannelId,
             updateLooper: 0, //鏁版嵁鍒锋柊杞鏍囧織
             total: 0,
-            beforeUrl: "/videoList",
+            beforeUrl: "/deviceList",
             isLoging: false,
             autoList: false,
         };
@@ -111,7 +111,7 @@
             // this.currentPage = parseInt(this.$route.params.page);
             // this.count = parseInt(this.$route.params.count);
             // if (this.parentChannelId == "" || this.parentChannelId == 0) {
-            //     this.beforeUrl = "/videoList";
+            //     this.beforeUrl = "/deviceList";
             // }
         },
         initBaiduMap() {
@@ -171,22 +171,29 @@
                 this.endTime = null;
             }
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/history`, {
+            this.$axios({
+                method: 'get',
+                url:`/api/position/history/${this.deviceId}`, 
                 params: {
                     start: self.startTime,
                     end: self.endTime,
                 },
-            })
-            .then(function (res) {
+            }).then(function (res) {
                 self.total = res.data.length;
                 self.mobilePositionList = res.data;
                 console.log(self.mobilePositionList);
-                // 闃叉鍑虹幇琛ㄦ牸閿欎綅
-                self.$nextTick(() => {
-                    self.showMarkPoints(self);
-                });
-            })
-            .catch(function (error) {
+                if (self.total == 0) {
+                    self.$message({
+                        showClose: true,
+						message: '鏈壘鍒扮鍚堟潯浠剁殑绉诲姩浣嶇疆淇℃伅',
+						type: 'error'
+					});
+                } else {
+                    self.$nextTick(() => {
+                        self.showMarkPoints(self);
+                    });
+                }
+            }).catch(function (error) {
                 console.log(error);
             });
         },
@@ -195,30 +202,39 @@
             this.mapPointList = [];
             this.mobilePositionList = [];
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/latest`)
-            .then(function (res) {
+            this.$axios({
+                method: 'get',
+                url:`/api/position/latest/${this.deviceId}`
+            }).then(function (res) {
                 console.log(res.data);
                 self.total = res.data.length;
                 self.mobilePositionList.push(res.data);
                 console.log(self.mobilePositionList);
-                // 闃叉鍑虹幇琛ㄦ牸閿欎綅
-                self.$nextTick(() => {
-                    self.showMarkPoints(self);
-                });
-            })
-            .catch(function (error) {
+                if (self.total == 0) {
+                    self.$message({
+                        showClose: true,
+						message: '鏈壘鍒扮鍚堟潯浠剁殑绉诲姩浣嶇疆淇℃伅',
+						type: 'error'
+					});
+                } else {
+                    self.$nextTick(() => {
+                        self.showMarkPoints(self);
+                    });
+                }
+            }).catch(function (error) {
                 console.log(error);
             });
         },
         subscribeMobilePosition: function() {
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, {
-                params: {
-                    expires: self.expired,
-                    interval: self.interval,
-                },
-            })
-            .then(function (res) {
+            this.$axios({
+					method: 'get',
+					url:`/api/position/subscribe/${this.deviceId}`,
+                    params: {
+                        expires: self.expired,
+                        interval: self.interval,
+                    },
+            }).then(function (res) {
                 console.log(res.data);
             })
             .catch(function (error) {
@@ -227,16 +243,17 @@
         },
         unSubscribeMobilePosition: function() {
             let self = this;
-            this.$axios.get(`/api/positions/${this.deviceId}/subscribe`, {
-                params: {
-                    expires: 0,
-                    interval: self.interval,
-                },
+            this.$axios({
+					method: 'get',
+					url:`/api/position/subscribe/${this.deviceId}`,
+                    params: {
+                        expires: 0,
+                        interval: self.interval,
+                    },
             })
             .then(function (res) {
                 console.log(res.data);
-            })
-            .catch(function (error) {
+            }).catch(function (error) {
                 console.log(error);
             });
         },

--
Gitblit v1.8.0