sh-chart 1.2.0 → 2.1.0
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.
- package/package.json +2 -2
- package/packages/components/global-components/mixin/autoResize.js +152 -0
- package/packages/components/global-components/sh-border/components/border1.vue +70 -0
- package/packages/components/global-components/sh-border/components/border10.vue +54 -0
- package/packages/components/global-components/sh-border/components/border11.vue +207 -0
- package/packages/components/global-components/sh-border/components/border12.vue +112 -0
- package/packages/components/global-components/sh-border/components/border13.vue +50 -0
- package/packages/components/global-components/sh-border/components/border2.vue +50 -0
- package/packages/components/global-components/sh-border/components/border3.vue +53 -0
- package/packages/components/global-components/sh-border/components/border4.vue +95 -0
- package/packages/components/global-components/sh-border/components/border5.vue +64 -0
- package/packages/components/global-components/sh-border/components/border6.vue +60 -0
- package/packages/components/global-components/sh-border/components/border7.vue +57 -0
- package/packages/components/global-components/sh-border/components/border8.vue +75 -0
- package/packages/components/global-components/sh-border/components/border9.vue +92 -0
- package/packages/components/global-components/sh-border/index.vue +73 -0
- package/packages/components/global-components/sh-border/mixin/border.js +62 -0
- package/packages/components/global-components/sh-charts/config/config.js +58 -0
- package/packages/components/global-components/sh-charts/index.vue +169 -0
- package/packages/components/global-components/sh-decoration/components/decoration1.vue +81 -0
- package/packages/components/global-components/sh-decoration/components/decoration10.vue +80 -0
- package/packages/components/global-components/sh-decoration/components/decoration11.vue +63 -0
- package/packages/components/global-components/sh-decoration/components/decoration12.vue +171 -0
- package/packages/components/global-components/sh-decoration/components/decoration2.vue +78 -0
- package/packages/components/global-components/sh-decoration/components/decoration3.vue +65 -0
- package/packages/components/global-components/sh-decoration/components/decoration4.vue +72 -0
- package/packages/components/global-components/sh-decoration/components/decoration5.vue +96 -0
- package/packages/components/global-components/sh-decoration/components/decoration6.vue +84 -0
- package/packages/components/global-components/sh-decoration/components/decoration7.vue +31 -0
- package/packages/components/global-components/sh-decoration/components/decoration8.vue +32 -0
- package/packages/components/global-components/sh-decoration/components/decoration9.vue +63 -0
- package/packages/components/global-components/sh-decoration/index.vue +71 -0
- package/packages/components/global-components/sh-decoration/mixin/decoration.js +69 -0
- package/packages/components/global-components/sh-screen-header/components/header1.vue +228 -0
- package/packages/components/global-components/sh-screen-header/components/header2.vue +285 -0
- package/packages/components/global-components/sh-screen-header/components/header3.vue +452 -0
- package/packages/components/global-components/sh-screen-header/components/header4.vue +544 -0
- package/packages/components/global-components/sh-screen-header/components/header5.vue +291 -0
- package/packages/components/global-components/sh-screen-header/components/header6.vue +206 -0
- package/packages/components/global-components/sh-screen-header/index.vue +50 -0
- package/packages/components/global-components/sh-screen-header/mixin/header.js +62 -0
- package/packages/components/global-components/sh-spin/index.vue +44 -0
- package/packages/components/index.js +24 -0
- package/packages/echarts/index.js +94 -0
- package/packages/echarts/map/110000.json +1 -0
- package/packages/echarts/map/120000.json +1 -0
- package/packages/echarts/map/130000.json +1 -0
- package/packages/echarts/map/140000.json +1 -0
- package/packages/echarts/map/150000.json +1 -0
- package/packages/echarts/map/210000.json +1 -0
- package/packages/echarts/map/220000.json +1 -0
- package/packages/echarts/map/230000.json +1 -0
- package/packages/echarts/map/310000.json +1 -0
- package/packages/echarts/map/320000.json +1 -0
- package/packages/echarts/map/330000.json +1 -0
- package/packages/echarts/map/340000.json +1 -0
- package/packages/echarts/map/350000.json +1 -0
- package/packages/echarts/map/360000.json +1 -0
- package/packages/echarts/map/370000.json +1 -0
- package/packages/echarts/map/410000.json +1 -0
- package/packages/echarts/map/420000.json +1 -0
- package/packages/echarts/map/430000.json +1 -0
- package/packages/echarts/map/440000.json +1 -0
- package/packages/echarts/map/450000.json +1 -0
- package/packages/echarts/map/460000.json +1 -0
- package/packages/echarts/map/500000.json +1 -0
- package/packages/echarts/map/510000.json +1 -0
- package/packages/echarts/map/520000.json +1 -0
- package/packages/echarts/map/530000.json +1 -0
- package/packages/echarts/map/540000.json +1 -0
- package/packages/echarts/map/610000.json +1 -0
- package/packages/echarts/map/620000.json +1 -0
- package/packages/echarts/map/630000.json +1 -0
- package/packages/echarts/map/640000.json +1 -0
- package/packages/echarts/map/650000.json +1 -0
- package/packages/echarts/map/710000.json +1 -0
- package/packages/echarts/map/china.json +1 -0
- package/packages/echarts/theme/dark.js +128 -0
- package/packages/echarts/theme/infographic.js +181 -0
- package/packages/echarts/theme/macarons.js +194 -0
- package/packages/echarts/theme/roma.js +66 -0
- package/packages/echarts/theme/shine.js +136 -0
- package/packages/echarts/theme/vintage.js +11 -0
- package/packages/index.js +31 -0
|
@@ -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>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :ref="ref" class="sh-decoration-12">
|
|
3
|
+
<svg :width="width" :height="height">
|
|
4
|
+
<defs>
|
|
5
|
+
<g :id="gId">
|
|
6
|
+
<path v-for="(d, i) in pathD" :key="d" :stroke="pathColor[i]" :stroke-width="width / 2" fill="transparent" :d="d" />
|
|
7
|
+
</g>
|
|
8
|
+
<radialGradient :id="gradientId" cx="50%" cy="50%" r="50%">
|
|
9
|
+
<stop offset="0%" stop-color="transparent" stop-opacity="1" />
|
|
10
|
+
<stop offset="100%" :stop-color="fade(mergedColor[1] || defaultColor[1], 30)" stop-opacity="1" />
|
|
11
|
+
</radialGradient>
|
|
12
|
+
</defs>
|
|
13
|
+
|
|
14
|
+
<circle v-for="r in circleR" :key="r" :r="r" :cx="x" :cy="y" :stroke="mergedColor[1]" :stroke-width="0.5" fill="transparent" />
|
|
15
|
+
|
|
16
|
+
<circle r="1" :cx="x" :cy="y" stroke="transparent" :fill="`url(#${gradientId})`">
|
|
17
|
+
<animate attributeName="r" :values="`1;${width / 2}`" :dur="`${haloDur}s`" repeatCount="indefinite" />
|
|
18
|
+
<animate attributeName="opacity" values="1;0" :dur="`${haloDur}s`" repeatCount="indefinite" />
|
|
19
|
+
</circle>
|
|
20
|
+
|
|
21
|
+
<circle r="2" :cx="x" :cy="y" :fill="mergedColor[1]" />
|
|
22
|
+
|
|
23
|
+
<g v-if="showSplitLine">
|
|
24
|
+
<polyline v-for="p in splitLinePoints" :key="p" :points="p" :stroke="mergedColor[1]" :stroke-width="0.5" opacity="0.5" />
|
|
25
|
+
</g>
|
|
26
|
+
|
|
27
|
+
<path v-for="d in arcD" :key="d" :d="d" :stroke="mergedColor[1]" stroke-width="2" fill="transparent" />
|
|
28
|
+
|
|
29
|
+
<use :xlink:href="`#${gId}`">
|
|
30
|
+
<animateTransform attributeName="transform" type="rotate" :values="`0, ${x} ${y};360, ${x} ${y}`" :dur="`${scanDur}s`" repeatCount="indefinite" />
|
|
31
|
+
</use>
|
|
32
|
+
</svg>
|
|
33
|
+
|
|
34
|
+
<div class="decoration-content">
|
|
35
|
+
<slot></slot>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import mixin from '../mixin/decoration'
|
|
42
|
+
export default {
|
|
43
|
+
name: 'ShDecoration12',
|
|
44
|
+
mixins: [mixin],
|
|
45
|
+
props: {
|
|
46
|
+
/**
|
|
47
|
+
* @description Scan animation dur
|
|
48
|
+
*/
|
|
49
|
+
scanDur: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 3
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* @description Halo animation dur
|
|
55
|
+
*/
|
|
56
|
+
haloDur: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 2
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
pathD: [],
|
|
64
|
+
pathColor: [],
|
|
65
|
+
circleR: [],
|
|
66
|
+
splitLinePoints: [],
|
|
67
|
+
arcD: [],
|
|
68
|
+
segment: 30,
|
|
69
|
+
sectorAngle: Math.PI / 3,
|
|
70
|
+
ringNum: 3,
|
|
71
|
+
ringWidth: 1,
|
|
72
|
+
showSplitLine: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
gId() {
|
|
77
|
+
return `decoration-12-g-${this.decorationId}`
|
|
78
|
+
},
|
|
79
|
+
gradientId() {
|
|
80
|
+
return `decoration-12-gradient-${this.decorationId}`
|
|
81
|
+
},
|
|
82
|
+
x() {
|
|
83
|
+
const { width } = this
|
|
84
|
+
return width / 2
|
|
85
|
+
},
|
|
86
|
+
y() {
|
|
87
|
+
const { height } = this
|
|
88
|
+
return height / 2
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
calcSVGData() {
|
|
93
|
+
const { calcPathD, calcPathColor, calcCircleR, calcSplitLinePoints, calcArcD } = this
|
|
94
|
+
calcPathD()
|
|
95
|
+
calcPathColor()
|
|
96
|
+
calcCircleR()
|
|
97
|
+
calcSplitLinePoints()
|
|
98
|
+
calcArcD()
|
|
99
|
+
},
|
|
100
|
+
calcPathD() {
|
|
101
|
+
const { x, y, width, segment, sectorAngle } = this
|
|
102
|
+
const startAngle = -Math.PI / 2
|
|
103
|
+
const angleGap = sectorAngle / segment
|
|
104
|
+
const r = width / 4
|
|
105
|
+
let lastEndPoints = this.getCircleRadianPoint(x, y, r, startAngle)
|
|
106
|
+
this.pathD = new Array(segment).fill('').map((_, i) => {
|
|
107
|
+
const endPoints = this.getCircleRadianPoint(x, y, r, startAngle - (i + 1) * angleGap).map(_ => _.toFixed(5))
|
|
108
|
+
const d = `M${lastEndPoints.join(',')} A${r}, ${r} 0 0 0 ${endPoints.join(',')}`
|
|
109
|
+
lastEndPoints = endPoints
|
|
110
|
+
return d
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
calcPathColor() {
|
|
114
|
+
const {
|
|
115
|
+
mergedColor: [color],
|
|
116
|
+
segment
|
|
117
|
+
} = this
|
|
118
|
+
const colorGap = 100 / (segment - 1)
|
|
119
|
+
this.pathColor = new Array(segment).fill(color).map((_, i) => this.fade(color, 100 - i * colorGap))
|
|
120
|
+
},
|
|
121
|
+
calcCircleR() {
|
|
122
|
+
const { segment, ringNum, width, ringWidth } = this
|
|
123
|
+
const radiusGap = (width / 2 - ringWidth / 2) / ringNum
|
|
124
|
+
this.circleR = new Array(ringNum).fill(0).map((_, i) => radiusGap * (i + 1))
|
|
125
|
+
},
|
|
126
|
+
calcSplitLinePoints() {
|
|
127
|
+
const { x, y, width } = this
|
|
128
|
+
const angleGap = Math.PI / 6
|
|
129
|
+
const r = width / 2
|
|
130
|
+
this.splitLinePoints = new Array(6).fill('').map((_, i) => {
|
|
131
|
+
const startAngle = angleGap * (i + 1)
|
|
132
|
+
const endAngle = startAngle + Math.PI
|
|
133
|
+
const startPoint = this.getCircleRadianPoint(x, y, r, startAngle)
|
|
134
|
+
const endPoint = this.getCircleRadianPoint(x, y, r, endAngle)
|
|
135
|
+
return `${startPoint.join(',')} ${endPoint.join(',')}`
|
|
136
|
+
})
|
|
137
|
+
},
|
|
138
|
+
calcArcD() {
|
|
139
|
+
const { x, y, width } = this
|
|
140
|
+
const angleGap = Math.PI / 6
|
|
141
|
+
const r = width / 2 - 1
|
|
142
|
+
this.arcD = new Array(4).fill('').map((_, i) => {
|
|
143
|
+
const startAngle = angleGap * (3 * i + 1)
|
|
144
|
+
const endAngle = startAngle + angleGap
|
|
145
|
+
const startPoint = this.getCircleRadianPoint(x, y, r, startAngle)
|
|
146
|
+
const endPoint = this.getCircleRadianPoint(x, y, r, endAngle)
|
|
147
|
+
return `M${startPoint.join(',')} A${x}, ${y} 0 0 1 ${endPoint.join(',')}`
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="scss">
|
|
155
|
+
.sh-decoration-12 {
|
|
156
|
+
position: relative;
|
|
157
|
+
width: 100%;
|
|
158
|
+
height: 100%;
|
|
159
|
+
display: flex;
|
|
160
|
+
.decoration-content {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 0px;
|
|
163
|
+
left: 0px;
|
|
164
|
+
width: 100%;
|
|
165
|
+
height: 100%;
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :ref="ref" class="sh-decoration-2">
|
|
3
|
+
<svg :width="`${width}px`" :height="`${height}px`">
|
|
4
|
+
<rect :x="x" :y="y" :width="w" :height="h" :fill="mergedColor[0]">
|
|
5
|
+
<animate
|
|
6
|
+
:attributeName="reverse ? 'height' : 'width'"
|
|
7
|
+
from="0"
|
|
8
|
+
:to="reverse ? height : width"
|
|
9
|
+
:dur="`${dur}s`"
|
|
10
|
+
calcMode="spline"
|
|
11
|
+
keyTimes="0;1"
|
|
12
|
+
keySplines=".42,0,.58,1"
|
|
13
|
+
repeatCount="indefinite" />
|
|
14
|
+
</rect>
|
|
15
|
+
|
|
16
|
+
<rect :x="x" :y="y" width="1" height="1" :fill="mergedColor[1]">
|
|
17
|
+
<animate
|
|
18
|
+
:attributeName="reverse ? 'y' : 'x'"
|
|
19
|
+
from="0"
|
|
20
|
+
:to="reverse ? height : width"
|
|
21
|
+
:dur="`${dur}s`"
|
|
22
|
+
calcMode="spline"
|
|
23
|
+
keyTimes="0;1"
|
|
24
|
+
keySplines="0.42,0,0.58,1"
|
|
25
|
+
repeatCount="indefinite" />
|
|
26
|
+
</rect>
|
|
27
|
+
</svg>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import mixin from '../mixin/decoration'
|
|
33
|
+
export default {
|
|
34
|
+
name: 'ShDecoration2',
|
|
35
|
+
mixins: [mixin],
|
|
36
|
+
props: {
|
|
37
|
+
dur: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 6
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0,
|
|
46
|
+
|
|
47
|
+
w: 0,
|
|
48
|
+
h: 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
calcSVGData() {
|
|
53
|
+
const { reverse, width, height } = this
|
|
54
|
+
if (reverse) {
|
|
55
|
+
this.w = 1
|
|
56
|
+
this.h = height
|
|
57
|
+
this.x = width / 2
|
|
58
|
+
this.y = 0
|
|
59
|
+
} else {
|
|
60
|
+
this.w = width
|
|
61
|
+
this.h = 1
|
|
62
|
+
this.x = 0
|
|
63
|
+
this.y = height / 2
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style scoped lang="scss">
|
|
71
|
+
.sh-decoration-2 {
|
|
72
|
+
display: flex;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
</style>
|