From 15d883a3bae0c852cf566b41537f4f8992b94916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 13 Jan 2023 15:54:41 +0800 Subject: [PATCH 01/87] =?UTF-8?q?perf:=20=E8=B0=83=E6=8D=A2=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=AF=BC=E5=87=BA=E7=9A=84=20logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentEdit/components/EditTools/index.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/chart/ContentEdit/components/EditTools/index.vue b/src/views/chart/ContentEdit/components/EditTools/index.vue index fc435ad2..79d2eb6c 100644 --- a/src/views/chart/ContentEdit/components/EditTools/index.vue +++ b/src/views/chart/ContentEdit/components/EditTools/index.vue @@ -172,18 +172,18 @@ const updateToSession = (id: string) => { // 配置列表 const btnList: BtnListType[] = [ - { - key: 'export', - type: TypeEnum.BUTTON, - name: '导出', - icon: ShareIcon, - handle: exportHandle - }, { key: 'import', type: TypeEnum.IMPORTUPLOAD, name: '导入', - icon: DownloadIcon + icon: ShareIcon + }, + { + key: 'export', + type: TypeEnum.BUTTON, + name: '导出', + icon: DownloadIcon, + handle: exportHandle }, { key: 'edit', From faafb02534fef7ff6d13ef1b1351a2f74ef382e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 13 Jan 2023 16:14:42 +0800 Subject: [PATCH 02/87] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=AD=98=E5=82=A8=E5=BA=8F=E5=88=97=E5=8C=96=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/storage.ts | 6 ++++-- src/utils/utils.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/storage.ts b/src/utils/storage.ts index d55d33bd..0cc733f0 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -1,3 +1,5 @@ +import { JSONStringify, JSONParse } from './utils' + /** * * 存储本地会话数据 * @param k 键名 @@ -6,7 +8,7 @@ */ export const setLocalStorage = (k: string, v: T) => { try { - window.localStorage.setItem(k, JSON.stringify(v)) + window.localStorage.setItem(k, JSONStringify(v)) } catch (error) { return false } @@ -20,7 +22,7 @@ export const setLocalStorage = (k: string, v: T) => { export const getLocalStorage = (k: string) => { const item = window.localStorage.getItem(k) try { - return item ? JSON.parse(item) : item + return item ? JSONParse(item) : item } catch (err) { return item } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 0a123db3..858ac9c3 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -295,7 +295,7 @@ export const setKeyboardDressShow = (keyCode?: number) => { * * JSON序列化,支持函数和 undefined * @param data */ -export const JSONStringify = (data: object) => { +export const JSONStringify = (data: T) => { return JSON.stringify( data, (key, val) => { From ed5752b692fd0c9bdacd54824e3f48e520a9bd86 Mon Sep 17 00:00:00 2001 From: CarnivalO Date: Thu, 12 Jan 2023 05:54:12 +0000 Subject: [PATCH 03/87] =?UTF-8?q?update=20src/packages/components/Decorate?= =?UTF-8?q?s/Three/ThreeEarth01/index.vue.=20Edge=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E4=B8=8D=E8=A1=8C=20Edg=E5=BA=94=E8=AF=A5=E4=B9=9F?= =?UTF-8?q?=E6=98=AF<-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: CarnivalO --- src/packages/components/Decorates/Three/ThreeEarth01/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/components/Decorates/Three/ThreeEarth01/index.vue b/src/packages/components/Decorates/Three/ThreeEarth01/index.vue index 5fd62d6a..d25d4e6e 100644 --- a/src/packages/components/Decorates/Three/ThreeEarth01/index.vue +++ b/src/packages/components/Decorates/Three/ThreeEarth01/index.vue @@ -66,7 +66,7 @@ watch( // DOM 渲染之后进行初始化 onMounted(() => { try { - if (navigator.userAgent.indexOf('Chrome') < -1 || navigator.userAgent.indexOf('Edg') > -1) { + if (navigator.userAgent.indexOf('Chrome') < -1 || navigator.userAgent.indexOf('Edg') < -1) { window['$message'].error('三维地图组件仅在【谷歌】浏览器上能正常展示!') chartEditStore.removeComponentList(undefined, false) return From 36f9fd2d493308e6aec0587d9d87d103abd08b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 16 Jan 2023 10:02:26 +0800 Subject: [PATCH 04/87] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=97=A0=E6=B3=95=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=9B=BE=E7=89=87=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/packages/index.ts | 3 ++- .../components/ChartsSearch/SearchImage.vue | 27 +++++++++++++++++++ .../components/ChartsSearch/index.vue | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue diff --git a/src/packages/index.ts b/src/packages/index.ts index d568afcb..4f530faa 100644 --- a/src/packages/index.ts +++ b/src/packages/index.ts @@ -63,7 +63,8 @@ export const fetchConfigComponent = (dropData: ConfigType) => { * * 获取图片内容 * @param {ConfigType} targetData 配置项 */ -export const fetchImages = async (targetData: ConfigType) => { +export const fetchImages = async (targetData?: ConfigType) => { + if (!targetData) return '' // 新数据动态处理 const { image, package: targetDataPackage } = targetData // 兼容旧数据 diff --git a/src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue b/src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue new file mode 100644 index 00000000..1cdb6aa9 --- /dev/null +++ b/src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/src/views/chart/ContentCharts/components/ChartsSearch/index.vue b/src/views/chart/ContentCharts/components/ChartsSearch/index.vue index f0684c86..8f4d8078 100644 --- a/src/views/chart/ContentCharts/components/ChartsSearch/index.vue +++ b/src/views/chart/ContentCharts/components/ChartsSearch/index.vue @@ -37,7 +37,7 @@ :title="item.title" @click="selectChartHandle(item)" > - 展示图 + {{ item.title }} @@ -77,6 +77,7 @@ import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayou import { isString, addEventListener, removeEventListener } from '@/utils' import { fetchConfigComponent, fetchChartComponent } from '@/packages/index' import { componentInstall, loadingStart, loadingFinish, loadingError } from '@/utils' +import SearchImage from './SearchImage.vue' const props = defineProps({ menuOptions: { From f49a55695339459b79c59e6eeab95aca8eb06f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 16 Jan 2023 12:45:47 +0800 Subject: [PATCH 05/87] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=8D?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E6=97=A0=E6=B3=95=E5=A4=84=E7=90=86?= =?UTF-8?q?es6=E7=AE=80=E5=86=99=E5=87=BD=E6=95=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 858ac9c3..4042eaed 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -321,6 +321,12 @@ export const JSONParse = (data: string) => { return JSON.parse(data, (k, v) => { if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) { return eval(`(function(){return ${v}})()`) + } else if (typeof v === 'string' && v.indexOf && (v.indexOf('return ') > -1)) { + const baseLeftIndex = v.indexOf('(') + if (baseLeftIndex > -1) { + const newFn = `function ${v.substring(baseLeftIndex)}` + return eval(`(function(){return ${newFn}})()`) + } } return v }) From 651bd976f3ea49e78fd607bc5c40320b758685b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 16 Jan 2023 17:58:07 +0800 Subject: [PATCH 06/87] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=BB=84=E4=BB=B6=E5=9B=BE=E7=89=87=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E5=8F=98=E5=8A=A8=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/components/Pages/ChartGlobImage/index.ts | 3 +++ .../Pages/ChartGlobImage}/index.vue | 13 ++++++--- .../components/ChartsItemBox/index.vue | 5 ++-- .../components/ChartsItemImage/index.ts | 3 --- .../components/ChartsSearch/SearchImage.vue | 27 ------------------- .../components/ChartsSearch/index.vue | 4 +-- 6 files changed, 18 insertions(+), 37 deletions(-) create mode 100644 src/components/Pages/ChartGlobImage/index.ts rename src/{views/chart/ContentCharts/components/ChartsItemImage => components/Pages/ChartGlobImage}/index.vue (76%) delete mode 100644 src/views/chart/ContentCharts/components/ChartsItemImage/index.ts delete mode 100644 src/views/chart/ContentCharts/components/ChartsSearch/SearchImage.vue diff --git a/src/components/Pages/ChartGlobImage/index.ts b/src/components/Pages/ChartGlobImage/index.ts new file mode 100644 index 00000000..9203fcd7 --- /dev/null +++ b/src/components/Pages/ChartGlobImage/index.ts @@ -0,0 +1,3 @@ +import ChartGlobImage from './index.vue' + +export { ChartGlobImage } diff --git a/src/views/chart/ContentCharts/components/ChartsItemImage/index.vue b/src/components/Pages/ChartGlobImage/index.vue similarity index 76% rename from src/views/chart/ContentCharts/components/ChartsItemImage/index.vue rename to src/components/Pages/ChartGlobImage/index.vue index d5ba9f18..efd6bf41 100644 --- a/src/views/chart/ContentCharts/components/ChartsItemImage/index.vue +++ b/src/components/Pages/ChartGlobImage/index.vue @@ -3,7 +3,7 @@ diff --git a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue index b6b9beeb..7ca3b1b0 100644 --- a/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue +++ b/src/views/chart/ContentCharts/components/ChartsItemBox/index.vue @@ -22,7 +22,7 @@
- +
@@ -37,7 +37,7 @@ - - \ No newline at end of file diff --git a/src/views/chart/ContentCharts/components/ChartsSearch/index.vue b/src/views/chart/ContentCharts/components/ChartsSearch/index.vue index 8f4d8078..f1a25ddd 100644 --- a/src/views/chart/ContentCharts/components/ChartsSearch/index.vue +++ b/src/views/chart/ContentCharts/components/ChartsSearch/index.vue @@ -37,7 +37,7 @@ :title="item.title" @click="selectChartHandle(item)" > - + {{ item.title }}
@@ -77,7 +77,7 @@ import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayou import { isString, addEventListener, removeEventListener } from '@/utils' import { fetchConfigComponent, fetchChartComponent } from '@/packages/index' import { componentInstall, loadingStart, loadingFinish, loadingError } from '@/utils' -import SearchImage from './SearchImage.vue' +import { ChartGlobImage } from '@/components/Pages/ChartGlobImage' const props = defineProps({ menuOptions: { From f54cad82ad13626c0e8e4ffc7879b8d1666b23c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 17 Jan 2023 14:31:42 +0800 Subject: [PATCH 07/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96mock=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=8C=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E6=80=A7=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axios.ts | 1 + src/api/mock/test.mock.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/api/axios.ts b/src/api/axios.ts index 9833998f..a64cfcd0 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -21,6 +21,7 @@ axiosInstance.interceptors.request.use( axiosInstance.interceptors.response.use( (res: AxiosResponse) => { const { code } = res.data as { code: number } + if (code === undefined || code === null) return Promise.resolve(res) if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data) // 重定向 if (ErrorPageNameMap.get(code)) redirectErrorPage(code) diff --git a/src/api/mock/test.mock.ts b/src/api/mock/test.mock.ts index f84b8cc3..9db8cc78 100644 --- a/src/api/mock/test.mock.ts +++ b/src/api/mock/test.mock.ts @@ -10,8 +10,8 @@ export default { status: 200, msg: '请求成功', data: { - dimensions: ['product', 'dataOne'], - 'source|50': [ + dimensions: ['product', 'dataOne'], + 'source|20': [ { product: '@name', 'dataOne|0-900': 3 @@ -37,12 +37,13 @@ export default { status: 200, msg: '请求成功', data: { - dimensions: ['product', 'dataOne', 'dataTwo'], - 'source|50': [ + dimensions: ['product', 'dataOne', 'dataTwo', 'dataThree'], + 'source|20': [ { product: '@name', 'dataOne|100-900': 3, - 'dataTwo|100-900': 3 + 'dataTwo|100-900': 3, + 'dataThree|100-900': 3 } ] } From c11ef13c04c311e1b931e9cfb4ebe988a5962e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 17 Jan 2023 14:45:13 +0800 Subject: [PATCH 08/87] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E5=AF=BC=E8=87=B4=E6=97=B6=E9=97=B4=E9=94=99?= =?UTF-8?q?=E8=AF=AF=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/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 4042eaed..c1fc2f67 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -305,7 +305,7 @@ export const JSONStringify = (data: T) => { } // 处理 undefined 丢失问题 if (typeof val === 'undefined') { - return 'undefined' + return null } return val }, From 9182e977344d5d9e00f442cd06eaba53cf1941b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 17 Jan 2023 15:31:16 +0800 Subject: [PATCH 09/87] =?UTF-8?q?fix:=20=E6=8E=92=E9=99=A4=E5=8F=8D?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E5=87=BD=E6=95=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E8=A7=84=E8=8C=83=E4=BA=8B=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/eventEnum.ts | 31 +++++++++++++++++++ src/hooks/useLifeHandler.hook.ts | 3 +- src/packages/index.d.ts | 21 +------------ src/packages/public/publicConfig.ts | 3 +- src/utils/storage.ts | 2 +- src/utils/utils.ts | 2 ++ .../ChartEventAdvancedHandle/index.vue | 3 +- .../components/ChartEventBaseHandle/index.vue | 2 +- src/views/chart/hooks/useSync.hook.ts | 3 +- 9 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 src/enums/eventEnum.ts diff --git a/src/enums/eventEnum.ts b/src/enums/eventEnum.ts new file mode 100644 index 00000000..a8110a71 --- /dev/null +++ b/src/enums/eventEnum.ts @@ -0,0 +1,31 @@ +// 基础事件类型(vue不加 on) +export enum BaseEvent { + // 点击 + ON_CLICK = 'click', + // 双击 + ON_DBL_CLICK = 'dblclick', + // 移入 + ON_MOUSE_ENTER = 'mouseenter', + // 移出 + ON_MOUSE_LEAVE = 'mouseleave', +} + +// vue3 生命周期事件 +export enum EventLife { + // 渲染之后 + VNODE_MOUNTED = 'vnodeMounted', + // 渲染之前 + VNODE_BEFORE_MOUNT = 'vnodeBeforeMount', +} + +// 内置字符串函数对象列表 +export const excludeParseEventKeyList = [ + EventLife.VNODE_BEFORE_MOUNT, + EventLife.VNODE_MOUNTED, + BaseEvent.ON_CLICK, + BaseEvent.ON_DBL_CLICK, + BaseEvent.ON_MOUSE_ENTER, + BaseEvent.ON_MOUSE_LEAVE, + //过滤器 + 'filter' +] \ No newline at end of file diff --git a/src/hooks/useLifeHandler.hook.ts b/src/hooks/useLifeHandler.hook.ts index 23ed5e00..2412a79a 100644 --- a/src/hooks/useLifeHandler.hook.ts +++ b/src/hooks/useLifeHandler.hook.ts @@ -1,4 +1,5 @@ -import { CreateComponentType, CreateComponentGroupType, EventLife, BaseEvent } from '@/packages/index.d' +import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' +import { EventLife } from '@/enums/eventEnum' import * as echarts from 'echarts' // 所有图表组件集合对象 diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index f431bf75..e1f626b3 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -1,3 +1,4 @@ +import { BaseEvent, EventLife } from '@/enums/eventEnum' import type { GlobalThemeJsonType } from '@/settings/chartThemes/index' import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' @@ -90,26 +91,6 @@ export const BlendModeEnumList = [ { label: '亮度', value: 'luminosity' } ] -// 基础事件类型(vue不加 on) -export enum BaseEvent { - // 点击 - ON_CLICK = 'click', - // 双击 - ON_DBL_CLICK = 'dblclick', - // 移入 - ON_MOUSE_ENTER = 'mouseenter', - // 移出 - ON_MOUSE_LEAVE = 'mouseleave', -} - -// vue3 生命周期事件 -export enum EventLife { - // 渲染之后 - VNODE_MOUNTED = 'vnodeMounted', - // 渲染之前 - VNODE_BEFORE_MOUNT = 'vnodeBeforeMount', -} - // 组件实例类 export interface PublicConfigType { id: string diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index 49dda2b0..c4288638 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -1,6 +1,7 @@ import { getUUID } from '@/utils' import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' import { groupTitle } from '@/settings/designSetting' +import { BaseEvent, EventLife } from '@/enums/eventEnum' import { RequestHttpEnum, RequestDataTypeEnum, @@ -9,8 +10,6 @@ import { RequestBodyEnum } from '@/enums/httpEnum' import { - BaseEvent, - EventLife, ChartFrameEnum, PublicConfigType, CreateComponentType, diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 0cc733f0..5b9f6922 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -57,7 +57,7 @@ export const setSessionStorage = (k: string, v: T) => { export const getSessionStorage: (k: string) => any = (k: string) => { const item = window.sessionStorage.getItem(k) try { - return item ? JSON.parse(item) : item + return item ? JSONParse(item) : item } catch (err) { return item } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index c1fc2f67..34161e04 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -10,6 +10,7 @@ import cloneDeep from 'lodash/cloneDeep' import { WinKeyboard } from '@/enums/editPageEnum' import { RequestHttpIntervalEnum, RequestParamsObjType } from '@/enums/httpEnum' import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' +import { excludeParseEventKeyList } from '@/enums/eventEnum' /** * * 判断是否是开发环境 @@ -319,6 +320,7 @@ export const JSONStringify = (data: T) => { */ export const JSONParse = (data: string) => { return JSON.parse(data, (k, v) => { + if (excludeParseEventKeyList.includes(k)) return v if (typeof v === 'string' && v.indexOf && (v.indexOf('function') > -1 || v.indexOf('=>') > -1)) { return eval(`(function(){return ${v}})()`) } else if (typeof v === 'string' && v.indexOf && (v.indexOf('return ') > -1)) { diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue index a697a628..581fefcb 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventAdvancedHandle/index.vue @@ -164,7 +164,8 @@ import { useTargetData } from '../../../hooks/useTargetData.hook' import { templateList } from './importTemplate' import { npmPkgs } from '@/hooks' import { icon } from '@/plugins' -import { CreateComponentType, EventLife } from '@/packages/index.d' +import { CreateComponentType } from '@/packages/index.d' +import { EventLife } from '@/enums/eventEnum' const { targetData, chartEditStore } = useTargetData() const { DocumentTextIcon, ChevronDownIcon, PencilIcon } = icon.ionicons5 diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue index ec01f60b..2defea36 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventBaseHandle/index.vue @@ -127,7 +127,7 @@ import { ref, computed, watch, toRefs, toRaw } from 'vue' import { MonacoEditor } from '@/components/Pages/MonacoEditor' import { useTargetData } from '../../../hooks/useTargetData.hook' -import { CreateComponentType, BaseEvent } from '@/packages/index.d' +import { BaseEvent } from '@/enums/eventEnum' import { icon } from '@/plugins' const { targetData, chartEditStore } = useTargetData() diff --git a/src/views/chart/hooks/useSync.hook.ts b/src/views/chart/hooks/useSync.hook.ts index a0783962..9376e412 100644 --- a/src/views/chart/hooks/useSync.hook.ts +++ b/src/views/chart/hooks/useSync.hook.ts @@ -5,7 +5,8 @@ import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHis import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore' import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d' import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index' -import { BaseEvent, EventLife, CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' +import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' +import { BaseEvent, EventLife } from '@/enums/eventEnum' import { PublicGroupConfigClass } from '@/packages/public/publicConfig' import merge from 'lodash/merge' From a7c7356d1f0a7a668520f91cdd368a4addff9538 Mon Sep 17 00:00:00 2001 From: pengjian Date: Mon, 30 Jan 2023 17:37:56 +0800 Subject: [PATCH 10/87] =?UTF-8?q?=E8=BD=AE=E6=92=AD=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E6=96=B9=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Tables/Tables/TableScrollBoard/config.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/packages/components/Tables/Tables/TableScrollBoard/config.vue b/src/packages/components/Tables/Tables/TableScrollBoard/config.vue index 834cfb5b..1aec6363 100644 --- a/src/packages/components/Tables/Tables/TableScrollBoard/config.vue +++ b/src/packages/components/Tables/Tables/TableScrollBoard/config.vue @@ -40,6 +40,15 @@ + + + From c40d922ddb3c23567fb6095dbc1841379dc313c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=94=E5=90=AC=E9=A3=8E=E5=90=9F720?= Date: Thu, 2 Feb 2023 09:34:50 +0000 Subject: [PATCH 11/87] =?UTF-8?q?fix:=20=E5=B7=A5=E4=BD=9C=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E8=A2=AB?= =?UTF-8?q?=E6=8C=A4=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 且听风吟720 --- src/views/chart/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/chart/index.vue b/src/views/chart/index.vue index 89c60d95..856ddea2 100644 --- a/src/views/chart/index.vue +++ b/src/views/chart/index.vue @@ -14,8 +14,10 @@ - - +
+ + +
From 68b8809a1e0d4d513a71ae1c56a7344fb95dfa16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Thu, 2 Feb 2023 20:54:02 +0800 Subject: [PATCH 12/87] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=87=BD=E6=95=B0=EF=BC=8C=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E9=94=99=E8=AF=AF=E6=8D=95=E8=8E=B7=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 6 ++++-- src/plugins/index.ts | 1 + src/plugins/initFunction.ts | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/plugins/initFunction.ts diff --git a/src/main.ts b/src/main.ts index cf9b86df..d85d46cb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import App from './App.vue' import router, { setupRouter } from '@/router' import i18n from '@/i18n/index' import { setupStore } from '@/store' -import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins' +import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins' import { GoAppProvider } from '@/components/GoAppProvider/index' import { setHtmlTheme } from '@/utils' @@ -53,4 +53,6 @@ async function appInit() { window['$vue'] = app } -void appInit() +await appInit() + +await initFunction() diff --git a/src/plugins/index.ts b/src/plugins/index.ts index c500f63a..d1ac07ba 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -2,3 +2,4 @@ export { setupNaive } from '@/plugins/naive' export { setupDirectives } from '@/plugins/directives' export { setupCustomComponents } from '@/plugins/customComponents' export { icon } from '@/plugins/icon' +export { initFunction } from '@/plugins/initFunction' diff --git a/src/plugins/initFunction.ts b/src/plugins/initFunction.ts new file mode 100644 index 00000000..1df1db45 --- /dev/null +++ b/src/plugins/initFunction.ts @@ -0,0 +1,9 @@ +/** + * * 页面初始化就执行的函数 + */ +export const initFunction = async () => { + // 捕获全局错误 + window.addEventListener("unhandledrejection", event => { + console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`); + }); +} \ No newline at end of file From d774a52c4fc03a47094ef38823d9d591949e8646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 8 Feb 2023 16:38:38 +0800 Subject: [PATCH 13/87] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=BA=8F=E5=88=97=E5=8C=96=E9=81=97=E6=BC=8F=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 5b9f6922..5804ae8d 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -44,7 +44,7 @@ export const clearLocalStorage = (name: string) => { */ export const setSessionStorage = (k: string, v: T) => { try { - window.sessionStorage.setItem(k, JSON.stringify(v)) + window.sessionStorage.setItem(k, JSONStringify(v)) } catch (error) { return false } From dea849cfdb46de6cd290ccfce6de4463e1307a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Thu, 9 Feb 2023 11:29:23 +0800 Subject: [PATCH 14/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E4=BD=93=E9=AA=8C=EF=BC=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/Bars/CapsuleChart/index.vue | 25 +++++++++++-------- .../ChartDataMonacoEditor/index.vue | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/packages/components/Charts/Bars/CapsuleChart/index.vue b/src/packages/components/Charts/Bars/CapsuleChart/index.vue index 804ae0dc..73a6ae0d 100644 --- a/src/packages/components/Charts/Bars/CapsuleChart/index.vue +++ b/src/packages/components/Charts/Bars/CapsuleChart/index.vue @@ -122,23 +122,28 @@ const calcData = (data: any, type?: string) => { // 数据解析 const calcCapsuleLengthAndLabelData = (dataset: any) => { - const { source } = dataset - if (!source.length) return + try { + const { source } = dataset + if (!source || !source.length) return - state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight) - const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]]) + state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight) + const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]]) - const maxValue = Math.max(...capsuleValue) + const maxValue = Math.max(...capsuleValue) - state.capsuleValue = capsuleValue + state.capsuleValue = capsuleValue - state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0)) + state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0)) - const oneFifth = maxValue / 5 + const oneFifth = maxValue / 5 - const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))) + const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))) - state.labelData = labelData + state.labelData = labelData + + } catch (error) { + console.warn(error); + } } const numberSizeHandle = (val: string | number) => { diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue index a0078f15..205f3328 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue @@ -150,7 +150,7 @@ const filterRes = computed(() => { } catch (error) { // eslint-disable-next-line vue/no-side-effects-in-computed-properties errorFlag.value = true - return '过滤函数错误' + return `过滤函数错误,日志:${error}` } }) From c87a8a1da974a2abb9be47b52428e78688cc96fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 14 Feb 2023 21:12:30 +0800 Subject: [PATCH 15/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20iframe=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/components/Informations/Mores/Iframe/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/components/Informations/Mores/Iframe/config.ts b/src/packages/components/Informations/Mores/Iframe/config.ts index 2e96c211..a9cf94c6 100644 --- a/src/packages/components/Informations/Mores/Iframe/config.ts +++ b/src/packages/components/Informations/Mores/Iframe/config.ts @@ -14,7 +14,7 @@ export const option = { export default class Config extends PublicConfigClass implements CreateComponentType { public key = IframeConfig.key - public attr = { ...chartInitConfig, w: 800, h: 800, zIndex: -1 } + public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } public chartConfig = cloneDeep(IframeConfig) public option = cloneDeep(option) } From 5ee5c0fd58ae7345c7ca6095e4df3f83ee063dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 15 Feb 2023 09:20:48 +0800 Subject: [PATCH 16/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useChartDataFetch.hook.ts | 3 ++- .../components/Charts/Maps/MapBase/index.vue | 4 ++-- .../components/Charts/Mores/Heatmap/index.vue | 4 ++-- .../components/Charts/Mores/Radar/index.vue | 4 ++-- .../components/Charts/Mores/TreeMap/index.vue | 4 ++-- .../Informations/Mores/WordCloud/index.vue | 4 ++-- src/packages/public/chart.ts | 13 +++++++++++++ 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/hooks/useChartDataFetch.hook.ts b/src/hooks/useChartDataFetch.hook.ts index 0138d1b7..ed82edf5 100644 --- a/src/hooks/useChartDataFetch.hook.ts +++ b/src/hooks/useChartDataFetch.hook.ts @@ -6,6 +6,7 @@ import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { RequestDataTypeEnum } from '@/enums/httpEnum' import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils' +import { setOption } from '@/packages/public/chart' // 获取类型 type ChartEditStoreType = typeof useChartEditStore @@ -34,7 +35,7 @@ export const useChartDataFetch = ( const echartsUpdateHandle = (dataset: any) => { if (chartFrame === ChartFrameEnum.ECHARTS) { if (vChartRef.value) { - vChartRef.value.setOption({ dataset: dataset }) + setOption(vChartRef.value, { dataset: dataset }) } } } diff --git a/src/packages/components/Charts/Maps/MapBase/index.vue b/src/packages/components/Charts/Maps/MapBase/index.vue index f927e64a..7a66753d 100644 --- a/src/packages/components/Charts/Maps/MapBase/index.vue +++ b/src/packages/components/Charts/Maps/MapBase/index.vue @@ -11,7 +11,7 @@ import { use, registerMap } from 'echarts/core' import { EffectScatterChart, MapChart } from 'echarts/charts' import { CanvasRenderer } from 'echarts/renderers' import { useChartDataFetch } from '@/hooks' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { isPreview } from '@/utils' import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json' @@ -76,7 +76,7 @@ registerMapInitAsync() // 手动触发渲染 const vEchartsSetOption = () => { option.value = props.chartConfig.option - vChartRef.value?.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } // 更新数据处理 diff --git a/src/packages/components/Charts/Mores/Heatmap/index.vue b/src/packages/components/Charts/Mores/Heatmap/index.vue index 45cb810c..3dcd91aa 100644 --- a/src/packages/components/Charts/Mores/Heatmap/index.vue +++ b/src/packages/components/Charts/Mores/Heatmap/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { HeatmapChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -68,7 +68,7 @@ const dataSetHandle = (dataset: typeof dataJson) => { props.chartConfig.option.series[0].data = seriesData } if (vChartRef.value && isPreview()) { - vChartRef.value.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Charts/Mores/Radar/index.vue b/src/packages/components/Charts/Mores/Radar/index.vue index 2e523267..8dad3571 100644 --- a/src/packages/components/Charts/Mores/Radar/index.vue +++ b/src/packages/components/Charts/Mores/Radar/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { RadarChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -50,7 +50,7 @@ const dataSetHandle = (dataset: typeof dataJson) => { props.chartConfig.option.radar.indicator = dataset.radarIndicator } if (vChartRef.value && isPreview()) { - vChartRef.value.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Charts/Mores/TreeMap/index.vue b/src/packages/components/Charts/Mores/TreeMap/index.vue index 7964f174..37eb4fb1 100644 --- a/src/packages/components/Charts/Mores/TreeMap/index.vue +++ b/src/packages/components/Charts/Mores/TreeMap/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { TreemapChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -42,7 +42,7 @@ const option = computed(() => { const dataSetHandle = (dataset: typeof dataJson) => { if (dataset) { props.chartConfig.option.series[0].data = dataset - vChartRef.value?.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Informations/Mores/WordCloud/index.vue b/src/packages/components/Informations/Mores/WordCloud/index.vue index 4c9626e3..a5c8a592 100644 --- a/src/packages/components/Informations/Mores/WordCloud/index.vue +++ b/src/packages/components/Informations/Mores/WordCloud/index.vue @@ -16,7 +16,7 @@ import 'echarts-wordcloud' import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import config, { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { isPreview } from '@/utils' @@ -49,7 +49,7 @@ const option = computed(() => { const dataSetHandle = (dataset: typeof dataJson) => { try { dataset && (props.chartConfig.option.series[0].data = dataset) - vChartRef.value && isPreview() && vChartRef.value.setOption(props.chartConfig.option) + vChartRef.value && isPreview() && setOption(vChartRef.value, props.chartConfig.option) } catch (error) { console.log(error) } diff --git a/src/packages/public/chart.ts b/src/packages/public/chart.ts index d36a850e..5ed7785e 100644 --- a/src/packages/public/chart.ts +++ b/src/packages/public/chart.ts @@ -2,6 +2,7 @@ import merge from 'lodash/merge' import pick from 'lodash/pick' import { EchartsDataType } from '../index.d' import { globalThemeJson } from '@/settings/chartThemes/index' +import type VChart from 'vue-echarts' /** * * 合并 color 和全局配置项 @@ -33,3 +34,15 @@ export const setData = (option: any, data: EchartsDataType) => { option.dataset = data return option } + +/** + * * 配置公共 setOption 方法 + * @param instance + * @param data + */ +export const setOption = (instance: T, data: D) => { + if (!instance) return + const option = instance.getOption() + option.dataset = null + instance.setOption(data) +} From 62c85cc0cfb2d6a4eee81c9a9e2ec59974e6d590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 15 Feb 2023 14:24:56 +0800 Subject: [PATCH 17/87] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20public=20?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=85=8D=E7=BD=AE=E9=A1=B9preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Informations/Texts/TextBarrage/config.ts | 2 +- src/packages/index.d.ts | 4 ++++ src/packages/public/publicConfig.ts | 4 ++++ .../preview/components/PreviewRenderGroup/index.vue | 4 ++-- .../preview/components/PreviewRenderList/index.vue | 8 +++----- src/views/preview/utils/style.ts | 12 ++++++++++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/packages/components/Informations/Texts/TextBarrage/config.ts b/src/packages/components/Informations/Texts/TextBarrage/config.ts index eb04f096..aefc4331 100644 --- a/src/packages/components/Informations/Texts/TextBarrage/config.ts +++ b/src/packages/components/Informations/Texts/TextBarrage/config.ts @@ -15,7 +15,6 @@ export const FontWeightObject = { } export const option = { - dataset: '让数字化看得见', fontSize: 32, fontColor: '#ffffff', @@ -39,4 +38,5 @@ export default class Config extends PublicConfigClass implements CreateComponent public attr = { ...chartInitConfig, w: 500, h: 70, zIndex: -1 } public chartConfig = cloneDeep(TextBarrageConfig) public option = cloneDeep(option) + public preview = { overFlowHidden: true } } diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index e1f626b3..d8ef0bdd 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -114,6 +114,10 @@ export interface PublicConfigType { // 动画 animations: string[] } + preview?: { + // 预览超出隐藏 + overFlowHidden?: boolean + } filter?: string status: StatusType events: { diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index c4288638..10b3a10b 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -78,6 +78,10 @@ export class PublicConfigClass implements PublicConfigType { // 动画 animations: [] } + // 预览 + public preview = { + overFlowHidden: false + } // 状态 public status = { lock: false, diff --git a/src/views/preview/components/PreviewRenderGroup/index.vue b/src/views/preview/components/PreviewRenderGroup/index.vue index e6e22d92..354fa29c 100644 --- a/src/views/preview/components/PreviewRenderGroup/index.vue +++ b/src/views/preview/components/PreviewRenderGroup/index.vue @@ -9,6 +9,7 @@ ...getFilterStyle(item.styles), ...getTransformStyle(item.styles), ...getStatusStyle(item.status), + ...getPreviewConfigStyle(item.preview), ...getBlendModeStyle(item.styles) as any }" > @@ -28,7 +29,7 @@ import { PropType } from 'vue' import { CreateComponentGroupType } from '@/packages/index.d' import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' -import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils' +import { getSizeStyle, getComponentAttrStyle, getStatusStyle, getPreviewConfigStyle } from '../../utils' import { useLifeHandler } from '@/hooks' const props = defineProps({ @@ -54,6 +55,5 @@ const props = defineProps({ diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue index ee5ea39c..eca587aa 100644 --- a/src/views/preview/components/PreviewRenderList/index.vue +++ b/src/views/preview/components/PreviewRenderList/index.vue @@ -2,13 +2,14 @@
@@ -43,7 +44,7 @@ import { PreviewRenderGroup } from '../PreviewRenderGroup/index' import { CreateComponentGroupType } from '@/packages/index.d' import { chartColors } from '@/settings/chartThemes/index' import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' -import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils' +import { getSizeStyle, getComponentAttrStyle, getStatusStyle, getPreviewConfigStyle } from '../../utils' import { useLifeHandler } from '@/hooks' // 初始化数据池 @@ -78,8 +79,5 @@ onMounted(() => { diff --git a/src/views/preview/utils/style.ts b/src/views/preview/utils/style.ts index 6cd25cba..945aa8c0 100644 --- a/src/views/preview/utils/style.ts +++ b/src/views/preview/utils/style.ts @@ -3,6 +3,7 @@ import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditSt type AttrType = PickCreateComponentType<'attr'> type StatusType = PickCreateComponentType<'status'> +type PreviewConfig = PickCreateComponentType<'preview'> // 设置位置 export const getComponentAttrStyle = (attr: AttrType, index: number) => { @@ -29,6 +30,17 @@ export const getStatusStyle = (attr: StatusType) => { } } +// 设置预览配置样式 +export const getPreviewConfigStyle = (previewConfig: PreviewConfig) => { + const previewStyle: Partial = {} + if (previewConfig) { + if (previewConfig.overFlowHidden) { + previewStyle.overflow = 'hidden' + } + } + return previewStyle +} + // 全局样式 export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => { // 背景 From 2de274b95d65c0d680e851977ff7f1e54462e72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 17 Feb 2023 18:15:00 +0800 Subject: [PATCH 18/87] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=A1=B6?= =?UTF-8?q?=E5=B1=82=E6=97=A0=E6=B3=95=E5=86=99=20await=20=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 5 +++-- src/styles/common/mixins/mixins.scss | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index d85d46cb..550bc63c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -53,6 +53,7 @@ async function appInit() { window['$vue'] = app } -await appInit() +appInit().then(() => { + initFunction() +}) -await initFunction() diff --git a/src/styles/common/mixins/mixins.scss b/src/styles/common/mixins/mixins.scss index ec6f2ccd..5cb85f5f 100644 --- a/src/styles/common/mixins/mixins.scss +++ b/src/styles/common/mixins/mixins.scss @@ -17,7 +17,7 @@ } @mixin deep() { - :deep() { + :deep(*) { @content; } } From 0d726846fc858e00c63a9c6afab9bb3a518a5b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 24 Feb 2023 21:34:15 +0800 Subject: [PATCH 19/87] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=20deep=20?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CanvasPage/index.vue | 13 +++++-------- .../components/ChartDataPondList/index.vue | 10 ++++------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index f024a4c2..fc5a915e 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -22,7 +22,7 @@ - +
- +
背景颜色 @@ -294,13 +294,10 @@ $uploadHeight: 193px; cursor: pointer; margin-bottom: 20px; @include deep() { - .n-card__content { - padding: 0; - overflow: hidden; - } .n-upload-dragger { padding: 5px; width: $uploadWidth; + background-color: rgba(0, 0, 0, 0); } } .upload-show { @@ -331,8 +328,8 @@ $uploadHeight: 193px; padding-right: 2.25em; } .select-preview-icon { - padding-right: .68em; - padding-left: .68em; + padding-right: 0.68em; + padding-left: 0.68em; } .tabs-box { margin-top: 20px; diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/components/ChartDataPondList/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/components/ChartDataPondList/index.vue index a19c90e4..696fcff8 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/components/ChartDataPondList/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataPond/components/ChartDataPondList/index.vue @@ -1,6 +1,6 @@ @@ -31,12 +28,7 @@ import { computed } from 'vue' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d' -import { - chartColors, - chartColorsName, - chartColorsshow, - ChartColorsNameType -} from '@/settings/chartThemes/index' +import { chartColors, chartColorsName, chartColorsshow, ChartColorsNameType } from '@/settings/chartThemes/index' import { useDesignStore } from '@/store/modules/designStore/designStore' import cloneDeep from 'lodash/cloneDeep' import { icon } from '@/plugins' @@ -69,6 +61,8 @@ const selectTheme = (theme: ChartColorsNameType) => { From a8ac40770dd31fc77599d7d3a0983e2889621144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 25 Feb 2023 22:00:55 +0800 Subject: [PATCH 21/87] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/icon.ts | 6 + src/plugins/naive.ts | 2 + src/settings/chartThemes/index.ts | 18 +- src/styles/common/mixins/mixins.scss | 2 +- src/utils/style.ts | 10 + .../components/ChartThemeColor/index.vue | 47 ++- .../components/CreateColor/index.vue | 331 ++++++++++++++++++ .../components/CreateColorRender/index.ts | 3 + .../components/CreateColorRender/index.vue | 233 ++++++++++++ .../CreateColorRenderChart/barOptions.ts | 47 +++ .../CreateColorRenderChart/index.ts | 3 + .../CreateColorRenderChart/index.vue | 69 ++++ .../CreateColorRenderChart/lineOptions.ts | 72 ++++ .../components/CanvasPage/index.vue | 4 +- 14 files changed, 817 insertions(+), 30 deletions(-) create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.ts create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.ts create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.vue create mode 100644 src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/lineOptions.ts diff --git a/src/plugins/icon.ts b/src/plugins/icon.ts index 1f485371..b195e340 100644 --- a/src/plugins/icon.ts +++ b/src/plugins/icon.ts @@ -1,4 +1,5 @@ import { + Add as AddIcon, Close as CloseIcon, Remove as RemoveIcon, Resize as ResizeIcon, @@ -52,6 +53,7 @@ import { ColorWand as ColorWandIcon, ArrowBack as ArrowBackIcon, ArrowForward as ArrowForwardIcon, + ArrowDown as ArrowDownIcon, Planet as PawIcon, Search as SearchIcon, ChevronUpOutline as ChevronUpOutlineIcon, @@ -101,6 +103,8 @@ import { } from '@vicons/carbon' const ionicons5 = { + // 新增 + AddIcon, // 帮助(问号) HelpOutlineIcon, // 添加 @@ -206,6 +210,8 @@ const ionicons5 = { ArrowBackIcon, // 前进 ArrowForwardIcon, + // 向下 + ArrowDownIcon, // 狗爪 PawIcon, // 搜索(放大镜) diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts index ab4dbb1f..0d004df7 100644 --- a/src/plugins/naive.ts +++ b/src/plugins/naive.ts @@ -57,6 +57,7 @@ import { NProgress, NDatePicker, NGrid, + NGi, NGridItem, NList, NListItem, @@ -160,6 +161,7 @@ const naive = create({ NProgress, NDatePicker, NGrid, + NGi, NGridItem, NList, NListItem, diff --git a/src/settings/chartThemes/index.ts b/src/settings/chartThemes/index.ts index d066d858..7a205c1c 100644 --- a/src/settings/chartThemes/index.ts +++ b/src/settings/chartThemes/index.ts @@ -31,6 +31,9 @@ export const chartColors = { // 默认主题 export const defaultTheme = 'dark' +// 默认展示的选择器颜色列表 +export const swatchesColors = ['#232324', '#2a2a2b', '#313132', '#373739', '#757575', '#e0e0e0', '#eeeeee', '#fafafa'] + // 主题色列表 export type ChartColorsNameType = keyof typeof chartColorsName export const chartColorsName = { @@ -48,21 +51,6 @@ export const chartColorsName = { roma: '罗马红' } -// 主题色列表 -export const chartColorsshow = { - dark: 'linear-gradient(to right, #4992ff 0%, #7cffb2 100%)', - customed: 'linear-gradient(to right, #5470c6 0%, #91cc75 100%)', - macarons: 'linear-gradient(to right, #2ec7c9 0%, #b6a2de 100%)', - walden: 'linear-gradient(to right, #3fb1e3 0%, #6be6c1 100%)', - purplePassion: 'linear-gradient(to right, #9b8bba 0%, #e098c7 100%)', - vintage: 'linear-gradient(to right, #d87c7c 0%, #919e8b 100%)', - chalk: 'linear-gradient(to right, #fc97af 0%, #87f7cf 100%)', - westeros: 'linear-gradient(to right, #516b91 0%, #edafda 100%)', - wonderland: 'linear-gradient(to right, #4ea397 0%, #22c3aa 100%)', - essos: 'linear-gradient(to right, #893448 0%, #d95850 100%)', - shine: 'linear-gradient(to right, #c12e34 0%, #0098d9 100%)', - roma: 'linear-gradient(to right, #e01f54 0%, #5e4ea5 100%)' -} // 渐变主题色列表(主色1、主色2、阴影、渐变1、渐变2) export const chartColorsSearch = { dark: ['#4992ff', '#7cffb2', 'rgba(68, 181, 226, 0.3)', 'rgba(73, 146, 255, 0.5)', 'rgba(124, 255, 178, 0.5)'], diff --git a/src/styles/common/mixins/mixins.scss b/src/styles/common/mixins/mixins.scss index 5cb85f5f..ec6f2ccd 100644 --- a/src/styles/common/mixins/mixins.scss +++ b/src/styles/common/mixins/mixins.scss @@ -17,7 +17,7 @@ } @mixin deep() { - :deep(*) { + :deep() { @content; } } diff --git a/src/utils/style.ts b/src/utils/style.ts index 8e8605d3..0fa9400a 100644 --- a/src/utils/style.ts +++ b/src/utils/style.ts @@ -86,6 +86,16 @@ export function darken(color: string, concentration: number) { return Color(color).darken(concentration).toString() } +/** + * hsl 转成16进制 + * @param hsl + * @returns + */ +export function hslToHex(hslString: string): string { + const color = Color(hslString); + return color.hex() +} + /** * * 修改主题色 * @param themeName 主题名称 diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue index fdca3b4a..9dd2e32b 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue @@ -1,5 +1,14 @@ + + diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.ts b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.ts new file mode 100644 index 00000000..0008d299 --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.ts @@ -0,0 +1,3 @@ +import CreateColorRender from './index.vue' + +export { CreateColorRender } diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue new file mode 100644 index 00000000..6bcdd75e --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts new file mode 100644 index 00000000..e9a1048b --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts @@ -0,0 +1,47 @@ +import { echartOptionProfixHandle } from '@/packages/public' + +export const includes = ['legend', 'xAxis', 'yAxis', 'grid'] + +const seriesHandle = (color: string[]) => { + const numHandle = (numsi: number, i: number) => parseInt(`${numsi * Math.random()}`, 10) * 2 + const nums = [60, 51, 200, 334, 366, 456, 223] + + return color.map((item, index) => ({ + name: `data${index + 1}`, + type: 'bar', + data: nums.map((numsItem, numsi) => numHandle(numsItem, index)) + })) +} + +export const option = (color: string[]) => { + return echartOptionProfixHandle( + { + tooltip: { + trigger: 'axis', + showContent: false, + axisPointer: { + type: 'shadow' + } + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: { + type: 'category', + data: color.map((e, i) => `data${i + 1}`), + axisTick: { + alignWithLabel: true + } + }, + yAxis: { + show: true, + type: 'value' + }, + series: seriesHandle(color || []) + }, + includes + ) +} diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.ts b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.ts new file mode 100644 index 00000000..cf82cfcc --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.ts @@ -0,0 +1,3 @@ +import CreateColorRenderChart from './index.vue' + +export { CreateColorRenderChart } diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.vue new file mode 100644 index 00000000..2733e982 --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/index.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/lineOptions.ts b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/lineOptions.ts new file mode 100644 index 00000000..2a41700d --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/lineOptions.ts @@ -0,0 +1,72 @@ +import { echartOptionProfixHandle } from '@/packages/public' +import { graphic } from 'echarts/core' +import { fade, hslToHex } from '@/utils' + +export const includes = ['legend', 'xAxis', 'yAxis', 'grid'] + +const seriesHandle = (color: string[]) => { + const numHandle = (numsi: number, i: number) => parseInt(`${numsi * Math.random()}`, 10) * 2 + const nums = [130, 251, 200, 334, 366, 456, 223] + + return color.map((item, index) => ({ + name: `data${index + 1}`, + type: 'line', + smooth: true, + lineStyle: { + width: 1, + type: 'solid' + }, + emphasis: { + focus: 'series' + }, + areaStyle: { + opacity: 0.8, + color: new graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 1, + color: item + }, + { + offset: 0, + color: item + } + ]) + }, + showSymbol: false, + data: nums.reverse().map((numsItem, numsi) => numHandle(numsItem, index)) + })) +} + +export const option = (color: string[]) => { + return echartOptionProfixHandle( + { + tooltip: { + trigger: 'axis', + showContent: false, + axisPointer: { + type: 'shadow' + } + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: color.map((e, i) => `data${i + 1}`), + axisTick: { + alignWithLabel: true + } + }, + yAxis: { + show: true, + type: 'value' + }, + series: seriesHandle(color || []) + }, + includes + ) +} diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index fc5a915e..f4ac2d24 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -128,6 +128,7 @@ From 7f1012274c020957a8882b04980f5fab841b291d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 25 Feb 2023 23:44:03 +0800 Subject: [PATCH 23/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CanvasPage/components/CreateColorRenderChart/barOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts index e9a1048b..20fe41a0 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions.ts @@ -4,7 +4,7 @@ export const includes = ['legend', 'xAxis', 'yAxis', 'grid'] const seriesHandle = (color: string[]) => { const numHandle = (numsi: number, i: number) => parseInt(`${numsi * Math.random()}`, 10) * 2 - const nums = [60, 51, 200, 334, 366, 456, 223] + const nums = [260, 251, 200, 334, 366, 256, 253] return color.map((item, index) => ({ name: `data${index + 1}`, From e54de6610386db96bb91da6aede57d8b31c0bb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sun, 26 Feb 2023 01:43:46 +0800 Subject: [PATCH 24/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20UI=20?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CreateColor/index.vue | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index c25300af..9f1a578e 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -211,9 +211,23 @@ const saveHandle = () => { // 取消 const closeHandle = () => { - colorList.splice(0, colorList.length) - selectColor.selectInfo = undefined - emit('update:modelShow', false) + const positiveHandle = () => { + updateColor.value = undefined + colorList.splice(0, colorList.length) + selectColor.selectInfo = undefined + emit('update:modelShow', false) + } + + if (updateColor.value !== undefined) { + goDialog({ + message: '当前有变动未保存,是否直接放弃修改?', + onPositiveCallback: () => { + positiveHandle() + } + }) + } else { + positiveHandle() + } } // 底色 From d2cc20288a1c991d46ed5d2c40801abd35cf8c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sun, 26 Feb 2023 13:08:22 +0800 Subject: [PATCH 25/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E7=BB=84=E4=BB=B6=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CanvasPage/components/CreateColorRender/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue index 71d94975..d601ac34 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue @@ -168,8 +168,8 @@ const computedColorList = (color?: string) => { }) return { - default: [...comLightenArr.splice(0, parseInt(`${num / 2}`)), ...comDarkenArr.splice(0, parseInt(`${num / 2}`))], - fade: comDarkenFadeArr + default: [...comLightenArr.reverse().splice(0, parseInt(`${num / 2}`) - 9), ...comDarkenArr.splice(0, parseInt(`${num / 2}`))], + fade: comDarkenFadeArr.reverse().splice(0, 27) } } From 2abf83b6bccb00ae7b1f0896983f7d50f01147ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sun, 26 Feb 2023 18:36:15 +0800 Subject: [PATCH 26/87] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E9=A2=9C=E8=89=B2=E5=92=8C=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/Lines/LineCommon/config.ts | 1 - src/settings/chartThemes/index.ts | 24 ++++------- src/settings/chartThemes/themes/chalk.json | 3 +- src/settings/chartThemes/themes/customed.json | 3 +- src/settings/chartThemes/themes/dark.json | 3 +- src/settings/chartThemes/themes/essos.json | 3 +- src/settings/chartThemes/themes/macarons.json | 3 +- .../chartThemes/themes/purple-passion.json | 3 +- src/settings/chartThemes/themes/roma.json | 3 +- src/settings/chartThemes/themes/shine.json | 3 +- src/settings/chartThemes/themes/vintage.json | 3 +- src/settings/chartThemes/themes/walden.json | 3 +- src/settings/chartThemes/themes/westeros.json | 3 +- .../chartThemes/themes/wonderland.json | 3 +- .../chartEditStore/chartEditStore.d.ts | 6 ++- .../modules/chartEditStore/chartEditStore.ts | 2 + src/utils/style.ts | 26 ++++++++++- .../components/ChartThemeColor/index.vue | 28 ++++++++---- .../components/CreateColor/index.vue | 43 ++++++++++++++++--- .../components/CreateColorRender/index.vue | 5 ++- .../CreateColorRenderChart/index.vue | 4 +- .../components/EditGroup/index.vue | 6 +-- src/views/chart/ContentEdit/index.vue | 6 +-- 23 files changed, 132 insertions(+), 55 deletions(-) diff --git a/src/packages/components/Charts/Lines/LineCommon/config.ts b/src/packages/components/Charts/Lines/LineCommon/config.ts index 917a5064..c6c07610 100644 --- a/src/packages/components/Charts/Lines/LineCommon/config.ts +++ b/src/packages/components/Charts/Lines/LineCommon/config.ts @@ -1,7 +1,6 @@ import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public' import { LineCommonConfig } from './index' import { CreateComponentType } from '@/packages/index.d' -import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index' import cloneDeep from 'lodash/cloneDeep' import dataJson from './data.json' diff --git a/src/settings/chartThemes/index.ts b/src/settings/chartThemes/index.ts index 7a205c1c..75e79e5c 100644 --- a/src/settings/chartThemes/index.ts +++ b/src/settings/chartThemes/index.ts @@ -34,23 +34,17 @@ export const defaultTheme = 'dark' // 默认展示的选择器颜色列表 export const swatchesColors = ['#232324', '#2a2a2b', '#313132', '#373739', '#757575', '#e0e0e0', '#eeeeee', '#fafafa'] -// 主题色列表 -export type ChartColorsNameType = keyof typeof chartColorsName -export const chartColorsName = { - dark: '明亮', - customed: '暗淡', - macarons: '马卡龙', - walden: '蓝绿', - purplePassion: '深紫', - vintage: '复古', - chalk: '粉青', - westeros: '灰粉', - wonderland: '青草', - essos: '橘红', - shine: '深色', - roma: '罗马红' +// 自定义颜色 +export type CustomColorsType = { + id: string, + name: string, + color: string[] } +// 主题色列表, 自定义的颜色使用的是 UUID 作为标识,因为两者数据结构不一致 +export type ChartColorsNameType = keyof typeof chartColors + + // 渐变主题色列表(主色1、主色2、阴影、渐变1、渐变2) export const chartColorsSearch = { dark: ['#4992ff', '#7cffb2', 'rgba(68, 181, 226, 0.3)', 'rgba(73, 146, 255, 0.5)', 'rgba(124, 255, 178, 0.5)'], diff --git a/src/settings/chartThemes/themes/chalk.json b/src/settings/chartThemes/themes/chalk.json index 09ac9268..62f4b9ea 100644 --- a/src/settings/chartThemes/themes/chalk.json +++ b/src/settings/chartThemes/themes/chalk.json @@ -8,5 +8,6 @@ "#d4a4eb", "#d2f5a6", "#76f2f2" - ] + ], + "name": "粉青" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/customed.json b/src/settings/chartThemes/themes/customed.json index d29733a6..2a0ffa2c 100644 --- a/src/settings/chartThemes/themes/customed.json +++ b/src/settings/chartThemes/themes/customed.json @@ -9,5 +9,6 @@ "#fc8452", "#9a60b4", "#ea7ccc" - ] + ], + "name": "暗淡" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/dark.json b/src/settings/chartThemes/themes/dark.json index 59126d9b..887a6469 100644 --- a/src/settings/chartThemes/themes/dark.json +++ b/src/settings/chartThemes/themes/dark.json @@ -9,5 +9,6 @@ "#ff8a45", "#8d48e3", "#dd79ff" - ] + ], + "name": "明亮" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/essos.json b/src/settings/chartThemes/themes/essos.json index 18823d46..27d57201 100644 --- a/src/settings/chartThemes/themes/essos.json +++ b/src/settings/chartThemes/themes/essos.json @@ -6,5 +6,6 @@ "#ffb248", "#f2d643", "#ebdba4" - ] + ], + "name": "橘红" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/macarons.json b/src/settings/chartThemes/themes/macarons.json index a800789a..14a4aa0f 100644 --- a/src/settings/chartThemes/themes/macarons.json +++ b/src/settings/chartThemes/themes/macarons.json @@ -20,5 +20,6 @@ "#7eb00a", "#6f5553", "#c14089" - ] + ], + "name": "马卡龙" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/purple-passion.json b/src/settings/chartThemes/themes/purple-passion.json index d96e4104..91550499 100644 --- a/src/settings/chartThemes/themes/purple-passion.json +++ b/src/settings/chartThemes/themes/purple-passion.json @@ -6,5 +6,6 @@ "#71669e", "#cc70af", "#7cb4cc" - ] + ], + "name": "深紫" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/roma.json b/src/settings/chartThemes/themes/roma.json index 2b527f53..be5af4df 100644 --- a/src/settings/chartThemes/themes/roma.json +++ b/src/settings/chartThemes/themes/roma.json @@ -20,5 +20,6 @@ "#3cb371", "#d5b158", "#38b6b6" - ] + ], + "name": "罗马红" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/shine.json b/src/settings/chartThemes/themes/shine.json index 4c4e0f88..1b2d8529 100644 --- a/src/settings/chartThemes/themes/shine.json +++ b/src/settings/chartThemes/themes/shine.json @@ -8,5 +8,6 @@ "#339ca8", "#cda819", "#32a487" - ] + ], + "name": "深色" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/vintage.json b/src/settings/chartThemes/themes/vintage.json index 28190dd7..72957825 100644 --- a/src/settings/chartThemes/themes/vintage.json +++ b/src/settings/chartThemes/themes/vintage.json @@ -10,5 +10,6 @@ "#cc7e63", "#724e58", "#4b565b" - ] + ], + "name": "复古" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/walden.json b/src/settings/chartThemes/themes/walden.json index 2cf15ab9..37127fba 100644 --- a/src/settings/chartThemes/themes/walden.json +++ b/src/settings/chartThemes/themes/walden.json @@ -6,5 +6,6 @@ "#a0a7e6", "#c4ebad", "#96dee8" - ] + ], + "name": "蓝绿" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/westeros.json b/src/settings/chartThemes/themes/westeros.json index 257891de..6dc5d0b6 100644 --- a/src/settings/chartThemes/themes/westeros.json +++ b/src/settings/chartThemes/themes/westeros.json @@ -6,5 +6,6 @@ "#93b7e3", "#a5e7f0", "#cbb0e3" - ] + ], + "name": "灰粉" } \ No newline at end of file diff --git a/src/settings/chartThemes/themes/wonderland.json b/src/settings/chartThemes/themes/wonderland.json index 06c33113..c3739021 100644 --- a/src/settings/chartThemes/themes/wonderland.json +++ b/src/settings/chartThemes/themes/wonderland.json @@ -6,5 +6,6 @@ "#d0648a", "#f58db2", "#f2b3c9" - ] + ], + "name": "青草" } \ No newline at end of file diff --git a/src/store/modules/chartEditStore/chartEditStore.d.ts b/src/store/modules/chartEditStore/chartEditStore.d.ts index 0084f673..f06bccbc 100644 --- a/src/store/modules/chartEditStore/chartEditStore.d.ts +++ b/src/store/modules/chartEditStore/chartEditStore.d.ts @@ -10,7 +10,7 @@ import { RequestParamsObjType } from '@/enums/httpEnum' import { PreviewScaleEnum } from '@/enums/styleEnum' -import type { ChartColorsNameType, GlobalThemeJsonType } from '@/settings/chartThemes/index' +import type { ChartColorsNameType, CustomColorsType, GlobalThemeJsonType } from '@/settings/chartThemes/index' // 编辑画布属性 export enum EditCanvasTypeEnum { @@ -52,6 +52,7 @@ export enum EditCanvasConfigEnum { WIDTH = 'width', HEIGHT = 'height', CHART_THEME_COLOR = 'chartThemeColor', + CHART_CUSTOM_THEME_COLOR_INFO = 'chartCustomThemeColorInfo', CHART_THEME_SETTING = 'chartThemeSetting', BACKGROUND = 'background', BACKGROUND_IMAGE = 'backgroundImage', @@ -87,9 +88,12 @@ export interface EditCanvasConfigType { [EditCanvasConfigEnum.HEIGHT]: number // 背景色 [EditCanvasConfigEnum.BACKGROUND]?: string + // 背景图片 [EditCanvasConfigEnum.BACKGROUND_IMAGE]?: string | null // 图表主题颜色 [EditCanvasConfigEnum.CHART_THEME_COLOR]: ChartColorsNameType + // 自定义图表主题颜色 + [EditCanvasConfigEnum.CHART_CUSTOM_THEME_COLOR_INFO]?: CustomColorsType[] // 图表全局配置 [EditCanvasConfigEnum.CHART_THEME_SETTING]: GlobalThemeJsonType // 图表主题颜色 diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 81d7a3b5..4469369e 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -108,6 +108,8 @@ export const useChartEditStore = defineStore({ selectColor: true, // chart 主题色 chartThemeColor: defaultTheme || 'dark', + // 自定义颜色列表 + chartCustomThemeColorInfo: undefined, // 全局配置 chartThemeSetting: globalThemeJson, // 适配方式 diff --git a/src/utils/style.ts b/src/utils/style.ts index 212cb33e..d4a9d30d 100644 --- a/src/utils/style.ts +++ b/src/utils/style.ts @@ -2,6 +2,7 @@ import Color from 'color' import { useDesignStore } from '@/store/modules/designStore/designStore' import { PickCreateComponentType } from '@/packages/index.d' import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' +import { chartColors, CustomColorsType } from '@/settings/chartThemes/index' type AttrType = PickCreateComponentType<'attr'> type StylesType = PickCreateComponentType<'styles'> @@ -87,7 +88,7 @@ export function darken(color: string, concentration: number) { } /** - * hsl 转成16进制 + * * hsl 转成16进制 * @param hsl * @returns */ @@ -115,3 +116,26 @@ export const setHtmlTheme = (themeName?: string) => { const designStore = useDesignStore() e.setAttribute('data-theme', designStore.themeName) } + +/** + * * 合并基础颜色和自定义颜色 + * @param chartDefaultColors + * @param customColor + * @returns + */ +export const colorCustomMerge = (customColor?: CustomColorsType[]) => { + type FormateCustomColorType = { + [T: string]: { + color: string[] + name: string + } + } + const formateCustomColor: FormateCustomColorType = {} + customColor?.forEach(item => { + formateCustomColor[item.id] = { + color: item.color, + name: item.name + } + }) + return { ...formateCustomColor, ...chartColors } +} \ No newline at end of file diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue index 9dd2e32b..9891ad88 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue @@ -10,7 +10,7 @@
- {{ chartColorsName[key] }} + {{ value.name }} import('../CreateColor/index.vue')) const { SquareIcon, AddIcon } = icon.ionicons5 @@ -54,10 +61,10 @@ const chartEditStore = useChartEditStore() const designStore = useDesignStore() const createColorModelShow = ref(false) -// 创建颜色 -const createColorHandle = () => { - createColorModelShow.value = true -} +// 合并默认颜色和自定义颜色 +const comChartColors = computed(() => { + return colorCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo) +}) // 颜色 const themeColor = computed(() => { @@ -69,6 +76,11 @@ const selectName = computed(() => { return chartEditStore.getEditCanvasConfig.chartThemeColor }) +// 创建颜色 +const createColorHandle = () => { + createColorModelShow.value = true +} + // 底色 const colorBackgroundImage = (item: { color: string[] }) => { return `linear-gradient(to right, ${item.color[0]} 0%, ${item.color[5]} 100%)` diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index 9f1a578e..35964b5e 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -78,7 +78,7 @@ - - + \ No newline at end of file diff --git a/src/views/chart/ContentEdit/components/EditGroup/index.vue b/src/views/chart/ContentEdit/components/EditGroup/index.vue index 5d7f1462..03cced49 100644 --- a/src/views/chart/ContentEdit/components/EditGroup/index.vue +++ b/src/views/chart/ContentEdit/components/EditGroup/index.vue @@ -56,7 +56,7 @@ import { MenuEnum } from '@/enums/editPageEnum' import { chartColors } from '@/settings/chartThemes/index' import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d' -import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' +import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle, colorCustomMerge } from '@/utils' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useContextMenu, divider } from '@/views/chart/hooks/useContextMenu.hook' import { useMouseHandle } from '../../hooks/useDrag.hook' @@ -117,8 +117,8 @@ const optionsHandle = ( // 配置项 const themeColor = computed(() => { - const chartThemeColor = chartEditStore.getEditCanvasConfig.chartThemeColor - return chartColors[chartThemeColor] + const colorCustomMergeData = colorCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo) + return colorCustomMergeData[chartEditStore.getEditCanvasConfig.chartThemeColor] }) // 主题色 diff --git a/src/views/chart/ContentEdit/index.vue b/src/views/chart/ContentEdit/index.vue index 2598f65f..1ea44997 100644 --- a/src/views/chart/ContentEdit/index.vue +++ b/src/views/chart/ContentEdit/index.vue @@ -87,7 +87,7 @@ import { onMounted, computed } from 'vue' import { chartColors } from '@/settings/chartThemes/index' import { MenuEnum } from '@/enums/editPageEnum' import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' -import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' +import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle, colorCustomMerge } from '@/utils' import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook' import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -146,8 +146,8 @@ const themeSetting = computed(() => { // 配置项 const themeColor = computed(() => { - const chartThemeColor = chartEditStore.getEditCanvasConfig.chartThemeColor - return chartColors[chartThemeColor] + const colorCustomMergeData = colorCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo) + return colorCustomMergeData[chartEditStore.getEditCanvasConfig.chartThemeColor] }) // 是否展示渲染 From 9222dec9f2bb27f08961038dfb3c37a39cce988a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sun, 26 Feb 2023 23:34:40 +0800 Subject: [PATCH 27/87] =?UTF-8?q?perf:=20=E5=A4=84=E7=90=86=E6=B8=90?= =?UTF-8?q?=E5=8F=98=E8=89=B2=E5=92=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E8=89=B2?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/Lines/LineGradientSingle/index.vue | 6 ++- .../Charts/Lines/LineGradients/index.vue | 6 ++- .../Charts/Lines/LineLinearSingle/index.vue | 6 ++- .../Charts/Mores/WaterPolo/index.vue | 6 ++- src/utils/style.ts | 36 +++++++++++--- .../components/CreateColor/index.vue | 49 +++++++++++++------ .../components/PreviewRenderList/index.vue | 9 ++-- 7 files changed, 84 insertions(+), 34 deletions(-) diff --git a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue index e0d9fb7e..0bd33cfe 100644 --- a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue +++ b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue @@ -15,7 +15,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index' import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components' import { useChartDataFetch } from '@/hooks' -import { isPreview } from '@/utils' +import { isPreview, colorGradientCustomMerge} from '@/utils' const props = defineProps({ themeSetting: { @@ -45,7 +45,9 @@ watch( (newColor: keyof typeof chartColorsSearch) => { try { if (!isPreview()) { - const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] + const themeColor = + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] || + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme] props.chartConfig.option.series.forEach((value: any, index: number) => { value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [ { diff --git a/src/packages/components/Charts/Lines/LineGradients/index.vue b/src/packages/components/Charts/Lines/LineGradients/index.vue index 8643426f..67ed6437 100644 --- a/src/packages/components/Charts/Lines/LineGradients/index.vue +++ b/src/packages/components/Charts/Lines/LineGradients/index.vue @@ -14,7 +14,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index' import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components' import { useChartDataFetch } from '@/hooks' -import { isPreview } from '@/utils' +import { isPreview, colorGradientCustomMerge} from '@/utils' const props = defineProps({ themeSetting: { @@ -44,7 +44,9 @@ watch( (newColor: keyof typeof chartColorsSearch) => { try { if (!isPreview()) { - const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] + const themeColor = + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] || + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme] props.chartConfig.option.series.forEach((value: any, index: number) => { value.areaStyle.color = new graphic.LinearGradient(0, 0, 0, 1, [ { diff --git a/src/packages/components/Charts/Lines/LineLinearSingle/index.vue b/src/packages/components/Charts/Lines/LineLinearSingle/index.vue index 19f4ef70..b2863a23 100644 --- a/src/packages/components/Charts/Lines/LineLinearSingle/index.vue +++ b/src/packages/components/Charts/Lines/LineLinearSingle/index.vue @@ -15,7 +15,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index' import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components' import { useChartDataFetch } from '@/hooks' -import { isPreview } from '@/utils' +import { isPreview, colorGradientCustomMerge } from '@/utils' const props = defineProps({ themeSetting: { @@ -45,7 +45,9 @@ watch( (newColor: keyof typeof chartColorsSearch) => { try { if (!isPreview()) { - const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] + const themeColor = + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] || + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme] props.chartConfig.option.series.forEach((value: any) => { value.lineStyle.shadowColor = themeColor[2] value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => { diff --git a/src/packages/components/Charts/Mores/WaterPolo/index.vue b/src/packages/components/Charts/Mores/WaterPolo/index.vue index f5aa4f74..e1fefed9 100644 --- a/src/packages/components/Charts/Mores/WaterPolo/index.vue +++ b/src/packages/components/Charts/Mores/WaterPolo/index.vue @@ -10,7 +10,7 @@ import 'echarts-liquidfill/src/liquidFill.js' import { CanvasRenderer } from 'echarts/renderers' import { GridComponent } from 'echarts/components' import config from './config' -import { isPreview, isString, isNumber } from '@/utils' +import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils' import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartDataFetch } from '@/hooks' @@ -44,7 +44,9 @@ watch( (newColor: keyof typeof chartColorsSearch) => { try { if (!isPreview()) { - const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] + const themeColor = + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] || + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme] // 背景颜色 props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2] // 水球颜色 diff --git a/src/utils/style.ts b/src/utils/style.ts index d4a9d30d..34dce3fe 100644 --- a/src/utils/style.ts +++ b/src/utils/style.ts @@ -2,7 +2,7 @@ import Color from 'color' import { useDesignStore } from '@/store/modules/designStore/designStore' import { PickCreateComponentType } from '@/packages/index.d' import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' -import { chartColors, CustomColorsType } from '@/settings/chartThemes/index' +import { chartColors, chartColorsSearch, CustomColorsType } from '@/settings/chartThemes/index' type AttrType = PickCreateComponentType<'attr'> type StylesType = PickCreateComponentType<'styles'> @@ -93,12 +93,12 @@ export function darken(color: string, concentration: number) { * @returns */ export function hslToHexa(hslString: string): string { - const color = Color(hslString); + const color = Color(hslString) return color.hexa() } export function hslToHex(hslString: string): string { - const color = Color(hslString); + const color = Color(hslString) return color.hex() } @@ -119,9 +119,9 @@ export const setHtmlTheme = (themeName?: string) => { /** * * 合并基础颜色和自定义颜色 - * @param chartDefaultColors - * @param customColor - * @returns + * @param chartDefaultColors + * @param customColor + * @returns */ export const colorCustomMerge = (customColor?: CustomColorsType[]) => { type FormateCustomColorType = { @@ -138,4 +138,26 @@ export const colorCustomMerge = (customColor?: CustomColorsType[]) => { } }) return { ...formateCustomColor, ...chartColors } -} \ No newline at end of file +} + +/** + * * 合并基础渐变颜色和自定义渐变颜色 + * @param customColor + */ +export const colorGradientCustomMerge = (customColor?: CustomColorsType[]) => { + type FormateGradientCustomColorType = { + [T: string]: string[] + } + const formateGradientCustomColor: FormateGradientCustomColorType = {} + customColor?.forEach(item => { + formateGradientCustomColor[item.id] = [ + item.color[0], + item.color[1], + fade(item.color[0], 0.3), + fade(item.color[0], 0.5), + fade(item.color[1], 0.5) + ] + }) + + return { ...formateGradientCustomColor, ...chartColorsSearch } +} diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index 35964b5e..1c8c3271 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -199,21 +199,34 @@ const createColor = () => { // 删除 const deleteHandle = (index: number) => { - goDialog({ - message: `是否删除此颜色?`, - onPositiveCallback: () => { - colorList.splice(index, 1) - chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_CUSTOM_THEME_COLOR_INFO, cloneDeep(colorList)) - nextTick(() => { - if (index) { - selectHandle(colorList[index - 1]) - } else { - // 已清空 - selectColor.selectInfo = undefined - } - }) - } - }) + const positiveHandle = () => { + colorList.splice(index, 1) + chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_CUSTOM_THEME_COLOR_INFO, cloneDeep(colorList)) + nextTick(() => { + if (index) { + selectHandle(colorList[index - 1]) + } else { + // 已清空 + selectColor.selectInfo = undefined + } + }) + } + if (updateColor.value !== undefined) { + goDialog({ + message: '当前有变动未保存,是否直接放弃修改?', + onPositiveCallback: () => { + updateColor.value = undefined + positiveHandle() + } + }) + } else { + goDialog({ + message: `是否删除此颜色?`, + onPositiveCallback: () => { + positiveHandle() + } + }) + } } // 存储更新数据的值 @@ -226,13 +239,17 @@ const saveHandle = () => { if (!updateColor.value) return const index = colorList.findIndex(item => item.id === updateColor.value?.id) if (index !== -1) { + window.$message.success('颜色应用成功!') const updateColorPrefix = cloneDeep({ ...updateColor.value, name: updateColor.value.name || '未定义' }) colorList.splice(index, 1, updateColorPrefix) - window.$message.success('颜色应用成功!') updateColor.value = undefined + const selectTheme = chartEditStore.getEditCanvasConfig.chartThemeColor + // 变换主题强制渐变色更新 + chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_THEME_COLOR, 'dark') // 存储到全局数据中 nextTick(() => { chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_CUSTOM_THEME_COLOR_INFO, cloneDeep(colorList)) + chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_THEME_COLOR, selectTheme) }) } else { window.$message.error('颜色应用失败!') diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue index eca587aa..800214cf 100644 --- a/src/views/preview/components/PreviewRenderList/index.vue +++ b/src/views/preview/components/PreviewRenderList/index.vue @@ -43,12 +43,14 @@ import { ChartEditStorageType } from '../../index.d' import { PreviewRenderGroup } from '../PreviewRenderGroup/index' import { CreateComponentGroupType } from '@/packages/index.d' import { chartColors } from '@/settings/chartThemes/index' -import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' +import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle, colorCustomMerge } from '@/utils' import { getSizeStyle, getComponentAttrStyle, getStatusStyle, getPreviewConfigStyle } from '../../utils' import { useLifeHandler } from '@/hooks' // 初始化数据池 const { initDataPond, clearMittDataPondMap } = useChartDataPondFetch() +const chartEditStore = useChartEditStore() const props = defineProps({ localStorageInfo: { @@ -63,10 +65,11 @@ const themeSetting = computed(() => { return chartThemeSetting }) + // 配置项 const themeColor = computed(() => { - const chartThemeColor = props.localStorageInfo.editCanvasConfig.chartThemeColor - return chartColors[chartThemeColor] + const colorCustomMergeData = colorCustomMerge(props.localStorageInfo.editCanvasConfig.chartCustomThemeColorInfo) + return colorCustomMergeData[props.localStorageInfo.editCanvasConfig.chartThemeColor] }) // 组件渲染结束初始化数据池 From 4bc41fbde8a50fa33c7aac2e212bce4439f0673b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 27 Feb 2023 00:24:19 +0800 Subject: [PATCH 28/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CanvasPage/components/CreateColor/index.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index 1c8c3271..5edac24a 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -183,6 +183,7 @@ const createColor = () => { colorList.push(newData) selectHandle(newData) updateColor.value = newData + saveHandle(false) } if (updateColor.value !== undefined) { goDialog({ @@ -235,11 +236,11 @@ const updateColorHandle = (newColor: ColorType) => { } // 保存数据 -const saveHandle = () => { +const saveHandle = (onMessage = true) => { if (!updateColor.value) return const index = colorList.findIndex(item => item.id === updateColor.value?.id) if (index !== -1) { - window.$message.success('颜色应用成功!') + onMessage && window.$message.success('数据应用成功!') const updateColorPrefix = cloneDeep({ ...updateColor.value, name: updateColor.value.name || '未定义' }) colorList.splice(index, 1, updateColorPrefix) updateColor.value = undefined @@ -252,7 +253,7 @@ const saveHandle = () => { chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_THEME_COLOR, selectTheme) }) } else { - window.$message.error('颜色应用失败!') + window.$message.error('数据应用失败!') } } From 82d800f943bd706bd987d3b3b32e97ddf674ac55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 27 Feb 2023 12:46:36 +0800 Subject: [PATCH 29/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=E7=BB=84=E4=BB=B6=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CanvasPage/components/CreateColor/index.vue | 8 ++++---- .../components/CreateColorRender/index.vue | 12 +++++++++++- .../chart/ContentEdit/components/EditRange/index.vue | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index 5edac24a..4186750c 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -56,7 +56,7 @@ 立即创建 -
+
{{ item.name }}
@@ -127,7 +127,7 @@ type ColorType = { const defaultColor: ColorType = { id: getUUID(), name: '未命名', - color: ['#6ae5bb', '#69e3de', '#5ac4ee', '#5ac4ee', '#4498ec', '#3c7ddf'] + color: ['#6ae5bb', '#69e3de', '#5ac5ee', '#5ac4ee', '#4498ec', '#3c7ddf'] } const chartEditStore = useChartEditStore() const modelShowRef = ref(false) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue index 7a842200..a3f6c441 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRender/index.vue @@ -27,6 +27,7 @@ :show-preview="true" :modes="['hex']" @complete="completeHandle($event, index)" + @update:show="selectHandle(item, index)" />
@@ -183,7 +184,13 @@ const getRenderBackgroundColor = (color?: string) => { } } -// 顶部选择颜色 +// 点击颜色 +const selectHandle = (color: string, index: number) => { + targetColor.color = color + targetColor.index = index +} + +// 顶部改变颜色 const completeHandle = (color?: string, index?: number) => { color && (targetColor.color = color) index && (targetColor.index = index) @@ -205,6 +212,9 @@ const selectExpandColor = (color: string, isHexa: boolean) => { const addColor = () => { const lastData = editColor.value?.color[editColor.value?.color.length - 1] || '#2c2c31' editColor.value?.color.push(lastData) + nextTick(() => { + emit('updateColor', editColor.value) + }) } // 删除颜色 diff --git a/src/views/chart/ContentEdit/components/EditRange/index.vue b/src/views/chart/ContentEdit/components/EditRange/index.vue index d9a7bcc9..d3be9d95 100644 --- a/src/views/chart/ContentEdit/components/EditRange/index.vue +++ b/src/views/chart/ContentEdit/components/EditRange/index.vue @@ -55,7 +55,7 @@ const rangeModelStyle = computed(() => { position: relative; transform-origin: left top; background-size: cover; - border-radius: 20px; + border-radius: 10px; overflow: hidden; @include fetch-border-color('hover-border-color'); @include fetch-bg-color('background-color2'); From 61c43df51b7a06f813024d8a20d416f0095051fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 27 Feb 2023 13:06:27 +0800 Subject: [PATCH 30/87] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=A2=9C=E8=89=B2=E4=B9=8B=E5=90=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CanvasPage/components/CreateColor/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue index 4186750c..e73eba55 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColor/index.vue @@ -204,8 +204,8 @@ const deleteHandle = (index: number) => { colorList.splice(index, 1) chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_CUSTOM_THEME_COLOR_INFO, cloneDeep(colorList)) nextTick(() => { - if (index) { - selectHandle(colorList[index - 1]) + if (colorList.length) { + selectHandle(colorList[index - 1 > -1 ? index - 1 : index]) } else { // 已清空 selectColor.selectInfo = undefined From b269933ffa2925e7c56d68c721a287f97ffb39af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Fri, 3 Mar 2023 22:25:36 +0800 Subject: [PATCH 31/87] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=BC=96?= =?UTF-8?q?=E8=BE=91=20JSON=20=E4=BA=A4=E4=BA=92=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/editPageEnum.ts | 3 +- src/layout/components/LayoutHeader/index.vue | 2 +- src/plugins/icon.ts | 7 +- .../chartEditStore/chartEditStore.d.ts | 5 +- .../modules/chartEditStore/chartEditStore.ts | 4 +- .../EditTools/hooks/useSyncUpdate.hook.ts | 46 +++++++-- .../components/EditTools/index.vue | 16 ++- .../ContentHeader/headerRightBtn/index.vue | 32 ++++-- src/views/edit/index.vue | 99 +++++++++++++------ 9 files changed, 158 insertions(+), 56 deletions(-) diff --git a/src/enums/editPageEnum.ts b/src/enums/editPageEnum.ts index 07d51e70..518b6f70 100644 --- a/src/enums/editPageEnum.ts +++ b/src/enums/editPageEnum.ts @@ -12,7 +12,8 @@ export enum DragKeyEnum { // 不同页面保存操作 export enum SavePageEnum { CHART = 'SaveChart', - JSON = 'SaveJSON' + JSON = 'SaveJSON', + CLOSE = 'close' } // 操作枚举 diff --git a/src/layout/components/LayoutHeader/index.vue b/src/layout/components/LayoutHeader/index.vue index 91c80823..718a9282 100644 --- a/src/layout/components/LayoutHeader/index.vue +++ b/src/layout/components/LayoutHeader/index.vue @@ -29,7 +29,7 @@ import { ThemeColorSelect } from '@/components/Pages/ThemeColorSelect' From 2e9e972826fa88e68201f0ef5a4704b6119106b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=AD=94=E6=B3=89?= Date: Thu, 9 Mar 2023 10:38:57 +0800 Subject: [PATCH 38/87] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0query=E5=8F=82=E6=95=B0=E7=9A=84=E6=97=B6=E5=80=99ID?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BC=82=E5=B8=B8=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=89=8D=E7=BD=AE=E5=AE=88=E5=8D=AB=E6=8A=8A=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8F=82=E6=95=B0=E6=94=BE=E5=85=A5window.ro?= =?UTF-8?q?ute.params=EF=BC=8C=E5=90=8E=E7=BB=ADAPI=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=AF=E4=BB=A5=E6=8B=BC=E6=8E=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://localhost:3000/#/chart/preview/792622755697790976?t=123 动态请求参数中使用javascript: return window.route?.params?.t --- src/router/router-guards.ts | 7 +++++++ src/utils/router.ts | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/router/router-guards.ts b/src/router/router-guards.ts index aedb0667..7d2a885d 100644 --- a/src/router/router-guards.ts +++ b/src/router/router-guards.ts @@ -5,6 +5,13 @@ import { loginCheck } from '@/utils' export function createRouterGuards(router: Router) { // 前置 router.beforeEach(async (to, from, next) => { + // http://localhost:3000/#/chart/preview/792622755697790976?t=123 + // 把外部动态参数放入window.route.params,后续API动态接口可以用window.route?.params?.t来拼接参数 + // @ts-ignore + if (!window.route) window.route = {params: {}} + // @ts-ignore + Object.assign(window.route.params, to.query) + const Loading = window['$loading']; Loading && Loading.start(); const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name); diff --git a/src/utils/router.ts b/src/utils/router.ts index f2a9c696..ea17d78a 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -159,7 +159,8 @@ export const fetchRouteParams = () => { */ export const fetchRouteParamsLocation = () => { try { - return document.location.hash.split('/').pop() || '' + // 防止添加query参数的时候,解析ID异常 + return document.location.hash.split('?')[0].split('/').pop() || '' } catch (error) { window['$message'].warning('查询路由信息失败,请联系管理员!') return '' @@ -190,4 +191,4 @@ export const loginCheck = () => { } catch (error) { return false } -} \ No newline at end of file +} \ No newline at end of file From 93350f0f6a4e1d9ff8288c1b13c9f09dbb46cd54 Mon Sep 17 00:00:00 2001 From: xiangmaoshuo <544437819@qq.com> Date: Thu, 9 Mar 2023 18:26:50 +0800 Subject: [PATCH 39/87] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=97=B6=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EchartsRendererSetting.vue | 45 +++++++++++++++++++ .../Pages/ChartItemSetting/GlobalSetting.vue | 41 +++++++++++++++++ src/hooks/useCanvasInitOptions.hook.ts | 26 +++++++++++ .../Charts/Bars/BarCommon/index.vue | 4 ++ .../Charts/Bars/BarCrossrange/index.vue | 4 ++ .../Charts/Lines/LineCommon/index.vue | 4 ++ .../Charts/Lines/LineGradientSingle/index.vue | 5 ++- .../Charts/Lines/LineGradients/index.vue | 5 ++- .../Charts/Lines/LineLinearSingle/index.vue | 5 ++- .../components/Charts/Maps/MapBase/index.vue | 5 ++- .../components/Charts/Mores/Funnel/index.vue | 5 ++- .../components/Charts/Mores/Heatmap/index.vue | 5 ++- .../components/Charts/Mores/Radar/index.vue | 5 ++- .../components/Charts/Mores/TreeMap/index.vue | 5 ++- .../Charts/Mores/WaterPolo/index.vue | 5 ++- .../Charts/Pies/PieCircle/index.vue | 5 ++- .../Charts/Pies/PieCommon/index.vue | 5 ++- .../Charts/Scatters/ScatterCommon/index.vue | 4 ++ .../ScatterLogarithmicRegression/index.vue | 4 ++ .../Informations/Mores/WordCloud/config.vue | 3 +- .../Informations/Mores/WordCloud/index.vue | 4 ++ src/settings/chartThemes/index.ts | 5 ++- src/views/preview/hooks/useScale.hook.ts | 18 +++++++- 23 files changed, 202 insertions(+), 15 deletions(-) create mode 100644 src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue create mode 100644 src/hooks/useCanvasInitOptions.hook.ts diff --git a/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue b/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue new file mode 100644 index 00000000..f7624fef --- /dev/null +++ b/src/components/Pages/ChartItemSetting/EchartsRendererSetting.vue @@ -0,0 +1,45 @@ + + diff --git a/src/components/Pages/ChartItemSetting/GlobalSetting.vue b/src/components/Pages/ChartItemSetting/GlobalSetting.vue index 35a74235..a416e69c 100644 --- a/src/components/Pages/ChartItemSetting/GlobalSetting.vue +++ b/src/components/Pages/ChartItemSetting/GlobalSetting.vue @@ -1,4 +1,34 @@