Commit 4fe7ee40957b26ab37e6955e553e89765ae4cf6b
Merge branch 'ft' into 'main'
feat(external/Compose): 组合组件新增头部组合1,2,3 See merge request yunteng/thingskit-view!11
Showing
13 changed files
with
667 additions
and
130 deletions
@@ -7,14 +7,15 @@ export const option = { | @@ -7,14 +7,15 @@ export const option = { | ||
7 | dataset: '物联网平台数据统计', | 7 | dataset: '物联网平台数据统计', |
8 | bgSrc: 'src/assets/external/headbackground/bg_top.png', | 8 | bgSrc: 'src/assets/external/headbackground/bg_top.png', |
9 | fontSize: 36, | 9 | fontSize: 36, |
10 | - showRight: true, | ||
11 | - textColor: '#00f6ff', | ||
12 | - textRightSizeColor: '#ffffff', | ||
13 | - textRightFontSize: 14, | ||
14 | - x: 0, | ||
15 | - y: 0, | ||
16 | - xT: 0, | ||
17 | - yT: 0, | 10 | + showRight:true, |
11 | + textColor:'#00f6ff', | ||
12 | + textRightSizeColor:'#ffffff', | ||
13 | + textRightFontSize:14, | ||
14 | + x:0, | ||
15 | + y:0, | ||
16 | + xT:0, | ||
17 | + yT:0, | ||
18 | + backgroundImage:'' | ||
18 | } | 19 | } |
19 | 20 | ||
20 | export default class Config extends PublicConfigClass implements CreateComponentType { | 21 | export default class Config extends PublicConfigClass implements CreateComponentType { |
1 | <template> | 1 | <template> |
2 | <collapse-item name="信息" :expanded="true"> | 2 | <collapse-item name="信息" :expanded="true"> |
3 | + <setting-item-box name="背景上传" :alone="true"> | ||
4 | + <setting-item> | ||
5 | + <n-card class="upload-box"> | ||
6 | + <n-upload | ||
7 | + :show-file-list="false" | ||
8 | + v-model:file-list="uploadFileListRef" | ||
9 | + :customRequest="customRequest" | ||
10 | + :onBeforeUpload="beforeUploadHandle" | ||
11 | + > | ||
12 | + <n-upload-dragger> | ||
13 | + <img v-if="optionData.backgroundImage" class="upload-show" :src="optionData.backgroundImage" alt="背景" /> | ||
14 | + <div class="upload-img" v-show="!optionData.backgroundImage"> | ||
15 | + <img src="@/assets/images/canvas/noImage.png" /> | ||
16 | + <n-text class="upload-desc" depth="3"> | ||
17 | + 背景图需小于 {{ backgroundImageSize }}M ,格式为 png/jpg/gif 的文件 | ||
18 | + </n-text> | ||
19 | + </div> | ||
20 | + </n-upload-dragger> | ||
21 | + </n-upload> | ||
22 | + </n-card> | ||
23 | + </setting-item> | ||
24 | + <setting-item> | ||
25 | + <n-space> | ||
26 | + <n-text>背景控制</n-text> | ||
27 | + <n-button class="clear-btn" size="small" :disabled="!optionData.backgroundImage" @click="clearImage"> | ||
28 | + 清除上传背景 | ||
29 | + </n-button> | ||
30 | + </n-space> | ||
31 | + </setting-item> | ||
32 | + </setting-item-box> | ||
3 | <setting-item-box name="背景选择" :alone="true"> | 33 | <setting-item-box name="背景选择" :alone="true"> |
4 | <setting-item> | 34 | <setting-item> |
5 | - <n-select size="small" placeholder="请选择您要使用的背景" style="width: 250px" v-model:value="selectValue" | ||
6 | - :options="selectBgOptions" @update:value="selectBgValueHandle" /> | 35 | + <n-select |
36 | + size="small" | ||
37 | + placeholder="请选择您要使用的背景" | ||
38 | + style="width: 250px" | ||
39 | + v-model:value="selectValue" | ||
40 | + :options="selectBgOptions" | ||
41 | + @update:value="selectBgValueHandle" | ||
42 | + /> | ||
7 | </setting-item> | 43 | </setting-item> |
8 | </setting-item-box> | 44 | </setting-item-box> |
9 | <setting-item-box name="文字" :alone="true"> | 45 | <setting-item-box name="文字" :alone="true"> |
@@ -42,7 +78,11 @@ | @@ -42,7 +78,11 @@ | ||
42 | </setting-item-box> | 78 | </setting-item-box> |
43 | <setting-item-box name="文字"> | 79 | <setting-item-box name="文字"> |
44 | <setting-item name="字体大小"> | 80 | <setting-item name="字体大小"> |
45 | - <n-input-number v-model:value="optionData.textRightFontSize" size="small" placeholder="字体大小"></n-input-number> | 81 | + <n-input-number |
82 | + v-model:value="optionData.textRightFontSize" | ||
83 | + size="small" | ||
84 | + placeholder="字体大小" | ||
85 | + ></n-input-number> | ||
46 | </setting-item> | 86 | </setting-item> |
47 | <setting-item name="字体位置x轴"> | 87 | <setting-item name="字体位置x轴"> |
48 | <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number> | 88 | <n-input-number v-model:value="optionData.xT" size="small" placeholder="字体位置"></n-input-number> |
@@ -60,14 +100,14 @@ | @@ -60,14 +100,14 @@ | ||
60 | </template> | 100 | </template> |
61 | 101 | ||
62 | <script setup lang="ts"> | 102 | <script setup lang="ts"> |
63 | -import { PropType, ref } from 'vue' | 103 | +import { PropType, ref, nextTick } from 'vue' |
64 | import { option } from './config' | 104 | import { option } from './config' |
65 | -import { | ||
66 | - CollapseItem, | ||
67 | - SettingItemBox, | ||
68 | - SettingItem | ||
69 | -} from '@/components/Pages/ChartItemSetting' | ||
70 | -import { SelectOption } from "naive-ui"; | 105 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' |
106 | +import { SelectOption, UploadCustomRequestOptions } from 'naive-ui' | ||
107 | +import { backgroundImageSize } from '@/settings/designSetting' | ||
108 | +import { uploadFile } from '@/api/external/contentSave/content' | ||
109 | +import { FileTypeEnum } from '@/enums/fileTypeEnum' | ||
110 | +import { fetchRouteParamsLocation } from '@/utils' | ||
71 | 111 | ||
72 | const props = defineProps({ | 112 | const props = defineProps({ |
73 | optionData: { | 113 | optionData: { |
@@ -75,6 +115,7 @@ const props = defineProps({ | @@ -75,6 +115,7 @@ const props = defineProps({ | ||
75 | required: true | 115 | required: true |
76 | } | 116 | } |
77 | }) | 117 | }) |
118 | +const uploadFileListRef = ref() | ||
78 | 119 | ||
79 | const selectBgOptions = ref<Array<SelectOption>>([]) | 120 | const selectBgOptions = ref<Array<SelectOption>>([]) |
80 | 121 | ||
@@ -95,7 +136,86 @@ const selectBgValueHandle = (value: string) => { | @@ -95,7 +136,86 @@ const selectBgValueHandle = (value: string) => { | ||
95 | props.optionData.bgSrc = value | 136 | props.optionData.bgSrc = value |
96 | } | 137 | } |
97 | 138 | ||
139 | +// 上传图片前置处理 | ||
140 | +//@ts-ignore | ||
141 | +const beforeUploadHandle = async ({ file }) => { | ||
142 | + uploadFileListRef.value = [] | ||
143 | + const type = file.file.type | ||
144 | + const size = file.file.size | ||
145 | + | ||
146 | + if (size > 1024 * 1024 * backgroundImageSize) { | ||
147 | + window['$message'].warning(`图片超出 ${backgroundImageSize}M 限制,请重新上传!`) | ||
148 | + return false | ||
149 | + } | ||
150 | + if (type !== FileTypeEnum.PNG && type !== FileTypeEnum.JPEG && type !== FileTypeEnum.GIF) { | ||
151 | + window['$message'].warning('文件格式不符合,请重新上传!') | ||
152 | + return false | ||
153 | + } | ||
154 | + return true | ||
155 | +} | ||
156 | + | ||
157 | +// 自定义上传操作 | ||
158 | +const customRequest = (options: UploadCustomRequestOptions) => { | ||
159 | + const { file } = options | ||
160 | + nextTick(async () => { | ||
161 | + if (file.file) { | ||
162 | + // 修改名称 | ||
163 | + const newNameFile = new File([file.file], `${fetchRouteParamsLocation()}_index_background.png`, { | ||
164 | + type: file.file.type | ||
165 | + }) | ||
166 | + let uploadParams = new FormData() | ||
167 | + uploadParams.append('file', newNameFile) | ||
168 | + const uploadRes = await uploadFile(uploadParams) | ||
169 | + if (uploadRes) { | ||
170 | + props.optionData.backgroundImage = uploadRes?.fileStaticUri | ||
171 | + props.optionData.bgSrc = uploadRes?.fileStaticUri | ||
172 | + window['$message'].success('添加图片成功!') | ||
173 | + } | ||
174 | + } else { | ||
175 | + window['$message'].error('添加图片失败,请稍后重试!') | ||
176 | + } | ||
177 | + }) | ||
178 | +} | ||
98 | const handleChange = (value: boolean) => { | 179 | const handleChange = (value: boolean) => { |
99 | props.optionData.showRight = value | 180 | props.optionData.showRight = value |
100 | } | 181 | } |
182 | +// 清除背景 | ||
183 | +const clearImage = () => { | ||
184 | + props.optionData.backgroundImage = '' | ||
185 | + props.optionData.bgSrc = '' | ||
186 | +} | ||
101 | </script> | 187 | </script> |
188 | +<style lang="scss" scoped> | ||
189 | +$uploadWidth: 215px; | ||
190 | +$uploadHeight: 193px; | ||
191 | +.upload-box { | ||
192 | + cursor: pointer; | ||
193 | + margin-bottom: 20px; | ||
194 | + @include deep() { | ||
195 | + .n-card__content { | ||
196 | + padding: 0; | ||
197 | + overflow: hidden; | ||
198 | + } | ||
199 | + .n-upload-dragger { | ||
200 | + padding: 5px; | ||
201 | + width: $uploadWidth; | ||
202 | + } | ||
203 | + } | ||
204 | + .upload-show { | ||
205 | + width: -webkit-fill-available; | ||
206 | + height: $uploadHeight; | ||
207 | + border-radius: 5px; | ||
208 | + } | ||
209 | + .upload-img { | ||
210 | + display: flex; | ||
211 | + flex-direction: column; | ||
212 | + align-items: center; | ||
213 | + img { | ||
214 | + height: 150px; | ||
215 | + } | ||
216 | + .upload-desc { | ||
217 | + padding: 10px 0; | ||
218 | + } | ||
219 | + } | ||
220 | +} | ||
221 | +</style> |
@@ -10,7 +10,7 @@ export const LeftCenterRightHeadConfig: ConfigType = { | @@ -10,7 +10,7 @@ export const LeftCenterRightHeadConfig: ConfigType = { | ||
10 | key, | 10 | key, |
11 | chartKey, | 11 | chartKey, |
12 | conKey, | 12 | conKey, |
13 | - title: '通用头部', | 13 | + title: '头部组合1', |
14 | category: ChatCategoryEnum.HEADCOMBINATION, | 14 | category: ChatCategoryEnum.HEADCOMBINATION, |
15 | categoryName: ChatCategoryEnumName.HEADCOMBINATION, | 15 | categoryName: ChatCategoryEnumName.HEADCOMBINATION, |
16 | package: EPackagesCategoryEnum.COMPOSES, | 16 | package: EPackagesCategoryEnum.COMPOSES, |
1 | <template> | 1 | <template> |
2 | <div class="go-text-box"> | 2 | <div class="go-text-box"> |
3 | - <n-grid :style="{ 'background-image': 'url(' + option.configOption.bgSrc + ')' }" class="go-n-grid" :x-gap="12" :y-gap="3" | ||
4 | - :cols="3" layout-shift-disabled> | 3 | + <n-grid :style="{'background-image': 'url('+option.configOption.bgSrc+')'}" class="go-n-grid" :x-gap="12" :y-gap="3" |
4 | + :cols="3" layout-shift-disabled> | ||
5 | <n-grid-item> | 5 | <n-grid-item> |
6 | <!-- 占位--> | 6 | <!-- 占位--> |
7 | <div></div> | 7 | <div></div> |
8 | </n-grid-item> | 8 | </n-grid-item> |
9 | <n-grid-item> | 9 | <n-grid-item> |
10 | - <span style="position:relative" | ||
11 | - :style="{ top: option.configOption.y + 'px', marginLeft: option.configOption.x + 'px', color: option.configOption.textColor, fontSize: option.configOption.fontSize + 'px' }">{{ | 10 | + <span |
11 | + style="position:relative" | ||
12 | + :style="{ top:option.configOption.y+'px',marginLeft:option.configOption.x+'px',color: option.configOption.textColor, fontSize: option.configOption.fontSize + 'px' }">{{ | ||
12 | option.configOption.dataset | 13 | option.configOption.dataset |
13 | }}</span> | 14 | }}</span> |
14 | </n-grid-item> | 15 | </n-grid-item> |
15 | <n-grid-item> | 16 | <n-grid-item> |
16 | <span style="position:relative" v-if="option.configOption.showRight" | 17 | <span style="position:relative" v-if="option.configOption.showRight" |
17 | - :style="{ top: option.configOption.yT + 'px', marginLeft: option.configOption.xT + 'px', color: option.configOption.textRightSizeColor, fontSize: option.configOption.textRightFontSize + 'px' }">{{ | 18 | + :style="{ top:option.configOption.yT+'px',marginLeft:option.configOption.xT+'px',color: option.configOption.textRightSizeColor, fontSize: option.configOption.textRightFontSize + 'px' }">{{ |
18 | newData | 19 | newData |
19 | }}</span> | 20 | }}</span> |
20 | </n-grid-item> | 21 | </n-grid-item> |
@@ -22,11 +23,11 @@ | @@ -22,11 +23,11 @@ | ||
22 | </div> | 23 | </div> |
23 | </template> | 24 | </template> |
24 | <script setup lang="ts"> | 25 | <script setup lang="ts"> |
25 | -import { PropType, toRefs, shallowReactive, watch, onMounted, onUnmounted, ref } from 'vue' | ||
26 | -import { CreateComponentType } from '@/packages/index.d' | ||
27 | -import { useChartDataFetch } from '@/hooks' | ||
28 | -import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | ||
29 | -import { option as configOption } from './config' | 26 | +import {PropType, toRefs, shallowReactive, watch, onMounted, onUnmounted, ref} from 'vue' |
27 | +import {CreateComponentType} from '@/packages/index.d' | ||
28 | +import {useChartDataFetch} from '@/hooks' | ||
29 | +import {useChartEditStore} from '@/store/modules/chartEditStore/chartEditStore' | ||
30 | +import {option as configOption} from './config' | ||
30 | 31 | ||
31 | const props = defineProps({ | 32 | const props = defineProps({ |
32 | chartConfig: { | 33 | chartConfig: { |
@@ -54,14 +55,14 @@ props.chartConfig.attr.x = 0 | @@ -54,14 +55,14 @@ props.chartConfig.attr.x = 0 | ||
54 | props.chartConfig.attr.y = 0 | 55 | props.chartConfig.attr.y = 0 |
55 | 56 | ||
56 | watch( | 57 | watch( |
57 | - () => props.chartConfig.option, | ||
58 | - (newData: any) => { | ||
59 | - option.configOption = newData | ||
60 | - }, | ||
61 | - { | ||
62 | - immediate: true, | ||
63 | - deep: false | ||
64 | - } | 58 | + () => props.chartConfig.option, |
59 | + (newData: any) => { | ||
60 | + option.configOption = newData | ||
61 | + }, | ||
62 | + { | ||
63 | + immediate: true, | ||
64 | + deep: false | ||
65 | + } | ||
65 | ) | 66 | ) |
66 | 67 | ||
67 | useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { | 68 | useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { |
@@ -71,18 +72,18 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { | @@ -71,18 +72,18 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { | ||
71 | 72 | ||
72 | //TODO待封装 这里和原作者时间通用获取当前时间代码一样 | 73 | //TODO待封装 这里和原作者时间通用获取当前时间代码一样 |
73 | onMounted(() => { | 74 | onMounted(() => { |
74 | - //格式化当前时间 | 75 | +//格式化当前时间 |
75 | timer = setInterval(() => { | 76 | timer = setInterval(() => { |
76 | const | 77 | const |
77 | - weeks = { | ||
78 | - "0": '星期日', | ||
79 | - "1": '星期一', | ||
80 | - "2": '星期二', | ||
81 | - "3": '星期三', | ||
82 | - "4": '星期四', | ||
83 | - "5": '星期五', | ||
84 | - "6": '星期六', | ||
85 | - } as any | 78 | + weeks = { |
79 | + "0": '星期日', | ||
80 | + "1": '星期一', | ||
81 | + "2": '星期二', | ||
82 | + "3": '星期三', | ||
83 | + "4": '星期四', | ||
84 | + "5": '星期五', | ||
85 | + "6": '星期六', | ||
86 | + } as any | ||
86 | const datetime = new Date() | 87 | const datetime = new Date() |
87 | const year = datetime.getFullYear() | 88 | const year = datetime.getFullYear() |
88 | const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1 | 89 | const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1 |
@@ -114,7 +115,6 @@ onUnmounted(() => { | @@ -114,7 +115,6 @@ onUnmounted(() => { | ||
114 | display: flex; | 115 | display: flex; |
115 | align-items: center; | 116 | align-items: center; |
116 | justify-content: center; | 117 | justify-content: center; |
117 | - | ||
118 | .n-gradient-text { | 118 | .n-gradient-text { |
119 | white-space: initial; | 119 | white-space: initial; |
120 | } | 120 | } |
src/packages/components/external/Composes/HeadCombinations/LeftCenterRightHeadAnimat/config.ts
0 → 100644
1 | +import { PublicConfigClass } from '@/packages/public' | ||
2 | +import { CreateComponentType } from '@/packages/index.d' | ||
3 | +import { LeftCenterRightHeadAnimatConfig } from './index' | ||
4 | +import cloneDeep from 'lodash/cloneDeep' | ||
5 | + | ||
6 | +export const option = { | ||
7 | + animat: { | ||
8 | + text: '我是标题', | ||
9 | + colors: ['#00CED1', '#FAD400'], | ||
10 | + x: 0, | ||
11 | + y: 0, | ||
12 | + w: 1920, | ||
13 | + h: 100, | ||
14 | + size: 40, | ||
15 | + textPos:{ | ||
16 | + x: 50, | ||
17 | + y: 0, | ||
18 | + }, | ||
19 | + gradient: { | ||
20 | + from: '#0000FFFF', | ||
21 | + to: '#00FF00FF', | ||
22 | + deg: 45 | ||
23 | + } | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +export default class Config extends PublicConfigClass implements CreateComponentType { | ||
28 | + public key = LeftCenterRightHeadAnimatConfig.key | ||
29 | + public chartConfig = cloneDeep(LeftCenterRightHeadAnimatConfig) | ||
30 | + public option = cloneDeep(option) | ||
31 | +} |
src/packages/components/external/Composes/HeadCombinations/LeftCenterRightHeadAnimat/config.vue
0 → 100644
1 | +<template> | ||
2 | + <CollapseItem name="配置" :expanded="true"> | ||
3 | + <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.animat.colors" :key="index"> | ||
4 | + <SettingItem name="颜色"> | ||
5 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.animat.colors[index]"></n-color-picker> | ||
6 | + </SettingItem> | ||
7 | + <SettingItem> | ||
8 | + <n-button size="small" @click="optionData.animat.colors[index] = optionData.animat.colors[index]"> | ||
9 | + 恢复默认 | ||
10 | + </n-button> | ||
11 | + </SettingItem> | ||
12 | + </SettingItemBox> | ||
13 | + <SettingItemBox name="大小"> | ||
14 | + <SettingItem name="宽度"> | ||
15 | + <n-input-number size="small" v-model:value="optionData.animat.w"></n-input-number> | ||
16 | + </SettingItem> | ||
17 | + <SettingItem name="高度"> | ||
18 | + <n-input-number size="small" v-model:value="optionData.animat.h"></n-input-number> | ||
19 | + </SettingItem> | ||
20 | + </SettingItemBox> | ||
21 | + <SettingItemBox name="间距"> | ||
22 | + <SettingItem name="左间距"> | ||
23 | + <n-input-number size="small" v-model:value="optionData.animat.x"></n-input-number> | ||
24 | + </SettingItem> | ||
25 | + <SettingItem name="上间距"> | ||
26 | + <n-input-number size="small" v-model:value="optionData.animat.y"></n-input-number> | ||
27 | + </SettingItem> | ||
28 | + </SettingItemBox> | ||
29 | + </CollapseItem> | ||
30 | + <collapse-item name="信息" :expanded="true"> | ||
31 | + <setting-item-box name="文字" :alone="true"> | ||
32 | + <setting-item> | ||
33 | + <n-input v-model:value="optionData.animat.text" size="small"></n-input> | ||
34 | + </setting-item> | ||
35 | + </setting-item-box> | ||
36 | + </collapse-item> | ||
37 | + <collapse-item name="样式" :expanded="true"> | ||
38 | + <setting-item-box name="文字"> | ||
39 | + <setting-item name="字体大小"> | ||
40 | + <n-input-number v-model:value="optionData.animat.size" size="small" placeholder="字体大小"></n-input-number> | ||
41 | + </setting-item> | ||
42 | + </setting-item-box> | ||
43 | + <setting-item-box name="渐变色参数"> | ||
44 | + <setting-item name="起始值"> | ||
45 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.animat.gradient.from"></n-color-picker> | ||
46 | + </setting-item> | ||
47 | + <setting-item name="结束值"> | ||
48 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.animat.gradient.to"></n-color-picker> | ||
49 | + </setting-item> | ||
50 | + <setting-item name="偏移角度"> | ||
51 | + <n-input-number | ||
52 | + v-model:value="optionData.animat.gradient.deg" | ||
53 | + size="small" | ||
54 | + placeholder="颜色旋转" | ||
55 | + ></n-input-number> | ||
56 | + </setting-item> | ||
57 | + </setting-item-box> | ||
58 | + <setting-item-box name="间距"> | ||
59 | + <setting-item name="字体左间距"> | ||
60 | + <n-input-number v-model:value="optionData.animat.textPos.x" size="small" placeholder="间距"></n-input-number> | ||
61 | + </setting-item> | ||
62 | + <setting-item name="字体上间距"> | ||
63 | + <n-input-number v-model:value="optionData.animat.textPos.y" size="small" placeholder="间距"></n-input-number> | ||
64 | + </setting-item> | ||
65 | + </setting-item-box> | ||
66 | + </collapse-item> | ||
67 | +</template> | ||
68 | + | ||
69 | +<script setup lang="ts"> | ||
70 | +import { PropType } from 'vue' | ||
71 | +import { option } from './config' | ||
72 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | ||
73 | + | ||
74 | +defineProps({ | ||
75 | + optionData: { | ||
76 | + type: Object as PropType<typeof option>, | ||
77 | + required: true | ||
78 | + } | ||
79 | +}) | ||
80 | +</script> |
src/packages/components/external/Composes/HeadCombinations/LeftCenterRightHeadAnimat/index.ts
0 → 100644
1 | +import { ChartFrameEnum } from '@/packages/index.d' | ||
2 | +import { ConfigType } from '@/packages/index.d' | ||
3 | +import { EPackagesCategoryEnum } from '@/packages/components/external/types' | ||
4 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | ||
5 | +import { useWidgetKey } from '@/packages/external/useWidgetKey' | ||
6 | + | ||
7 | +const { key, chartKey, conKey } = useWidgetKey('LeftCenterRightHeadAnimat') | ||
8 | + | ||
9 | +export const LeftCenterRightHeadAnimatConfig: ConfigType = { | ||
10 | + key, | ||
11 | + chartKey, | ||
12 | + conKey, | ||
13 | + title: '头部组合3', | ||
14 | + category: ChatCategoryEnum.HEADCOMBINATION, | ||
15 | + categoryName: ChatCategoryEnumName.HEADCOMBINATION, | ||
16 | + package: EPackagesCategoryEnum.COMPOSES, | ||
17 | + chartFrame: ChartFrameEnum.COMMON, | ||
18 | + image: 'left_center_rightHead.png', | ||
19 | +} |
src/packages/components/external/Composes/HeadCombinations/LeftCenterRightHeadAnimat/index.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="go-animat"> | ||
3 | + <div class="go-animat-item" :style="{ marginLeft: animat.x + 'px', marginTop: animat.y + 'px' }"> | ||
4 | + <svg :width="animat.w + 'px'" :height="animat.h + 'px'"> | ||
5 | + <polyline | ||
6 | + fill="transparent" | ||
7 | + stroke-width="3" | ||
8 | + :points="`0,20 ${animat.w / 5.555555555555556},20 ${animat.w / 5},40 ${animat.w / 4},40 ${ | ||
9 | + animat.w / 3.703703703703704 | ||
10 | + },60 ${animat.w / 1.388888888888889},60 ${animat.w / 1.333333333333333},40 ${animat.w / 1.25},40 ${ | ||
11 | + animat.w / 1.219512195121951 | ||
12 | + },20 ${animat.w},20`" | ||
13 | + :stroke="animat.colors[0]" | ||
14 | + > | ||
15 | + <animate | ||
16 | + attributeName="stroke-dasharray" | ||
17 | + attributeType="XML" | ||
18 | + :from="`0, 969.031002232793, 0, 969.031002232793`" | ||
19 | + :to="`0, 0, 1938.062004465586, 0`" | ||
20 | + dur="3s" | ||
21 | + begin="0s" | ||
22 | + calcMode="spline" | ||
23 | + keyTimes="0;1" | ||
24 | + keySplines="0.4,1,0.49,0.98" | ||
25 | + repeatCount="indefinite" | ||
26 | + ></animate> | ||
27 | + </polyline> | ||
28 | + <polyline | ||
29 | + fill="transparent" | ||
30 | + stroke-width="2" | ||
31 | + :points="`${animat.w / 3.333333333333333},80 ${animat.w / 1.428571428571429},80`" | ||
32 | + :stroke="animat.colors[1]" | ||
33 | + > | ||
34 | + <animate | ||
35 | + attributeName="stroke-dasharray" | ||
36 | + attributeType="XML" | ||
37 | + from="0, 384, 0, 384" | ||
38 | + to="0, 0, 768, 0" | ||
39 | + dur="3s" | ||
40 | + begin="0s" | ||
41 | + calcMode="spline" | ||
42 | + keyTimes="0;1" | ||
43 | + keySplines=".4,1,.49,.98" | ||
44 | + repeatCount="indefinite" | ||
45 | + ></animate> | ||
46 | + </polyline> | ||
47 | + </svg> | ||
48 | + <div class="go-text" :style="{ top: animat.textPos.y + '%', left: animat.textPos.x + '%' }"> | ||
49 | + <n-gradient-text :size="animat.size" :gradient="animat.gradient"> | ||
50 | + {{ animat.text }} | ||
51 | + </n-gradient-text> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | +</template> | ||
56 | +<script setup lang="ts"> | ||
57 | +import { PropType, toRefs } from 'vue' | ||
58 | +import { CreateComponentType } from '@/packages/index.d' | ||
59 | + | ||
60 | +const props = defineProps({ | ||
61 | + chartConfig: { | ||
62 | + type: Object as PropType<CreateComponentType>, | ||
63 | + required: true | ||
64 | + } | ||
65 | +}) | ||
66 | + | ||
67 | +//默认设置宽高距离位置 | ||
68 | +props.chartConfig.attr.w = 1920 | ||
69 | +props.chartConfig.attr.h = 300 | ||
70 | +props.chartConfig.attr.x = 0 | ||
71 | +props.chartConfig.attr.y = 0 | ||
72 | + | ||
73 | +const { animat } = toRefs(props.chartConfig.option) | ||
74 | +</script> | ||
75 | + | ||
76 | +<style lang="scss" scoped> | ||
77 | +.go-animat { | ||
78 | + width: 1920px; | ||
79 | + height: 1080px; | ||
80 | + display: flex; | ||
81 | + margin: 0 auto; | ||
82 | + justify-content: center; | ||
83 | + align-items: center; | ||
84 | + .go-animat-item { | ||
85 | + position: relative; | ||
86 | + } | ||
87 | + .go-text { | ||
88 | + position: absolute; | ||
89 | + } | ||
90 | +} | ||
91 | +</style> |
@@ -4,15 +4,42 @@ import { LeftCenterRightHeadCommonConfig } from './index' | @@ -4,15 +4,42 @@ import { LeftCenterRightHeadCommonConfig } from './index' | ||
4 | import cloneDeep from 'lodash/cloneDeep' | 4 | import cloneDeep from 'lodash/cloneDeep' |
5 | 5 | ||
6 | export const option = { | 6 | export const option = { |
7 | - colorLefts: ['#1dc1f5', '#1dc1f5'], | ||
8 | - colorRights: ['#1dc1f5', '#1dc1f5'], | ||
9 | - // 是否翻转,组合头部,默认开启 | ||
10 | - reverse: true, | ||
11 | - defaultReverse: false, | 7 | + //左边颜色 |
8 | + colorLefts: ['#1dc1f5', '#1dc1f5'], | ||
9 | + //中间标题颜色 | ||
10 | + colorTexts: ['#1DC1F533', '#1DC1F5FF'], | ||
11 | + //右边颜色 | ||
12 | + colorRights: ['#1dc1f5', '#1dc1f5'], | ||
13 | + //头部左边尺寸位置配置 | ||
14 | + headLeftInfo: { | ||
15 | + w: 700, | ||
16 | + h: 300, | ||
17 | + ml: 0, | ||
18 | + mt: 0, | ||
19 | + headLeftReverse: false | ||
20 | + }, | ||
21 | + //头部中间尺寸位置配置 | ||
22 | + headCenterInfo: { | ||
23 | + w: 500, | ||
24 | + h: 70, | ||
25 | + ml: 235, | ||
26 | + mt: 125, | ||
27 | + dataset: '我是标题', | ||
28 | + textColor: '#fff', | ||
29 | + textSize: 32 | ||
30 | + }, | ||
31 | + //头部右边尺寸位置配置 | ||
32 | + headRightInfo: { | ||
33 | + w: 700, | ||
34 | + h: 300, | ||
35 | + ml: 245, | ||
36 | + mt: 0, | ||
37 | + headRightReverse: true | ||
38 | + } | ||
12 | } | 39 | } |
13 | 40 | ||
14 | export default class Config extends PublicConfigClass implements CreateComponentType { | 41 | export default class Config extends PublicConfigClass implements CreateComponentType { |
15 | - public key = LeftCenterRightHeadCommonConfig.key | ||
16 | - public chartConfig = cloneDeep(LeftCenterRightHeadCommonConfig) | ||
17 | - public option = cloneDeep(option) | 42 | + public key = LeftCenterRightHeadCommonConfig.key |
43 | + public chartConfig = cloneDeep(LeftCenterRightHeadCommonConfig) | ||
44 | + public option = cloneDeep(option) | ||
18 | } | 45 | } |
1 | <template> | 1 | <template> |
2 | - <CollapseItem name="头部左侧样式" :expanded="true"> | 2 | + <CollapseItem name="头部左侧配置" :expanded="true"> |
3 | <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorLefts" :key="index"> | 3 | <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorLefts" :key="index"> |
4 | <SettingItem name="颜色"> | 4 | <SettingItem name="颜色"> |
5 | <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorLefts[index]"></n-color-picker> | 5 | <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorLefts[index]"></n-color-picker> |
6 | </SettingItem> | 6 | </SettingItem> |
7 | <SettingItem> | 7 | <SettingItem> |
8 | - <n-button size="small" @click="optionData.colorLefts[index] = option.colorLefts[index]"> | ||
9 | - 恢复默认 | ||
10 | - </n-button> | 8 | + <n-button size="small" @click="optionData.colorLefts[index] = option.colorLefts[index]"> 恢复默认 </n-button> |
9 | + </SettingItem> | ||
10 | + </SettingItemBox> | ||
11 | + <SettingItemBox name="大小"> | ||
12 | + <SettingItem name="宽度"> | ||
13 | + <n-input-number size="small" v-model:value="optionData.headLeftInfo.w"></n-input-number> | ||
14 | + </SettingItem> | ||
15 | + <SettingItem name="高度"> | ||
16 | + <n-input-number size="small" v-model:value="optionData.headLeftInfo.h"></n-input-number> | ||
17 | + </SettingItem> | ||
18 | + </SettingItemBox> | ||
19 | + <SettingItemBox name="间距"> | ||
20 | + <SettingItem name="左间距"> | ||
21 | + <n-input-number size="small" v-model:value="optionData.headLeftInfo.ml"></n-input-number> | ||
22 | + </SettingItem> | ||
23 | + <SettingItem name="上间距"> | ||
24 | + <n-input-number size="small" v-model:value="optionData.headLeftInfo.mt"></n-input-number> | ||
25 | + </SettingItem> | ||
26 | + </SettingItemBox> | ||
27 | + <SettingItemBox name="方向"> | ||
28 | + <SettingItem> | ||
29 | + <n-space> | ||
30 | + <n-switch v-model:value="optionData.headLeftInfo.headLeftReverse" size="small" /> | ||
31 | + <n-text>开启反向</n-text> | ||
32 | + </n-space> | ||
11 | </SettingItem> | 33 | </SettingItem> |
12 | </SettingItemBox> | 34 | </SettingItemBox> |
13 | </CollapseItem> | 35 | </CollapseItem> |
14 | - <CollapseItem name="头部右侧样式" :expanded="true"> | 36 | + <CollapseItem name="头部中间配置" :expanded="true"> |
37 | + <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorTexts" :key="index"> | ||
38 | + <SettingItem name="颜色"> | ||
39 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorTexts[index]"></n-color-picker> | ||
40 | + </SettingItem> | ||
41 | + <SettingItem> | ||
42 | + <n-button size="small" @click="optionData.colorTexts[index] = option.colorTexts[index]"> 恢复默认 </n-button> | ||
43 | + </SettingItem> | ||
44 | + </SettingItemBox> | ||
45 | + <SettingItemBox name="文字" alone> | ||
46 | + <SettingItem> | ||
47 | + <n-input v-model:value="optionData.headCenterInfo.dataset" size="small"></n-input> | ||
48 | + </SettingItem> | ||
49 | + </SettingItemBox> | ||
50 | + <SettingItemBox name="样式"> | ||
51 | + <SettingItem name="颜色"> | ||
52 | + <n-color-picker | ||
53 | + size="small" | ||
54 | + :modes="['hex']" | ||
55 | + v-model:value="optionData.headCenterInfo.textColor" | ||
56 | + ></n-color-picker> | ||
57 | + </SettingItem> | ||
58 | + <SettingItem name="大小"> | ||
59 | + <n-input-number v-model:value="optionData.headCenterInfo.textSize" size="small" :min="12"></n-input-number> | ||
60 | + </SettingItem> | ||
61 | + </SettingItemBox> | ||
62 | + <SettingItemBox name="大小"> | ||
63 | + <SettingItem name="宽度"> | ||
64 | + <n-input-number size="small" v-model:value="optionData.headCenterInfo.w"></n-input-number> | ||
65 | + </SettingItem> | ||
66 | + <SettingItem name="高度"> | ||
67 | + <n-input-number size="small" v-model:value="optionData.headCenterInfo.h"></n-input-number> | ||
68 | + </SettingItem> | ||
69 | + </SettingItemBox> | ||
70 | + <SettingItemBox name="间距"> | ||
71 | + <SettingItem name="左间距"> | ||
72 | + <n-input-number size="small" v-model:value="optionData.headCenterInfo.ml"></n-input-number> | ||
73 | + </SettingItem> | ||
74 | + <SettingItem name="上间距"> | ||
75 | + <n-input-number size="small" v-model:value="optionData.headCenterInfo.mt"></n-input-number> | ||
76 | + </SettingItem> | ||
77 | + </SettingItemBox> | ||
78 | + </CollapseItem> | ||
79 | + <CollapseItem name="头部右侧配置" :expanded="true"> | ||
15 | <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorRights" :key="index"> | 80 | <SettingItemBox :name="`颜色-${index + 1}`" v-for="(item, index) in optionData.colorRights" :key="index"> |
16 | <SettingItem name="颜色"> | 81 | <SettingItem name="颜色"> |
17 | <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorRights[index]"></n-color-picker> | 82 | <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.colorRights[index]"></n-color-picker> |
18 | </SettingItem> | 83 | </SettingItem> |
19 | <SettingItem> | 84 | <SettingItem> |
20 | - <n-button size="small" @click="optionData.colorRights[index] = option.colorRights[index]"> | ||
21 | - 恢复默认 | ||
22 | - </n-button> | 85 | + <n-button size="small" @click="optionData.colorRights[index] = option.colorRights[index]"> 恢复默认 </n-button> |
86 | + </SettingItem> | ||
87 | + </SettingItemBox> | ||
88 | + <SettingItemBox name="大小"> | ||
89 | + <SettingItem name="宽度"> | ||
90 | + <n-input-number size="small" v-model:value="optionData.headRightInfo.w"></n-input-number> | ||
91 | + </SettingItem> | ||
92 | + <SettingItem name="高度"> | ||
93 | + <n-input-number size="small" v-model:value="optionData.headRightInfo.h"></n-input-number> | ||
94 | + </SettingItem> | ||
95 | + </SettingItemBox> | ||
96 | + <SettingItemBox name="间距"> | ||
97 | + <SettingItem name="左间距"> | ||
98 | + <n-input-number size="small" v-model:value="optionData.headRightInfo.ml"></n-input-number> | ||
99 | + </SettingItem> | ||
100 | + <SettingItem name="上间距"> | ||
101 | + <n-input-number size="small" v-model:value="optionData.headRightInfo.mt"></n-input-number> | ||
102 | + </SettingItem> | ||
103 | + </SettingItemBox> | ||
104 | + <SettingItemBox name="方向"> | ||
105 | + <SettingItem> | ||
106 | + <n-space> | ||
107 | + <n-switch v-model:value="optionData.headRightInfo.headRightReverse" size="small" /> | ||
108 | + <n-text>开启反向</n-text> | ||
109 | + </n-space> | ||
23 | </SettingItem> | 110 | </SettingItem> |
24 | </SettingItemBox> | 111 | </SettingItemBox> |
25 | </CollapseItem> | 112 | </CollapseItem> |
@@ -28,18 +115,12 @@ | @@ -28,18 +115,12 @@ | ||
28 | <script setup lang="ts"> | 115 | <script setup lang="ts"> |
29 | import { PropType } from 'vue' | 116 | import { PropType } from 'vue' |
30 | import { option } from './config' | 117 | import { option } from './config' |
31 | -import { | ||
32 | - CollapseItem, | ||
33 | - SettingItemBox, | ||
34 | - SettingItem | ||
35 | -} from '@/components/Pages/ChartItemSetting' | 118 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' |
36 | 119 | ||
37 | -const props = defineProps({ | 120 | +defineProps({ |
38 | optionData: { | 121 | optionData: { |
39 | - type: Object as PropType<typeof option>, | 122 | + type: Object as any as PropType<typeof option>, |
40 | required: true | 123 | required: true |
41 | } | 124 | } |
42 | }) | 125 | }) |
43 | - | ||
44 | - | ||
45 | </script> | 126 | </script> |
@@ -8,7 +8,7 @@ export const LeftCenterRightHeadCommonConfig: ConfigType = { | @@ -8,7 +8,7 @@ export const LeftCenterRightHeadCommonConfig: ConfigType = { | ||
8 | key, | 8 | key, |
9 | chartKey, | 9 | chartKey, |
10 | conKey, | 10 | conKey, |
11 | - title: '头部', | 11 | + title: '头部组合2', |
12 | category: ChatCategoryEnum.HEADCOMBINATION, | 12 | category: ChatCategoryEnum.HEADCOMBINATION, |
13 | categoryName: ChatCategoryEnumName.HEADCOMBINATION, | 13 | categoryName: ChatCategoryEnumName.HEADCOMBINATION, |
14 | package: EPackagesCategoryEnum.COMPOSES, | 14 | package: EPackagesCategoryEnum.COMPOSES, |
1 | <template> | 1 | <template> |
2 | - <div> | ||
3 | - <n-grid :x-gap="12" :cols="3" layout-shift-disabled> | ||
4 | - <n-grid-item> | ||
5 | - <svg :width="w" :height="h"> | ||
6 | - <polyline :stroke="colorLefts[0]" stroke-width="2" fill="transparent" | ||
7 | - :points="`${xFalsePos(0)}, 0 ${xFalsePos(30)}, ${h / 2}`" /> | ||
8 | - | ||
9 | - <polyline :stroke="colorLefts[0]" stroke-width="2" fill="transparent" :points="`${xFalsePos(20)}, 0 ${xFalsePos(50)}, ${h / 2} ${xFalsePos(w)}, ${h / 2 | ||
10 | - }`" /> | ||
11 | - | ||
12 | - <polyline :stroke="colorLefts[1]" fill="transparent" stroke-width="3" | ||
13 | - :points="`${xFalsePos(0)}, ${h - 3}, ${xFalsePos(200)}, ${h - 3}`" /> | ||
14 | - </svg> | ||
15 | - </n-grid-item> | ||
16 | - <n-grid-item> | ||
17 | - <!-- <div style="width:300px;height: 30px"></div>--> | ||
18 | - </n-grid-item> | ||
19 | - <n-grid-item> | ||
20 | - <!-- <svg :width="w" :height="h">--> | ||
21 | - <!-- <polyline--> | ||
22 | - <!-- :stroke="colorRights[0]"--> | ||
23 | - <!-- stroke-width="2"--> | ||
24 | - <!-- fill="transparent"--> | ||
25 | - <!-- :points="`${xPos(0)}, 0 ${xPos(30)}, ${h / 2}`"--> | ||
26 | - <!-- />--> | ||
27 | - | ||
28 | - <!-- <polyline--> | ||
29 | - <!-- :stroke="colorRights[0]"--> | ||
30 | - <!-- stroke-width="2"--> | ||
31 | - <!-- fill="transparent"--> | ||
32 | - <!-- :points="`${xPos(20)}, 0 ${xPos(50)}, ${h / 2} ${xPos(w)}, ${--> | ||
33 | - <!-- h / 2--> | ||
34 | - <!-- }`"--> | ||
35 | - <!-- />--> | ||
36 | - | ||
37 | - <!-- <polyline--> | ||
38 | - <!-- :stroke="colorRights[1]"--> | ||
39 | - <!-- fill="transparent"--> | ||
40 | - <!-- stroke-width="3"--> | ||
41 | - <!-- :points="`${xPos(0)}, ${h - 3}, ${xPos(200)}, ${h - 3}`"--> | ||
42 | - <!-- />--> | ||
43 | - <!-- </svg>--> | ||
44 | - </n-grid-item> | 2 | + <div style="display: flex"> |
3 | + <n-grid :x-gap="12" :y-gap="12" :cols="4" layout-shift-disabled> | ||
4 | + <n-gi> | ||
5 | + <div :style="{ marginLeft: headLeftInfo.ml + 'px', marginTop: headLeftInfo.mt + 'px' }"> | ||
6 | + <svg :width="headLeftInfo.w + 'px'" :height="headLeftInfo.h + 'px'"> | ||
7 | + <polyline | ||
8 | + :stroke="colorLefts[0]" | ||
9 | + stroke-width="2" | ||
10 | + fill="transparent" | ||
11 | + :points="`${xLeftPos(0)}, 0 ${xLeftPos(30)}, ${headLeftInfo.h / 2}`" | ||
12 | + /> | ||
13 | + <polyline | ||
14 | + :stroke="colorLefts[0]" | ||
15 | + stroke-width="2" | ||
16 | + fill="transparent" | ||
17 | + :points="`${xLeftPos(20)}, 0 ${xLeftPos(50)}, ${headLeftInfo.h / 2} ${xLeftPos(headLeftInfo.w)}, ${ | ||
18 | + headLeftInfo.h / 2 | ||
19 | + }`" | ||
20 | + /> | ||
21 | + <polyline | ||
22 | + :stroke="colorLefts[1]" | ||
23 | + fill="transparent" | ||
24 | + stroke-width="3" | ||
25 | + :points="`${xLeftPos(0)}, ${headLeftInfo.h - 3}, ${xLeftPos(200)}, ${headLeftInfo.h - 3}`" | ||
26 | + /> | ||
27 | + </svg> | ||
28 | + </div> | ||
29 | + </n-gi> | ||
30 | + <n-gi> | ||
31 | + <div :style="{ top: headCenterInfo.mt + 'px', left: headCenterInfo.ml + 'px' }" class="go-border-06"> | ||
32 | + <svg xmlns="http://www.w3.org/2000/svg" :width="headCenterInfo.w" :height="headCenterInfo.h"> | ||
33 | + <polygon class="stroke fill" :points="`15.5 6.5 20.5 0.5 50.5 0.5 55.5 6.5 15.5 6.5`" /> | ||
34 | + <polygon | ||
35 | + class="stroke fill" | ||
36 | + :points="`15.5 ${headCenterInfo.h - 6.5} 20.5 ${headCenterInfo.h - 0.5} 50.5 ${ | ||
37 | + headCenterInfo.h - 0.5 | ||
38 | + } 55.5 ${headCenterInfo.h - 6.5} 15.5 ${headCenterInfo.h - 6.5}`" | ||
39 | + /> | ||
40 | + <polygon | ||
41 | + class="stroke fill" | ||
42 | + :points="`${headCenterInfo.w - 15.5} 6.5 ${headCenterInfo.w - 20.5} 0.5 ${headCenterInfo.w - 50.5} 0.5 ${ | ||
43 | + headCenterInfo.w - 55.5 | ||
44 | + } 6.5 ${headCenterInfo.w - 15.5} 6.5`" | ||
45 | + /> | ||
46 | + <polygon | ||
47 | + class="stroke fill" | ||
48 | + :points="`${headCenterInfo.w - 15.5} ${headCenterInfo.h - 6.5} ${headCenterInfo.w - 20.5} ${ | ||
49 | + headCenterInfo.h - 0.5 | ||
50 | + } ${headCenterInfo.w - 50.5} ${headCenterInfo.h - 0.5} ${headCenterInfo.w - 55.5} ${ | ||
51 | + headCenterInfo.h - 6.5 | ||
52 | + } ${headCenterInfo.w - 15.5} ${headCenterInfo.h - 6.5}`" | ||
53 | + /> | ||
54 | + <polygon | ||
55 | + class="stroke fill" | ||
56 | + :points="`15.5 6.5 0.5 ${headCenterInfo.h / 2} 15.5 ${headCenterInfo.h - 6.5} ${ | ||
57 | + headCenterInfo.w - 15.5 | ||
58 | + } ${headCenterInfo.h - 6.5} ${headCenterInfo.w - 0.5} ${headCenterInfo.h / 2} ${ | ||
59 | + headCenterInfo.w - 15.5 | ||
60 | + } 6.5 15.5 6.5`" | ||
61 | + /> | ||
62 | + <polyline | ||
63 | + class="stroke fill-none" | ||
64 | + :points="`20.5 14.5 8.5 ${headCenterInfo.h / 2} 20.5 ${headCenterInfo.h - 14.5}`" | ||
65 | + /> | ||
66 | + <polyline | ||
67 | + class="stroke fill-none" | ||
68 | + :points="`${headCenterInfo.w - 20.5} 14.5 ${headCenterInfo.w - 8.5} ${headCenterInfo.h / 2} ${ | ||
69 | + headCenterInfo.w - 20.5 | ||
70 | + } ${headCenterInfo.h - 14.5}`" | ||
71 | + /> | ||
72 | + </svg> | ||
73 | + <span class="text">{{ headCenterInfo.dataset }}</span> | ||
74 | + </div> | ||
75 | + </n-gi> | ||
76 | + <n-gi> | ||
77 | + <div :style="{ marginLeft: headRightInfo.ml + 'px', marginTop: headRightInfo.mt + 'px' }"> | ||
78 | + <svg :width="headRightInfo.w" :height="headRightInfo.h"> | ||
79 | + <polyline | ||
80 | + :stroke="colorRights[0]" | ||
81 | + stroke-width="2" | ||
82 | + fill="transparent" | ||
83 | + :points="`${xRightPos(0)}, 0 ${xRightPos(30)}, ${headRightInfo.h / 2}`" | ||
84 | + /> | ||
85 | + <polyline | ||
86 | + :stroke="colorRights[0]" | ||
87 | + stroke-width="2" | ||
88 | + fill="transparent" | ||
89 | + :points="`${xRightPos(20)}, 0 ${xRightPos(50)}, ${headRightInfo.h / 2} ${xRightPos(headRightInfo.w)}, ${ | ||
90 | + headRightInfo.h / 2 | ||
91 | + }`" | ||
92 | + /> | ||
93 | + <polyline | ||
94 | + :stroke="colorRights[1]" | ||
95 | + fill="transparent" | ||
96 | + stroke-width="3" | ||
97 | + :points="`${xRightPos(0)}, ${headRightInfo.h - 3}, ${xRightPos(200)}, ${headRightInfo.h - 3}`" | ||
98 | + /> | ||
99 | + </svg> | ||
100 | + </div> | ||
101 | + </n-gi> | ||
45 | </n-grid> | 102 | </n-grid> |
46 | </div> | 103 | </div> |
47 | </template> | 104 | </template> |
@@ -57,22 +114,51 @@ const props = defineProps({ | @@ -57,22 +114,51 @@ const props = defineProps({ | ||
57 | }) | 114 | }) |
58 | 115 | ||
59 | //默认设置宽高距离位置 | 116 | //默认设置宽高距离位置 |
60 | -// props.chartConfig.attr.w = 1920 | ||
61 | -// props.chartConfig.attr.h = 148 | ||
62 | -// props.chartConfig.attr.x = 0 | ||
63 | -// props.chartConfig.attr.y = 0 | ||
64 | -const { w, h } = toRefs(props.chartConfig.attr) | ||
65 | -const { colorLefts, colorRights, reverse, defaultReverse } = toRefs(props.chartConfig.option) | 117 | +props.chartConfig.attr.w = 1920 |
118 | +props.chartConfig.attr.h = 300 | ||
119 | +props.chartConfig.attr.x = 0 | ||
120 | +props.chartConfig.attr.y = 0 | ||
66 | 121 | ||
67 | -const xPos = (pos: number) => { | ||
68 | - if (!reverse.value) return pos | ||
69 | - return w.value - pos | 122 | +const { headLeftInfo, headCenterInfo, headRightInfo, colorLefts, colorRights, colorTexts } = toRefs( |
123 | + props.chartConfig.option | ||
124 | +) | ||
125 | + | ||
126 | +const xLeftPos = (pos: number) => { | ||
127 | + if (!headLeftInfo.value.headLeftReverse) return pos | ||
128 | + return headLeftInfo.value.w - pos | ||
70 | } | 129 | } |
71 | -const xFalsePos = (pos: number) => { | ||
72 | - if (!defaultReverse.value) return pos | ||
73 | - return w.value - pos | 130 | + |
131 | +const xRightPos = (pos: number) => { | ||
132 | + if (!headRightInfo.value.headRightReverse) return pos | ||
133 | + return headRightInfo.value.w - pos | ||
74 | } | 134 | } |
75 | </script> | 135 | </script> |
76 | 136 | ||
77 | <style lang="scss" scoped> | 137 | <style lang="scss" scoped> |
138 | +@include go('border-06') { | ||
139 | + position: relative; | ||
140 | + display: flex; | ||
141 | + justify-content: center; | ||
142 | + align-items: center; | ||
143 | + | ||
144 | + svg { | ||
145 | + position: absolute; | ||
146 | + z-index: -1; | ||
147 | + } | ||
148 | + | ||
149 | + .fill { | ||
150 | + fill: v-bind('colorTexts[0]'); | ||
151 | + } | ||
152 | + .fill-none { | ||
153 | + fill: none; | ||
154 | + } | ||
155 | + .stroke { | ||
156 | + stroke: v-bind('colorTexts[1]'); | ||
157 | + } | ||
158 | + | ||
159 | + .text { | ||
160 | + color: v-bind('headCenterInfo.textColor'); | ||
161 | + font-size: v-bind('headCenterInfo.textSize+"px"'); | ||
162 | + } | ||
163 | +} | ||
78 | </style> | 164 | </style> |
1 | import { LeftCenterRightHeadConfig } from './LeftCenterRightHead/index' | 1 | import { LeftCenterRightHeadConfig } from './LeftCenterRightHead/index' |
2 | import { LeftCenterRightHeadCommonConfig } from './LeftCenterRightHeadCommon/index' | 2 | import { LeftCenterRightHeadCommonConfig } from './LeftCenterRightHeadCommon/index' |
3 | +import { LeftCenterRightHeadAnimatConfig } from './LeftCenterRightHeadAnimat/index' | ||
3 | 4 | ||
4 | -export default [LeftCenterRightHeadConfig, LeftCenterRightHeadCommonConfig] | 5 | +export default [LeftCenterRightHeadConfig, LeftCenterRightHeadCommonConfig,LeftCenterRightHeadAnimatConfig] |