@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.151-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/BakeViewDemo/AnimatePic.vue +1 -1
- package/Basic/components/text/TextDirection.vue +7 -1
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +2 -2
- package/CoupletsTest/App.vue +1 -1
- package/CoupletsTest/widget/Banger/Banger.vue +3 -3
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
- package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
- package/CustomShader/App.vue +4 -4
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +80 -0
- package/DashPath/AppForOperator.vue +33 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +69 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +316 -0
- package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
- package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
- package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
- package/DemoForOperator/Blur/Blur.vue +146 -0
- package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
- package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
- package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
- package/DemoForOperator/BookFlip/BookPage.vue +82 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +81 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +291 -0
- package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
- package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
- package/DemoForOperator/DominantColor/App.vue +187 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +110 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +250 -0
- package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
- package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
- package/DemoForOperator/Firework1/App.vue +25 -0
- package/DemoForOperator/Firework1/Fireworks.vue +397 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +178 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +95 -0
- package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
- package/DemoForOperator/Focus/App.vue +124 -0
- package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
- package/DemoForOperator/Focus/Item.vue +46 -0
- package/DemoForOperator/Focus/Light/Item.vue +67 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +87 -0
- package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
- package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
- package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
- package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
- package/DemoForOperator/Focus/Normal/Item.vue +64 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +65 -0
- package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
- package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
- package/DemoForOperator/FrameShadow/App.vue +193 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +56 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +741 -0
- package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
- package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
- package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
- package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
- package/DemoForOperator/GrayFilter/App.vue +51 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +59 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +142 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +118 -0
- package/DemoForOperator/LongChatBox/App.vue +36 -0
- package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
- package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
- package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
- package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
- package/DemoForOperator/LongChatBox/testData.js +51 -0
- package/DemoForOperator/LongChatBox/utile.js +331 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +208 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +120 -0
- package/DemoForOperator/PosterAnim/App.vue +125 -0
- package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
- package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
- package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
- package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
- package/DemoForOperator/PosterAnim/Item.vue +46 -0
- package/DemoForOperator/PosterAnim/PosterAnim.js +79 -0
- package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
- package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
- package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
- package/DemoForOperator/PosterOverflow/App.vue +116 -0
- package/DemoForOperator/PosterOverflow/Item.vue +67 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +39 -0
- package/DemoForOperator/Resize/App.vue +157 -0
- package/DemoForOperator/Resize/Resize/Item.vue +234 -0
- package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +65 -0
- package/DemoForOperator/ScreenShootScale/App.vue +96 -0
- package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
- package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
- package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
- package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
- package/DemoForOperator/SmoothSwiper/App.vue +50 -0
- package/DemoForOperator/Sound/Bounce/App.vue +56 -0
- package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
- package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
- package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
- package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
- package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
- package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
- package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
- package/DemoForOperator/Sound/Rain/App.vue +11 -0
- package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
- package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
- package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
- package/DemoForOperator/Sound/Sound/index.js +4 -0
- package/DemoForOperator/Sound/Sound/useSound.js +112 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +147 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +218 -0
- package/DemoForOperator/Swiper/App.vue +101 -0
- package/DemoForOperator/Swiper/Item.vue +56 -0
- package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
- package/DemoForOperator/TabContent/App.vue +89 -0
- package/DemoForOperator/TabContent/ContentPage.vue +66 -0
- package/DemoForOperator/TabContent/Item.vue +85 -0
- package/DemoForOperator/TabContent/PageItem.vue +40 -0
- package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +184 -0
- package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
- package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContent/testData.js +241 -0
- package/DemoForOperator/TabContentVertical/App.vue +104 -0
- package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
- package/DemoForOperator/TabContentVertical/Item.vue +94 -0
- package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
- package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
- package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
- package/DemoForOperator/TabContentVertical/testData.js +76 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +180 -0
- package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
- package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
- package/DemoForOperator/index.js +6 -0
- package/DemoForOperator/routeList.js +259 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +178 -81
- package/DemoHomepage/views/Homepage.vue +7 -2
- package/DivMetroPerformance/data.js +3 -3
- package/DriftScopeTest/App.vue +1 -1
- package/FilterDemo/AnimatePic.vue +1 -1
- package/FilterDemo/VideoLayer.vue +2 -2
- package/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -12
- package/GiftRain/components/SpriteTranslate.vue +68 -48
- package/HashHistory/App.vue +2 -2
- package/HashHistory/router.js +1 -1
- package/JsvPreDownloader/App.vue +4 -4
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
- package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
- package/MetroWidgetDemos/TripleWidget/App.vue +7 -1
- package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
- package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +34 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +5 -5
- package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +4 -4
- package/SceneTransition/App.vue +2 -2
- package/SceneTransition/maskConfig/config2.js +12 -12
- package/SceneTransition/maskConfig/config3.js +14 -14
- package/SprayView/App.vue +96 -51
- package/SpringFestival/App.vue +73 -0
- package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
- package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
- package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
- package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
- package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
- package/SpringFestival/SpringFestivalScene/index.js +1 -0
- package/Swiper/App.vue +28 -29
- package/Swiper/Item.vue +19 -0
- package/SwiperTest/App.vue +9 -9
- package/TestNativeSharedView/AckEventDefine.ts +82 -0
- package/TestNativeSharedView/App.vue +4 -6
- package/TestNativeSharedView/JsvDemoTester.js +131 -0
- package/TextureAnimation/App.vue +16 -6
- package/TextureAnimation/App3.vue +100 -0
- package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
- package/TextureAnimation/utils/RotateFrame.vue +146 -0
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +21 -2
- package/package.json +1 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
3
|
+
import { JsvTextureStoreApi, JsvPreload, buildPreloadInfo } from "jsview";
|
|
4
|
+
|
|
5
|
+
const Image1 =
|
|
6
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/CustomShader/App/panda.jpeg";
|
|
7
|
+
const Image2 =
|
|
8
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/CustomShader/App/owl.jpeg";
|
|
9
|
+
|
|
10
|
+
const vToCapture = shallowRef(null);
|
|
11
|
+
const colorList1 = shallowRef([]);
|
|
12
|
+
const colorList2 = shallowRef([]);
|
|
13
|
+
const isPreloadDone = shallowRef(false);
|
|
14
|
+
|
|
15
|
+
let cancelHandel1 = null;
|
|
16
|
+
let cancelHandel2 = null;
|
|
17
|
+
|
|
18
|
+
const preloadList = [buildPreloadInfo(Image1)];
|
|
19
|
+
|
|
20
|
+
function handlePreloadDone() {
|
|
21
|
+
console.log("图片预加载完成");
|
|
22
|
+
isPreloadDone.value = true;
|
|
23
|
+
catpure();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function catpure() {
|
|
27
|
+
try {
|
|
28
|
+
cancelHandel1 = JsvTextureStoreApi.capture2Texture(
|
|
29
|
+
vToCapture.value,
|
|
30
|
+
(textureName, autoRecycle, w, h) => {
|
|
31
|
+
console.log("ccht captureBlurTexture", textureName, autoRecycle, w, h);
|
|
32
|
+
if (textureName) {
|
|
33
|
+
cancelHandel1 = JsvTextureStoreApi.getDominantColor(
|
|
34
|
+
`jsvtexturestore://${textureName}`,
|
|
35
|
+
(info) => {
|
|
36
|
+
console.log("ccht getDominantColor", info);
|
|
37
|
+
if (info.dominantColors) {
|
|
38
|
+
colorList1.value = info.dominantColors.map((color) => {
|
|
39
|
+
return "#" + color;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
true
|
|
47
|
+
);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("captureTexture error", error, new Error().stack);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
cancelHandel2 = JsvTextureStoreApi.getDominantColor(Image2, (info) => {
|
|
55
|
+
console.log("ccht getDominantColor2", info);
|
|
56
|
+
if (info.dominantColors) {
|
|
57
|
+
colorList2.value = info.dominantColors.map((color) => {
|
|
58
|
+
return "#" + color;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
onBeforeUnmount(() => {
|
|
65
|
+
cancelHandel1?.();
|
|
66
|
+
cancelHandel2?.();
|
|
67
|
+
});
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<div
|
|
72
|
+
:style="{
|
|
73
|
+
left: 0,
|
|
74
|
+
top: 0,
|
|
75
|
+
width: 1280,
|
|
76
|
+
height: 720,
|
|
77
|
+
backgroundColor: '#FFFFFF',
|
|
78
|
+
}"
|
|
79
|
+
></div>
|
|
80
|
+
<jsv-preload
|
|
81
|
+
:preloadList="preloadList"
|
|
82
|
+
:onPreloadDone="handlePreloadDone"
|
|
83
|
+
></jsv-preload>
|
|
84
|
+
<div
|
|
85
|
+
ref="vToCapture"
|
|
86
|
+
:style="{
|
|
87
|
+
left: 0,
|
|
88
|
+
top: 50,
|
|
89
|
+
width: 640, // 截屏区域的宽
|
|
90
|
+
height: 360, // 截屏区域的高
|
|
91
|
+
}"
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
:style="{
|
|
95
|
+
width: 640,
|
|
96
|
+
height: 360,
|
|
97
|
+
backgroundImage: `url(${Image1})`,
|
|
98
|
+
}"
|
|
99
|
+
/>
|
|
100
|
+
<div
|
|
101
|
+
:style="{
|
|
102
|
+
width: 300,
|
|
103
|
+
height: 300,
|
|
104
|
+
backgroundColor: '#007788',
|
|
105
|
+
}"
|
|
106
|
+
></div>
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
:style="{
|
|
110
|
+
left: 50,
|
|
111
|
+
top: 420,
|
|
112
|
+
}"
|
|
113
|
+
v-if="colorList1.length > 0"
|
|
114
|
+
>
|
|
115
|
+
<div
|
|
116
|
+
v-for="(color, index) in colorList1"
|
|
117
|
+
:style="{
|
|
118
|
+
left: 60 * index,
|
|
119
|
+
width: 50,
|
|
120
|
+
height: 50,
|
|
121
|
+
backgroundColor: color,
|
|
122
|
+
}"
|
|
123
|
+
></div>
|
|
124
|
+
<div
|
|
125
|
+
:style="{
|
|
126
|
+
top: 50,
|
|
127
|
+
width: 480,
|
|
128
|
+
height: 40,
|
|
129
|
+
fontSize: 20,
|
|
130
|
+
textAlign: 'center',
|
|
131
|
+
lineHeight: '40px',
|
|
132
|
+
}"
|
|
133
|
+
>
|
|
134
|
+
截图取主色调
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div
|
|
139
|
+
:style="{
|
|
140
|
+
left: 640,
|
|
141
|
+
top: 50,
|
|
142
|
+
width: 640,
|
|
143
|
+
height: 360,
|
|
144
|
+
backgroundImage: `url(${Image2})`,
|
|
145
|
+
}"
|
|
146
|
+
/>
|
|
147
|
+
<div
|
|
148
|
+
:style="{
|
|
149
|
+
top: 420,
|
|
150
|
+
left: 690,
|
|
151
|
+
}"
|
|
152
|
+
v-if="colorList2.length > 0"
|
|
153
|
+
>
|
|
154
|
+
<div
|
|
155
|
+
v-for="(color, index) in colorList2"
|
|
156
|
+
:style="{
|
|
157
|
+
left: 60 * index,
|
|
158
|
+
width: 50,
|
|
159
|
+
height: 50,
|
|
160
|
+
backgroundColor: color,
|
|
161
|
+
}"
|
|
162
|
+
></div>
|
|
163
|
+
<div
|
|
164
|
+
:style="{
|
|
165
|
+
top: 50,
|
|
166
|
+
width: 480,
|
|
167
|
+
height: 40,
|
|
168
|
+
fontSize: 20,
|
|
169
|
+
textAlign: 'center',
|
|
170
|
+
lineHeight: '40px',
|
|
171
|
+
}"
|
|
172
|
+
>
|
|
173
|
+
图片取主色调
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
177
|
+
|
|
178
|
+
<style>
|
|
179
|
+
@keyframes rotate {
|
|
180
|
+
0% {
|
|
181
|
+
transform: rotate3d(0, 0, 1, 0deg);
|
|
182
|
+
}
|
|
183
|
+
100% {
|
|
184
|
+
transform: rotate3d(0, 0, 1, 360deg);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
width: 1280,
|
|
5
|
+
height: 720,
|
|
6
|
+
backgroundColor: '#007788',
|
|
7
|
+
}"
|
|
8
|
+
></div>
|
|
9
|
+
<EpisodeList
|
|
10
|
+
:name="name"
|
|
11
|
+
:listLayout="listLayout"
|
|
12
|
+
:groupLayout="groupLayout"
|
|
13
|
+
:numPerPage="numPerPage"
|
|
14
|
+
:listMeasures="listMeasures"
|
|
15
|
+
:groupMeasures="groupMeasures"
|
|
16
|
+
:totalNumber="totalNumber"
|
|
17
|
+
:listPadding="listPadding"
|
|
18
|
+
>
|
|
19
|
+
<template #listItem="{ data, onAction, query }">
|
|
20
|
+
<list-item :data="data" :onAction="onAction" :query="query" />
|
|
21
|
+
</template>
|
|
22
|
+
<template #groupItem="{ data, onAction, query }">
|
|
23
|
+
<group-item :data="data" :onAction="onAction" :query="query" />
|
|
24
|
+
</template>
|
|
25
|
+
</EpisodeList>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import EpisodeList from "./EpisodeList/EpisodeList.vue";
|
|
30
|
+
import ListItem from "./ListItem.vue";
|
|
31
|
+
import GroupItem from "./GroupItem.vue";
|
|
32
|
+
import { onMounted } from "vue";
|
|
33
|
+
import { useFocusHub } from "jsview";
|
|
34
|
+
|
|
35
|
+
const focusHub = useFocusHub();
|
|
36
|
+
const name = "episodeList";
|
|
37
|
+
const listLayout = {
|
|
38
|
+
left: 80,
|
|
39
|
+
top: 100,
|
|
40
|
+
width: 940,
|
|
41
|
+
height: 120,
|
|
42
|
+
};
|
|
43
|
+
const groupLayout = {
|
|
44
|
+
left: 100,
|
|
45
|
+
top: 220,
|
|
46
|
+
width: 900,
|
|
47
|
+
height: 50,
|
|
48
|
+
};
|
|
49
|
+
const numPerPage = 10;
|
|
50
|
+
function listMeasures(index) {
|
|
51
|
+
return {
|
|
52
|
+
width: 80,
|
|
53
|
+
height: 80,
|
|
54
|
+
marginRight: 10,
|
|
55
|
+
data: {
|
|
56
|
+
content: index,
|
|
57
|
+
width: 80,
|
|
58
|
+
height: 80,
|
|
59
|
+
backgroundColor: "#ffffffaa",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function groupMeasures(index) {
|
|
64
|
+
return {
|
|
65
|
+
width: 150,
|
|
66
|
+
height: 50,
|
|
67
|
+
marginRight: 10,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const totalNumber = 400;
|
|
71
|
+
const listPadding = {
|
|
72
|
+
left: 20,
|
|
73
|
+
right: 20,
|
|
74
|
+
top: 20,
|
|
75
|
+
bottom: 20,
|
|
76
|
+
};
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
focusHub.setFocus(name);
|
|
79
|
+
});
|
|
80
|
+
</script>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { MetroWidget, HORIZONTAL, useFocusHub, EdgeDirection } from "jsview";
|
|
8
|
+
import { ref } from "vue";
|
|
9
|
+
|
|
10
|
+
const widget = ref();
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
name: String,
|
|
13
|
+
number: Number,
|
|
14
|
+
widgetHandler: Object,
|
|
15
|
+
numPerPage: Number,
|
|
16
|
+
measures: Function,
|
|
17
|
+
listName: String,
|
|
18
|
+
layout: Object,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const focusHub = useFocusHub();
|
|
22
|
+
|
|
23
|
+
let data = [];
|
|
24
|
+
const provideData = () => {
|
|
25
|
+
data = [];
|
|
26
|
+
const c = Math.ceil(props.number / props.numPerPage);
|
|
27
|
+
for (let i = 0; i < c; ++i) {
|
|
28
|
+
const m = props.measures(i);
|
|
29
|
+
data.push({
|
|
30
|
+
width: m.width,
|
|
31
|
+
height: m.height,
|
|
32
|
+
marginRight: m.marginRight,
|
|
33
|
+
from: i * props.numPerPage,
|
|
34
|
+
to: Math.min((i + 1) * props.numPerPage - 1, props.number - 1),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const measures = (data) => {
|
|
41
|
+
return {
|
|
42
|
+
width: data.width,
|
|
43
|
+
height: data.height,
|
|
44
|
+
marginRight: data.marginRight,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// callbacks
|
|
49
|
+
const onEdge = (edgeInfo) => {
|
|
50
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
51
|
+
focusHub.setFocus(props.listName);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onBlur = () => {
|
|
56
|
+
firstLock = false;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let targetFocus = 0;
|
|
60
|
+
|
|
61
|
+
let firstLock = false;
|
|
62
|
+
const setFocusId = (index) => {
|
|
63
|
+
targetFocus = index;
|
|
64
|
+
firstLock = true;
|
|
65
|
+
widget.value.setFocusId(index, true, true);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function onFocusItemChange(id) {
|
|
69
|
+
if (firstLock) {
|
|
70
|
+
firstLock = false;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let itemData = data[id];
|
|
75
|
+
|
|
76
|
+
if (itemData) {
|
|
77
|
+
props.widgetHandler.widget.value?.setFocusId(itemData.from, false);
|
|
78
|
+
const itemPos = props.widgetHandler.widget.value?.getTemplatePosition(
|
|
79
|
+
itemData.from
|
|
80
|
+
);
|
|
81
|
+
props.widgetHandler.widget.value?.slideTo(itemPos.left);
|
|
82
|
+
targetFocus = itemData.from;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
defineExpose({
|
|
87
|
+
setFocusId,
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<metro-widget
|
|
93
|
+
ref="widget"
|
|
94
|
+
:name="name"
|
|
95
|
+
:left="layout.left"
|
|
96
|
+
:top="layout.top"
|
|
97
|
+
:width="layout.width"
|
|
98
|
+
:height="layout.height"
|
|
99
|
+
:provideData="provideData"
|
|
100
|
+
:direction="HORIZONTAL"
|
|
101
|
+
:measures="measures"
|
|
102
|
+
:onEdge="onEdge"
|
|
103
|
+
:onBlur="onBlur"
|
|
104
|
+
:onFocusChange="onFocusItemChange"
|
|
105
|
+
>
|
|
106
|
+
<template #renderItem="{ data, onAction, query }">
|
|
107
|
+
<slot name="item" :onAction="onAction" :query="query" :data="data"></slot>
|
|
108
|
+
</template>
|
|
109
|
+
</metro-widget>
|
|
110
|
+
</template>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
/**
|
|
8
|
+
* @slot listItem - 渲染单个列表项
|
|
9
|
+
* @property {Object} data - 项数据
|
|
10
|
+
* @property {Function} onAction - 动作处理函数
|
|
11
|
+
* @property {Object} query - 查询参数
|
|
12
|
+
*
|
|
13
|
+
* @slot groupItem - 渲染分页组项
|
|
14
|
+
* @property {Object} item - 分页组项数据
|
|
15
|
+
* @property {number} index - 分页组项索引
|
|
16
|
+
*/
|
|
17
|
+
let TOKEN = 0;
|
|
18
|
+
</script>
|
|
19
|
+
<script setup>
|
|
20
|
+
import {
|
|
21
|
+
MetroWidget,
|
|
22
|
+
HORIZONTAL,
|
|
23
|
+
useFocusHub,
|
|
24
|
+
SeamlessSlide,
|
|
25
|
+
EdgeDirection,
|
|
26
|
+
SlideSetting,
|
|
27
|
+
} from "jsview";
|
|
28
|
+
import Controller from "./Controller.vue";
|
|
29
|
+
import { onMounted, ref } from "vue";
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
/**
|
|
33
|
+
* 组件名称标识
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @required
|
|
36
|
+
*/
|
|
37
|
+
name: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 列表布局配置
|
|
44
|
+
* @type {Object}
|
|
45
|
+
* @required
|
|
46
|
+
* @property {number} left - 列表左侧位置
|
|
47
|
+
* @property {number} top - 列表顶部位置
|
|
48
|
+
* @property {number} width - 列表宽度
|
|
49
|
+
* @property {number} height - 列表高度
|
|
50
|
+
*/
|
|
51
|
+
listLayout: {
|
|
52
|
+
type: Object,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 分页器布局配置
|
|
58
|
+
* @type {Object}
|
|
59
|
+
* @required
|
|
60
|
+
* @property {number} left - 分页器左侧位置
|
|
61
|
+
* @property {number} top - 分页器顶部位置
|
|
62
|
+
* @property {number} width - 分页器宽度
|
|
63
|
+
* @property {number} height - 分页器高度
|
|
64
|
+
*/
|
|
65
|
+
groupLayout: {
|
|
66
|
+
type: Object,
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 每页显示项数
|
|
72
|
+
* @type {number}
|
|
73
|
+
* @default 10
|
|
74
|
+
*/
|
|
75
|
+
numPerPage: {
|
|
76
|
+
type: Number,
|
|
77
|
+
default: 10,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 列表项测量函数
|
|
82
|
+
* @type {Function}
|
|
83
|
+
* @required
|
|
84
|
+
* @param {number} index - 当前项索引
|
|
85
|
+
* @returns {Object} 包含尺寸和数据的对象
|
|
86
|
+
* @returns {number} return.width - 项宽度
|
|
87
|
+
* @returns {number} return.height - 项高度
|
|
88
|
+
* @returns {number} [return.marginRight] - 右侧间距
|
|
89
|
+
* @returns {Object} return.data - 项数据
|
|
90
|
+
*/
|
|
91
|
+
listMeasures: {
|
|
92
|
+
type: Function,
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 分页组测量函数
|
|
97
|
+
* @type {Function}
|
|
98
|
+
* @required
|
|
99
|
+
*/
|
|
100
|
+
groupMeasures: {
|
|
101
|
+
type: Function,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 总项数
|
|
106
|
+
* @type {number}
|
|
107
|
+
* @required
|
|
108
|
+
*/
|
|
109
|
+
totalNumber: {
|
|
110
|
+
type: Number,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 列表内边距配置
|
|
115
|
+
* @type {Object}
|
|
116
|
+
* @optional
|
|
117
|
+
*/
|
|
118
|
+
listPadding: {
|
|
119
|
+
type: Object,
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const controller = ref(null);
|
|
124
|
+
const widget = ref(null);
|
|
125
|
+
const handler = {
|
|
126
|
+
widget,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const slideObj = {
|
|
130
|
+
headRange: 0.5,
|
|
131
|
+
tailRange: 0.5,
|
|
132
|
+
};
|
|
133
|
+
const defaultSlide = new SeamlessSlide(slideObj);
|
|
134
|
+
|
|
135
|
+
const slide1 = new SeamlessSlide({
|
|
136
|
+
...slideObj,
|
|
137
|
+
boundaryProtect: SlideSetting.START_PROTECT,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const focusHub = useFocusHub();
|
|
141
|
+
|
|
142
|
+
let t = TOKEN++;
|
|
143
|
+
const listName = props.name + "_list_" + t;
|
|
144
|
+
const controllerName = props.name + "_controller_" + t;
|
|
145
|
+
let curFocusName = listName;
|
|
146
|
+
|
|
147
|
+
const provideData = () => {
|
|
148
|
+
const data = [];
|
|
149
|
+
for (let i = 0; i < props.totalNumber; i++) {
|
|
150
|
+
const item = props.listMeasures(i);
|
|
151
|
+
data.push({
|
|
152
|
+
index: i,
|
|
153
|
+
data: item.data,
|
|
154
|
+
width: item.width,
|
|
155
|
+
height: item.height,
|
|
156
|
+
marginRight: item.marginRight,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return data;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const measures = (data) => {
|
|
163
|
+
return {
|
|
164
|
+
width: data.width,
|
|
165
|
+
height: data.height,
|
|
166
|
+
marginRight: data.marginRight,
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
function onItemFocus(index) {
|
|
171
|
+
const ctrlItemIndex = Math.floor(index / props.numPerPage);
|
|
172
|
+
controller.value?.setFocusId(ctrlItemIndex);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const onEdge = (edgeInfo) => {
|
|
176
|
+
if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
177
|
+
focusHub.setFocus(controllerName);
|
|
178
|
+
curFocusName = controllerName;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const onBlur = () => {
|
|
183
|
+
widget.value?.setSlideSetting(slide1);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const onFocus = () => {
|
|
187
|
+
widget.value?.setSlideSetting(null);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
onMounted(() => {});
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 处理组件获取焦点时的操作
|
|
194
|
+
*/
|
|
195
|
+
function componentOnFocus() {
|
|
196
|
+
focusHub.setFocus(curFocusName);
|
|
197
|
+
}
|
|
198
|
+
</script>
|
|
199
|
+
|
|
200
|
+
<template>
|
|
201
|
+
<jsv-focus-block
|
|
202
|
+
:name="name"
|
|
203
|
+
:onAction="{
|
|
204
|
+
onFocus: componentOnFocus,
|
|
205
|
+
}"
|
|
206
|
+
>
|
|
207
|
+
<metro-widget
|
|
208
|
+
ref="widget"
|
|
209
|
+
:name="listName"
|
|
210
|
+
:left="listLayout.left"
|
|
211
|
+
:top="listLayout.top"
|
|
212
|
+
:width="listLayout.width"
|
|
213
|
+
:height="listLayout.height"
|
|
214
|
+
:provideData="provideData"
|
|
215
|
+
:direction="HORIZONTAL"
|
|
216
|
+
:measures="measures"
|
|
217
|
+
:onEdge="onEdge"
|
|
218
|
+
:onBlur="onBlur"
|
|
219
|
+
:onFocus="onFocus"
|
|
220
|
+
:initFocusId="0"
|
|
221
|
+
:slideSetting="defaultSlide"
|
|
222
|
+
:onFocusChange="onItemFocus"
|
|
223
|
+
:padding="listPadding"
|
|
224
|
+
>
|
|
225
|
+
<template #renderItem="{ data, onAction, query }">
|
|
226
|
+
<slot
|
|
227
|
+
name="listItem"
|
|
228
|
+
:data="data.data"
|
|
229
|
+
:onAction="onAction"
|
|
230
|
+
:query="query"
|
|
231
|
+
></slot>
|
|
232
|
+
</template>
|
|
233
|
+
</metro-widget>
|
|
234
|
+
|
|
235
|
+
<controller
|
|
236
|
+
ref="controller"
|
|
237
|
+
:name="controllerName"
|
|
238
|
+
:number="totalNumber"
|
|
239
|
+
:widgetHandler="handler"
|
|
240
|
+
:numPerPage="numPerPage"
|
|
241
|
+
:measures="groupMeasures"
|
|
242
|
+
:listName="listName"
|
|
243
|
+
:layout="groupLayout"
|
|
244
|
+
>
|
|
245
|
+
<template #item="slotProps">
|
|
246
|
+
<slot name="groupItem" v-bind="slotProps"></slot>
|
|
247
|
+
</template>
|
|
248
|
+
</controller>
|
|
249
|
+
</jsv-focus-block>
|
|
250
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
/* 固定格式 {width: Number, hieght: Number, from: Number, to: Number} */
|
|
11
|
+
data: Object,
|
|
12
|
+
onAction: Object,
|
|
13
|
+
query: Object,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const focused = ref(false);
|
|
17
|
+
const gazed = ref(false);
|
|
18
|
+
|
|
19
|
+
// 注册回调
|
|
20
|
+
const onFocus = () => {
|
|
21
|
+
focused.value = true;
|
|
22
|
+
};
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
focused.value = false;
|
|
25
|
+
};
|
|
26
|
+
const onGaze = () => {
|
|
27
|
+
gazed.value = true;
|
|
28
|
+
};
|
|
29
|
+
const onIgnore = () => {
|
|
30
|
+
gazed.value = false;
|
|
31
|
+
};
|
|
32
|
+
const onClick = () => {
|
|
33
|
+
console.log("item onclick ", props.data);
|
|
34
|
+
};
|
|
35
|
+
props.onAction.register("onFocus", onFocus);
|
|
36
|
+
props.onAction.register("onBlur", onBlur);
|
|
37
|
+
props.onAction.register("onClick", onClick);
|
|
38
|
+
props.onAction.register("onGaze", onGaze);
|
|
39
|
+
props.onAction.register("onIgnore", onIgnore);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div
|
|
44
|
+
:style="{
|
|
45
|
+
width: data.width,
|
|
46
|
+
height: data.height,
|
|
47
|
+
lineHeight: data.height,
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
backgroundColor: '#6789fd',
|
|
50
|
+
fontSize: 30,
|
|
51
|
+
color: gazed ? '#ffffff' : '#aaaaaa',
|
|
52
|
+
}"
|
|
53
|
+
>
|
|
54
|
+
{{ data.from + "-" + data.to }}
|
|
55
|
+
</div>
|
|
56
|
+
<div
|
|
57
|
+
v-if="focused"
|
|
58
|
+
:style="{
|
|
59
|
+
top: data.height - 3,
|
|
60
|
+
width: data.width,
|
|
61
|
+
height: 3,
|
|
62
|
+
backgroundColor: '#0000ff',
|
|
63
|
+
}"
|
|
64
|
+
></div>
|
|
65
|
+
</template>
|