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 @@