初始化
This commit is contained in:
144
frontend/packages/BasicComponents/ThemeSelect/index.vue
Normal file
144
frontend/packages/BasicComponents/ThemeSelect/index.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div
|
||||
class="bs-design-wrap theme-switcher-wrap"
|
||||
:class="`bs-theme-switcher-${customTheme}`"
|
||||
>
|
||||
<el-dropdown
|
||||
trigger="click"
|
||||
@command="handleChange"
|
||||
>
|
||||
<div
|
||||
class="el-dropdown-link content-box"
|
||||
:style="{'font-size': config.customize.fontSize +'px','font-weight': +config.customize.fontWeight,'background-image': `-webkit-linear-gradient(${config.customize.color})`}"
|
||||
>
|
||||
主题切换
|
||||
</div>
|
||||
<el-dropdown-menu
|
||||
slot="dropdown"
|
||||
class="theme-dropdown-menu"
|
||||
>
|
||||
<el-dropdown-item command="light">
|
||||
明亮主题
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="dark">
|
||||
暗黑主题
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import paramsMixins from 'data-room-ui/js/mixins/paramsMixins'
|
||||
import { themeToSetting } from 'data-room-ui/js/utils/themeFormatting'
|
||||
import { mapMutations, mapState } from 'vuex'
|
||||
import { refreshComponentMixin } from 'data-room-ui/js/mixins/refreshComponent'
|
||||
|
||||
export default {
|
||||
name: 'ThemeSwitcher',
|
||||
components: {},
|
||||
mixins: [paramsMixins, refreshComponentMixin],
|
||||
props: {
|
||||
// 卡片的属性
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
pageInfo: (state) => state.bigScreen.pageInfo
|
||||
}),
|
||||
isPreview () {
|
||||
return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
mounted () {
|
||||
document.documentElement.style.setProperty('--radio-label-color', this.config.customize.activeColor)
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
changePageInfo: 'bigScreen/changePageInfo'
|
||||
}),
|
||||
// 点击切换主题
|
||||
handleChange (val) {
|
||||
const pageInfo = this.pageInfo
|
||||
this.pageInfo.pageConfig.customTheme = val
|
||||
pageInfo.chartList = themeToSetting(pageInfo.chartList, val)
|
||||
this.changePageInfo(pageInfo)
|
||||
pageInfo.chartList.forEach(chart => {
|
||||
if (chart.type === 'remoteComponent') {
|
||||
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',
|
||||
duration: 5000,
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bs-design-wrap{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.content-box{
|
||||
text-align: center;
|
||||
/* 将背景设为渐变 */
|
||||
/*background-image: -webkit-linear-gradient(left, #6294F7, #C85D14);*/
|
||||
/* 规定背景绘制区域 */
|
||||
-webkit-background-clip: text;
|
||||
/* 将文字隐藏 */
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
// 自定义dropdown的样式
|
||||
.theme-dropdown-menu{
|
||||
background-color: var(--bs-background-2)!important;
|
||||
border: 1px solid var(--bs-border-1);
|
||||
::v-deep .popper__arrow{
|
||||
//background-color: var(--bs-background-2)!important;
|
||||
background-color: transparent!important;
|
||||
border-bottom-color:transparent!important;
|
||||
&:after{
|
||||
border-bottom-color: var(--bs-background-2)!important;
|
||||
}
|
||||
}
|
||||
::v-deep .el-dropdown-menu__item{
|
||||
background-color: var(--bs-background-2)!important;
|
||||
color: rgb(188, 201, 212)!important;
|
||||
&:hover {
|
||||
color: var(--bs-el-color-primary) !important;
|
||||
background-color: var(--bs-el-background-3) !important;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
::v-deep .el-input__inner,
|
||||
::v-deep .el-color-picker__color-inner,
|
||||
::v-deep .el-input-number--mini,
|
||||
::v-deep .el-textarea__inner,
|
||||
::v-deep .el-input-group__append {
|
||||
//background: var(--bs-el-background-1);
|
||||
//color: var(--bs-el-text);
|
||||
//border: 0 !important;
|
||||
//width: 100px;
|
||||
}
|
||||
</style>
|
||||
128
frontend/packages/BasicComponents/ThemeSelect/setting.vue
Normal file
128
frontend/packages/BasicComponents/ThemeSelect/setting.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
|
||||
<template>
|
||||
<div class="bs-setting-wrap">
|
||||
<el-form
|
||||
ref="form"
|
||||
label-width="100px"
|
||||
label-position="left"
|
||||
:model="config"
|
||||
:rules="rules"
|
||||
class="bs-el-form"
|
||||
>
|
||||
<SettingTitle>标题</SettingTitle>
|
||||
<div class="bs-setting-wrap">
|
||||
<el-form-item
|
||||
label="标题"
|
||||
label-width="100px"
|
||||
prop="title"
|
||||
>
|
||||
<el-input
|
||||
v-model="config.customize.title"
|
||||
placeholder="请输入标题"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<SettingTitle>位置</SettingTitle>
|
||||
<div class="lc-field-body">
|
||||
<PosWhSetting :config="config" />
|
||||
</div>
|
||||
<SettingTitle v-if="config.border">边框</SettingTitle>
|
||||
<div class="lc-field-body">
|
||||
<BorderSetting
|
||||
v-if="config.border"
|
||||
label-width="100px"
|
||||
:config="config.border"
|
||||
:bigTitle='config.title'
|
||||
/>
|
||||
</div>
|
||||
<SettingTitle>旋转</SettingTitle>
|
||||
<div class="lc-field-body">
|
||||
<RotateSetting
|
||||
:config="config"
|
||||
/>
|
||||
</div>
|
||||
<SettingTitle>基础</SettingTitle>
|
||||
<div class="lc-field-body">
|
||||
<el-form-item
|
||||
label="标题字体大小"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-input
|
||||
v-model="config.customize.fontSize"
|
||||
placeholder="请输入标题字体大小"
|
||||
clearable
|
||||
>
|
||||
<template slot="append">
|
||||
px
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="标题字体权重"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-input-number
|
||||
v-model="config.customize.fontWeight"
|
||||
class="bs-el-input-number"
|
||||
placeholder="请输入标题字体权重"
|
||||
:min="0"
|
||||
:step="100"
|
||||
/>
|
||||
</el-form-item>
|
||||
<TextGradient v-model="config.customize.color" />
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import SettingTitle from 'data-room-ui/SettingTitle/index.vue'
|
||||
import BorderSetting from 'data-room-ui/BigScreenDesign/RightSetting/BorderSetting.vue'
|
||||
import TextGradient from 'data-room-ui/BigScreenDesign/RightSetting/TextGradient/index'
|
||||
import PosWhSetting from 'data-room-ui/BigScreenDesign/RightSetting/PosWhSetting.vue'
|
||||
import RotateSetting from 'data-room-ui/BigScreenDesign/RightSetting/RotateSetting.vue'
|
||||
export default {
|
||||
name: 'ThemeSelect',
|
||||
components: {
|
||||
TextGradient,
|
||||
PosWhSetting,
|
||||
SettingTitle,
|
||||
BorderSetting,
|
||||
RotateSetting
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true, message: '请输入标题', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
config: {
|
||||
get () {
|
||||
return this.$store.state.bigScreen.activeItemConfig
|
||||
},
|
||||
set (val) {
|
||||
this.$store.state.bigScreen.activeItemConfig = val
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
mounted () {},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../assets/style/settingWrap.scss";
|
||||
.bs-setting-wrap{
|
||||
padding-top: 16px;
|
||||
}
|
||||
.lc-field-body {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* @Descripttion:
|
||||
* @Author: liu.shiyi
|
||||
* @Date: 2022-10-13 11:18:03
|
||||
* @LastEditTime: 2022-10-13 13:55:11
|
||||
*/
|
||||
import { commonConfig } from 'data-room-ui/js/config'
|
||||
|
||||
export const settingConfig = {
|
||||
// 设置面板属性的显隐
|
||||
displayOption: {
|
||||
dataAllocation: {
|
||||
// 是否存在数据配置
|
||||
enable: false
|
||||
}
|
||||
}
|
||||
}
|
||||
const customConfig = {
|
||||
type: 'themeSelect',
|
||||
root: {
|
||||
version: '2023071001',
|
||||
// 绕x轴旋转角度
|
||||
rotateX: 0,
|
||||
// 绕y轴旋转角度
|
||||
rotateY: 0,
|
||||
// 绕z轴旋转角度
|
||||
rotateZ: 0,
|
||||
// 透视距离
|
||||
perspective: 0,
|
||||
skewX: 0,
|
||||
skewY: 0
|
||||
},
|
||||
customize: {
|
||||
title: '文本标签占位符',
|
||||
fontSize: 20,
|
||||
fontWeight: 700,
|
||||
color: 'left,#bcc9d4,#bcc9d4'
|
||||
}
|
||||
|
||||
}
|
||||
export const dataConfig = {
|
||||
...commonConfig(customConfig)
|
||||
}
|
||||
Reference in New Issue
Block a user