From 74f3a7dcedba7e9aeac99287c3daf666a726d1d6 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 14 Jun 2025 13:53:29 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v2.0.0/后台管理数据中心'

---
 src/utils/util.js |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/utils/util.js b/src/utils/util.js
index 94137a6..acf5472 100644
--- a/src/utils/util.js
+++ b/src/utils/util.js
@@ -438,3 +438,33 @@
   // 设置默认范围 [上个月, 当前月]
   return [new Date(lastMonthYear, lastMonth, 1), new Date(currentYear, currentMonth, 1)]
 }
+/**
+ * 获取中等缩略图路径
+ * @param url
+ * @returns {string}
+ */
+export const getShowImg = url => {
+	if (!url) return ''
+	const lastDotIndex = url.lastIndexOf('.')
+	return `${url.substring(0, lastDotIndex)}_show${url.substring(lastDotIndex)}`
+}
+
+// key驼峰转换为下划线
+export function camelToSnake (obj) {
+  if (typeof obj !== 'object' || obj === null) {
+    return obj
+  }
+
+  if (Array.isArray(obj)) {
+    return obj.map(item => camelToSnake(item))
+  }
+
+  const newObj = {}
+  for (const key in obj) {
+    if (Object.prototype.hasOwnProperty.call(obj, key)) {
+      const newKey = key.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()
+      newObj[newKey] = camelToSnake(obj[key])
+    }
+  }
+  return newObj
+}
\ No newline at end of file

--
Gitblit v1.9.3