@shijiu/jsview-vue-samples 2.1.428 → 2.1.448-test.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/DemoHomepage/router.js +13 -8
- package/NinePatchTester/App.vue +182 -0
- package/SceneTransition/App.vue +237 -146
- package/SceneTransition/JsvSceneTransition.vue +90 -104
- package/SceneTransition/maskConfig/config1.js +101 -0
- package/SceneTransition/maskConfig/config2.js +88 -0
- package/SceneTransition/maskConfig/config3.js +102 -0
- package/TextureStoreTest/App.vue +112 -47
- package/package.json +1 -1
- package/SceneTransition/images/fly1.jpg +0 -0
- package/SceneTransition/images/fly2.jpg +0 -0
- package/SceneTransition/images/mask-025/config.json +0 -29
- package/SceneTransition/images/mask-025/res/1.png +0 -0
- package/SceneTransition/images/mask-025/res/2.png +0 -0
- package/SceneTransition/images/mask-025/res/3.png +0 -0
- package/SceneTransition/images/mask-025/res/4.png +0 -0
- package/SceneTransition/images/mask-025/res/icon.png +0 -0
- package/SceneTransition/images/mask-025/res/stroke.png +0 -0
- package/SceneTransition/images/sample.png +0 -0
package/DemoHomepage/router.js
CHANGED
|
@@ -16,11 +16,6 @@ let routeList = [
|
|
|
16
16
|
path: '/feature/Basic',
|
|
17
17
|
component: () => import('jsview-vue-samples/Basic/App.vue'),
|
|
18
18
|
},
|
|
19
|
-
// {
|
|
20
|
-
// name: '场景过渡',
|
|
21
|
-
// path: '/feature/SceneTransition',
|
|
22
|
-
// component: () => import('jsview-vue-samples/SceneTransition/App.vue'),
|
|
23
|
-
// },
|
|
24
19
|
{
|
|
25
20
|
name: 'FlexDemo',
|
|
26
21
|
path: '/feature/FlexDemo',
|
|
@@ -48,6 +43,11 @@ let routeList = [
|
|
|
48
43
|
path: '/feature/TextureStoreTest',
|
|
49
44
|
component: () => import('jsview-vue-samples/TextureStoreTest/App.vue'),
|
|
50
45
|
},
|
|
46
|
+
{
|
|
47
|
+
name: 'NinePatch对齐测试',
|
|
48
|
+
path: '/feature/NinePatchTester',
|
|
49
|
+
component: () => import('jsview-vue-samples/NinePatchTester/App.vue'),
|
|
50
|
+
},
|
|
51
51
|
{
|
|
52
52
|
name: 'NativeSharedView测试',
|
|
53
53
|
path: '/feature/TestNativeSharedView',
|
|
@@ -305,14 +305,19 @@ let routeList = [
|
|
|
305
305
|
},
|
|
306
306
|
{
|
|
307
307
|
name: '进度条',
|
|
308
|
-
path: '/
|
|
308
|
+
path: '/Operations/ProgressBar',
|
|
309
309
|
component: () => import('jsview-vue-samples/ProgressBar/App.vue'),
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
name: '春联测试',
|
|
313
|
-
path: '/
|
|
313
|
+
path: '/Operations/CoupletsTest',
|
|
314
314
|
component: () => import('jsview-vue-samples/CoupletsTest/App.vue'),
|
|
315
|
-
}
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: '场景过渡',
|
|
318
|
+
path: '/Operations/SceneTransition',
|
|
319
|
+
component: () => import('jsview-vue-samples/SceneTransition/App.vue'),
|
|
320
|
+
},
|
|
316
321
|
];
|
|
317
322
|
|
|
318
323
|
//添加MetroWidget demo
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bgStyle">
|
|
3
|
+
<div :style="{ top: 50, left: 80 }">
|
|
4
|
+
<div
|
|
5
|
+
:style="{
|
|
6
|
+
top: (sampleImageWidth - innerRadius2) / 2,
|
|
7
|
+
left: (sampleImageWidth - innerRadius2) / 2,
|
|
8
|
+
width: innerRadius2,
|
|
9
|
+
height: innerRadius2,
|
|
10
|
+
fontSize: 10,
|
|
11
|
+
textAlign: 'center',
|
|
12
|
+
lineHeight: innerRadius2,
|
|
13
|
+
backgroundColor: '#FF0000',
|
|
14
|
+
}"
|
|
15
|
+
>
|
|
16
|
+
{{ `圆环内径方形${innerRadius2}x${innerRadius2}` }}
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
:style="{
|
|
20
|
+
width: sampleImageWidth,
|
|
21
|
+
height: sampleImageWidth,
|
|
22
|
+
backgroundImage: `jsvtexturestore://${sourceId}`,
|
|
23
|
+
}"
|
|
24
|
+
/>
|
|
25
|
+
<div
|
|
26
|
+
:style="{
|
|
27
|
+
top: sampleImageWidth + 5,
|
|
28
|
+
width: sampleImageWidth,
|
|
29
|
+
height: 12,
|
|
30
|
+
fontSize: 10,
|
|
31
|
+
textAlign: 'center',
|
|
32
|
+
lineHeight: 12,
|
|
33
|
+
}"
|
|
34
|
+
>
|
|
35
|
+
{{ `NinePatch原图尺寸 ${sampleImageWidth}x${sampleImageWidth}` }}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div :style="{ top: 50, left: 80 + sampleImageWidth + 20 }">
|
|
40
|
+
<div
|
|
41
|
+
:style="{
|
|
42
|
+
width: vTargetRectWidth,
|
|
43
|
+
height: vTargetRectHeight,
|
|
44
|
+
backgroundColor: 'rgb(255,0,0)',
|
|
45
|
+
}"
|
|
46
|
+
/>
|
|
47
|
+
<div
|
|
48
|
+
:style="{
|
|
49
|
+
width: vTargetRectWidth,
|
|
50
|
+
height: vTargetRectHeight,
|
|
51
|
+
backgroundColor: 'rgb(0,100,200)',
|
|
52
|
+
borderRadius: vTargetRectRaidus,
|
|
53
|
+
}"
|
|
54
|
+
/>
|
|
55
|
+
<JsvFlexDiv
|
|
56
|
+
:style="{
|
|
57
|
+
width: vTargetRectWidth,
|
|
58
|
+
height: vTargetRectHeight,
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
:style="{
|
|
64
|
+
width: vTargetRectWidth,
|
|
65
|
+
textAlign: 'center',
|
|
66
|
+
fontSize: 10,
|
|
67
|
+
lineHeight: 12,
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
{{
|
|
71
|
+
`需要外框对齐的带圆角矩形\n\nborderRadius = 圆环内径 / 2\n= ${innerRadius2} / 2`
|
|
72
|
+
}}
|
|
73
|
+
</div>
|
|
74
|
+
</JsvFlexDiv>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
:style="{
|
|
79
|
+
top: 50,
|
|
80
|
+
left: 80 + sampleImageWidth + 20 + vTargetRectWidth + 20,
|
|
81
|
+
}"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
:style="{
|
|
85
|
+
width: vTargetRectWidth,
|
|
86
|
+
height: vTargetRectHeight,
|
|
87
|
+
backgroundColor: 'rgb(0,100,200)',
|
|
88
|
+
}"
|
|
89
|
+
/>
|
|
90
|
+
<div
|
|
91
|
+
:style="{
|
|
92
|
+
width: vTargetRectWidth,
|
|
93
|
+
height: vTargetRectHeight,
|
|
94
|
+
backgroundColor: 'rgb(0,0,255)',
|
|
95
|
+
borderRadius: vTargetRectRaidus,
|
|
96
|
+
}"
|
|
97
|
+
/>
|
|
98
|
+
<JsvNinePatch
|
|
99
|
+
:style="{
|
|
100
|
+
width: vTargetRectWidth,
|
|
101
|
+
height: vTargetRectHeight,
|
|
102
|
+
}"
|
|
103
|
+
:imageUrl="`jsvtexturestore://${sourceId}`"
|
|
104
|
+
:imageWidth="vImageWidth"
|
|
105
|
+
:centerWidth="vCenterWidth"
|
|
106
|
+
:imageDspWidth="vImageDspWidth"
|
|
107
|
+
:borderOutset="vBorderOutset"
|
|
108
|
+
/>
|
|
109
|
+
<JsvFlexDiv
|
|
110
|
+
:style="{
|
|
111
|
+
width: vTargetRectWidth,
|
|
112
|
+
height: vTargetRectHeight,
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
}"
|
|
115
|
+
>
|
|
116
|
+
<div
|
|
117
|
+
:style="{
|
|
118
|
+
width: vTargetRectWidth,
|
|
119
|
+
textAlign: 'center',
|
|
120
|
+
fontSize: 10,
|
|
121
|
+
lineHeight: 12,
|
|
122
|
+
}"
|
|
123
|
+
>
|
|
124
|
+
{{
|
|
125
|
+
`带圆角矩形 和 NinePatch图形伸缩\n\nborderOutset = (原图高 - 圆环内径) / 2\n= (${sampleImageWidth} - ${innerRadius2}) / 2\n\ncenterWidth = 1`
|
|
126
|
+
}}
|
|
127
|
+
</div>
|
|
128
|
+
</JsvFlexDiv>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script setup>
|
|
134
|
+
import { shallowRef, onBeforeUnmount } from "vue";
|
|
135
|
+
import { JsvNinePatch, JsvTextureStoreApi, JsvFlexDiv } from "jsview";
|
|
136
|
+
|
|
137
|
+
// 调试参数输入设定
|
|
138
|
+
const innerRadius2 = 110; // 最右边图片的内直径(也是右边图矩形的边长值)
|
|
139
|
+
const circleLineWidth = 10; // 最右边图的边缘粗细
|
|
140
|
+
const sampleImageWidth = 148; // 最右边图形的画布尺寸,画布为正方形
|
|
141
|
+
|
|
142
|
+
const vTargetRectWidth = 250; // 需要对齐区域的矩形宽
|
|
143
|
+
const vTargetRectHeight = 300; // 需要对齐区域的矩形高
|
|
144
|
+
const vTargetRectRaidus = innerRadius2 / 2; // 需要对齐区域的圆角半径,请和圆环内径对应的半径一致才能套齐
|
|
145
|
+
|
|
146
|
+
// 计算后的对应NinePatch参数
|
|
147
|
+
let vBorderOutset = (sampleImageWidth - innerRadius2) / 2; // 设置值为图片长度减去内直径除以2
|
|
148
|
+
let vImageWidth = sampleImageWidth; // 原图尺寸设置
|
|
149
|
+
let vImageDspWidth = sampleImageWidth; // 显示图尺寸,当想复用目标图片,但是半径又不想等时才和原图不一样
|
|
150
|
+
let vCenterWidth = 1; // 圆形的.9图, 中心固定为1
|
|
151
|
+
|
|
152
|
+
// 设置设定模拟绘制.9图
|
|
153
|
+
let canvasRef;
|
|
154
|
+
let sourceId = shallowRef("");
|
|
155
|
+
canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
156
|
+
sampleImageWidth,
|
|
157
|
+
sampleImageWidth
|
|
158
|
+
); // 创建画布
|
|
159
|
+
|
|
160
|
+
let circleRadius =
|
|
161
|
+
Math.floor(innerRadius2 / 2) + Math.floor(circleLineWidth / 2); // 圆环绘制路径是粗线的中心线,所以要减去一半的线宽
|
|
162
|
+
let customPath = canvasRef.circlePath(
|
|
163
|
+
Math.floor(sampleImageWidth / 2),
|
|
164
|
+
Math.floor(sampleImageWidth / 2),
|
|
165
|
+
circleRadius
|
|
166
|
+
); // 创建圆环绘制路径,圆形在画布的中心点位置
|
|
167
|
+
canvasRef.drawColor("rgba(200,200,200,0.5)"); // 画布绘制半透明底色
|
|
168
|
+
customPath.stroke(circleLineWidth, "#FF00FF7F"); // 以给定线宽绘制圆环
|
|
169
|
+
sourceId.value = canvasRef.commit(); // texture和div的textureStore绑定
|
|
170
|
+
|
|
171
|
+
onBeforeUnmount(() => {
|
|
172
|
+
JsvTextureStoreApi.deleteTexture(sourceId.value); // 释放texture资源
|
|
173
|
+
});
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style lang="css" scoped>
|
|
177
|
+
.bgStyle {
|
|
178
|
+
width: 1280;
|
|
179
|
+
height: 720;
|
|
180
|
+
background-color: #819864;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
package/SceneTransition/App.vue
CHANGED
|
@@ -1,177 +1,268 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<JsvPreload
|
|
2
|
+
<JsvPreload
|
|
3
|
+
:preloadList="preload_info"
|
|
4
|
+
:onPreloadDone="loadDone"
|
|
5
|
+
></JsvPreload>
|
|
3
6
|
<jsv-focus-block autoFocus :onKeyDown="onKeyDown">
|
|
4
|
-
<div
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
<div class="bgStyle">
|
|
8
|
+
<div :style="{ width: 640, height: 360, backgroundImage: bg, top: 100 }">
|
|
9
|
+
<JsvSceneTransition
|
|
10
|
+
v-show="isShow"
|
|
11
|
+
:imageUrl="fly1"
|
|
12
|
+
:ArraySet="SelectArray"
|
|
13
|
+
:displayWidth="640"
|
|
14
|
+
:style="style"
|
|
15
|
+
:onOff="onOff"
|
|
16
|
+
></JsvSceneTransition>
|
|
17
|
+
</div>
|
|
13
18
|
<!-- 文字说明 -->
|
|
14
|
-
<div class="text"
|
|
19
|
+
<div class="text" :style="{ left: 20, top: 20 }">
|
|
20
|
+
{{ "操作说明:按【OK】键进行随机遮罩层碎片过渡效果。" }}
|
|
21
|
+
</div>
|
|
22
|
+
<div class="text" :style="{ left: 810, top: 20 }">{{ "素材展示" }}</div>
|
|
23
|
+
<div class="text" :style="{ left: 400, top: 500 }">
|
|
24
|
+
{{ "按需采用碎片式的图片来进行遮罩,此例只展示一组遮罩素材。" }}
|
|
25
|
+
</div>
|
|
26
|
+
<!-- 报错小框 -->
|
|
27
|
+
<div v-if="boxSwitch" class="smallBox">
|
|
28
|
+
<div class="text" :style="{ left: 50, top: 40 }">
|
|
29
|
+
{{ "图片没预加载完成!" }}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<!-- 素材展示 -->
|
|
33
|
+
<div
|
|
34
|
+
:style="{
|
|
35
|
+
width: 320,
|
|
36
|
+
height: 180,
|
|
37
|
+
backgroundImage: fly1,
|
|
38
|
+
top: 80,
|
|
39
|
+
left: 700,
|
|
40
|
+
}"
|
|
41
|
+
></div>
|
|
42
|
+
<div
|
|
43
|
+
:style="{
|
|
44
|
+
width: 320,
|
|
45
|
+
height: 180,
|
|
46
|
+
backgroundImage: fly2,
|
|
47
|
+
top: 280,
|
|
48
|
+
left: 700,
|
|
49
|
+
}"
|
|
50
|
+
></div>
|
|
51
|
+
<div
|
|
52
|
+
:style="{
|
|
53
|
+
width: 100,
|
|
54
|
+
height: 60,
|
|
55
|
+
backgroundImage: ArraySet1[0].url,
|
|
56
|
+
top: 500,
|
|
57
|
+
left: 700,
|
|
58
|
+
}"
|
|
59
|
+
></div>
|
|
60
|
+
<div
|
|
61
|
+
:style="{
|
|
62
|
+
width: 100,
|
|
63
|
+
height: 60,
|
|
64
|
+
backgroundImage: ArraySet1[1].url,
|
|
65
|
+
top: 500,
|
|
66
|
+
left: 800,
|
|
67
|
+
}"
|
|
68
|
+
></div>
|
|
69
|
+
<div
|
|
70
|
+
:style="{
|
|
71
|
+
width: 100,
|
|
72
|
+
height: 60,
|
|
73
|
+
backgroundImage: ArraySet1[2].url,
|
|
74
|
+
top: 500,
|
|
75
|
+
left: 920,
|
|
76
|
+
}"
|
|
77
|
+
></div>
|
|
78
|
+
<div
|
|
79
|
+
:style="{
|
|
80
|
+
width: 100,
|
|
81
|
+
height: 60,
|
|
82
|
+
backgroundImage: ArraySet1[3].url,
|
|
83
|
+
top: 550,
|
|
84
|
+
left: 700,
|
|
85
|
+
}"
|
|
86
|
+
></div>
|
|
87
|
+
<div
|
|
88
|
+
:style="{
|
|
89
|
+
width: 100,
|
|
90
|
+
height: 60,
|
|
91
|
+
backgroundImage: ArraySet1[4].url,
|
|
92
|
+
top: 550,
|
|
93
|
+
left: 820,
|
|
94
|
+
}"
|
|
95
|
+
></div>
|
|
96
|
+
<div
|
|
97
|
+
:style="{
|
|
98
|
+
width: 100,
|
|
99
|
+
height: 60,
|
|
100
|
+
backgroundImage: ArraySet1[5].url,
|
|
101
|
+
top: 550,
|
|
102
|
+
left: 920,
|
|
103
|
+
}"
|
|
104
|
+
></div>
|
|
105
|
+
<div
|
|
106
|
+
:style="{
|
|
107
|
+
width: 100,
|
|
108
|
+
height: 60,
|
|
109
|
+
backgroundImage: ArraySet1[6].url,
|
|
110
|
+
top: 600,
|
|
111
|
+
left: 700,
|
|
112
|
+
}"
|
|
113
|
+
></div>
|
|
114
|
+
<div
|
|
115
|
+
:style="{
|
|
116
|
+
width: 100,
|
|
117
|
+
height: 60,
|
|
118
|
+
backgroundImage: ArraySet1[7].url,
|
|
119
|
+
top: 600,
|
|
120
|
+
left: 770,
|
|
121
|
+
}"
|
|
122
|
+
></div>
|
|
123
|
+
<div
|
|
124
|
+
:style="{
|
|
125
|
+
width: 80,
|
|
126
|
+
height: 60,
|
|
127
|
+
backgroundImage: ArraySet1[8].url,
|
|
128
|
+
top: 600,
|
|
129
|
+
left: 860,
|
|
130
|
+
}"
|
|
131
|
+
></div>
|
|
132
|
+
<div
|
|
133
|
+
:style="{
|
|
134
|
+
width: 60,
|
|
135
|
+
height: 60,
|
|
136
|
+
backgroundImage: ArraySet1[9].url,
|
|
137
|
+
top: 600,
|
|
138
|
+
left: 930,
|
|
139
|
+
}"
|
|
140
|
+
></div>
|
|
141
|
+
<div
|
|
142
|
+
:style="{
|
|
143
|
+
width: 30,
|
|
144
|
+
height: 30,
|
|
145
|
+
backgroundImage: ArraySet1[10].url,
|
|
146
|
+
top: 590,
|
|
147
|
+
left: 950,
|
|
148
|
+
}"
|
|
149
|
+
></div>
|
|
150
|
+
<div
|
|
151
|
+
:style="{
|
|
152
|
+
width: 40,
|
|
153
|
+
height: 60,
|
|
154
|
+
backgroundImage: ArraySet1[11].url,
|
|
155
|
+
top: 600,
|
|
156
|
+
left: 980,
|
|
157
|
+
}"
|
|
158
|
+
></div>
|
|
15
159
|
</div>
|
|
16
160
|
</jsv-focus-block>
|
|
17
161
|
</template>
|
|
18
162
|
|
|
19
163
|
<script setup>
|
|
20
|
-
import { shallowRef } from "vue";
|
|
21
|
-
import { JsvPreload, buildPreloadInfo
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
buildPreloadInfo(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
buildPreloadInfo(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
164
|
+
import { shallowRef, onBeforeUnmount } from "vue";
|
|
165
|
+
import { JsvPreload, buildPreloadInfo } from "jsview";
|
|
166
|
+
import JsvSceneTransition from "./jsvSceneTransition.vue";
|
|
167
|
+
import { ArraySet1 } from "./maskConfig/config1";
|
|
168
|
+
import { ArraySet2 } from "./maskConfig/config2";
|
|
169
|
+
import { ArraySet3 } from "./maskConfig/config3";
|
|
170
|
+
|
|
171
|
+
const fly1 =
|
|
172
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/fly1.jpg";
|
|
173
|
+
const fly2 =
|
|
174
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/fly2.jpg";
|
|
175
|
+
//预加载数组
|
|
176
|
+
const preload_info = [buildPreloadInfo(fly1), buildPreloadInfo(fly2)];
|
|
177
|
+
|
|
178
|
+
//三个配置数组分别添加自己的图片地址进行预加载
|
|
179
|
+
ArraySet1.forEach((item, index) => {
|
|
180
|
+
preload_info.push(buildPreloadInfo(item.url));
|
|
181
|
+
});
|
|
182
|
+
ArraySet2.forEach((item, index) => {
|
|
183
|
+
preload_info.push(buildPreloadInfo(item.url));
|
|
184
|
+
});
|
|
185
|
+
ArraySet3.forEach((item, index) => {
|
|
186
|
+
preload_info.push(buildPreloadInfo(item.url));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
//预加载完成标志
|
|
190
|
+
let isDone = shallowRef(false);
|
|
191
|
+
//小框显示标志
|
|
192
|
+
let boxSwitch = shallowRef(false);
|
|
193
|
+
//计时器
|
|
194
|
+
let timer = { id: -1 };
|
|
195
|
+
//预加载完成回调
|
|
196
|
+
const loadDone = () => {
|
|
197
|
+
isDone.value = true;
|
|
198
|
+
};
|
|
54
199
|
const style = { width: 1280, height: 720 };
|
|
55
200
|
let isShow = shallowRef(false);
|
|
56
201
|
let bg = shallowRef(fly1);
|
|
57
202
|
let onOff = shallowRef(false);
|
|
58
203
|
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
url: png1,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
left: 301,
|
|
75
|
-
top: 0,
|
|
76
|
-
width: 590,
|
|
77
|
-
height: 266,
|
|
78
|
-
url: png2,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
left: 693,
|
|
82
|
-
top: 0,
|
|
83
|
-
width: 587,
|
|
84
|
-
height: 306,
|
|
85
|
-
url: png3,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
left: 0,
|
|
89
|
-
top: 140,
|
|
90
|
-
width: 561,
|
|
91
|
-
height: 431,
|
|
92
|
-
url: png4,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
left: 482,
|
|
96
|
-
top: 140,
|
|
97
|
-
width: 409,
|
|
98
|
-
height: 377,
|
|
99
|
-
url: png5,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
left: 717,
|
|
103
|
-
top: 247,
|
|
104
|
-
width: 563,
|
|
105
|
-
height: 247,
|
|
106
|
-
url: png6,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
left: 0,
|
|
110
|
-
top: 385,
|
|
111
|
-
width: 533,
|
|
112
|
-
height: 335,
|
|
113
|
-
url: png7,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
left: 333,
|
|
117
|
-
top: 392,
|
|
118
|
-
width: 293,
|
|
119
|
-
height: 328,
|
|
120
|
-
url: png8,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
left: 569,
|
|
124
|
-
top: 452,
|
|
125
|
-
width: 213,
|
|
126
|
-
height: 268,
|
|
127
|
-
url: png9,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
left: 714,
|
|
131
|
-
top: 405,
|
|
132
|
-
width: 332,
|
|
133
|
-
height: 315,
|
|
134
|
-
url: png10,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
left: 810,
|
|
138
|
-
top: 387,
|
|
139
|
-
width: 172,
|
|
140
|
-
height: 117,
|
|
141
|
-
url: png11,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
left: 893,
|
|
145
|
-
top: 428,
|
|
146
|
-
width: 387,
|
|
147
|
-
height: 292,
|
|
148
|
-
url: png12,
|
|
149
|
-
},
|
|
150
|
-
];
|
|
204
|
+
//随机选择数组
|
|
205
|
+
const randomSelect = () => {
|
|
206
|
+
let randomNum = Math.random();
|
|
207
|
+
if (randomNum <= 0.33) {
|
|
208
|
+
return ArraySet1;
|
|
209
|
+
} else if (randomNum <= 0.66) {
|
|
210
|
+
return ArraySet2;
|
|
211
|
+
} else {
|
|
212
|
+
return ArraySet3;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const SelectArray = randomSelect();
|
|
151
216
|
|
|
152
217
|
const onKeyDown = (ev) => {
|
|
153
218
|
switch (ev.keyCode) {
|
|
154
219
|
case 13:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
220
|
+
if (isDone.value == true) {
|
|
221
|
+
bg.value = fly2;
|
|
222
|
+
onOff.value = true;
|
|
223
|
+
isShow.value = true;
|
|
224
|
+
} else {
|
|
225
|
+
boxSwitch.value = true;
|
|
226
|
+
timer.id = setTimeout(() => {
|
|
227
|
+
boxSwitch.value = false;
|
|
228
|
+
}, 1000);
|
|
229
|
+
}
|
|
230
|
+
|
|
158
231
|
break;
|
|
159
232
|
|
|
160
233
|
default:
|
|
161
234
|
break;
|
|
162
235
|
}
|
|
163
236
|
};
|
|
237
|
+
//卸载时清除定时器
|
|
238
|
+
onBeforeUnmount(() => {
|
|
239
|
+
if (timer.id) {
|
|
240
|
+
clearTimeout(timer.id);
|
|
241
|
+
timer.id = -1;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
164
244
|
</script>
|
|
165
245
|
|
|
166
246
|
<style scoped>
|
|
167
|
-
.text{
|
|
168
|
-
width:300;
|
|
169
|
-
height:
|
|
170
|
-
color
|
|
247
|
+
.text {
|
|
248
|
+
width: 300;
|
|
249
|
+
height: 80;
|
|
250
|
+
color: #ffffff;
|
|
171
251
|
font-weight: bold;
|
|
172
252
|
line-height: 26;
|
|
173
253
|
font-size: 24;
|
|
174
|
-
|
|
175
|
-
|
|
254
|
+
}
|
|
255
|
+
.bgStyle {
|
|
256
|
+
width: 1280;
|
|
257
|
+
height: 720;
|
|
258
|
+
background-color: #007788;
|
|
259
|
+
}
|
|
260
|
+
.smallBox {
|
|
261
|
+
width: 300;
|
|
262
|
+
height: 100;
|
|
263
|
+
left: 170;
|
|
264
|
+
top: 230;
|
|
265
|
+
border-radius: 20;
|
|
266
|
+
background-color: #006400;
|
|
176
267
|
}
|
|
177
268
|
</style>
|