Skip to content

Commit

Permalink
chore(projects): correct the word spell
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jul 19, 2023
1 parent 56c770c commit 458e387
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .env
Expand Up @@ -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 changes: 18 additions & 3 deletions .vscode/settings.json
@@ -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
},
Expand All @@ -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"]
}
}
8 changes: 4 additions & 4 deletions build/plugins/unplugin.ts
Expand Up @@ -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({
Expand All @@ -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__'
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/custom/svg-icon.vue
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/config/map-sdk.ts
Expand Up @@ -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 changes: 4 additions & 4 deletions src/typings/env.d.ts
Expand Up @@ -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;
/** 开启请求代理 */
Expand Down
4 changes: 2 additions & 2 deletions src/utils/common/color.ts
Expand Up @@ -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 }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/crypto/index.ts
Expand Up @@ -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();
}
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/storage/local.ts
@@ -1,4 +1,4 @@
import { decrypto, encrypto } from '../crypto';
import { decrypt, encrypt } from '../crypto';
interface StorageData<T> {
value: T;
expire: number | null;
Expand All @@ -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);
}

Expand All @@ -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 {
// 防止解析失败
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/storage/session.ts
@@ -1,16 +1,16 @@
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) {
const json = sessionStorage.getItem(key as string);
let data: T[K] | null = null;
if (json) {
try {
data = decrypto(json);
data = decrypt(json);
} catch {
// 防止解析失败
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/plugin/icon/index.vue
Expand Up @@ -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">
Expand Down
4 changes: 2 additions & 2 deletions src/views/plugin/map/components/gaode-map.vue
Expand Up @@ -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>();
Expand Down

1 comment on commit 458e387

@vercel
Copy link

@vercel vercel bot commented on 458e387 Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.