From ebb329f3e1f4ab99c0806291566306e1a0bff552 Mon Sep 17 00:00:00 2001 From: yuanlei <18627959669@163.com> Date: Fri, 18 Jul 2025 17:10:56 +0800 Subject: [PATCH] 1 --- plugins/modal.js | 90 +++++++++++++++++++++++++-------------------------- plugins/pluginTool.js | 16 ++++----- plugins/tab.js | 86 ++++++++++++++++++++++++------------------------ 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/plugins/modal.js b/plugins/modal.js index f9fbc68..bc51783 100644 --- a/plugins/modal.js +++ b/plugins/modal.js @@ -1,72 +1,72 @@ // 消息提示 export function msg(content) { - uni.showToast({ - title: content, - icon: 'none' - }) + uni.showToast({ + title: content, + icon: 'none' + }) } // 错误消息 export function msgError(content) { - uni.showToast({ - title: content, - icon: 'error' - }) + uni.showToast({ + title: content, + icon: 'error' + }) } // 成功消息 export function msgSuccess(content) { - uni.showToast({ - title: content, - icon: 'success' - }) + uni.showToast({ + title: content, + icon: 'success' + }) } // 隐藏消息 export function hideMsg(content) { - uni.hideToast() + uni.hideToast() } // 弹出提示 export function alert(content, title) { - uni.showModal({ - title: title || '系统提示', - content: content, - showCancel: false - }) + uni.showModal({ + title: title || '系统提示', + content: content, + showCancel: false + }) } // 确认窗体 export function 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) - } - } - }) - }) + return new Promise((resolve, reject) => { + uni.showModal({ + title: title || '系统提示', + content: content, + cancelText: '取消', + confirmText: '确定', + success: function(res) { + if (res.confirm) { + resolve(res.confirm) + } + } + }) + }) } // 提示信息 export function showToast(option) { - if (typeof option === "object") { - uni.showToast(option) - } else { - uni.showToast({ - title: option, - icon: "none", - duration: 2500 - }) - } + if (typeof option === "object") { + uni.showToast(option) + } else { + uni.showToast({ + title: option, + icon: "none", + duration: 2500 + }) + } } // 打开遮罩层 export function loading(content) { - uni.showLoading({ - title: content, - icon: 'none' - }) + uni.showLoading({ + title: content, + icon: 'none' + }) } // 关闭遮罩层 export function closeLoading() { - uni.hideLoading() + uni.hideLoading() } diff --git a/plugins/pluginTool.js b/plugins/pluginTool.js index 91c0af2..b96cba1 100644 --- a/plugins/pluginTool.js +++ b/plugins/pluginTool.js @@ -3,13 +3,13 @@ import * as modal from '@/plugins/modal.js' export default { install(app) { - // tab工具 - Object.keys(tab).forEach((key) => { - app.config.globalProperties[key] = tab[key]; - }) - // modal工具 - Object.keys(modal).forEach((key) => { - app.config.globalProperties[key] = modal[key]; - }); + // tab工具 + Object.keys(tab).forEach((key) => { + app.config.globalProperties[key] = tab[key]; + }); + // modal工具 + Object.keys(modal).forEach((key) => { + app.config.globalProperties[key] = modal[key]; + }); } }; \ No newline at end of file diff --git a/plugins/tab.js b/plugins/tab.js index f3ff2ca..fb86a9f 100644 --- a/plugins/tab.js +++ b/plugins/tab.js @@ -1,74 +1,74 @@ // 关闭所有页面,打开到应用内的某个页面 export function reLaunch(url) { - return uni.reLaunch({ - url: url - }) + return uni.reLaunch({ + url: url + }) } export function reLaunchLogin() { - return uni.reLaunch({ - url: '/pages/user/login' - }) + return uni.reLaunch({ + url: '/pages/user/login' + }) } // 跳转到tabBar页面,并关闭其他所有非tabBar页面 export function switchTab(url) { - return uni.switchTab({ - url: url - }) + return uni.switchTab({ + url: url + }) } // 关闭当前页面,跳转到应用内的某个页面 export function redirectTo(url) { - return uni.redirectTo({ - url: url - }) + return uni.redirectTo({ + url: url + }) } // 保留当前页面,跳转到应用内的某个页面 export function navigateTo(url) { - return uni.navigateTo({ - url: url - }) + return uni.navigateTo({ + url: url + }) } // 保留当前页面,跳转到应用内的某个页面 export function navigateToLogin() { - return uni.navigateTo({ - url: '/pages/user/login' - }) + return uni.navigateTo({ + url: '/pages/user/login' + }) } // 关闭当前页面,返回上一页面或多级页面 export function navigateBack() { - return uni.navigateBack() + return uni.navigateBack() } export function openUrl(url) { - if(!url || typeof url == 'object' || url == '#'){ - uni.showToast({ - title: '此功能正开发中,敬请期待!', - icon: 'none' - }) - return; - } - uni.navigateTo({ - url: url - }) + if(!url || typeof url == 'object' || url == '#'){ + uni.showToast({ + title: '此功能正开发中,敬请期待!', + icon: 'none' + }) + return; + } + uni.navigateTo({ + url: url + }) } export function pageScrollTo(scrollTop, duration=0) { - uni.pageScrollTo({ - scrollTop: scrollTop, - duration: duration - }); + uni.pageScrollTo({ + scrollTop: scrollTop, + duration: duration + }); } // 复制 export function setClipboardData(content) { - return new Promise((resolve, reject) => { - uni.setClipboardData({ - data: content, - success: (res) => { - if (res.confirm) { - resolve(res.confirm) - } - } - }) - }) + return new Promise((resolve, reject) => { + uni.setClipboardData({ + data: content, + success: (res) => { + if (res.confirm) { + resolve(res.confirm) + } + } + }) + }) }