Merge pull request #2942 from dataease/dev

dev merge
This commit is contained in:
王嘉豪 2022-08-25 14:50:37 +08:00 committed by GitHub
commit 5885be9664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 59 additions and 35 deletions

View File

@ -81,6 +81,7 @@ import { mapState } from 'vuex'
import EditBar from '@/components/canvas/components/Editor/EditBar'
import MobileCheckBar from '@/components/canvas/components/Editor/MobileCheckBar'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
replace: true,
@ -594,7 +595,7 @@ export default {
style['border-radius'] = (this.element.commonBackground.borderRadius || 0) + 'px'
if (this.element.commonBackground.enable) {
if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') {
style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}`
} else {
style['background-color'] = colorRGBA
}

View File

@ -58,6 +58,7 @@ import EditBar from '@/components/canvas/components/Editor/EditBar'
import MobileCheckBar from '@/components/canvas/components/Editor/MobileCheckBar'
import CloseBar from '@/components/canvas/components/Editor/CloseBar'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
components: { CloseBar, MobileCheckBar, DeOutWidget, EditBar },
@ -155,9 +156,9 @@ export default {
if (this.config.commonBackground.enable) {
if (this.screenShot && this.config.commonBackground.backgroundType === 'innerImage' && typeof this.config.commonBackground.innerImage === 'string') {
let innerImage = this.config.commonBackground.innerImage.replace('svg', 'png')
style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}`
} else if (this.config.commonBackground.backgroundType === 'outerImage' && typeof this.config.commonBackground.outerImage === 'string') {
style['background'] = `url(${this.config.commonBackground.outerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(this.config.commonBackground.outerImage)}) no-repeat ${colorRGBA}`
} else {
style['background-color'] = colorRGBA
}

View File

@ -75,7 +75,7 @@ import { mapState } from 'vuex'
import ComponentWrapper from './ComponentWrapper'
import { changeStyleWithScale } from '@/components/canvas/utils/translate'
import { uuid } from 'vue-uuid'
import { deepCopy } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils'
import eventBus from '@/components/canvas/utils/eventBus'
import elementResizeDetectorMaker from 'element-resize-detector'
import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
@ -231,7 +231,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {

View File

@ -46,7 +46,7 @@ import { mapState } from 'vuex'
import ComponentWrapper from './ComponentWrapper'
import { changeStyleWithScale } from '@/components/canvas/utils/translate'
import { uuid } from 'vue-uuid'
import { deepCopy } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils'
import eventBus from '@/components/canvas/utils/eventBus'
import elementResizeDetectorMaker from 'element-resize-detector'
import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
@ -113,7 +113,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {

View File

@ -189,7 +189,7 @@ import DeDrag from '@/components/DeDrag'
// eslint-disable-next-line no-unused-vars
import { getStyle, getComponentRotatedStyle } from '@/components/canvas/utils/style'
import { _$ } from '@/components/canvas/utils/utils'
import {_$, imgUrlTrans} from '@/components/canvas/utils/utils'
import ContextMenu from './ContextMenu'
import MarkLine from './MarkLine'
import Area from './Area'
@ -968,7 +968,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {

View File

@ -42,7 +42,7 @@ import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import { exportDetails, innerExportDetails } from '@/api/panel/panel'
import html2canvas from 'html2canvasde'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { deepCopy, exportImg } from '@/components/canvas/utils/utils'
import {deepCopy, exportImg, imgUrlTrans} from '@/components/canvas/utils/utils'
import { getLinkToken, getToken } from '@/utils/auth'
export default {
name: 'UserViewDialog',
@ -84,7 +84,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {
@ -125,9 +125,9 @@ export default {
if (this.element.commonBackground.enable) {
if (this.screenShot && this.element.commonBackground.backgroundType === 'innerImage' && typeof this.element.commonBackground.innerImage === 'string') {
let innerImage = this.element.commonBackground.innerImage.replace('svg', 'png')
style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}`
} else if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') {
style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}`
} else {
style['background-color'] = colorRGBA
}

View File

@ -34,7 +34,7 @@ import DeContainer from '@/components/dataease/DeContainer'
import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import PluginCom from '@/views/system/plugin/PluginCom'
import { deepCopy } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils'
import {hexColorToRGBA} from "@/views/chart/chart/util";
export default {
name: 'UserViewMobileDialog',
@ -66,7 +66,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {
@ -107,9 +107,9 @@ export default {
if (this.element.commonBackground.enable) {
if (this.screenShot && this.element.commonBackground.backgroundType === 'innerImage' && typeof this.element.commonBackground.innerImage === 'string') {
let innerImage = this.element.commonBackground.innerImage.replace('svg', 'png')
style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}`
} else if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') {
style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}`
} else {
style['background-color'] = colorRGBA
}

View File

@ -216,3 +216,12 @@ export function colorReverse(OldColorValue) {
const str = '000000' + (0xFFFFFF - OldColorValue).toString(16)
return '#' + str.substring(str.length - 6, str.length)
}
export function imgUrlTrans(url) {
if(url && url.indexOf('static-resource') > -1){
return process.env.VUE_APP_BASE_API + url.replace('/static-resource','static-resource')
}else {
return url
}
}

View File

@ -1671,7 +1671,7 @@ export default {
template_preview: '预览模板',
apply: '应用',
apply_this_template: '应用此模板',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)通,请检查网络...',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)通,请检查网络...',
enter_name_tips: '请输入仪表板名称',
name: '名称',
apply_template: '应用模板',

View File

@ -1679,7 +1679,7 @@ export default {
template_preview: '预览模板',
apply: '应用',
apply_this_template: '应用此模板',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)通,请检查网络...',
market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)通,请检查网络...',
enter_name_tips: '请输入仪表板名称',
name: '名称',
apply_template: '应用模板',

View File

@ -17,6 +17,7 @@
<script>
import { mapState } from 'vuex'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'BackgroundItem',
@ -38,7 +39,7 @@ export default {
classBackground() {
if (this.template.url) {
return {
background: `url(${this.template.url}) no-repeat`,
background: `url(${imgUrlTrans(this.template.url)}) no-repeat`,
'background-size': `100% 100%`
}
} else {

View File

@ -261,6 +261,7 @@ import 'codemirror/keymap/emacs.js'
import 'codemirror/addon/hint/show-hint.css'
import 'codemirror/addon/hint/sql-hint'
import 'codemirror/addon/hint/show-hint'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
components: { codemirror, draggable },
@ -327,7 +328,7 @@ export default {
classBackground() {
if (this.importTemplateInfo.snapshot) {
return {
background: `url(${this.importTemplateInfo.snapshot}) no-repeat`
background: `url(${imgUrlTrans(this.importTemplateInfo.snapshot)}) no-repeat`
}
} else {
return {}

View File

@ -133,6 +133,7 @@ import { chartTransStr2Object } from '@/views/panel/panel'
import { mapState } from 'vuex'
import bus from '@/utils/bus'
import { saveOrUpdateSubject } from '@/api/panel/panel'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'StyleTemplateItem',
@ -159,7 +160,7 @@ export default {
style = {
width: '100%',
height: '100%',
background: `url(${this.subjectItemDetails.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.subjectItemDetails.panel.imageUrl)}) no-repeat`,
'background-size': '100% 100% !important'
}
} else {

View File

@ -56,6 +56,7 @@
<script>
import { chartTransStr2Object } from '@/views/panel/panel'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'StyleTemplateItem',
props: {
@ -84,7 +85,7 @@ export default {
style = {
width: '100%',
height: '100%',
background: `url(${this.subjectItemDetails.panel.imageUrl}) no-repeat`
background: `url(${imgUrlTrans(this.subjectItemDetails.panel.imageUrl)}) no-repeat`
}
} else {
style = {

View File

@ -75,6 +75,7 @@ import { mapState } from 'vuex'
import bus from '@/utils/bus'
import { saveOrUpdateSubject } from '@/api/panel/panel'
import { resetViewCacheCallBack } from '@/api/chart/chart'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'StyleTemplateItem',
@ -103,7 +104,7 @@ export default {
style = {
width: '100%',
height: '100%',
background: `url(${this.subjectItemDetails.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.subjectItemDetails.panel.imageUrl)}) no-repeat`,
'background-size': '100% 100% !important'
}
} else {

View File

@ -56,6 +56,7 @@
<script>
import { chartTransStr2Object } from '@/views/panel/panel'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'StyleTemplateItem',
props: {
@ -84,7 +85,7 @@ export default {
style = {
width: '100%',
height: '100%',
background: `url(${this.subjectItemDetails.panel.imageUrl}) no-repeat`
background: `url(${imgUrlTrans(this.subjectItemDetails.panel.imageUrl)}) no-repeat`
}
} else {
style = {

View File

@ -36,6 +36,7 @@ import MobileCheckBar from '@/components/canvas/components/Editor/MobileCheckBar
import { getStyle } from '@/components/canvas/utils/style'
import DeOutWidget from '@/components/dataease/DeOutWidget'
import { hexColorToRGBA } from '@/views/chart/chart/util'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'ComponentWaitItem',
@ -82,7 +83,7 @@ export default {
}
if (this.config.commonBackground.enable) {
if (this.config.commonBackground.backgroundType === 'outerImage' && typeof this.config.commonBackground.outerImage === 'string') {
style['background'] = `url(${this.config.commonBackground.outerImage}) no-repeat ${colorRGBA}`
style['background'] = `url(${imgUrlTrans(this.config.commonBackground.outerImage)}) no-repeat ${colorRGBA}`
} else {
style['background-color'] = colorRGBA
}

View File

@ -387,7 +387,7 @@ import FilterGroup from '../filter'
import SubjectSetting from '../SubjectSetting'
import bus from '@/utils/bus'
import Editor from '@/components/canvas/components/Editor/index'
import { deepCopy, matrixBaseChange } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans, matrixBaseChange} from '@/components/canvas/utils/utils'
import componentList, {
BASE_MOBILE_STYLE,
COMMON_BACKGROUND,
@ -581,7 +581,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && typeof (this.canvasStyleData.panel.imageUrl) === 'string') {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {
style = {
@ -603,7 +603,7 @@ export default {
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && typeof (this.canvasStyleData.panel.imageUrl) === 'string') {
style = {
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`,
...style
}
} else if (this.canvasStyleData.panel.backgroundType === 'color') {

View File

@ -34,6 +34,7 @@ export default {
if (this.componentName === 'PanelEdit') {
next(false)
if (confirm(this.$t('panel.edit_leave_tips'))) {
bus.$emit('PanelSwitchComponent', { name: 'PanelMain' })
next()
}
} else {

View File

@ -35,7 +35,7 @@
import { panelSave, panelUpdate } from '@/api/panel/panel'
import { showTemplateList } from '@/api/system/template'
import TemplateAllList from './TemplateAllList'
import { deepCopy } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils'
export default {
components: { TemplateAllList },
@ -68,7 +68,7 @@ export default {
classBackground() {
if (this.importTemplateInfo.snapshot) {
return {
background: `url(${this.importTemplateInfo.snapshot}) no-repeat`
background: `url(${imgUrlTrans(this.importTemplateInfo.snapshot)}) no-repeat`
}
} else {
return {}

View File

@ -46,6 +46,7 @@
import { save, nameCheck } from "@/api/system/template";
import msgCfm from "@/components/msgCfm/index";
import { find } from "@/api/system/template";
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
mixins: [msgCfm],
@ -86,7 +87,7 @@ export default {
classBackground() {
if (this.importTemplateInfo.snapshot) {
return {
background: `url(${this.importTemplateInfo.snapshot}) no-repeat`,
background: `url(${imgUrlTrans(this.importTemplateInfo.snapshot)}) no-repeat`,
};
} else {
return {};
@ -104,7 +105,7 @@ export default {
// },
// validator(rule, value, callback) {
// if (this.nameRepeat(value)) {
// callback(new Error(this.$t('commons.already_exists')));
// } else {
// callback();

View File

@ -14,6 +14,8 @@
</template>
<script>
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'TemplateMarketItem',
props: {
@ -39,7 +41,7 @@ export default {
return {
width: this.width + 'px',
height: this.width * 0.58 + 'px',
background: `url(${this.thumbnailUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.thumbnailUrl)}) no-repeat`,
'background-size': `100% 100%`
}
},

View File

@ -14,6 +14,8 @@
</template>
<script>
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'TemplateMarketPreviewItem',
props: {
@ -39,7 +41,7 @@ export default {
computed: {
classBackground() {
return {
background: `url(${this.thumbnailUrl}) no-repeat`,
background: `url(${imgUrlTrans(this.thumbnailUrl)}) no-repeat`,
'background-size': `100% 100%`
}
},