Showing
5 changed files
with
237 additions
and
0 deletions
1 | +import { PublicConfigClass } from '@/packages/public' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { Subtitle4Config } from './index' | |
4 | +import cloneDeep from 'lodash/cloneDeep' | |
5 | +import { chartInitConfig } from '@/settings/designSetting' | |
6 | + | |
7 | +export const option = { | |
8 | + dataset: '我是标题', | |
9 | + attribute: { | |
10 | + linearColors: [ | |
11 | + '#2AFFFF', | |
12 | + '#2AFFFF', | |
13 | + '#2affff', | |
14 | + '#2affff', | |
15 | + '#2affff', | |
16 | + '#2affff', | |
17 | + '#2affff', | |
18 | + '#2affff', | |
19 | + '#2affff', | |
20 | + '#2affff', | |
21 | + ], | |
22 | + fontSize: 20, | |
23 | + fontPos: { | |
24 | + x: 0, | |
25 | + y: 20 | |
26 | + }, | |
27 | + fontColor: '#2AFFFF' | |
28 | + } | |
29 | +} | |
30 | + | |
31 | +export default class Config extends PublicConfigClass implements CreateComponentType { | |
32 | + public key = Subtitle4Config.key | |
33 | + public attr = { ...chartInitConfig, zIndex: 1, w: 550, h: 60 } | |
34 | + public chartConfig = cloneDeep(Subtitle4Config) | |
35 | + public option = cloneDeep(option) | |
36 | +} | ... | ... |
1 | +<template> | |
2 | + <CollapseItem name="配置" :expanded="true"> | |
3 | + <SettingItemBox name="标题"> | |
4 | + <SettingItem name="内容"> | |
5 | + <n-input v-model:value="optionData.dataset" /> | |
6 | + </SettingItem> | |
7 | + <SettingItem name="大小"> | |
8 | + <n-input-number v-model:value="optionData.attribute.fontSize" /> | |
9 | + </SettingItem> | |
10 | + <SettingItem name="x轴位置"> | |
11 | + <n-input-number v-model:value="optionData.attribute.fontPos.x" /> | |
12 | + </SettingItem> | |
13 | + <SettingItem name="y轴位置"> | |
14 | + <n-input-number v-model:value="optionData.attribute.fontPos.y" /> | |
15 | + </SettingItem> | |
16 | + <SettingItem name="颜色"> | |
17 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.fontColor"></n-color-picker> | |
18 | + </SettingItem> | |
19 | + <SettingItem name="颜色"> | |
20 | + <n-button size="small" @click="optionData.attribute.fontColor = '#2AFFFF'"> 恢复默认 </n-button> | |
21 | + </SettingItem> | |
22 | + </SettingItemBox> | |
23 | + <SettingItemBox | |
24 | + :name="`装饰颜色-${index + 1}`" | |
25 | + v-for="(item, index) in optionData.attribute.linearColors" | |
26 | + :key="index" | |
27 | + > | |
28 | + <SettingItem name="颜色"> | |
29 | + <n-color-picker | |
30 | + size="small" | |
31 | + :modes="['hex']" | |
32 | + v-model:value="optionData.attribute.linearColors[index]" | |
33 | + ></n-color-picker> | |
34 | + </SettingItem> | |
35 | + <SettingItem> | |
36 | + <n-button size="small" @click="optionData.attribute.linearColors[index] = option.attribute.linearColors[index]"> | |
37 | + 恢复默认 | |
38 | + </n-button> | |
39 | + </SettingItem> | |
40 | + </SettingItemBox> | |
41 | + </CollapseItem> | |
42 | +</template> | |
43 | + | |
44 | +<script setup lang="ts"> | |
45 | +import { PropType } from 'vue' | |
46 | +import { option } from './config' | |
47 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
48 | + | |
49 | +defineProps({ | |
50 | + optionData: { | |
51 | + type: Object as PropType<typeof option>, | |
52 | + required: true | |
53 | + } | |
54 | +}) | |
55 | +</script> | ... | ... |
1 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
2 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
3 | +import { useWidgetKey } from '@/packages/external/useWidgetKey' | |
4 | + | |
5 | +const { key, chartKey, conKey } = useWidgetKey('Subtitle4',true) | |
6 | + | |
7 | +export const Subtitle4Config: ConfigType = { | |
8 | + key, | |
9 | + chartKey, | |
10 | + conKey, | |
11 | + title: '小标题4', | |
12 | + category: ChatCategoryEnum.SUBTITLE, | |
13 | + categoryName: ChatCategoryEnumName.SUBTITLE, | |
14 | + package: PackagesCategoryEnum.DECORATES, | |
15 | + chartFrame: ChartFrameEnum.COMMON, | |
16 | + image: 'title3.png', | |
17 | +} | ... | ... |
1 | +<template> | |
2 | + <div class="go-content-box"> | |
3 | + <svg | |
4 | + xmlns="http://www.w3.org/2000/svg" | |
5 | + xmlns:xlink="http://www.w3.org/1999/xlink" | |
6 | + :width="w" | |
7 | + :height="h" | |
8 | + fill="none" | |
9 | + > | |
10 | + <defs> | |
11 | + <linearGradient id="linear_0" x1="0%" y1="50%" x2="100%" y2="50%" gradientUnits="objectBoundingBox"> | |
12 | + <stop offset="0" :stop-color="attribute.linearColors[0]" stop-opacity="0.5" /> | |
13 | + <stop offset="1" :stop-color="attribute.linearColors[1]" stop-opacity="0" /> | |
14 | + </linearGradient> | |
15 | + </defs> | |
16 | + <g opacity="1" :transform="`translate(0 ${h / 2 - 10}) rotate(0 248 17.5)`"> | |
17 | + <path | |
18 | + id="路径 13" | |
19 | + :style="{ stroke: attribute.linearColors[2], strokeWidth: 1, strokeOpacity: 1 }" | |
20 | + :transform="`translate(8 12) rotate(0 243.5 8)`" | |
21 | + :d="`M0,0 L14.01,16 L${w},16`" | |
22 | + /> | |
23 | + <g opacity="1" transform="translate(28 0) rotate(0 46 13)"> | |
24 | + <text> | |
25 | + <tspan | |
26 | + :x="attribute.fontPos.x" | |
27 | + :y="attribute.fontPos.y" | |
28 | + :font-size="attribute.fontSize" | |
29 | + line-height="0" | |
30 | + :fill="attribute.fontColor" | |
31 | + opacity="1" | |
32 | + font-family="YouSheBiaoTiHei" | |
33 | + letter-spacing="0" | |
34 | + > | |
35 | + {{ dataset }} | |
36 | + </tspan> | |
37 | + </text> | |
38 | + </g> | |
39 | + <path | |
40 | + id="圆形 15" | |
41 | + fill-rule="evenodd" | |
42 | + :style="{ fill: attribute.linearColors[3] }" | |
43 | + transform="translate(6 10) rotate(0 2.5 2.5)" | |
44 | + opacity="1" | |
45 | + d="M2.5,0C1.12,0 0,1.12 0,2.5C0,3.88 1.12,5 2.5,5C3.88,5 5,3.88 5,2.5C5,1.12 3.88,0 2.5,0Z " | |
46 | + /> | |
47 | + <path | |
48 | + id="圆形 15" | |
49 | + :style="{ stroke: attribute.linearColors[4], strokeWidth: 0.5, strokeOpacity: 0.5 }" | |
50 | + transform="translate(3 7) rotate(0 5.5 5.5)" | |
51 | + d="M5.5,0C2.46,0 0,2.46 0,5.5C0,8.54 2.46,11 5.5,11C8.54,11 11,8.54 11,5.5C11,2.46 8.54,0 5.5,0Z " | |
52 | + /> | |
53 | + <path | |
54 | + id="圆形 15" | |
55 | + :style="{ stroke: attribute.linearColors[5], strokeWidth: 0.5, strokeOpacity: 0.19 }" | |
56 | + transform="translate(0 4) rotate(0 8.5 8.5)" | |
57 | + d="M8.5,0C3.81,0 0,3.81 0,8.5C0,13.19 3.81,17 8.5,17C13.19,17 17,13.19 17,8.5C17,3.81 13.19,0 8.5,0Z " | |
58 | + /> | |
59 | + <path | |
60 | + id="圆形 16" | |
61 | + fill-rule="evenodd" | |
62 | + :style="{ fill: attribute.linearColors[6] }" | |
63 | + transform="translate(2.5 12) rotate(0 1 1)" | |
64 | + opacity="1" | |
65 | + d="M1,0C0.45,0 0,0.45 0,1C0,1.55 0.45,2 1,2C1.55,2 2,1.55 2,1C2,0.45 1.55,0 1,0Z " | |
66 | + /> | |
67 | + <path | |
68 | + id="圆形 16" | |
69 | + fill-rule="evenodd" | |
70 | + :style="{ fill: attribute.linearColors[7] }" | |
71 | + transform="translate(12.5 12) rotate(0 1 1)" | |
72 | + opacity="1" | |
73 | + d="M1,0C0.45,0 0,0.45 0,1C0,1.55 0.45,2 1,2C1.55,2 2,1.55 2,1C2,0.45 1.55,0 1,0Z " | |
74 | + /> | |
75 | + <path | |
76 | + id="圆形 16" | |
77 | + fill-rule="evenodd" | |
78 | + :style="{ fill: attribute.linearColors[8] }" | |
79 | + transform="translate(8 6.5) rotate(0 1 1)" | |
80 | + opacity="1" | |
81 | + d="M1,0C0.45,0 0,0.45 0,1C0,1.55 0.45,2 1,2C1.55,2 2,1.55 2,1C2,0.45 1.55,0 1,0Z " | |
82 | + /> | |
83 | + <path | |
84 | + id="圆形 17" | |
85 | + fill-rule="evenodd" | |
86 | + :style="{ fill: attribute.linearColors[9] }" | |
87 | + :transform="`translate(${w - 5} 26) rotate(0 2 2)`" | |
88 | + opacity="1" | |
89 | + d="M2,0C0.9,0 0,0.9 0,2C0,3.1 0.9,4 2,4C3.1,4 4,3.1 4,2C4,0.9 3.1,0 2,0Z " | |
90 | + /> | |
91 | + <path | |
92 | + id="矩形 44" | |
93 | + fill-rule="evenodd" | |
94 | + fill="url(#linear_0)" | |
95 | + transform="translate(23 30) rotate(0 110.5 2.5)" | |
96 | + opacity="1" | |
97 | + :d="`M5,5 L${w / 2},5 L${w / 2},0 L0,0 L5,5 Z `" | |
98 | + /> | |
99 | + </g> | |
100 | + </svg> | |
101 | + </div> | |
102 | +</template> | |
103 | +<script setup lang="ts"> | |
104 | +import { PropType, toRefs } from 'vue' | |
105 | +import { CreateComponentType } from '@/packages/index.d' | |
106 | + | |
107 | +const props = defineProps({ | |
108 | + chartConfig: { | |
109 | + type: Object as PropType<CreateComponentType>, | |
110 | + required: true | |
111 | + } | |
112 | +}) | |
113 | + | |
114 | +const { dataset, attribute } = toRefs(props.chartConfig.option) | |
115 | + | |
116 | +const { w, h } = toRefs(props.chartConfig.attr) | |
117 | +</script> | |
118 | + | |
119 | +<style lang="scss" scoped> | |
120 | +.go-content-box { | |
121 | + width: v-bind('w+"px"'); | |
122 | + height: v-bind('h+"px"'); | |
123 | + display: flex; | |
124 | + align-items: center; | |
125 | + justify-content: center; | |
126 | +} | |
127 | +</style> | ... | ... |
... | ... | @@ -28,6 +28,7 @@ import { Headline2Config } from '@/packages/components/external/Decorates/Headli |
28 | 28 | import { Subtitle1Config } from '@/packages/components/external/Decorates/Subtitle/Subtitle1' |
29 | 29 | import { Subtitle2Config } from '@/packages/components/external/Decorates/Subtitle/Subtitle2' |
30 | 30 | import { Subtitle3Config } from '@/packages/components/external/Decorates/Subtitle/Subtitle3' |
31 | +import { Subtitle4Config } from '@/packages/components/external/Decorates/Subtitle/Subtitle4' | |
31 | 32 | import { Decorates07Config } from '@/packages/components/external/Decorates/Decorates/Decorates07' |
32 | 33 | import { Decorates08Config } from '@/packages/components/external/Decorates/Decorates/Decorates08' |
33 | 34 | |
... | ... | @@ -46,6 +47,7 @@ export function useInjectLib(packagesList: EPackagesType) { |
46 | 47 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Subtitle1Config)//小标题1 |
47 | 48 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Subtitle2Config)//小标题2 |
48 | 49 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Subtitle3Config)//小标题3 |
50 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Subtitle4Config)//小标题4 | |
49 | 51 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Decorates07Config)//新增装饰07 |
50 | 52 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, Decorates08Config)//新增装饰08 |
51 | 53 | // | ... | ... |