From be22b22fd841eee709616186255d9f5057a5ffcc Mon Sep 17 00:00:00 2001 From: zhaotianci <1071562691@qq.con> Date: Sat, 8 Feb 2025 17:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8C=E4=BA=BA=E7=99=BB=E5=BD=95=E5=8F=8A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 6 ++--- src/api/login.js | 6 ++--- src/api/user.js | 4 +-- src/utils/login.js | 28 +++++++++++++++++++++ src/views/AccountManagement/index.vue | 2 +- src/views/AccountManagement/safeSetting.vue | 4 +-- src/views/login/index.vue | 10 ++++---- stats.html | 2 +- 8 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 src/utils/login.js diff --git a/.env.development b/.env.development index 62998f7..b54733c 100644 --- a/.env.development +++ b/.env.development @@ -3,13 +3,13 @@ VITE_APP_URL = /api #VITE_WEBSOCKET_URL = 192.168.100.53:8000 # 192.168.100.118:8099 -VITE_WEBSOCKET_URL = 192.168.1.116:8000 +VITE_WEBSOCKET_URL = 192.168.1.213:9000 #VITE_WEBSOCKET_URL = 192.168.1.92:9000 #VITE_WEBSOCKET_URL = 192.168.100.99:8000 #VITE_SEVER_URL = http://192.168.1.151:8000 #VITE_SEVER_URL = http://192.168.1.85:9000 -VITE_SEVER_URL = http://192.168.1.116:8000 -VITE_FACE_SEVER_URL = http://192.168.1.116:8000 +VITE_SEVER_URL = http://192.168.1.213:9000 +VITE_FACE_SEVER_URL = http://192.168.1.213:8081 # VITE_SEVER_URL = http://192.168.100.127:5555 #VITE_SEVER_URL = http://192.168.100.99:8000 diff --git a/src/api/login.js b/src/api/login.js index 8dfe2b0..73e904d 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -10,9 +10,9 @@ export function useLogin(data) { export function useIdLogin(params) { return request({ - url: '/api/userfaceLogin', - method: 'get', - params + url: '/api/userfaceLogin?id=' +params.id, + method: 'post', + // data:params }); } //绑定人脸 diff --git a/src/api/user.js b/src/api/user.js index c8b39a5..4367f5c 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -77,13 +77,13 @@ export function userLogin(data) { export function getDeviceInfo() { return request({ - url: `/get_device_info`, + url: `/api/get_device_info`, method: 'get' }); } export function setSafetyInfo(device_id, params) { return request({ - url: `/device`, + url: `/api/device`, method: 'get', params }); diff --git a/src/utils/login.js b/src/utils/login.js new file mode 100644 index 0000000..ea98248 --- /dev/null +++ b/src/utils/login.js @@ -0,0 +1,28 @@ +import { message, notify } from '@/utils/message.js'; + +export function doubleUserLogin(res) { + let userArray = JSON.parse(sessionStorage.getItem('userArray')); + if (!userArray || !Array.isArray(userArray)) { + userArray = []; + // localStorage.setItem('userArray', JSON.stringify(userArray)); + } + if (userArray.length == 0 || userArray.length >= 2) { + userArray = []; + + userArray.push(res); + userArray = sessionStorage.setItem('userArray', JSON.stringify(userArray)); + notify('请使用人员登录验证', 'success'); + + return false; + } else if (userArray.length == 1) { + if (userArray[0].user_id == res.user_id) { + notify('您已登录,请勿重复登录!', 'danger'); + return false; + } + userArray.push(res); + userArray = sessionStorage.setItem('userArray', JSON.stringify(userArray)); + sessionStorage.setItem('userInfo', JSON.stringify(res)); + + return true; + } +} \ No newline at end of file diff --git a/src/views/AccountManagement/index.vue b/src/views/AccountManagement/index.vue index 03f1296..8e5183c 100644 --- a/src/views/AccountManagement/index.vue +++ b/src/views/AccountManagement/index.vue @@ -181,7 +181,7 @@ const rolseList = async () => { notify(desc); return; } - dataSource.value = data.users.map((item, index) => ({ + dataSource.value = data.map((item, index) => ({ ...item, set: ["编辑", "录入人脸", "删除"], // set: ["编辑", "删除"], diff --git a/src/views/AccountManagement/safeSetting.vue b/src/views/AccountManagement/safeSetting.vue index b7edd14..5d1076b 100644 --- a/src/views/AccountManagement/safeSetting.vue +++ b/src/views/AccountManagement/safeSetting.vue @@ -71,7 +71,7 @@ let is_safety = ref(false); const getDeviceInfoMethods = async () => { let { data } = await getDeviceInfo(); - if (data.status == 1) { + if (data.code == 200) { device_id.value = data.data.device_id; form_value.value.need_two_face = data.data.need_two_face; console.log(form_value.value.need_two_face, "11111111"); @@ -130,7 +130,7 @@ need_two_face: Number(form_value.value.need_two_face), device_id: "1", }); - if (data.status == 1) { + if (data.code == 200) { notify("设置成功", "success"); router.push("/home"); } else { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 8552b01..b62d285 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -91,6 +91,7 @@ import { useUserStore } from "@/store/user"; import { Icon } from 'vant'; import { getDeviceInfo } from "@/api/user"; +import { doubleUserLogin } from "@/utils/login.js"; const userStore = useUserStore(); const router = useRouter(); @@ -101,7 +102,7 @@ const useInfo = reactive({ let verify_num = ref(1); const getDeviceInfoMethods = async () => { let { data } = await getDeviceInfo(); - if (data.status == 1) { + if (data.code == 200) { verify_num.value = data.data.need_two_face; } }; @@ -131,7 +132,7 @@ const userLogin = async () => { return; } let { data } = await getDeviceInfo(); - if (data.status == 1) { + if (data.code == 200) { verify_num.value = data.data.need_two_face; } const res = await useLogin(useInfo); @@ -223,10 +224,10 @@ const getPhotoLocal = async () => { status.value = false; console.log('id=====', id); let res2 = await useIdLogin({ id }); - let status2 = res2.data.status; + let status2 = res2.data.code; if (status2) { let { user_id, user_name } = res2.data.data; - notify(res2.data.message, "success"); + // notify(res2.data.desc, "success"); if (verify_num.value != 2) { notify("验证成功!", "success"); @@ -252,7 +253,6 @@ const getPhotoLocal = async () => { fnClose(); return; } - notify("欢迎登录", "success"); } else { notify("人脸认证失败", "danger"); } diff --git a/stats.html b/stats.html index 337c2eb..5f92d14 100644 --- a/stats.html +++ b/stats.html @@ -4822,7 +4822,7 @@ var drawChart = (function (exports) {