From fa09825b5dc5ab3f7454edab519dba66af8b722e Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 19 Feb 2024 16:14:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/api/staticResource.ts | 2 +- core/core-frontend/src/utils/style.ts | 21 +- .../dashboard/MobileBackgroundSelector.vue | 208 ++++++++++++++++++ .../src/views/dashboard/MobileConfigPanel.vue | 4 +- .../src/views/mobile/directory/index.vue | 20 +- core/core-frontend/src/views/mobile/index.vue | 36 +-- .../src/views/mobile/panel/index.vue | 4 + 7 files changed, 261 insertions(+), 34 deletions(-) create mode 100644 core/core-frontend/src/views/dashboard/MobileBackgroundSelector.vue diff --git a/core/core-frontend/src/api/staticResource.ts b/core/core-frontend/src/api/staticResource.ts index 94d5bd56a8..6075c32ac4 100644 --- a/core/core-frontend/src/api/staticResource.ts +++ b/core/core-frontend/src/api/staticResource.ts @@ -32,7 +32,7 @@ export function uploadFileResult(file, callback) { const fileUrl = staticResourcePath + newFileName const param = new FormData() param.append('file', file) - uploadFile(fileId, param).then(() => { + return uploadFile(fileId, param).then(() => { callback(fileUrl) }) } diff --git a/core/core-frontend/src/utils/style.ts b/core/core-frontend/src/utils/style.ts index e63c0355ac..b4450554a8 100644 --- a/core/core-frontend/src/utils/style.ts +++ b/core/core-frontend/src/utils/style.ts @@ -182,8 +182,14 @@ export function getComponentRotatedStyle(style) { } export function getCanvasStyle(canvasStyleData) { - const { backgroundColorSelect, background, backgroundColor, backgroundImageEnable, fontSize } = - canvasStyleData + const { + backgroundColorSelect, + background, + backgroundColor, + backgroundImageEnable, + fontSize, + mobileSetting + } = canvasStyleData const style = { fontSize: fontSize + 'px', color: canvasStyleData.color } // 仪表板默认色#f5f6f7 大屏默认配色 #1a1a1a let colorRGBA = dvMainStore.dvInfo.type === 'dashboard' ? '#f5f6f7' : '#1a1a1a' @@ -195,6 +201,17 @@ export function getCanvasStyle(canvasStyleData) { } else { style['background-color'] = colorRGBA } + + if (dvMainStore.mobileInPc && mobileSetting?.customSetting) { + const { backgroundType, color, alpha, imageUrl } = mobileSetting + if (backgroundType === 'image' && typeof imageUrl === 'string') { + style['background'] = `url(${imgUrlTrans(imageUrl)}) no-repeat` + } else if (backgroundType === 'color') { + const colorRGBA = hexColorToRGBA(color, alpha === undefined ? 100 : alpha) + style['background'] = colorRGBA + } + } + console.log('style', style) return style } diff --git a/core/core-frontend/src/views/dashboard/MobileBackgroundSelector.vue b/core/core-frontend/src/views/dashboard/MobileBackgroundSelector.vue new file mode 100644 index 0000000000..055e458799 --- /dev/null +++ b/core/core-frontend/src/views/dashboard/MobileBackgroundSelector.vue @@ -0,0 +1,208 @@ + + + + + diff --git a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue index 0fe1f304e6..1234f9f952 100644 --- a/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue +++ b/core/core-frontend/src/views/dashboard/MobileConfigPanel.vue @@ -1,6 +1,7 @@ -