sh-chart 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.eslintrc.js +21 -0
  2. package/README.en.md +36 -0
  3. package/README.md +39 -0
  4. package/package.json +42 -0
  5. package/packages/components/global-components/mixin/autoResize.js +152 -0
  6. package/packages/components/global-components/sh-border/components/border1.vue +70 -0
  7. package/packages/components/global-components/sh-border/components/border10.vue +54 -0
  8. package/packages/components/global-components/sh-border/components/border11.vue +207 -0
  9. package/packages/components/global-components/sh-border/components/border12.vue +112 -0
  10. package/packages/components/global-components/sh-border/components/border13.vue +50 -0
  11. package/packages/components/global-components/sh-border/components/border2.vue +50 -0
  12. package/packages/components/global-components/sh-border/components/border3.vue +53 -0
  13. package/packages/components/global-components/sh-border/components/border4.vue +95 -0
  14. package/packages/components/global-components/sh-border/components/border5.vue +64 -0
  15. package/packages/components/global-components/sh-border/components/border6.vue +60 -0
  16. package/packages/components/global-components/sh-border/components/border7.vue +57 -0
  17. package/packages/components/global-components/sh-border/components/border8.vue +75 -0
  18. package/packages/components/global-components/sh-border/components/border9.vue +92 -0
  19. package/packages/components/global-components/sh-border/index.vue +73 -0
  20. package/packages/components/global-components/sh-border/mixin/border.js +62 -0
  21. package/packages/components/global-components/sh-charts/config/config.js +58 -0
  22. package/packages/components/global-components/sh-charts/index.vue +169 -0
  23. package/packages/components/global-components/sh-decoration/components/decoration1.vue +81 -0
  24. package/packages/components/global-components/sh-decoration/components/decoration10.vue +80 -0
  25. package/packages/components/global-components/sh-decoration/components/decoration11.vue +63 -0
  26. package/packages/components/global-components/sh-decoration/components/decoration12.vue +171 -0
  27. package/packages/components/global-components/sh-decoration/components/decoration2.vue +78 -0
  28. package/packages/components/global-components/sh-decoration/components/decoration3.vue +65 -0
  29. package/packages/components/global-components/sh-decoration/components/decoration4.vue +72 -0
  30. package/packages/components/global-components/sh-decoration/components/decoration5.vue +96 -0
  31. package/packages/components/global-components/sh-decoration/components/decoration6.vue +84 -0
  32. package/packages/components/global-components/sh-decoration/components/decoration7.vue +31 -0
  33. package/packages/components/global-components/sh-decoration/components/decoration8.vue +32 -0
  34. package/packages/components/global-components/sh-decoration/components/decoration9.vue +63 -0
  35. package/packages/components/global-components/sh-decoration/index.vue +71 -0
  36. package/packages/components/global-components/sh-decoration/mixin/decoration.js +69 -0
  37. package/packages/components/global-components/sh-screen-header/components/header1.vue +228 -0
  38. package/packages/components/global-components/sh-screen-header/components/header2.vue +285 -0
  39. package/packages/components/global-components/sh-screen-header/components/header3.vue +452 -0
  40. package/packages/components/global-components/sh-screen-header/components/header4.vue +544 -0
  41. package/packages/components/global-components/sh-screen-header/components/header5.vue +291 -0
  42. package/packages/components/global-components/sh-screen-header/components/header6.vue +206 -0
  43. package/packages/components/global-components/sh-screen-header/index.vue +50 -0
  44. package/packages/components/global-components/sh-screen-header/mixin/header.js +62 -0
  45. package/packages/components/global-components/sh-spin/index.vue +44 -0
  46. package/packages/components/index.js +24 -0
  47. package/packages/echarts/index.js +94 -0
  48. package/packages/echarts/map/110000.json +1 -0
  49. package/packages/echarts/map/120000.json +1 -0
  50. package/packages/echarts/map/130000.json +1 -0
  51. package/packages/echarts/map/140000.json +1 -0
  52. package/packages/echarts/map/150000.json +1 -0
  53. package/packages/echarts/map/210000.json +1 -0
  54. package/packages/echarts/map/220000.json +1 -0
  55. package/packages/echarts/map/230000.json +1 -0
  56. package/packages/echarts/map/310000.json +1 -0
  57. package/packages/echarts/map/320000.json +1 -0
  58. package/packages/echarts/map/330000.json +1 -0
  59. package/packages/echarts/map/340000.json +1 -0
  60. package/packages/echarts/map/350000.json +1 -0
  61. package/packages/echarts/map/360000.json +1 -0
  62. package/packages/echarts/map/370000.json +1 -0
  63. package/packages/echarts/map/410000.json +1 -0
  64. package/packages/echarts/map/420000.json +1 -0
  65. package/packages/echarts/map/430000.json +1 -0
  66. package/packages/echarts/map/440000.json +1 -0
  67. package/packages/echarts/map/450000.json +1 -0
  68. package/packages/echarts/map/460000.json +1 -0
  69. package/packages/echarts/map/500000.json +1 -0
  70. package/packages/echarts/map/510000.json +1 -0
  71. package/packages/echarts/map/520000.json +1 -0
  72. package/packages/echarts/map/530000.json +1 -0
  73. package/packages/echarts/map/540000.json +1 -0
  74. package/packages/echarts/map/610000.json +1 -0
  75. package/packages/echarts/map/620000.json +1 -0
  76. package/packages/echarts/map/630000.json +1 -0
  77. package/packages/echarts/map/640000.json +1 -0
  78. package/packages/echarts/map/650000.json +1 -0
  79. package/packages/echarts/map/710000.json +1 -0
  80. package/packages/echarts/map/china.json +1 -0
  81. package/packages/echarts/theme/dark.js +128 -0
  82. package/packages/echarts/theme/infographic.js +181 -0
  83. package/packages/echarts/theme/macarons.js +194 -0
  84. package/packages/echarts/theme/roma.js +66 -0
  85. package/packages/echarts/theme/shine.js +136 -0
  86. package/packages/echarts/theme/vintage.js +11 -0
  87. package/packages/index.js +31 -0
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-border-box-9">
3
+ <svg class="border-svg-container" :width="width" :height="height">
4
+ <defs>
5
+ <linearGradient :id="gradientId" x1="0%" y1="0%" x2="100%" y2="100%">
6
+ <animate attributeName="x1" values="0%;100%;0%" dur="10s" begin="0s" repeatCount="indefinite" />
7
+
8
+ <animate attributeName="x2" values="100%;0%;100%" dur="10s" begin="0s" repeatCount="indefinite" />
9
+
10
+ <stop offset="0%" :stop-color="mergedColor[0]">
11
+ <animate attributeName="stop-color" :values="`${mergedColor[0]};${mergedColor[1]};${mergedColor[0]}`" dur="10s" begin="0s" repeatCount="indefinite" />
12
+ </stop>
13
+ <stop offset="100%" :stop-color="mergedColor[1]">
14
+ <animate attributeName="stop-color" :values="`${mergedColor[1]};${mergedColor[0]};${mergedColor[1]}`" dur="10s" begin="0s" repeatCount="indefinite" />
15
+ </stop>
16
+ </linearGradient>
17
+
18
+ <mask :id="maskId">
19
+ <polyline stroke="#fff" stroke-width="3" fill="transparent" :points="`8, ${height * 0.4} 8, 3, ${width * 0.4 + 7}, 3`" />
20
+ <polyline fill="#fff" :points="`8, ${height * 0.15} 8, 3, ${width * 0.1 + 7}, 3 ${width * 0.1}, 8 14, 8 14, ${height * 0.15 - 7}`" />
21
+
22
+ <polyline stroke="#fff" stroke-width="3" fill="transparent" :points="`${width * 0.5}, 3 ${width - 3}, 3, ${width - 3}, ${height * 0.25}`" />
23
+ <polyline fill="#fff" :points="`${width * 0.52}, 3 ${width * 0.58}, 3 ${width * 0.58 - 7}, 9 ${width * 0.52 + 7}, 9`" />
24
+ <polyline fill="#fff" :points="`${width * 0.9}, 3 ${width - 3}, 3 ${width - 3}, ${height * 0.1} ${width - 9}, ${height * 0.1 - 7} ${width - 9}, 9 ${width * 0.9 + 7}, 9`" />
25
+
26
+ <polyline stroke="#fff" stroke-width="3" fill="transparent" :points="`8, ${height * 0.5} 8, ${height - 3} ${width * 0.3 + 7}, ${height - 3}`" />
27
+ <polyline fill="#fff" :points="`8, ${height * 0.55} 8, ${height * 0.7} 2, ${height * 0.7 - 7} 2, ${height * 0.55 + 7}`" />
28
+
29
+ <polyline stroke="#fff" stroke-width="3" fill="transparent" :points="`${width * 0.35}, ${height - 3} ${width - 3}, ${height - 3} ${width - 3}, ${height * 0.35}`" />
30
+ <polyline
31
+ fill="#fff"
32
+ :points="`${width * 0.92}, ${height - 3} ${width - 3}, ${height - 3} ${width - 3}, ${height * 0.8} ${width - 9}, ${height * 0.8 + 7} ${width - 9}, ${height - 9} ${
33
+ width * 0.92 + 7
34
+ }, ${height - 9}`" />
35
+ </mask>
36
+ </defs>
37
+
38
+ <polygon
39
+ :fill="backgroundColor"
40
+ :points="`
41
+ 15, 9 ${width * 0.1 + 1}, 9 ${width * 0.1 + 4}, 6 ${width * 0.52 + 2}, 6
42
+ ${width * 0.52 + 6}, 10 ${width * 0.58 - 7}, 10 ${width * 0.58 - 2}, 6
43
+ ${width * 0.9 + 2}, 6 ${width * 0.9 + 6}, 10 ${width - 10}, 10 ${width - 10}, ${height * 0.1 - 6}
44
+ ${width - 6}, ${height * 0.1 - 1} ${width - 6}, ${height * 0.8 + 1} ${width - 10}, ${height * 0.8 + 6}
45
+ ${width - 10}, ${height - 10} ${width * 0.92 + 7}, ${height - 10} ${width * 0.92 + 2}, ${height - 6}
46
+ 11, ${height - 6} 11, ${height * 0.15 - 2} 15, ${height * 0.15 - 7}
47
+ `" />
48
+
49
+ <rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
50
+ </svg>
51
+
52
+ <div class="border-box-content">
53
+ <slot></slot>
54
+ </div>
55
+ </div>
56
+ </template>
57
+
58
+ <script>
59
+ import mixin from '../mixin/border'
60
+ export default {
61
+ name: 'ShBorder9',
62
+ mixins: [mixin],
63
+ computed: {
64
+ gradientId() {
65
+ return `border-box-9-gradient-${this.borderId}`
66
+ },
67
+ maskId() {
68
+ return `border-box-9-mask-${this.borderId}`
69
+ }
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style scoped lang="scss">
75
+ .sh-border-box-9 {
76
+ position: relative;
77
+ width: 100%;
78
+ height: 100%;
79
+ .border-svg-container {
80
+ position: absolute;
81
+ width: 100%;
82
+ height: 100%;
83
+ left: 0;
84
+ top: 0;
85
+ }
86
+ .border-box-content {
87
+ position: relative;
88
+ width: 100%;
89
+ height: 100%;
90
+ }
91
+ }
92
+ </style>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <component :is="borderName" class="sh-border-box" v-bind="$props">
3
+ <slot></slot>
4
+ </component>
5
+ </template>
6
+
7
+ <script>
8
+ import border1 from './components/border1'
9
+ import border2 from './components/border2'
10
+ import border3 from './components/border3'
11
+ import border4 from './components/border4'
12
+ import border5 from './components/border5'
13
+ import border6 from './components/border6'
14
+ import border7 from './components/border7'
15
+ import border8 from './components/border8'
16
+ import border9 from './components/border9'
17
+ import border10 from './components/border10'
18
+ import border11 from './components/border11'
19
+ import border12 from './components/border12'
20
+ import border13 from './components/border13'
21
+ export default {
22
+ name: 'ShBorder',
23
+ components: {
24
+ border1,
25
+ border2,
26
+ border3,
27
+ border4,
28
+ border5,
29
+ border6,
30
+ border7,
31
+ border8,
32
+ border9,
33
+ border10,
34
+ border11,
35
+ border12,
36
+ border13
37
+ },
38
+ props: {
39
+ type: {
40
+ type: [String, Number],
41
+ default: '1'
42
+ },
43
+ color: {
44
+ type: Array,
45
+ default() {
46
+ return []
47
+ }
48
+ },
49
+ backgroundColor: {
50
+ type: String,
51
+ default: 'transparent'
52
+ },
53
+ dur: {
54
+ type: Number,
55
+ default: 3
56
+ },
57
+ reverse: {
58
+ type: Boolean,
59
+ default: false
60
+ }
61
+ },
62
+ computed: {
63
+ borderType() {
64
+ return +this.type > 0 && +this.type < 14 ? this.type : 1
65
+ },
66
+ borderName() {
67
+ return `border${this.borderType}`
68
+ }
69
+ }
70
+ }
71
+ </script>
72
+
73
+ <style lang="scss" scoped></style>
@@ -0,0 +1,62 @@
1
+ import autoResize from '../../mixin/autoResize'
2
+ export default {
3
+ mixins: [autoResize],
4
+ props: {
5
+ type: {
6
+ type: [String, Number],
7
+ default: '1'
8
+ },
9
+ color: {
10
+ type: Array,
11
+ default() {
12
+ return []
13
+ }
14
+ },
15
+ backgroundColor: {
16
+ type: String,
17
+ default: 'transparent'
18
+ },
19
+ dur: {
20
+ type: Number,
21
+ default: 3
22
+ },
23
+ reverse: {
24
+ type: Boolean,
25
+ default: false
26
+ }
27
+ },
28
+ data() {
29
+ return {
30
+ border: ['left-top', 'right-top', 'left-bottom', 'right-bottom'],
31
+ defaultColors: [
32
+ ['#4fd2dd', '#235fa7'],
33
+ ['#fff', 'rgba(255, 255, 255, 0.6)'],
34
+ ['#2862b7', '#2862b7'],
35
+ ['red', 'rgba(0,0,255,0.8)'],
36
+ ['rgba(255, 255, 255, 0.35)', 'rgba(255, 255, 255, 0.20)'],
37
+ ['rgba(255, 255, 255, 0.35)', 'gray'],
38
+ ['rgba(128,128,128,0.3)', 'rgba(128,128,128,0.5)'],
39
+ ['#235fa7', '#4fd2dd'],
40
+ ['#11eefd', '#0078d2'],
41
+ ['#1d48c4', '#d3e1f8'],
42
+ ['#8aaafb', '#1f33a2'],
43
+ ['#2e6099', '#7ce7fd'],
44
+ ['#6586ec', '#2cf7fe']
45
+ ]
46
+ }
47
+ },
48
+ computed: {
49
+ ref() {
50
+ return `sh-border-box-${this.type}`
51
+ },
52
+ borderId() {
53
+ return this.uuid()
54
+ },
55
+ mergedColor() {
56
+ let defaultColor = this.defaultColors[this.type - 1]
57
+ return this.deepMerge(defaultColor, this.color)
58
+ }
59
+ },
60
+ methods: {},
61
+ mounted() {}
62
+ }
@@ -0,0 +1,58 @@
1
+ const mainConfig = {
2
+ line: {},
3
+ bar: {},
4
+ pie: {
5
+ xAxis: {
6
+ show: false
7
+ },
8
+ yAxis: {
9
+ // show: false
10
+ }
11
+ },
12
+ scatter: {},
13
+ gauge: {
14
+ xAxis: {
15
+ show: false
16
+ },
17
+ yAxis: {
18
+ show: false
19
+ }
20
+ },
21
+ map: {
22
+ xAxis: {
23
+ show: false
24
+ },
25
+ yAxis: {
26
+ show: false
27
+ },
28
+ roamController: {
29
+ show: true,
30
+ left: 'right',
31
+ mapTypeControl: {
32
+ china: true
33
+ }
34
+ },
35
+ geo: {
36
+ map: 'china', // 与引用进来的地图js名字一致
37
+ zoom: 1,
38
+ roam: false, // 是否开启鼠标缩放和平移漫游 默认不开启 如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move' 设置成 true 为都开启
39
+ label: {
40
+ show: true // 是否显示对应地名
41
+ },
42
+ itemStyle: {
43
+ normal: {
44
+ borderWidth: 1, // 边际线大小
45
+ borderColor: '#bbb', // 边界线颜色
46
+ areaColor: '#fff' // 默认区域颜色
47
+ },
48
+ emphasis: {
49
+ borderColor: '#fff',
50
+ borderWidth: 1,
51
+ areaColor: '#fcb1b4' // 鼠标滑过区域颜色
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ export default mainConfig
@@ -0,0 +1,169 @@
1
+ <template>
2
+ <div :id="chartRef" :ref="chartRef" v-resize="resize" class="charts chart-common" :style="{ width: width, height: height }"></div>
3
+ </template>
4
+
5
+ <script>
6
+ import defaultSetup from './config/config'
7
+
8
+ export default {
9
+ name: 'ShChart',
10
+ props: {
11
+ type: String,
12
+ title: String,
13
+ subTitle: String,
14
+ theme: String,
15
+ legend: Boolean,
16
+ toolbox: Boolean,
17
+ loading: Boolean,
18
+ width: {
19
+ type: [String, Number],
20
+ default: '100%'
21
+ },
22
+ height: {
23
+ type: [String, Number],
24
+ default: '300px'
25
+ },
26
+ cdata: {
27
+ type: Array,
28
+ default() {
29
+ return []
30
+ }
31
+ },
32
+ coption: {
33
+ type: Object,
34
+ default() {
35
+ return {}
36
+ }
37
+ },
38
+ cextra: {
39
+ type: Object,
40
+ default() {
41
+ return {
42
+ locale: 'ZH'
43
+ }
44
+ }
45
+ }
46
+ },
47
+ emits: ['finished'],
48
+ data() {
49
+ return {
50
+ renderFinished: false,
51
+ shChartObj: null
52
+ }
53
+ },
54
+ computed: {
55
+ chartRef() {
56
+ return 'shChart' + this._.uid
57
+ },
58
+ chartTheme() {
59
+ let theme = this.theme || this.$store.state.app.chartTheme
60
+ return theme ? 'shTheme-' + theme : ''
61
+ },
62
+ chartTitle() {
63
+ return {
64
+ show: this.title !== undefined,
65
+ text: this.title,
66
+ subtext: this.subTitle,
67
+ x: 'center'
68
+ }
69
+ },
70
+ chartOption() {
71
+ const { type, chartTitle, toolbox, legend, cdata, coption, $vUtils } = this
72
+ let xAxisData = cdata.map(_ => _.name)
73
+ let seriesData = cdata.map(_ => _.value)
74
+ let noadTypeCharts = ['map']
75
+ let seriesType = noadTypeCharts.includes(type) ? '' : type
76
+ var defaultOption = {
77
+ grid: {
78
+ left: '5%',
79
+ right: '5%',
80
+ top: '30',
81
+ bottom: '30'
82
+ },
83
+ tooltip: {
84
+ show: true
85
+ },
86
+ title: chartTitle,
87
+ legend: {
88
+ show: legend,
89
+ left: 'left',
90
+ top: chartTitle ? '40' : '0',
91
+ data: xAxisData
92
+ },
93
+ toolbox: {
94
+ show: toolbox,
95
+ orient: 'horizontal',
96
+ itemSize: 10,
97
+ itemGap: 8,
98
+ feature: {
99
+ restore: {},
100
+ dataZoom: {},
101
+ saveAsImage: {}
102
+ }
103
+ },
104
+ xAxis: {
105
+ type: 'category',
106
+ data: xAxisData
107
+ },
108
+ yAxis: {
109
+ type: 'value'
110
+ },
111
+ series: [
112
+ {
113
+ data: seriesData,
114
+ type: seriesType
115
+ }
116
+ ]
117
+ }
118
+ return $vUtils.merge({}, defaultSetup[type], defaultOption, coption)
119
+ }
120
+ },
121
+ watch: {
122
+ chartOption: {
123
+ handler: function () {
124
+ this.chartRender(true)
125
+ },
126
+ deep: true
127
+ },
128
+ chartTheme() {
129
+ this.chartRender()
130
+ },
131
+ loading(value) {
132
+ if (this.shChartObj) {
133
+ value ? this.shChartObj.showLoading() : this.shChartObj.hideLoading()
134
+ }
135
+ }
136
+ },
137
+ mounted() {
138
+ this.chartRender()
139
+ },
140
+ beforeUnmount() {
141
+ if (this.shChartObj) this.shChartObj.dispose()
142
+ },
143
+ methods: {
144
+ chartRender(update = false) {
145
+ const that = this
146
+ let chart = null
147
+ that.renderFinished = false
148
+ if (update) {
149
+ chart = that.shChartObj
150
+ } else {
151
+ if (that.shChartObj) that.shChartObj.dispose()
152
+ that.shChartObj = chart = that.$echarts.init(that.$refs[that.chartRef], that.chartTheme, that.cextra)
153
+ }
154
+ chart.on('finished', () => {
155
+ that.finished()
156
+ })
157
+ chart.setOption(that.chartOption)
158
+ },
159
+ resize() {
160
+ this.renderFinished && this.shChartObj.resize()
161
+ },
162
+ // 渲染完成运行的函数
163
+ finished() {
164
+ this.renderFinished = true
165
+ return this.$emit('finished', this.shChartObj)
166
+ }
167
+ }
168
+ }
169
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-1">
3
+ <svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
4
+ <template v-for="(point, i) in points" :key="i">
5
+ <rect v-if="Math.random() > 0.6" :fill="mergedColor[0]" :x="point[0] - halfPointSideLength" :y="point[1] - halfPointSideLength" :width="pointSideLength" :height="pointSideLength">
6
+ <animate attributeName="fill" :values="`${mergedColor[0]};transparent`" dur="1s" :begin="Math.random() * 2" repeatCount="indefinite" />
7
+ </rect>
8
+ </template>
9
+
10
+ <rect v-if="rects[0]" :fill="mergedColor[1]" :x="rects[0][0] - pointSideLength" :y="rects[0][1] - pointSideLength" :width="pointSideLength * 2" :height="pointSideLength * 2">
11
+ <animate attributeName="width" :values="`0;${pointSideLength * 2}`" dur="2s" repeatCount="indefinite" />
12
+ <animate attributeName="height" :values="`0;${pointSideLength * 2}`" dur="2s" repeatCount="indefinite" />
13
+ <animate attributeName="x" :values="`${rects[0][0]};${rects[0][0] - pointSideLength}`" dur="2s" repeatCount="indefinite" />
14
+ <animate attributeName="y" :values="`${rects[0][1]};${rects[0][1] - pointSideLength}`" dur="2s" repeatCount="indefinite" />
15
+ </rect>
16
+
17
+ <rect v-if="rects[1]" :fill="mergedColor[1]" :x="rects[1][0] - 40" :y="rects[1][1] - pointSideLength" :width="40" :height="pointSideLength * 2">
18
+ <animate attributeName="width" values="0;40;0" dur="2s" repeatCount="indefinite" />
19
+ <animate attributeName="x" :values="`${rects[1][0]};${rects[1][0] - 40};${rects[1][0]}`" dur="2s" repeatCount="indefinite" />
20
+ </rect>
21
+ </svg>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ import mixin from '../mixin/decoration'
27
+ export default {
28
+ name: 'ShDecoration1',
29
+ mixins: [mixin],
30
+ data() {
31
+ const pointSideLength = 2.5
32
+ return {
33
+ svgWH: [200, 50],
34
+ svgScale: [1, 1],
35
+ rowNum: 4,
36
+ rowPoints: 20,
37
+ pointSideLength,
38
+ halfPointSideLength: pointSideLength / 2,
39
+ points: [],
40
+ rects: []
41
+ }
42
+ },
43
+ methods: {
44
+ calcSVGData() {
45
+ const { calcPointsPosition, calcRectsPosition, calcScale } = this
46
+ calcPointsPosition()
47
+ calcRectsPosition()
48
+ calcScale()
49
+ },
50
+ calcPointsPosition() {
51
+ const { svgWH, rowNum, rowPoints } = this
52
+ const [w, h] = svgWH
53
+ const horizontalGap = w / (rowPoints + 1)
54
+ const verticalGap = h / (rowNum + 1)
55
+ let points = new Array(rowNum).fill(0).map((foo, i) => new Array(rowPoints).fill(0).map((foo, j) => [horizontalGap * (j + 1), verticalGap * (i + 1)]))
56
+ this.points = points.reduce((all, item) => [...all, ...item], [])
57
+ },
58
+ calcRectsPosition() {
59
+ const { points, rowPoints } = this
60
+ const rect1 = points[rowPoints * 2 - 1]
61
+ const rect2 = points[rowPoints * 2 - 3]
62
+ this.rects = [rect1, rect2]
63
+ },
64
+ calcScale() {
65
+ const { width, height, svgWH } = this
66
+ const [w, h] = svgWH
67
+ this.svgScale = [width / w, height / h]
68
+ }
69
+ }
70
+ }
71
+ </script>
72
+
73
+ <style scoped lang="scss">
74
+ .sh-decoration-1 {
75
+ width: 100%;
76
+ height: 100%;
77
+ svg {
78
+ transform-origin: left top;
79
+ }
80
+ }
81
+ </style>
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-10">
3
+ <svg :width="width" :height="height">
4
+ <polyline :stroke="mergedColor[1]" stroke-width="2" :points="`0, ${height / 2} ${width}, ${height / 2}`" />
5
+
6
+ <polyline :stroke="mergedColor[0]" stroke-width="2" :points="`5, ${height / 2} ${width * 0.2 - 3}, ${height / 2}`" :stroke-dasharray="`0, ${width * 0.2}`" fill="freeze">
7
+ <animate :id="animationId2" attributeName="stroke-dasharray" :values="`0, ${width * 0.2};${width * 0.2}, 0;`" dur="3s" :begin="`${animationId1}.end`" fill="freeze" />
8
+ <animate attributeName="stroke-dasharray" :values="`${width * 0.2}, 0;0, ${width * 0.2}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
9
+ </polyline>
10
+
11
+ <polyline :stroke="mergedColor[0]" stroke-width="2" :points="`${width * 0.2 + 3}, ${height / 2} ${width * 0.8 - 3}, ${height / 2}`" :stroke-dasharray="`0, ${width * 0.6}`">
12
+ <animate :id="animationId4" attributeName="stroke-dasharray" :values="`0, ${width * 0.6};${width * 0.6}, 0`" dur="3s" :begin="`${animationId3}.end + 1s`" fill="freeze" />
13
+ <animate attributeName="stroke-dasharray" :values="`${width * 0.6}, 0;0, ${width * 0.6}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
14
+ </polyline>
15
+
16
+ <polyline :stroke="mergedColor[0]" stroke-width="2" :points="`${width * 0.8 + 3}, ${height / 2} ${width - 5}, ${height / 2}`" :stroke-dasharray="`0, ${width * 0.2}`">
17
+ <animate :id="animationId6" attributeName="stroke-dasharray" :values="`0, ${width * 0.2};${width * 0.2}, 0`" dur="3s" :begin="`${animationId5}.end + 1s`" fill="freeze" />
18
+ <animate attributeName="stroke-dasharray" :values="`${width * 0.2}, 0;0, ${width * 0.3}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
19
+ </polyline>
20
+
21
+ <circle cx="2" :cy="height / 2" r="2" :fill="mergedColor[1]">
22
+ <animate :id="animationId1" attributeName="fill" :values="`${mergedColor[1]};${mergedColor[0]}`" :begin="`0s;${animationId7}.end`" dur="0.3s" fill="freeze" />
23
+ </circle>
24
+
25
+ <circle :cx="width * 0.2" :cy="height / 2" r="2" :fill="mergedColor[1]">
26
+ <animate :id="animationId3" attributeName="fill" :values="`${mergedColor[1]};${mergedColor[0]}`" :begin="`${animationId2}.end`" dur="0.3s" fill="freeze" />
27
+ <animate attributeName="fill" :values="`${mergedColor[1]};${mergedColor[1]}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
28
+ </circle>
29
+
30
+ <circle :cx="width * 0.8" :cy="height / 2" r="2" :fill="mergedColor[1]">
31
+ <animate :id="animationId5" attributeName="fill" :values="`${mergedColor[1]};${mergedColor[0]}`" :begin="`${animationId4}.end`" dur="0.3s" fill="freeze" />
32
+ <animate attributeName="fill" :values="`${mergedColor[1]};${mergedColor[1]}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
33
+ </circle>
34
+
35
+ <circle :cx="width - 2" :cy="height / 2" r="2" :fill="mergedColor[1]">
36
+ <animate :id="animationId7" attributeName="fill" :values="`${mergedColor[1]};${mergedColor[0]}`" :begin="`${animationId6}.end`" dur="0.3s" fill="freeze" />
37
+ <animate attributeName="fill" :values="`${mergedColor[1]};${mergedColor[1]}`" dur="0.01s" :begin="`${animationId7}.end`" fill="freeze" />
38
+ </circle>
39
+ </svg>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ import mixin from '../mixin/decoration'
45
+ export default {
46
+ name: 'ShDecoration10',
47
+ mixins: [mixin],
48
+ computed: {
49
+ animationId1() {
50
+ return `d10ani1${this.decorationId}`
51
+ },
52
+ animationId2() {
53
+ return `d10ani2${this.decorationId}`
54
+ },
55
+ animationId3() {
56
+ return `d10ani3${this.decorationId}`
57
+ },
58
+ animationId4() {
59
+ return `d10ani4${this.decorationId}`
60
+ },
61
+ animationId5() {
62
+ return `d10ani5${this.decorationId}`
63
+ },
64
+ animationId6() {
65
+ return `d10ani6${this.decorationId}`
66
+ },
67
+ animationId7() {
68
+ return `d10ani7${this.decorationId}`
69
+ }
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style scoped lang="scss">
75
+ .sh-decoration-10 {
76
+ width: 100%;
77
+ height: 100%;
78
+ display: flex;
79
+ }
80
+ </style>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div :ref="ref" class="sh-decoration-11">
3
+ <svg :width="width" :height="height">
4
+ <polygon :fill="fade(mergedColor[1] || defaultColor[1], 10)" :stroke="mergedColor[1]" :points="`20 10, 25 4, 55 4 60 10`" />
5
+ <polygon :fill="fade(mergedColor[1] || defaultColor[1], 10)" :stroke="mergedColor[1]" :points="`20 ${height - 10}, 25 ${height - 4}, 55 ${height - 4} 60 ${height - 10}`" />
6
+ <polygon :fill="fade(mergedColor[1] || defaultColor[1], 10)" :stroke="mergedColor[1]" :points="`${width - 20} 10, ${width - 25} 4, ${width - 55} 4 ${width - 60} 10`" />
7
+
8
+ <polygon
9
+ :fill="fade(mergedColor[1] || defaultColor[1], 10)"
10
+ :stroke="mergedColor[1]"
11
+ :points="`${width - 20} ${height - 10}, ${width - 25} ${height - 4}, ${width - 55} ${height - 4} ${width - 60} ${height - 10}`" />
12
+
13
+ <polygon
14
+ :fill="fade(mergedColor[0] || defaultColor[0], 20)"
15
+ :stroke="mergedColor[0]"
16
+ :points="`20 10, 5 ${height / 2} 20 ${height - 10} ${width - 20} ${height - 10} ${width - 5} ${height / 2} ${width - 20} 10`" />
17
+
18
+ <polyline fill="transparent" :stroke="fade(mergedColor[0] || defaultColor[0], 70)" :points="`25 18, 15 ${height / 2} 25 ${height - 18}`" />
19
+ <polyline fill="transparent" :stroke="fade(mergedColor[0] || defaultColor[0], 70)" :points="`${width - 25} 18, ${width - 15} ${height / 2} ${width - 25} ${height - 18}`" />
20
+ </svg>
21
+
22
+ <div class="decoration-content">
23
+ <slot></slot>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import mixin from '../mixin/decoration'
30
+ export default {
31
+ name: 'ShDecoration11',
32
+ mixins: [mixin],
33
+ props: {
34
+ titleWidth: {
35
+ type: Number,
36
+ default: 250
37
+ },
38
+ title: {
39
+ type: String,
40
+ default: ''
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <style scoped lang="scss">
47
+ .sh-decoration-11 {
48
+ position: relative;
49
+ width: 100%;
50
+ height: 100%;
51
+ display: flex;
52
+ .decoration-content {
53
+ position: absolute;
54
+ top: 0px;
55
+ left: 0px;
56
+ width: 100%;
57
+ height: 100%;
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ }
62
+ }
63
+ </style>