From 2c86a8bd60deed0dd0e044bad6fb83f75d19a332 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 26 十月 2025 15:05:50 +0800
Subject: [PATCH] Merge branch 'feature-task'

---
 app/plugins/modal.js |   94 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/app/plugins/modal.js b/app/plugins/modal.js
new file mode 100644
index 0000000..fa5b4a1
--- /dev/null
+++ b/app/plugins/modal.js
@@ -0,0 +1,94 @@
+export default {
+  // 娑堟伅鎻愮ず
+  msg(content) {
+    uni.showToast({
+      title: content,
+      icon: 'none'
+    })
+  },
+  // 閿欒娑堟伅
+  msgError(content) {
+    uni.showToast({
+      title: content,
+      icon: 'error'
+    })
+  },
+  // 鎴愬姛娑堟伅
+  msgSuccess(content) {
+    uni.showToast({
+      title: content,
+      icon: 'success'
+    })
+  },
+  // 闅愯棌娑堟伅
+  hideMsg(content) {
+    uni.hideToast()
+  },
+  // 寮瑰嚭鎻愮ず
+  alert(content, title) {
+    uni.showModal({
+      title: title || '绯荤粺鎻愮ず',
+      content: content,
+      showCancel: false
+    })
+  },
+  // 纭绐椾綋
+  confirm(content, title) {
+    return new Promise((resolve, reject) => {
+      uni.showModal({
+        title: title || '绯荤粺鎻愮ず',
+        content: content,
+        cancelText: '鍙栨秷',
+        confirmText: '纭畾',
+        success: function(res) {
+          if (res.confirm) {
+            resolve(res.confirm)
+          }
+        }
+      })
+    })
+  },
+  // 杈撳叆妗�
+  prompt(content, defaultValue) {
+    return new Promise((resolve, reject) => {
+      uni.showModal({
+        title: '绯荤粺鎻愮ず',
+        content: content,
+        editable: true,
+        placeholderText: defaultValue || '',
+        cancelText: '鍙栨秷',
+        confirmText: '纭畾',
+        success: function(res) {
+          if (res.confirm) {
+            resolve(res.content)
+          } else {
+            reject()
+          }
+        }
+      })
+    })
+  },
+  // 鎻愮ず淇℃伅
+  showToast(option) {
+    if (typeof option === "object") {
+      uni.showToast(option)
+    } else {
+      uni.showToast({
+        title: option,
+        icon: "none",
+        duration: 2500
+      })
+    }
+  },
+  // 鎵撳紑閬僵灞�
+  loading(content) {
+    uni.showLoading({
+      title: content,
+      icon: 'none'
+    })
+  },
+  // 鍏抽棴閬僵灞�
+  closeLoading() {
+    uni.hideLoading()
+  }
+}

--
Gitblit v1.9.1