chore(projects): correct the word spell
This commit is contained in:
parent
56c770c49d
commit
458e387b68
8
.env
8
.env
@ -13,8 +13,8 @@ VITE_AUTH_ROUTE_MODE=static
|
||||
VITE_ROUTE_HOME_PATH=/dashboard/analysis
|
||||
|
||||
# iconify图标作为组件的前缀
|
||||
VITE_ICON_PREFFIX=icon
|
||||
VITE_ICON_PREFIX=icon
|
||||
|
||||
# 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFFIX
|
||||
# 格式 {VITE_ICON_PREFFIX}-{本地图标集合名称}
|
||||
VITE_ICON_LOCAL_PREFFIX=icon-local
|
||||
# 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFIX
|
||||
# 格式 {VITE_ICON_PREFIX}-{本地图标集合名称}
|
||||
VITE_ICON_LOCAL_PREFIX=icon-local
|
||||
|
21
.vscode/settings.json
vendored
21
.vscode/settings.json
vendored
@ -1,4 +1,19 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"AMAP",
|
||||
"antv",
|
||||
"colord",
|
||||
"echarts",
|
||||
"iconify",
|
||||
"Sider",
|
||||
"unocss",
|
||||
"unplugin",
|
||||
"vditor",
|
||||
"vueuse",
|
||||
"wangeditor",
|
||||
"wechat",
|
||||
"xgplayer"
|
||||
],
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
},
|
||||
@ -8,15 +23,15 @@
|
||||
"strings": true
|
||||
},
|
||||
"editor.tabSize": 2,
|
||||
"eslint.validate": ["svelte", "astro", "json"],
|
||||
"eslint.validate": ["json"],
|
||||
"files.associations": {
|
||||
"*.env.*": "dotenv",
|
||||
"*.svg": "html"
|
||||
},
|
||||
"files.eol": "\n",
|
||||
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"],
|
||||
"[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"]
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||
import { getSrcPath } from '../utils';
|
||||
|
||||
export default function unplugin(viteEnv: ImportMetaEnv) {
|
||||
const { VITE_ICON_PREFFIX, VITE_ICON_LOCAL_PREFFIX } = viteEnv;
|
||||
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv;
|
||||
|
||||
const srcPath = getSrcPath();
|
||||
const localIconPath = `${srcPath}/assets/svg-icon`;
|
||||
|
||||
/** 本地svg图标集合名称 */
|
||||
const collectionName = VITE_ICON_LOCAL_PREFFIX.replace(`${VITE_ICON_PREFFIX}-`, '');
|
||||
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '');
|
||||
|
||||
return [
|
||||
Icons({
|
||||
@ -31,12 +31,12 @@ export default function unplugin(viteEnv: ImportMetaEnv) {
|
||||
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
|
||||
resolvers: [
|
||||
NaiveUiResolver(),
|
||||
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFFIX })
|
||||
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
|
||||
]
|
||||
}),
|
||||
createSvgIconsPlugin({
|
||||
iconDirs: [localIconPath],
|
||||
symbolId: `${VITE_ICON_LOCAL_PREFFIX}-[dir]-[name]`,
|
||||
symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
|
||||
inject: 'body-last',
|
||||
customDomId: '__SVG_ICON_LOCAL__'
|
||||
})
|
||||
|
@ -37,7 +37,7 @@ const bindAttrs = computed<{ class: string; style: string }>(() => ({
|
||||
}));
|
||||
|
||||
const symbolId = computed(() => {
|
||||
const { VITE_ICON_LOCAL_PREFFIX: preffix } = import.meta.env;
|
||||
const { VITE_ICON_LOCAL_PREFIX: preffix } = import.meta.env;
|
||||
|
||||
const defaultLocalIcon = 'no-icon';
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
export const BAIDU_MAP_SDK_URL = `https://api.map.baidu.com/getscript?v=3.0&ak=KSezYymXPth1DIGILRX3oYN9PxbOQQmU&services=&t=20210201100830&s=1`;
|
||||
|
||||
/** 高德地图sdk地址 */
|
||||
export const GAODE_MAP_SDK_URL = 'https://webapi.amap.com/maps?v=2.0&key=e7bd02bd504062087e6563daf4d6721d';
|
||||
export const AMAP_SDK_URL = 'https://webapi.amap.com/maps?v=2.0&key=e7bd02bd504062087e6563daf4d6721d';
|
||||
|
||||
/** 腾讯地图sdk地址 */
|
||||
export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7';
|
||||
|
8
src/typings/env.d.ts
vendored
8
src/typings/env.d.ts
vendored
@ -40,13 +40,13 @@ interface ImportMetaEnv {
|
||||
/** 路由首页的路径 */
|
||||
readonly VITE_ROUTE_HOME_PATH: AuthRoute.RoutePath;
|
||||
/** iconify图标作为组件的前缀 */
|
||||
readonly VITE_ICON_PREFFIX: string;
|
||||
readonly VITE_ICON_PREFIX: string;
|
||||
/**
|
||||
* 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFFIX
|
||||
* - 格式 {VITE_ICON_PREFFIX}-{本地图标集合名称}
|
||||
* 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFIX
|
||||
* - 格式 {VITE_ICON_PREFIX}-{本地图标集合名称}
|
||||
* - 例如:icon-local
|
||||
*/
|
||||
readonly VITE_ICON_LOCAL_PREFFIX: string;
|
||||
readonly VITE_ICON_LOCAL_PREFIX: string;
|
||||
/** 后端服务的环境类型 */
|
||||
readonly VITE_SERVICE_ENV?: ServiceEnvType;
|
||||
/** 开启请求代理 */
|
||||
|
@ -77,9 +77,9 @@ const darkColorMap = [
|
||||
* @param darkThemeMixColor - 暗黑主题的混合颜色,默认 #141414
|
||||
*/
|
||||
export function getColorPalettes(color: AnyColor, darkTheme = false, darkThemeMixColor = '#141414'): string[] {
|
||||
const indexs: ColorIndex[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
const indexes: ColorIndex[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
|
||||
const patterns = indexs.map(index => getColorPalette(color, index));
|
||||
const patterns = indexes.map(index => getColorPalette(color, index));
|
||||
|
||||
if (darkTheme) {
|
||||
const darkPatterns = darkColorMap.map(({ index, opacity }) => {
|
||||
|
@ -6,7 +6,7 @@ const CryptoSecret = '__CryptoJS_Secret__';
|
||||
* 加密数据
|
||||
* @param data - 数据
|
||||
*/
|
||||
export function encrypto(data: any) {
|
||||
export function encrypt(data: any) {
|
||||
const newData = JSON.stringify(data);
|
||||
return CryptoJS.AES.encrypt(newData, CryptoSecret).toString();
|
||||
}
|
||||
@ -15,7 +15,7 @@ export function encrypto(data: any) {
|
||||
* 解密数据
|
||||
* @param cipherText - 密文
|
||||
*/
|
||||
export function decrypto(cipherText: string) {
|
||||
export function decrypt(cipherText: string) {
|
||||
const bytes = CryptoJS.AES.decrypt(cipherText, CryptoSecret);
|
||||
const originalText = bytes.toString(CryptoJS.enc.Utf8);
|
||||
if (originalText) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { decrypto, encrypto } from '../crypto';
|
||||
import { decrypt, encrypt } from '../crypto';
|
||||
interface StorageData<T> {
|
||||
value: T;
|
||||
expire: number | null;
|
||||
@ -13,7 +13,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
|
||||
value,
|
||||
expire: expire !== null ? new Date().getTime() + expire * 1000 : null
|
||||
};
|
||||
const json = encrypto(storageData);
|
||||
const json = encrypt(storageData);
|
||||
window.localStorage.setItem(key as string, json);
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
|
||||
if (json) {
|
||||
let storageData: StorageData<T[K]> | null = null;
|
||||
try {
|
||||
storageData = decrypto(json);
|
||||
storageData = decrypt(json);
|
||||
} catch {
|
||||
// 防止解析失败
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { decrypto, encrypto } from '../crypto';
|
||||
import { decrypt, encrypt } from '../crypto';
|
||||
|
||||
function createSessionStorage<T extends StorageInterface.Session = StorageInterface.Session>() {
|
||||
function set<K extends keyof T>(key: K, value: T[K]) {
|
||||
const json = encrypto(value);
|
||||
const json = encrypt(value);
|
||||
sessionStorage.setItem(key as string, json);
|
||||
}
|
||||
function get<K extends keyof T>(key: K) {
|
||||
@ -10,7 +10,7 @@ function createSessionStorage<T extends StorageInterface.Session = StorageInterf
|
||||
let data: T[K] | null = null;
|
||||
if (json) {
|
||||
try {
|
||||
data = decrypto(json);
|
||||
data = decrypt(json);
|
||||
} catch {
|
||||
// 防止解析失败
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
<n-card title="自定义图标示例" :bordered="false" class="mt-10px rounded-8px shadow-sm">
|
||||
<div class="pb-12px text-16px">
|
||||
在src/assets/svg-icon文件夹下的svg文件,通过在template里面以 icon-local-{文件名} 直接渲染,
|
||||
其中icon-local为.env文件里的 VITE_ICON_LOCAL_PREFFIX
|
||||
其中icon-local为.env文件里的 VITE_ICON_LOCAL_PREFIX
|
||||
</div>
|
||||
<div class="grid grid-cols-10">
|
||||
<div class="mt-5px flex-x-center">
|
||||
|
@ -5,11 +5,11 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useScriptTag } from '@vueuse/core';
|
||||
import { GAODE_MAP_SDK_URL } from '@/config';
|
||||
import { AMAP_SDK_URL } from '@/config';
|
||||
|
||||
defineOptions({ name: 'GaodeMap' });
|
||||
|
||||
const { load } = useScriptTag(GAODE_MAP_SDK_URL);
|
||||
const { load } = useScriptTag(AMAP_SDK_URL);
|
||||
|
||||
const domRef = ref<HTMLDivElement>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user