feat:切换主题时添加提示

main
liu.shiyi 2 years ago
parent 847f9d21b7
commit 6e28e876ef

@ -46,7 +46,10 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
pageInfo: (state) => state.bigScreen.pageInfo pageInfo: (state) => state.bigScreen.pageInfo
}) }),
isPreview () {
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
}
}, },
data () { data () {
return { return {
@ -73,6 +76,17 @@ export default {
this.$emit('styleHandler', chart) this.$emit('styleHandler', chart)
} }
}) })
if (!this.isPreview) {
const themeLabel = val === 'light' ? '明亮' : '暗黑'
const htmlStr = `<span>当前已切换到<strong>${themeLabel}</strong>主题,颜色设置针对当前主题生效</span>`
this.$notify({
title: '注意',
dangerouslyUseHTMLString: true,
message: htmlStr,
customClass: 'ds-el-notify',
type: 'warning'
})
}
} }
} }
} }

@ -313,6 +313,9 @@ export default {
pageInfo: state => state.bigScreen.pageInfo, pageInfo: state => state.bigScreen.pageInfo,
config: state => state.bigScreen.activeItemConfig config: state => state.bigScreen.activeItemConfig
}), }),
isPreview () {
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
},
// //
currentBgColor () { currentBgColor () {
return this.form.customTheme === 'dark' ? 'bgColor' : 'lightBgColor' return this.form.customTheme === 'dark' ? 'bgColor' : 'lightBgColor'
@ -379,6 +382,17 @@ export default {
this.$emit('styleHandler', chart) this.$emit('styleHandler', chart)
} }
}) })
if (!this.isPreview) {
const themeLabel = theme === 'light' ? '明亮' : '暗黑'
const htmlStr = `<span>当前已切换到<strong>${themeLabel}</strong>主题,颜色设置针对当前主题生效</span>`
this.$notify({
title: '注意',
dangerouslyUseHTMLString: true,
message: htmlStr,
customClass: 'ds-el-notify',
type: 'warning'
})
}
}, },
init () { init () {
if (!this.pageInfo.pageConfig.refreshConfig) { if (!this.pageInfo.pageConfig.refreshConfig) {
@ -657,4 +671,20 @@ export default {
height: calc(100% - 50px); height: calc(100% - 50px);
overflow-y: auto; overflow-y: auto;
} }
</style>
<style lang="scss">
//notify
.ds-el-notify {
background-color: var(--bs-el-background-1)!important;
.el-notification__title{
color: #fff!important;
}
.el-notification__content{
color: #fff!important;
}
.el-notification__closeBtn{
color: #fff!important;
}
}
</style> </style>

@ -413,4 +413,4 @@
.bs-context-menu-class .menu_item__available:hover { .bs-context-menu-class .menu_item__available:hover {
background: var(--bs-el-background-3) !important; background: var(--bs-el-background-3) !important;
color: var(--bs-el-hover) !important; color: var(--bs-el-hover) !important;
} }

Loading…
Cancel
Save