双人登录及用户列表展示

master
zhaotianci 2 months ago
parent 1889d39dfe
commit be22b22fd8

@ -3,13 +3,13 @@ VITE_APP_URL = /api
#VITE_WEBSOCKET_URL = 192.168.100.53:8000 #VITE_WEBSOCKET_URL = 192.168.100.53:8000
# 192.168.100.118:8099 # 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.1.92:9000
#VITE_WEBSOCKET_URL = 192.168.100.99:8000 #VITE_WEBSOCKET_URL = 192.168.100.99:8000
#VITE_SEVER_URL = http://192.168.1.151: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.85:9000
VITE_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.116:8000 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.127:5555
#VITE_SEVER_URL = http://192.168.100.99:8000 #VITE_SEVER_URL = http://192.168.100.99:8000

@ -10,9 +10,9 @@ export function useLogin(data) {
export function useIdLogin(params) { export function useIdLogin(params) {
return request({ return request({
url: '/api/userfaceLogin', url: '/api/userfaceLogin?id=' +params.id,
method: 'get', method: 'post',
params // data:params
}); });
} }
//绑定人脸 //绑定人脸

@ -77,13 +77,13 @@ export function userLogin(data) {
export function getDeviceInfo() { export function getDeviceInfo() {
return request({ return request({
url: `/get_device_info`, url: `/api/get_device_info`,
method: 'get' method: 'get'
}); });
} }
export function setSafetyInfo(device_id, params) { export function setSafetyInfo(device_id, params) {
return request({ return request({
url: `/device`, url: `/api/device`,
method: 'get', method: 'get',
params params
}); });

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

@ -181,7 +181,7 @@ const rolseList = async () => {
notify(desc); notify(desc);
return; return;
} }
dataSource.value = data.users.map((item, index) => ({ dataSource.value = data.map((item, index) => ({
...item, ...item,
set: ["编辑", "录入人脸", "删除"], set: ["编辑", "录入人脸", "删除"],
// set: ["", ""], // set: ["", ""],

@ -71,7 +71,7 @@
let is_safety = ref(false); let is_safety = ref(false);
const getDeviceInfoMethods = async () => { const getDeviceInfoMethods = async () => {
let { data } = await getDeviceInfo(); let { data } = await getDeviceInfo();
if (data.status == 1) { if (data.code == 200) {
device_id.value = data.data.device_id; device_id.value = data.data.device_id;
form_value.value.need_two_face = data.data.need_two_face; form_value.value.need_two_face = data.data.need_two_face;
console.log(form_value.value.need_two_face, "11111111"); console.log(form_value.value.need_two_face, "11111111");
@ -130,7 +130,7 @@
need_two_face: Number(form_value.value.need_two_face), need_two_face: Number(form_value.value.need_two_face),
device_id: "1", device_id: "1",
}); });
if (data.status == 1) { if (data.code == 200) {
notify("设置成功", "success"); notify("设置成功", "success");
router.push("/home"); router.push("/home");
} else { } else {

@ -91,6 +91,7 @@ import { useUserStore } from "@/store/user";
import { Icon } from 'vant'; import { Icon } from 'vant';
import { getDeviceInfo } from "@/api/user"; import { getDeviceInfo } from "@/api/user";
import { doubleUserLogin } from "@/utils/login.js";
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
@ -101,7 +102,7 @@ const useInfo = reactive({
let verify_num = ref(1); let verify_num = ref(1);
const getDeviceInfoMethods = async () => { const getDeviceInfoMethods = async () => {
let { data } = await getDeviceInfo(); let { data } = await getDeviceInfo();
if (data.status == 1) { if (data.code == 200) {
verify_num.value = data.data.need_two_face; verify_num.value = data.data.need_two_face;
} }
}; };
@ -131,7 +132,7 @@ const userLogin = async () => {
return; return;
} }
let { data } = await getDeviceInfo(); let { data } = await getDeviceInfo();
if (data.status == 1) { if (data.code == 200) {
verify_num.value = data.data.need_two_face; verify_num.value = data.data.need_two_face;
} }
const res = await useLogin(useInfo); const res = await useLogin(useInfo);
@ -223,10 +224,10 @@ const getPhotoLocal = async () => {
status.value = false; status.value = false;
console.log('id=====', id); console.log('id=====', id);
let res2 = await useIdLogin({ id }); let res2 = await useIdLogin({ id });
let status2 = res2.data.status; let status2 = res2.data.code;
if (status2) { if (status2) {
let { user_id, user_name } = res2.data.data; let { user_id, user_name } = res2.data.data;
notify(res2.data.message, "success"); // notify(res2.data.desc, "success");
if (verify_num.value != 2) { if (verify_num.value != 2) {
notify("验证成功!", "success"); notify("验证成功!", "success");
@ -252,7 +253,6 @@ const getPhotoLocal = async () => {
fnClose(); fnClose();
return; return;
} }
notify("欢迎登录", "success");
} else { } else {
notify("人脸认证失败", "danger"); notify("人脸认证失败", "danger");
} }

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save