chore(projects): correct the word spell

This commit is contained in:
Soybean 2023-07-19 23:44:18 +08:00
parent 56c770c49d
commit 458e387b68
12 changed files with 45 additions and 30 deletions

8
.env
View File

@ -13,8 +13,8 @@ VITE_AUTH_ROUTE_MODE=static
VITE_ROUTE_HOME_PATH=/dashboard/analysis VITE_ROUTE_HOME_PATH=/dashboard/analysis
# iconify图标作为组件的前缀 # iconify图标作为组件的前缀
VITE_ICON_PREFFIX=icon VITE_ICON_PREFIX=icon
# 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFFIX # 本地SVG图标作为组件的前缀, 请注意一定要包含 VITE_ICON_PREFIX
# 格式 {VITE_ICON_PREFFIX}-{本地图标集合名称} # 格式 {VITE_ICON_PREFIX}-{本地图标集合名称}
VITE_ICON_LOCAL_PREFFIX=icon-local VITE_ICON_LOCAL_PREFIX=icon-local

21
.vscode/settings.json vendored
View File

@ -1,4 +1,19 @@
{ {
"cSpell.words": [
"AMAP",
"antv",
"colord",
"echarts",
"iconify",
"Sider",
"unocss",
"unplugin",
"vditor",
"vueuse",
"wangeditor",
"wechat",
"xgplayer"
],
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": true "source.fixAll.eslint": true
}, },
@ -8,15 +23,15 @@
"strings": true "strings": true
}, },
"editor.tabSize": 2, "editor.tabSize": 2,
"eslint.validate": ["svelte", "astro", "json"], "eslint.validate": ["json"],
"files.associations": { "files.associations": {
"*.env.*": "dotenv", "*.env.*": "dotenv",
"*.svg": "html" "*.svg": "html"
}, },
"files.eol": "\n", "files.eol": "\n",
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"],
"[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": { "[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true "editor.formatOnSave": true
}, }
"i18n-ally.localesPaths": ["src/locales", "src/locales/lang"]
} }

View File

@ -7,13 +7,13 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import { getSrcPath } from '../utils'; import { getSrcPath } from '../utils';
export default function unplugin(viteEnv: ImportMetaEnv) { 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 srcPath = getSrcPath();
const localIconPath = `${srcPath}/assets/svg-icon`; const localIconPath = `${srcPath}/assets/svg-icon`;
/** 本地svg图标集合名称 */ /** 本地svg图标集合名称 */
const collectionName = VITE_ICON_LOCAL_PREFFIX.replace(`${VITE_ICON_PREFFIX}-`, ''); const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '');
return [ return [
Icons({ Icons({
@ -31,12 +31,12 @@ export default function unplugin(viteEnv: ImportMetaEnv) {
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }], types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
resolvers: [ resolvers: [
NaiveUiResolver(), NaiveUiResolver(),
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFFIX }) IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
] ]
}), }),
createSvgIconsPlugin({ createSvgIconsPlugin({
iconDirs: [localIconPath], iconDirs: [localIconPath],
symbolId: `${VITE_ICON_LOCAL_PREFFIX}-[dir]-[name]`, symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
inject: 'body-last', inject: 'body-last',
customDomId: '__SVG_ICON_LOCAL__' customDomId: '__SVG_ICON_LOCAL__'
}) })

View File

@ -37,7 +37,7 @@ const bindAttrs = computed<{ class: string; style: string }>(() => ({
})); }));
const symbolId = computed(() => { 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'; const defaultLocalIcon = 'no-icon';

View File

@ -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`; export const BAIDU_MAP_SDK_URL = `https://api.map.baidu.com/getscript?v=3.0&ak=KSezYymXPth1DIGILRX3oYN9PxbOQQmU&services=&t=20210201100830&s=1`;
/** 高德地图sdk地址 */ /** 高德地图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地址 */ /** 腾讯地图sdk地址 */
export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7'; export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7';

View File

@ -40,13 +40,13 @@ interface ImportMetaEnv {
/** 路由首页的路径 */ /** 路由首页的路径 */
readonly VITE_ROUTE_HOME_PATH: AuthRoute.RoutePath; readonly VITE_ROUTE_HOME_PATH: AuthRoute.RoutePath;
/** iconify图标作为组件的前缀 */ /** iconify图标作为组件的前缀 */
readonly VITE_ICON_PREFFIX: string; readonly VITE_ICON_PREFIX: string;
/** /**
* SVG图标作为组件的前缀, VITE_ICON_PREFFIX * SVG图标作为组件的前缀, VITE_ICON_PREFIX
* - {VITE_ICON_PREFFIX}-{} * - {VITE_ICON_PREFIX}-{}
* - icon-local * - icon-local
*/ */
readonly VITE_ICON_LOCAL_PREFFIX: string; readonly VITE_ICON_LOCAL_PREFIX: string;
/** 后端服务的环境类型 */ /** 后端服务的环境类型 */
readonly VITE_SERVICE_ENV?: ServiceEnvType; readonly VITE_SERVICE_ENV?: ServiceEnvType;
/** 开启请求代理 */ /** 开启请求代理 */

View File

@ -77,9 +77,9 @@ const darkColorMap = [
* @param darkThemeMixColor - #141414 * @param darkThemeMixColor - #141414
*/ */
export function getColorPalettes(color: AnyColor, darkTheme = false, darkThemeMixColor = '#141414'): string[] { 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) { if (darkTheme) {
const darkPatterns = darkColorMap.map(({ index, opacity }) => { const darkPatterns = darkColorMap.map(({ index, opacity }) => {

View File

@ -6,7 +6,7 @@ const CryptoSecret = '__CryptoJS_Secret__';
* *
* @param data - * @param data -
*/ */
export function encrypto(data: any) { export function encrypt(data: any) {
const newData = JSON.stringify(data); const newData = JSON.stringify(data);
return CryptoJS.AES.encrypt(newData, CryptoSecret).toString(); return CryptoJS.AES.encrypt(newData, CryptoSecret).toString();
} }
@ -15,7 +15,7 @@ export function encrypto(data: any) {
* *
* @param cipherText - * @param cipherText -
*/ */
export function decrypto(cipherText: string) { export function decrypt(cipherText: string) {
const bytes = CryptoJS.AES.decrypt(cipherText, CryptoSecret); const bytes = CryptoJS.AES.decrypt(cipherText, CryptoSecret);
const originalText = bytes.toString(CryptoJS.enc.Utf8); const originalText = bytes.toString(CryptoJS.enc.Utf8);
if (originalText) { if (originalText) {

View File

@ -1,4 +1,4 @@
import { decrypto, encrypto } from '../crypto'; import { decrypt, encrypt } from '../crypto';
interface StorageData<T> { interface StorageData<T> {
value: T; value: T;
expire: number | null; expire: number | null;
@ -13,7 +13,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
value, value,
expire: expire !== null ? new Date().getTime() + expire * 1000 : null expire: expire !== null ? new Date().getTime() + expire * 1000 : null
}; };
const json = encrypto(storageData); const json = encrypt(storageData);
window.localStorage.setItem(key as string, json); window.localStorage.setItem(key as string, json);
} }
@ -22,7 +22,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
if (json) { if (json) {
let storageData: StorageData<T[K]> | null = null; let storageData: StorageData<T[K]> | null = null;
try { try {
storageData = decrypto(json); storageData = decrypt(json);
} catch { } catch {
// 防止解析失败 // 防止解析失败
} }

View File

@ -1,8 +1,8 @@
import { decrypto, encrypto } from '../crypto'; import { decrypt, encrypt } from '../crypto';
function createSessionStorage<T extends StorageInterface.Session = StorageInterface.Session>() { function createSessionStorage<T extends StorageInterface.Session = StorageInterface.Session>() {
function set<K extends keyof T>(key: K, value: T[K]) { 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); sessionStorage.setItem(key as string, json);
} }
function get<K extends keyof T>(key: K) { 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; let data: T[K] | null = null;
if (json) { if (json) {
try { try {
data = decrypto(json); data = decrypt(json);
} catch { } catch {
// 防止解析失败 // 防止解析失败
} }

View File

@ -19,7 +19,7 @@
<n-card title="自定义图标示例" :bordered="false" class="mt-10px rounded-8px shadow-sm"> <n-card title="自定义图标示例" :bordered="false" class="mt-10px rounded-8px shadow-sm">
<div class="pb-12px text-16px"> <div class="pb-12px text-16px">
在src/assets/svg-icon文件夹下的svg文件通过在template里面以 icon-local-{文件名} 直接渲染, 在src/assets/svg-icon文件夹下的svg文件通过在template里面以 icon-local-{文件名} 直接渲染,
其中icon-local为.env文件里的 VITE_ICON_LOCAL_PREFFIX 其中icon-local为.env文件里的 VITE_ICON_LOCAL_PREFIX
</div> </div>
<div class="grid grid-cols-10"> <div class="grid grid-cols-10">
<div class="mt-5px flex-x-center"> <div class="mt-5px flex-x-center">

View File

@ -5,11 +5,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useScriptTag } from '@vueuse/core'; import { useScriptTag } from '@vueuse/core';
import { GAODE_MAP_SDK_URL } from '@/config'; import { AMAP_SDK_URL } from '@/config';
defineOptions({ name: 'GaodeMap' }); defineOptions({ name: 'GaodeMap' });
const { load } = useScriptTag(GAODE_MAP_SDK_URL); const { load } = useScriptTag(AMAP_SDK_URL);
const domRef = ref<HTMLDivElement>(); const domRef = ref<HTMLDivElement>();