From 3fe2fbfc0888c0f1ff7b4b009d7354bbe7ee21b0 Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Mon, 28 Feb 2022 10:30:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=AF=86=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=8A=98=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/storageEnum.ts | 6 ++- .../Charts/Lines/LineCommon/config.ts | 37 +++++++++++-- .../Charts/Lines/LineGradientSingle/config.ts | 7 ++- .../Charts/Lines/LineGradients/config.ts | 42 +++++++++------ .../modules/settingStore/settingStore.ts | 6 +-- src/utils/crypto.ts | 53 +++++++++---------- src/utils/index.ts | 1 + src/views/login/index.vue | 45 ++++++++++++---- 8 files changed, 136 insertions(+), 61 deletions(-) diff --git a/src/enums/storageEnum.ts b/src/enums/storageEnum.ts index b7fe4340..84e144fc 100644 --- a/src/enums/storageEnum.ts +++ b/src/enums/storageEnum.ts @@ -1,8 +1,10 @@ export enum StorageEnum { // 全局设置 - GO_SYSTEM_SETTING = 'GO-SYSTEM-SETTING', + GO_SYSTEM_SETTING_STORE = 'GO-SYSTEM-SETTING', + // token 等信息 + GO_ACCESS_TOKEN_STORE = 'GO-ACCESS-TOKEN', // 登录信息 - GO_LOGIN_STORE = 'GO-ACCESS-TOKEN', + GO_LOGIN_INFO_STORE = 'GO_LOGIN_INFO', // 语言 GO_LANG_STORE = 'GO-LANG', // 当前选择的主题 diff --git a/src/packages/components/Charts/Lines/LineCommon/config.ts b/src/packages/components/Charts/Lines/LineCommon/config.ts index cb51008f..e2c0c5bc 100644 --- a/src/packages/components/Charts/Lines/LineCommon/config.ts +++ b/src/packages/components/Charts/Lines/LineCommon/config.ts @@ -7,7 +7,7 @@ export const includes = ['legend', 'xAxis', 'yAxis'] const option = { legend: { - show: true, + show: true }, xAxis: { show: true, @@ -22,14 +22,45 @@ const option = { { name: 'data1', type: 'line', + lineStyle: { + normal: { + width: 3, + color: { + type: 'linear', + + colorStops: [ + { + offset: 0, + color: '#42a5f5' // 0% 处的颜色 + }, + { + offset: 1, + color: '#48D8BF' // 100% 处的颜色 + } + ], + globalCoord: false // 缺省为 false + }, + shadowColor: 'rgba(68, 181, 226, 0.3)', + shadowBlur: 5, + shadowOffsetY: 20 + } + }, + itemStyle: { + normal: { + color: '#fff', + borderWidth: 10, + borderColor: '#42a5f5' + } + }, data: [120, 200, 150, 80, 70, 110, 130] } ] } -export default class Config extends publicConfig implements CreateComponentType { +export default class Config extends publicConfig + implements CreateComponentType { public key: string = LineCommonConfig.key public chartConfig = omit(LineCommonConfig, ['node']) // 图表配置项 public option = echartOptionProfixHandle(option, includes) -} \ No newline at end of file +} diff --git a/src/packages/components/Charts/Lines/LineGradientSingle/config.ts b/src/packages/components/Charts/Lines/LineGradientSingle/config.ts index a7bf0c34..d2fc0877 100644 --- a/src/packages/components/Charts/Lines/LineGradientSingle/config.ts +++ b/src/packages/components/Charts/Lines/LineGradientSingle/config.ts @@ -25,12 +25,17 @@ const options = echartOptionProfixHandle( name: 'data1', type: 'line', smooth: false, + lineStyle: { + normal: { + width: 3 + } + }, areaStyle: { opacity: 0.8, color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgba(25,163,223,.3)' + color: 'rgba(25,163,223,.5)' }, { offset: 1, diff --git a/src/packages/components/Charts/Lines/LineGradients/config.ts b/src/packages/components/Charts/Lines/LineGradients/config.ts index 0d4edce0..b37569be 100644 --- a/src/packages/components/Charts/Lines/LineGradients/config.ts +++ b/src/packages/components/Charts/Lines/LineGradients/config.ts @@ -8,61 +8,71 @@ export const includes = ['legend', 'xAxis', 'yAxis'] const option = { legend: { - show: true, + show: true }, xAxis: { show: true, type: 'category', - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { show: true, - type: 'value', + type: 'value' }, series: [ { name: 'data1', type: 'line', smooth: false, - data: [120, 200, 150, 80, 70, 110, 130], + lineStyle: { + normal: { + width: 3 + } + }, areaStyle: { opacity: 0.8, color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgba(25,163,223,.3)', + color: 'rgba(25,163,223,.3)' }, { offset: 1, - color: 'rgba(25,163,223, 0)', - }, - ]), + color: 'rgba(25,163,223, 0)' + } + ]) }, + data: [120, 200, 150, 80, 70, 110, 130], }, { name: 'data2', type: 'line', smooth: false, + lineStyle: { + normal: { + width: 3 + } + }, areaStyle: { normal: { opacity: 0.8, color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgba(0,202,149,0.3)', + color: 'rgba(0,202,149,0.3)' }, { offset: 1, - color: 'rgba(0,202,149,0)', - }, + color: 'rgba(0,202,149,0)' + } ]), shadowColor: 'rgba(0,202,149, 0.9)', - shadowBlur: 20, - }, + shadowBlur: 20 + } }, - data: [130, 130, 312, 268, 155, 117, 160], - }, - ], + data: [130, 130, 312, 268, 155, 117, 160] + } + ] } export default class Config extends publicConfig diff --git a/src/store/modules/settingStore/settingStore.ts b/src/store/modules/settingStore/settingStore.ts index 604f094a..dfd36584 100644 --- a/src/store/modules/settingStore/settingStore.ts +++ b/src/store/modules/settingStore/settingStore.ts @@ -8,9 +8,9 @@ import { asideCollapsedWidth } from '@/settings/designSetting' import { SettingStoreType } from './settingStore.d' import { setLocalStorage, getLocalStorage } from '@/utils' import { StorageEnum } from '@/enums/storageEnum' -const { GO_SYSTEM_SETTING } = StorageEnum +const { GO_SYSTEM_SETTING_STORE } = StorageEnum -const storageSetting: SettingStoreType = getLocalStorage(GO_SYSTEM_SETTING) +const storageSetting: SettingStoreType = getLocalStorage(GO_SYSTEM_SETTING_STORE) // 全局设置 export const useSettingStore = defineStore({ @@ -38,7 +38,7 @@ export const useSettingStore = defineStore({ actions: { setItem(key: string, value: boolean): void { ; (this as any)[key] = value - setLocalStorage(GO_SYSTEM_SETTING, this.$state) + setLocalStorage(GO_SYSTEM_SETTING_STORE, this.$state) }, }, }) diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index ef2db7e7..35e872db 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -1,30 +1,29 @@ import * as CryptoJS from 'crypto-ts' -export default { - AES_KEY: 'mt', - cryptoEncode(data: string): string { - if (typeof data !== 'string') return '' - // 加密 - const key = CryptoJS.enc.Utf8.parse(this.AES_KEY) - const str = JSON.stringify(data) - const encryptedData = CryptoJS.AES.encrypt(str, key, { - mode: CryptoJS.mode.ECB, - padding: CryptoJS.pad.PKCS7, - iv: CryptoJS.enc.Utf8.parse(this.AES_KEY) - }) - return encryptedData.toString() - }, - // 解密 - cryptoDecode(data: string): string { - if (typeof data !== 'string') return '' - const encryptedHexStr = CryptoJS.enc.Utf8.parse(data) - const encryptedBase64Str = CryptoJS.enc.Utf8.stringify(encryptedHexStr) - const key = CryptoJS.enc.Utf8.parse(this.AES_KEY) - const decryptedData = CryptoJS.AES.decrypt(encryptedBase64Str, key, { - mode: CryptoJS.mode.ECB, - padding: CryptoJS.pad.PKCS7, - iv: CryptoJS.enc.Utf8.parse(this.AES_KEY) - }) - return decryptedData.toString(CryptoJS.enc.Utf8) - } +const AES_KEY = 'mt' + +export const cryptoEncode = (data: string): string => { + if (typeof data !== 'string') return '' + // 加密 + const key = CryptoJS.enc.Utf8.parse(AES_KEY) + const str = JSON.stringify(data) + const encryptedData = CryptoJS.AES.encrypt(str, key, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.PKCS7, + iv: CryptoJS.enc.Utf8.parse(AES_KEY) + }) + return encryptedData.toString() +} +// 解密 +export const cryptoDecode = (data: string): string => { + if (typeof data !== 'string') return '' + const encryptedHexStr = CryptoJS.enc.Utf8.parse(data) + const encryptedBase64Str = CryptoJS.enc.Utf8.stringify(encryptedHexStr) + const key = CryptoJS.enc.Utf8.parse(AES_KEY) + const decryptedData = CryptoJS.AES.decrypt(encryptedBase64Str, key, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.PKCS7, + iv: CryptoJS.enc.Utf8.parse(AES_KEY) + }) + return decryptedData.toString(CryptoJS.enc.Utf8) } diff --git a/src/utils/index.ts b/src/utils/index.ts index f6fd01e4..d6ced66f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,5 @@ export * from '@/utils/utils' +export * from '@/utils/crypto' export * from '@/utils/router' export * from '@/utils/storage' export * from '@/utils/style' diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 34ddb921..fa57848b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -24,7 +24,11 @@