From 1889d39dfec02100325fc76fbb7b8bc35ea66d4c Mon Sep 17 00:00:00 2001 From: zhaotianci <1071562691@qq.con> Date: Fri, 7 Feb 2025 17:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8C=E4=BA=BA=E8=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.js | 14 ++ src/router/routes.js | 6 + .../AccountManagement/changePassword.vue | 17 +- src/views/AccountManagement/safeSetting.vue | 205 ++++++++++++++++++ src/views/experiment/index.vue | 1 + src/views/index/index.vue | 6 + src/views/login/index.vue | 86 ++++++-- stats.html | 2 +- 8 files changed, 314 insertions(+), 23 deletions(-) create mode 100644 src/views/AccountManagement/safeSetting.vue diff --git a/src/api/user.js b/src/api/user.js index 26db1ff..c8b39a5 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -74,3 +74,17 @@ export function userLogin(data) { params: data }); } + +export function getDeviceInfo() { + return request({ + url: `/get_device_info`, + method: 'get' + }); +} +export function setSafetyInfo(device_id, params) { +return request({ + url: `/device`, + method: 'get', + params +}); +} \ No newline at end of file diff --git a/src/router/routes.js b/src/router/routes.js index adb31c3..18d16ff 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -84,6 +84,12 @@ const routes = [ name: 'changePassword', title: '修改密码', component: () => import('@/views/AccountManagement/changePassword.vue') + }, + { + path: '/safeSetting', + name: 'safeSetting', + title: '安全设置', + component: () => import('@/views/AccountManagement/safeSetting.vue') } ] } diff --git a/src/views/AccountManagement/changePassword.vue b/src/views/AccountManagement/changePassword.vue index 31ef053..1c58590 100644 --- a/src/views/AccountManagement/changePassword.vue +++ b/src/views/AccountManagement/changePassword.vue @@ -19,16 +19,18 @@ @@ -115,8 +117,13 @@ const save = async () => { } } } + .btn { + margin: 0; + width: 220PX; + font-size: 13px !important; + } .footer_btn { - margin-top: 60px; + // margin-top: 60px; display: flex; justify-content: space-between; } diff --git a/src/views/AccountManagement/safeSetting.vue b/src/views/AccountManagement/safeSetting.vue new file mode 100644 index 0000000..b7edd14 --- /dev/null +++ b/src/views/AccountManagement/safeSetting.vue @@ -0,0 +1,205 @@ + + + {{ is_safety ? "安全设置" : "修改密码" }} + + + + 新密码 + + + + 确认密码 + + + + + + 是否双人登录 + + 否 + 是 + + + + + + + + + + \ No newline at end of file diff --git a/src/views/experiment/index.vue b/src/views/experiment/index.vue index a610054..ef7e147 100644 --- a/src/views/experiment/index.vue +++ b/src/views/experiment/index.vue @@ -342,6 +342,7 @@ const stopExperiment = async (val) => { .echart { flex: 1; background: #f6f6f6; + height: 80%; // margin: 10px; border-radius: 0.05456rem; border: 1px solid #e6e6e6; diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 38d737c..741d169 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -153,6 +153,12 @@ const setSelectOption = reactive([ imgSrc: changePassword, path: '/changePassword' }, + { + id: 5, + content: '安全设置', + imgSrc: changePassword, + path: '/safeSetting' + }, { id: 4, content: '退出登录', diff --git a/src/views/login/index.vue b/src/views/login/index.vue index efea2b2..8552b01 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -89,6 +89,8 @@ import { message, notify } from "@/utils/message.js"; import axios from "axios"; import { useUserStore } from "@/store/user"; import { Icon } from 'vant'; +import { getDeviceInfo } from "@/api/user"; + const userStore = useUserStore(); const router = useRouter(); @@ -96,7 +98,14 @@ const useInfo = reactive({ username: "", password: "", }); - +let verify_num = ref(1); +const getDeviceInfoMethods = async () => { + let { data } = await getDeviceInfo(); + if (data.status == 1) { + verify_num.value = data.data.need_two_face; + } +}; +getDeviceInfoMethods(); const isFocused = ref(false); const stopInput = (e) => { @@ -121,16 +130,35 @@ const userLogin = async () => { notify("请输入用户名或密码"); return; } + let { data } = await getDeviceInfo(); + if (data.status == 1) { + verify_num.value = data.data.need_two_face; + } const res = await useLogin(useInfo); if (res.data.code == 200) { let { user_id, user_name } = res.data.data; - notify(res.data.desc, "success"); - let userInfo = { + notify(res.data.message, "success"); + +if (verify_num.value != 2) { + notify("验证成功!", "success"); + sessionStorage.setItem( + "userInfo", + JSON.stringify({ ...res.data.data, userId: user_id, userName: user_name }) + ); + router.push("/home"); + return; +} +let isDouble = doubleUserLogin({ + ...res.data.data, userId: user_id, userName: user_name, - }; - sessionStorage.setItem("userInfo", JSON.stringify(userInfo)); - router.push("/home"); + }); + if (isDouble) { + router.push("/home"); + } else { + useInfo.userName = ""; + useInfo.userPwd = ""; + } } else { notify(res.data.desc, "danger"); } @@ -181,6 +209,12 @@ const getPhotoLocal = async () => { let imgUrl = saveAsPNG(canvasface.value); let newImg = imgUrl.split('base64,')[1]; try { + { + let { data } = await getDeviceInfo(); + if (data.status == 1) { + verify_num.value = data.data.need_two_face; + } + } const res = await userFaceLogin({ raw: newImg }); let data = res.data; console.log(data,'MMMMMMMMMM'); @@ -189,20 +223,38 @@ const getPhotoLocal = async () => { status.value = false; console.log('id=====', id); let res2 = await useIdLogin({ id }); - let resData = res2.data; - console.log('resCode===', resData.code); - if (resData.code == 1) { - console.log('2次认证成功===', res); - let { user_id, user_name } = resData.data; - notify(resData.desc, "success"); - let userInfo = { + let status2 = res2.data.status; + if (status2) { + let { user_id, user_name } = res2.data.data; + notify(res2.data.message, "success"); + + if (verify_num.value != 2) { + notify("验证成功!", "success"); + sessionStorage.setItem( + "userInfo", + JSON.stringify({ + ...res2.data.data, + userId: user_id, + userName: user_name, + }) + ); + router.push("/home"); + return; + } + // userStore.faceLoginMethods(res.data); + let isDouble = doubleUserLogin({ + ...res2.data.data, userId: user_id, userName: user_name, - }; - sessionStorage.setItem("userInfo", JSON.stringify(userInfo)); - router.push("/home"); + }); + if (isDouble) { + router.push("/home"); + fnClose(); + return; + } + notify("欢迎登录", "success"); } else { - notify('人脸认证失败', 'danger'); + notify("人脸认证失败", "danger"); } fnClose(); } else { diff --git a/stats.html b/stats.html index 6d2d3d0..337c2eb 100644 --- a/stats.html +++ b/stats.html @@ -4822,7 +4822,7 @@ var drawChart = (function (exports) {