From 873444dd0bcf718f8322dca198cbd5e7d9167ae5 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Thu, 18 Dec 2025 14:45:57 +0800
Subject: [PATCH] 优化topbar顶部菜单样式
---
ruoyi-ui/src/utils/validate.js | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/ruoyi-ui/src/utils/validate.js b/ruoyi-ui/src/utils/validate.js
index 9c00400..13b7a15 100644
--- a/ruoyi-ui/src/utils/validate.js
+++ b/ruoyi-ui/src/utils/validate.js
@@ -1,4 +1,38 @@
/**
+ * 路径匹配器
+ * @param {string} pattern
+ * @param {string} path
+ * @returns {Boolean}
+ */
+export function isPathMatch(pattern, path) {
+ const regexPattern = pattern.replace(/\//g, '\\/').replace(/\*\*/g, '.*').replace(/\*/g, '[^\\/]*')
+ const regex = new RegExp(`^${regexPattern}$`)
+ return regex.test(path)
+}
+
+/**
+ * 判断value字符串是否为空
+ * @param {string} value
+ * @returns {Boolean}
+ */
+export function isEmpty(value) {
+ if (value == null || value == "" || value == undefined || value == "undefined") {
+ return true
+ }
+ return false
+}
+
+/**
+ * 判断url是否是http或https
+ * @param {string} url
+ * @returns {Boolean}
+ */
+export function isHttp(url) {
+ return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
+}
+
+/**
+ * 判断path是否为外链
* @param {string} path
* @returns {Boolean}
*/
@@ -65,10 +99,7 @@
* @returns {Boolean}
*/
export function isString(str) {
- if (typeof str === 'string' || str instanceof String) {
- return true
- }
- return false
+ return typeof str === 'string' || str instanceof String
}
/**
--
Gitblit v1.9.3