File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
frontend/src/app/pages/DashBoardPage Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,16 @@ import {
1919 BackgroundConfig ,
2020 BorderConfig ,
2121} from 'app/pages/DashBoardPage/pages/Board/slice/types' ;
22- import { convertImageUrl } from 'app/pages/DashBoardPage/utils' ;
22+ import { getBackgroundImage } from 'app/pages/DashBoardPage/utils' ;
2323import styled from 'styled-components/macro' ;
2424export interface StyledBackgroundProps {
2525 bg : BackgroundConfig ;
2626 bd ?: BorderConfig ;
2727}
28+
2829const StyledBackground = styled . div < StyledBackgroundProps > `
2930 background-color: ${ p => p . bg ?. color } ;
30- background-image: ${ p => 'url(' + convertImageUrl ( p . bg ?. image ) + ')' } ;
31+ background-image: ${ p => getBackgroundImage ( p . bg ?. image ) } ;
3132 background-repeat: ${ p => p . bg ?. repeat } ;
3233 background-size: ${ p => p . bg ?. size } ;
3334 border-color: ${ p => p ?. bd ?. color } ;
Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ export const convertImageUrl = (urlKey: string = ''): string => {
6767 }
6868 return urlKey ;
6969} ;
70+ export const getBackgroundImage = ( url : string = '' ) : string => {
71+ return url ? `url(${ convertImageUrl ( url ) } )` : 'none' ;
72+ } ;
73+
7074/**
7175 * @description '为了server 复制board 副本,原有board资源文件 和新副本资源文件 脱离关系 不受影响'
7276 * 将当前前端渲染环境 id 替换掉原有的id ,原来的和当前的相等不受影响
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import { DeltaStatic } from 'quill';
2929import { CSSProperties } from 'react' ;
3030import { FONT_FAMILY , G90 , WHITE } from 'styles/StyleConstants' ;
3131import { uuidv4 } from 'utils/utils' ;
32- import { convertImageUrl , fillPx } from '.' ;
32+ import { fillPx , getBackgroundImage } from '.' ;
3333import {
3434 AutoBoardWidgetBackgroundDefault ,
3535 BackgroundDefault ,
@@ -705,7 +705,7 @@ export const getFreeWidgetStyle = (widget: Widget) => {
705705export const getBackgroundCss = ( bg : BackgroundConfig ) => {
706706 let css : CSSProperties = {
707707 backgroundColor : bg . color ,
708- backgroundImage : `url( ${ convertImageUrl ( bg . image ) } )` ,
708+ backgroundImage : getBackgroundImage ( bg . image ) ,
709709 backgroundRepeat : bg . repeat ,
710710 backgroundSize : bg . size ,
711711 } ;
You can’t perform that action at this time.
0 commit comments