From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/hooks/web/useMessage.ts |   95 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/src/hooks/web/useMessage.ts b/src/hooks/web/useMessage.ts
new file mode 100644
index 0000000..ac2b552
--- /dev/null
+++ b/src/hooks/web/useMessage.ts
@@ -0,0 +1,95 @@
+import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
+import { useI18n } from './useI18n'
+export const useMessage = () => {
+  const { t } = useI18n()
+  return {
+    // 娑堟伅鎻愮ず
+    info(content: string) {
+      ElMessage.info(content)
+    },
+    // 閿欒娑堟伅
+    error(content: string) {
+      ElMessage.error(content)
+    },
+    // 鎴愬姛娑堟伅
+    success(content: string) {
+      ElMessage.success(content)
+    },
+    // 璀﹀憡娑堟伅
+    warning(content: string) {
+      ElMessage.warning(content)
+    },
+    // 寮瑰嚭鎻愮ず
+    alert(content: string) {
+      ElMessageBox.alert(content, t('common.confirmTitle'))
+    },
+    // 閿欒鎻愮ず
+    alertError(content: string) {
+      ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'error' })
+    },
+    // 鎴愬姛鎻愮ず
+    alertSuccess(content: string) {
+      ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'success' })
+    },
+    // 璀﹀憡鎻愮ず
+    alertWarning(content: string) {
+      ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'warning' })
+    },
+    // 閫氱煡鎻愮ず
+    notify(content: string) {
+      ElNotification.info(content)
+    },
+    // 閿欒閫氱煡
+    notifyError(content: string) {
+      ElNotification.error(content)
+    },
+    // 鎴愬姛閫氱煡
+    notifySuccess(content: string) {
+      ElNotification.success(content)
+    },
+    // 璀﹀憡閫氱煡
+    notifyWarning(content: string) {
+      ElNotification.warning(content)
+    },
+    // 纭绐椾綋
+    confirm(content: string, tip?: string) {
+      return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), {
+        confirmButtonText: t('common.ok'),
+        cancelButtonText: t('common.cancel'),
+        type: 'warning'
+      })
+    },
+    // 鍒犻櫎绐椾綋
+    delConfirm(content?: string, tip?: string) {
+      return ElMessageBox.confirm(
+        content ? content : t('common.delMessage'),
+        tip ? tip : t('common.confirmTitle'),
+        {
+          confirmButtonText: t('common.ok'),
+          cancelButtonText: t('common.cancel'),
+          type: 'warning'
+        }
+      )
+    },
+    // 瀵煎嚭绐椾綋
+    exportConfirm(content?: string, tip?: string) {
+      return ElMessageBox.confirm(
+        content ? content : t('common.exportMessage'),
+        tip ? tip : t('common.confirmTitle'),
+        {
+          confirmButtonText: t('common.ok'),
+          cancelButtonText: t('common.cancel'),
+          type: 'warning'
+        }
+      )
+    },
+    // 鎻愪氦鍐呭
+    prompt(content: string, tip: string) {
+      return ElMessageBox.prompt(content, tip, {
+        confirmButtonText: t('common.ok'),
+        cancelButtonText: t('common.cancel'),
+        type: 'warning'
+      })
+    }
+  }
+}

--
Gitblit v1.8.0