From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改
---
src/utils/util.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/src/utils/util.js b/src/utils/util.js
index fc0bc9e..57c3536 100644
--- a/src/utils/util.js
+++ b/src/utils/util.js
@@ -125,9 +125,19 @@
* @returns {string}
*/
export const getSmallImg = url => {
- if (!url) return ''
- const lastDotIndex = url.lastIndexOf('.')
- return `${url.substring(0, lastDotIndex)}_small${url.substring(lastDotIndex)}`
+ if (!url) return ''
+ const lastDotIndex = url.lastIndexOf('.')
+ return `${url.substring(0, lastDotIndex)}_small${url.substring(lastDotIndex)}`
+}
+/**
+ * 获取正射路径
+ * @param url
+ * @returns {string}
+ */
+export const getzsSmallImg = url => {
+ if (!url) return ''
+ const lastDotIndex = url.lastIndexOf('.')
+ return `${url.substring(0, lastDotIndex)}_small.jpeg`
}
/**
* 浏览器判断是否全屏
@@ -438,7 +448,27 @@
// 设置默认范围 [上个月, 当前月]
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)}`
+}
+/**
+ * 获取正射路径
+ * @param url
+ * @returns {string}
+ */
+export const getzsShowImg = url => {
+ if (!url) return ''
+ const lastDotIndex = url.lastIndexOf('.')
+ return `${url.substring(0, lastDotIndex)}_show.jpeg`
+}
// key驼峰转换为下划线
export function camelToSnake (obj) {
if (typeof obj !== 'object' || obj === null) {
@@ -457,4 +487,16 @@
}
}
return newObj
-}
\ No newline at end of file
+}
+
+// a链接直接下载
+export const aLinkDownloadUtil = (url, name) => {
+ let a = document.createElement('a')
+ a.style.display = 'none'
+ a.href = url
+ a.download = name
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+ a = null
+}
--
Gitblit v1.9.3