@zhangqingcq/vgce 0.0.31 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +1,74 @@
1
1
  <script lang="ts" setup>
2
- const props = withDefaults(defineProps<{ id: string }>(), { id: '' })
3
- const nowTime = ref(new Date())
4
- const s = nowTime.value.getSeconds()
5
- const m = nowTime.value.getMinutes()
6
- const h = Math.floor((nowTime.value.getHours() + (m + s / 60) / 60) * 30)
2
+ const props = withDefaults(
3
+ defineProps<{
4
+ id: string
5
+ centerColor: string
6
+ secondsColor: string
7
+ circleColor: string
8
+ minutesColor: string
9
+ hoursColor: string
10
+ scaleColor: string
11
+ backgroundColor: string
12
+ borderColor: string
13
+ }>(),
14
+ {
15
+ id: '',
16
+ centerColor: '#EBF257',
17
+ secondsColor: '#E83E24',
18
+ circleColor: '#F45AFC',
19
+ minutesColor: '#50E68E',
20
+ hoursColor: '#9A36E7',
21
+ scaleColor: '#4942CF',
22
+ backgroundColor: '#ffffff',
23
+ borderColor: '#B3A7FF'
24
+ }
25
+ )
26
+ const nowTime = new Date(Number(window.sessionStorage.getItem('editorLoadTime') || '0'))
27
+ const s = nowTime.getSeconds() + 1
28
+ const m = nowTime.getMinutes()
29
+ const h = Math.floor((nowTime.getHours() + (m + s / 60) / 60) * 30)
7
30
  </script>
8
31
  <template>
9
32
  <g :id="props.id">
10
33
  <symbol :id="`${props.id}clock-a-n`" viewBox="0 0 1024 1024">
11
- <path d="M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z" fill="#429BCF" />
12
- <path d="M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z" fill="#FFFFFF" />
34
+ <path d="M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z" :fill="props.borderColor" />
35
+ <path d="M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z" :fill="props.backgroundColor" />
13
36
  <path
14
- d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z"
15
- fill="#2D416C"
37
+ d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z"
38
+ :fill="props.minutesColor"
16
39
  >
17
40
  <animateTransform
18
41
  attributeName="transform"
19
42
  attributeType="XML"
20
43
  type="rotate"
21
- :from="`${-45 + h} 512.3 506.3`"
22
- :to="`${315 + h} 512.3 506.3`"
23
- dur="43200s"
44
+ :from="`${45 + m * 6} 512.3 506.3`"
45
+ :to="`${405 + m * 6} 512.3 506.3`"
46
+ dur="3600s"
24
47
  repeatCount="indefinite"
25
48
  />
26
49
  </path>
27
50
  <path
28
- d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z"
29
- fill="#365087"
51
+ d="M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z"
52
+ :fill="props.hoursColor"
30
53
  >
31
54
  <animateTransform
32
55
  attributeName="transform"
33
56
  attributeType="XML"
34
57
  type="rotate"
35
- :from="`${45 + m * 6} 512.3 506.3`"
36
- :to="`${405 + m * 6} 512.3 506.3`"
37
- dur="3600s"
58
+ :from="`${-45 + h} 512.3 506.3`"
59
+ :to="`${315 + h} 512.3 506.3`"
60
+ dur="43200s"
38
61
  repeatCount="indefinite"
39
62
  />
40
63
  </path>
41
- <path d="M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z" fill="#365087" />
64
+ <path d="M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z" :fill="props.circleColor" />
42
65
  <path
43
66
  d="M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z"
44
- fill="#2D416C"
67
+ :fill="props.scaleColor"
45
68
  />
46
69
  <path
47
70
  d="M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z"
48
- fill="#C11B16"
71
+ :fill="props.secondsColor"
49
72
  >
50
73
  <animateTransform
51
74
  attributeName="transform"
@@ -57,7 +80,7 @@
57
80
  repeatCount="indefinite"
58
81
  />
59
82
  </path>
60
- <path d="M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z" fill="#fff" />
83
+ <path d="M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z" :fill="props.centerColor" />
61
84
  </symbol>
62
85
  <use :xlink:href="`#${props.id}clock-a-n`" width="100" height="100" />
63
86
  </g>
@@ -1,4 +1,4 @@
1
- import { EDoneJsonType } from '@/config/types'
1
+ import { EConfigItemPropsType, EDoneJsonType } from '@/config/types'
2
2
  import type { IConfigItem } from '@/config/types'
3
3
 
4
4
  export const clock_a: IConfigItem = {
@@ -12,7 +12,48 @@ export const clock_a: IConfigItem = {
12
12
  actual_rect: true
13
13
  },
14
14
  display: true,
15
- props: {},
15
+ props: {
16
+ centerColor: {
17
+ title: '针顶颜色',
18
+ type: EConfigItemPropsType.Color,
19
+ val: '#EBF257'
20
+ },
21
+ secondsColor: {
22
+ title: '秒针颜色',
23
+ type: EConfigItemPropsType.Color,
24
+ val: '#E83E24'
25
+ },
26
+ circleColor: {
27
+ title: '针圈颜色',
28
+ type: EConfigItemPropsType.Color,
29
+ val: '#F45AFC'
30
+ },
31
+ minutesColor: {
32
+ title: '分针颜色',
33
+ type: EConfigItemPropsType.Color,
34
+ val: '#50E68E'
35
+ },
36
+ hoursColor: {
37
+ title: '时针颜色',
38
+ type: EConfigItemPropsType.Color,
39
+ val: '#9A36E7'
40
+ },
41
+ scaleColor: {
42
+ title: '刻度颜色',
43
+ type: EConfigItemPropsType.Color,
44
+ val: '#4942CF'
45
+ },
46
+ backgroundColor: {
47
+ title: '表盘颜色',
48
+ type: EConfigItemPropsType.Color,
49
+ val: '#ffffff'
50
+ },
51
+ borderColor: {
52
+ title: '裱框颜色',
53
+ type: EConfigItemPropsType.Color,
54
+ val: '#B3A7FF'
55
+ }
56
+ },
16
57
  common_animations: {
17
58
  val: '',
18
59
  delay: 'delay-0s',
@@ -4,16 +4,34 @@ import type { IConfigItem } from '@/config/types'
4
4
  import { EDoneJsonType } from '@/config/types'
5
5
  import type { IDoneJson, IPointCoordinate } from '@/stores/global/types'
6
6
  import { EGlobalStoreIntention, EMouseInfoState } from '@/stores/global/types'
7
- import { straight_line_system } from '@/components/config'
8
7
  import { useGlobalStore } from '@/stores/global'
9
8
  import { pinia } from '@/hooks'
10
9
  import { useConfigStore } from '@/stores/config'
11
10
  import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
12
11
  import { kebabCase } from 'lodash-es'
12
+ import { vueComp } from '@/config'
13
13
 
14
14
  export const stopEvent = (e: any) => {
15
15
  e.stopPropagation()
16
16
  }
17
+ export const preventDefault = (e: any) => {
18
+ e.preventDefault()
19
+ }
20
+
21
+ export function componentsRegister() {
22
+ //注册所有组件
23
+ const instance = getCurrentInstance()
24
+ for (let key in vueComp) {
25
+ if (!instance?.appContext?.components.hasOwnProperty(key) && vueComp.hasOwnProperty(key)) {
26
+ instance?.appContext?.app.component(key, vueComp[key])
27
+ }
28
+ }
29
+ }
30
+
31
+ export function setEditorLoadTime() {
32
+ //记录编辑器加载到浏览器的时间,有些组件需要用这个时间
33
+ window.sessionStorage.setItem('editorLoadTime', new Date().getTime().toString())
34
+ }
17
35
 
18
36
  /**
19
37
  * 生成随机字符串