From 8c1844f7f3a8be88c6de9d79d5cb79b8a9b9f275 Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Wed, 4 Sep 2024 15:58:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E5=A4=9A=E4=B8=AA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8A=A5=E9=94=99=EF=BC=8C=E5=87=BA=E7=8E=B0=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E6=8F=90=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/common.ts | 1 + src/utils/index.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/store/modules/common.ts b/src/store/modules/common.ts index f2faa6ed..50f7fa18 100644 --- a/src/store/modules/common.ts +++ b/src/store/modules/common.ts @@ -20,6 +20,7 @@ export const commonStore = defineStore('common', () => { common_tencent_map_ak: '', common_tianditu_map_ak: '', currency_symbol: '', + attachment_host: '', } as any, // 基础数据配置参数 }); // 存储链接数据 diff --git a/src/utils/index.ts b/src/utils/index.ts index cdfde37b..80c7c24a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,8 @@ import { isEmpty } from 'lodash'; +import { commonStore } from '@/store'; +const { common } = commonStore(); +// 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色 +// 这些颜色包括从白色到黑色的不同灰度,以及一些鲜艳的颜色,格式有十六进制、RGB、RGBA、HSV、HSL等 export const predefine_colors = ['#fff', '#ddd', '#ccc', '#999', '#666', '#333', '#000', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#00ced1', '#c71585', 'rgba(255, 69, 0, 0.68)', 'rgb(255, 120, 0)', 'hsv(51, 100, 98)', 'hsva(120, 40, 94, 0.5)', 'hsl(181, 100%, 37%)', '#1F93FF', '#c7158577']; /** * 判断一个对象是否为空。 @@ -67,7 +71,7 @@ export function gradient_handle(color_list: color_list[], direction: string, is_ if (color_list.length == 1) { container_common_styles += ` ${item.color_percentage || 0}%, ${item.color} 100%`; } else { - if (typeof item.color_percentage === "number") { + if (typeof item.color_percentage === 'number') { if (index == color_list.length - 1) { container_common_styles += ` ${item.color_percentage}%`; } else { @@ -332,10 +336,11 @@ export const tabs_style = (color: string, style: string | number | boolean | und * @returns {Promise} 返回一个Promise,解析为包含资源URL的字符串 */ export const online_url = async (directory: string) => { + const attachemnt_host = common.config.attachment_host; if (import.meta.env.VITE_APP_BASE_API == '/dev-api') { let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d'); return temp_data.default.temp_attachment_host + directory; } else { - return get_cookie('attachment_host') + directory; + return attachemnt_host + directory; } };