diff --git a/src/assets/images/canvas/noImage.png b/src/assets/images/canvas/noImage.png index 522694e9..a927780b 100644 Binary files a/src/assets/images/canvas/noImage.png and b/src/assets/images/canvas/noImage.png differ diff --git a/src/assets/images/canvas/pageBg.png b/src/assets/images/canvas/pageBg.png new file mode 100644 index 00000000..d393f2b2 Binary files /dev/null and b/src/assets/images/canvas/pageBg.png differ diff --git a/src/components/LoadingComponent/Skeleton.vue b/src/components/LoadingComponent/Skeleton.vue new file mode 100644 index 00000000..fd56b243 --- /dev/null +++ b/src/components/LoadingComponent/Skeleton.vue @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/src/components/LoadingComponent/index.ts b/src/components/LoadingComponent/index.ts index 434d7dd9..a9b3e40f 100644 --- a/src/components/LoadingComponent/index.ts +++ b/src/components/LoadingComponent/index.ts @@ -1,6 +1,7 @@ import type { App } from 'vue' import LoadingComponent from './index.vue' import AsyncLoading from './index.vue' +import AsyncSkeletonLoading from './Skeleton.vue' // 正常组件 export { LoadingComponent } @@ -9,4 +10,8 @@ export { LoadingComponent } AsyncLoading.install = (app: App): void => { app.component('AsyncLoading', AsyncLoading) } -export { AsyncLoading } + +AsyncSkeletonLoading.install = (app: App): void => { + app.component('AsyncSkeletonLoading', AsyncSkeletonLoading) +} +export { AsyncLoading, AsyncSkeletonLoading } diff --git a/src/plugins/icon.ts b/src/plugins/icon.ts index 3ca08fac..51ded250 100644 --- a/src/plugins/icon.ts +++ b/src/plugins/icon.ts @@ -101,7 +101,7 @@ const ionicons5 = { PencilIcon, // 编辑2(锤子) HammerIcon, - // 预览 + // 电脑 DesktopOutlineIcon, // 下载 DownloadIcon, @@ -115,7 +115,7 @@ const ionicons5 = { GridIcon, // 电脑1 TvOutlineIcon, - // 浏览器 + // 预览,浏览器 BrowsersOutlineIcon, // 文档 DocumentTextIcon, diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts index ffc12b02..75889dfd 100644 --- a/src/plugins/naive.ts +++ b/src/plugins/naive.ts @@ -84,6 +84,7 @@ import { NPopselect, NCollapse, NCollapseItem, + NColorPicker, NCollapseTransition } from 'naive-ui'; @@ -172,6 +173,7 @@ const naive = create({ NPopselect, NCollapse, NCollapseItem, + NColorPicker, NCollapseTransition ], }); diff --git a/src/store/modules/chartEditStore/chartEditStore.d.ts b/src/store/modules/chartEditStore/chartEditStore.d.ts index fcbe79b7..4d9718d7 100644 --- a/src/store/modules/chartEditStore/chartEditStore.d.ts +++ b/src/store/modules/chartEditStore/chartEditStore.d.ts @@ -5,13 +5,10 @@ import { HistoryActionTypeEnum } from '@/store/modules/chartHistoryStore/chartHi export enum EditCanvasTypeEnum { EDIT_LAYOUT_DOM = 'editLayoutDom', EDIT_CONTENT_DOM = 'editContentDom', - WIDTH = 'width', - HEIGHT = 'height', OFFSET = 'offset', SCALE = 'scale', USER_SCALE = 'userScale', LOCK_SCALE = 'lockScale', - BACKGROUND = 'background' } // 编辑区域 @@ -30,33 +27,42 @@ export type EditCanvasType = { } // 滤镜 -export enum EditCanvasFilterEnum { +export enum EditCanvasConfigEnum { + WIDTH = 'width', + HEIGHT = 'height', HUE_ROTATE = 'hueRotate', SATURATE = 'saturate', BRIGHTNESS = 'brightness', CONTRAST = 'contrast', UN_OPACITY = 'unOpacity', CHART_THEME = 'chartTheme', + BACKGROUND = 'background', + BACKGROUND_IAMGE = 'backgroundImage', + SELECT_COLOR = 'selectColor' } + export interface EditCanvasConfigType { // 大屏宽度 - [EditCanvasTypeEnum.WIDTH]: number + [EditCanvasConfigEnum.WIDTH]: number // 大屏高度 - [EditCanvasTypeEnum.HEIGHT]: number + [EditCanvasConfigEnum.HEIGHT]: number // 色相 - [EditCanvasFilterEnum.HUE_ROTATE]: number + [EditCanvasConfigEnum.HUE_ROTATE]: number // 饱和度 - [EditCanvasFilterEnum.SATURATE]: number + [EditCanvasConfigEnum.SATURATE]: number // 亮度 - [EditCanvasFilterEnum.BRIGHTNESS]: number + [EditCanvasConfigEnum.BRIGHTNESS]: number // 对比度 - [EditCanvasFilterEnum.CONTRAST]: number + [EditCanvasConfigEnum.CONTRAST]: number // 不透明度 - [EditCanvasFilterEnum.UN_OPACITY]: number + [EditCanvasConfigEnum.UN_OPACITY]: number // 背景色 - [EditCanvasTypeEnum.BACKGROUND]?: string + [EditCanvasConfigEnum.BACKGROUND]?: string + [EditCanvasConfigEnum.BACKGROUND_IAMGE]?: string | ArrayBuffer | null // 图表主题颜色 - [EditCanvasFilterEnum.CHART_THEME]: string + [EditCanvasConfigEnum.CHART_THEME]: string + // 图表主题颜色 + [EditCanvasConfigEnum.SELECT_COLOR]: boolean } // 坐标轴信息 diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 61a2d36b..68ce9497 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -54,6 +54,9 @@ export const useChartEditStoreStore = defineStore({ unOpacity: 100, // 默认背景色 background: undefined, + backgroundImage: undefined, + // 是否使用纯颜色 + selectColor: true, // chart 主题色 chartTheme: defaultTheme || 'dark' }, diff --git a/src/utils/componets.ts b/src/utils/componets.ts index 018b7007..abf3fa11 100644 --- a/src/utils/componets.ts +++ b/src/utils/componets.ts @@ -1,5 +1,5 @@ import { defineAsyncComponent, AsyncComponentLoader } from 'vue' -import { AsyncLoading } from '@/components/LoadingComponent' +import { AsyncLoading, AsyncSkeletonLoading } from '@/components/LoadingComponent' /** * * 异步加载组件 @@ -12,3 +12,10 @@ export const loadAsyncComponent = (loader: AsyncComponentLoader) => loadingComponent: AsyncLoading, delay: 20, }) + +export const loadSkeletonAsyncComponent = (loader: AsyncComponentLoader) => + defineAsyncComponent({ + loader, + loadingComponent: AsyncSkeletonLoading, + delay: 20, + }) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 0f126148..b9d9ed8b 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -91,6 +91,7 @@ export const setDomAttribute = { return /macintosh|mac os x/i.test(navigator.userAgent) } + +/** + * * file转base64 +*/ +export const fileTobase64 = (file:File, callback: Function) => { + let reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function (e: ProgressEvent) { + if(e.target) { + let base64 = e.target.result; + callback(base64) + } + }; +}; + /** * * 挂载监听 */ diff --git a/src/views/chart/ContentDetails/components/CanvasPage/components/ChartTheme/index.vue b/src/views/chart/ContentDetails/components/CanvasPage/components/ChartTheme/index.vue index 6bdd840c..d02d1c1d 100644 --- a/src/views/chart/ContentDetails/components/CanvasPage/components/ChartTheme/index.vue +++ b/src/views/chart/ContentDetails/components/CanvasPage/components/ChartTheme/index.vue @@ -34,7 +34,7 @@ diff --git a/src/views/chart/ContentDetails/components/CanvasPage/index.vue b/src/views/chart/ContentDetails/components/CanvasPage/index.vue index 5d9139fb..2d6076f2 100644 --- a/src/views/chart/ContentDetails/components/CanvasPage/index.vue +++ b/src/views/chart/ContentDetails/components/CanvasPage/index.vue @@ -1,16 +1,218 @@ - diff --git a/src/views/chart/ContentDetails/index.vue b/src/views/chart/ContentDetails/index.vue index 61e6abb0..04e48154 100644 --- a/src/views/chart/ContentDetails/index.vue +++ b/src/views/chart/ContentDetails/index.vue @@ -31,7 +31,7 @@ 页面设置 - + @@ -72,7 +72,7 @@ @@ -41,7 +43,7 @@ const style = computed(() => { position: relative; border: 1px solid; border-radius: 15px; - @include filter-bg-color('background-color2'); + background: url('@/assets/images/canvas/pageBg.png'); @include fetch-theme('box-shadow'); @include filter-border-color('hover-border-color'); @include fetch-theme-custom('border-color', 'background-color4'); diff --git a/src/views/chart/ContentEdit/components/History/index.vue b/src/views/chart/ContentEdit/components/History/index.vue index f8827ead..a3d36655 100644 --- a/src/views/chart/ContentEdit/components/History/index.vue +++ b/src/views/chart/ContentEdit/components/History/index.vue @@ -4,7 +4,6 @@ @select="handleSelect" :show="showDropdownRef" :options="options" - scrollable size="small" placement="top-start" style="max-height: 100vh; overflow-y: auto;" diff --git a/src/views/chart/ContentEdit/hooks/useDrop.hook.ts b/src/views/chart/ContentEdit/hooks/useDrop.hook.ts index c6a89e0c..d21a575d 100644 --- a/src/views/chart/ContentEdit/hooks/useDrop.hook.ts +++ b/src/views/chart/ContentEdit/hooks/useDrop.hook.ts @@ -19,9 +19,13 @@ export const handleDrop = async (e: DragEvent) => { try { loadingStart() - // 获取拖拽数据 const drayDataString = e!.dataTransfer!.getData(DragKeyEnum.DROG_KEY) + if (!drayDataString) { + loadingFinish() + return + } + const dropData: Exclude = JSON.parse( drayDataString ) @@ -67,8 +71,8 @@ export const useMouseHandle = () => { onClickoutside() chartEditStore.setTargetSelectChart(item.id) const scale = chartEditStore.getEditCanvas.scale - const width = chartEditStore.getEditCanvas.width - const height = chartEditStore.getEditCanvas.height + const width = chartEditStore.getEditCanvasConfig.width + const height = chartEditStore.getEditCanvasConfig.height // 获取编辑区域 Dom const editcontentDom = chartEditStore.getEditCanvas.editContentDom diff --git a/src/views/chart/HeaderRightBtn/index.vue b/src/views/chart/HeaderRightBtn/index.vue index 43355dc8..f808c8c8 100644 --- a/src/views/chart/HeaderRightBtn/index.vue +++ b/src/views/chart/HeaderRightBtn/index.vue @@ -15,13 +15,13 @@ import { reactive } from 'vue' import { renderIcon } from '@/utils' import { icon } from '@/plugins' -const { DesktopOutlineIcon, SendIcon } = icon.ionicons5 +const { BrowsersOutlineIcon, SendIcon } = icon.ionicons5 const btnList = reactive([ { select: true, title: '预览', - icon: renderIcon(DesktopOutlineIcon) + icon: renderIcon(BrowsersOutlineIcon) }, { select: true, diff --git a/src/views/project/items/components/Card/index.vue b/src/views/project/items/components/Card/index.vue index 81606db3..03b4caa9 100644 --- a/src/views/project/items/components/Card/index.vue +++ b/src/views/project/items/components/Card/index.vue @@ -92,7 +92,7 @@ const { CopyIcon, TrashIcon, PencilIcon, - DesktopOutlineIcon, + BrowsersOutlineIcon, DownloadIcon, HammerIcon, SendIcon @@ -122,7 +122,7 @@ const selectOptions = ref([ { label: renderLang('global.r_preview'), key: 'preview', - icon: renderIcon(DesktopOutlineIcon) + icon: renderIcon(BrowsersOutlineIcon) }, { label: renderLang('global.r_copy'),