From b9bd29a1a81f6f7de479e3cc3fdfe3d85fc660bf Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期三, 23 四月 2025 13:35:06 +0800 Subject: [PATCH] UA 整理提交 --- src/hooks/useElement.js | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/src/hooks/useElement.js b/src/hooks/useElement.js index 9ff5857..f56bc7d 100644 --- a/src/hooks/useElement.js +++ b/src/hooks/useElement.js @@ -1,5 +1,6 @@ import { ref, reactive } from "vue"; import { ElMessageBox, ElMessage, ElLoading } from "element-plus"; +import { checkSnId } from '@/api/user.js'; export default () => { const $message = ElMessage; @@ -39,6 +40,7 @@ text: "Loading", background: "rgba(0, 0, 0, 0.7)", target: document.body, + zIndex: 9000, // 鍙互娣诲姞鏇村榛樿閰嶇疆 }; @@ -55,5 +57,39 @@ // }; } - return { $alert, $confirm, $message, $loading }; + // 纭鐢ㄦ埛瀵嗙爜鍚庡共鏌愪簨 + async function $confirmPwdDo(callback) { + ElMessageBox.prompt('璇疯緭鍏ョ敤鎴峰瘑鐮�', '绯荤粺鎻愮ず', { + inputType: 'password', + inputPattern: /^.+$/, + inputErrorMessage: '瀵嗙爜涓嶈兘涓虹┖', + }) + .then(async ({ value: pwd }) => { + console.log('pwd', pwd, '============='); + + // 楠岃瘉瀵嗙爜 + let res = await checkSnId(pwd); + let { code, data } = res; + let res_pwd = code && data; + + if (res_pwd) { + $message({ + type: 'success', + message: '瀵嗙爜姝g‘' + }); + } else { + $message({ + type: 'error', + message: '瀵嗙爜閿欒' + }); + return false; + } + + if (callback && typeof callback === 'function') { + callback(); + } + }); + } + + return { $alert, $confirm, $message, $loading, $confirmPwdDo }; }; -- Gitblit v1.9.1