From d422b8ffb363f1821c0ec2cffd7d395b6b2fe094 Mon Sep 17 00:00:00 2001 From: duan Date: Mon, 5 Sep 2022 22:27:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(index):=20=E4=BA=BA=E8=84=B8=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E4=BC=98=E5=8C=96=EF=BC=8C=E6=96=B0=E5=A2=9Esocketio?= =?UTF-8?q?=E9=80=9A=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 ++ src/api/user/user.js | 39 ++++++++++++++++++++------------- src/main.js | 9 ++++++++ src/views/login/index.vue | 45 ++++++++++++++++++++------------------- src/views/user/index.vue | 41 +++++++++++------------------------ 5 files changed, 70 insertions(+), 66 deletions(-) diff --git a/package.json b/package.json index 49a15a8..167994d 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,11 @@ "path-to-regexp": "2.4.0", "postcss-px2rem": "^0.3.0", "px2rem-loader": "^0.1.9", + "socket.io-client": "^4.5.2", "tracking": "^1.1.3", "vue": "2.6.10", "vue-router": "3.0.6", + "vue-socket.io": "^3.0.10", "vuedraggable": "^2.24.3", "vuex": "3.1.0", "vuex-persistedstate": "^4.1.0" diff --git a/src/api/user/user.js b/src/api/user/user.js index da08801..0216318 100644 --- a/src/api/user/user.js +++ b/src/api/user/user.js @@ -123,28 +123,37 @@ export function faceStart() { }) } -export function faceStop() { +export function addStart(data) { return request({ - url: '/face/stoprecognition/', - method: 'get', - baseURL: process.env.VUE_APP_FACE_API - }) -} - -export function faceRecognition(data) { - return request({ - url: '/face/recognition/', + url: '/face/add/', method: 'post', baseURL: process.env.VUE_APP_FACE_API, data }) } -export function faceAdd(data) { +export function faceStop() { return request({ - url: '/face/add/', - method: 'post', - baseURL: process.env.VUE_APP_FACE_API, - data + url: '/face/stoprecognition/', + method: 'get', + baseURL: process.env.VUE_APP_FACE_API }) } + +// export function faceRecognition(data) { +// return request({ +// url: '/face/recognition/', +// method: 'post', +// baseURL: process.env.VUE_APP_FACE_API, +// data +// }) +// } +// +// export function faceAdd(data) { +// return request({ +// url: '/face/add/', +// method: 'post', +// baseURL: process.env.VUE_APP_FACE_API, +// data +// }) +// } diff --git a/src/main.js b/src/main.js index fde92f5..0980b87 100644 --- a/src/main.js +++ b/src/main.js @@ -28,6 +28,15 @@ import * as echarts from 'echarts' Vue.prototype.$echarts = echarts // 挂载到Vue实例上面 +import VueSocketIO from 'vue-socket.io' +import SocketIO from 'socket.io-client' + +Vue.use(new VueSocketIO({ + debug: true, + connection: SocketIO(process.env.VUE_APP_FACE_API) // options object is Optional +}) +) + // set ElementUI lang to EN Vue.use(ElementUI, { zhCN }) // 如果想要中文版 element-ui,按如下方式声明 diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5804fa7..195fd20 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -104,9 +104,9 @@