@shijiu/jsview-vue 0.0.1-beta.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.
Files changed (252) hide show
  1. package/docs/IMPORT_CHANGE_LOG.txt +3 -0
  2. package/docs/git_commit.md +15 -0
  3. package/docs/test_version_up.txt +1 -0
  4. package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
  5. package/dom/browser-root-style.css +21 -0
  6. package/dom/jsv-browser-debug-dom.js +8 -0
  7. package/dom/jsv-dom.js +6 -0
  8. package/dom/jsv-forge-define.js +6 -0
  9. package/dom/target_core_revision.js +14 -0
  10. package/load/header_script_loader.js +134 -0
  11. package/load/jsview-main.js +42 -0
  12. package/load/jsview.config.default.js +37 -0
  13. package/load/jsview.default.config.js +37 -0
  14. package/load/loader.js +172 -0
  15. package/load/loader_webkit.js +40 -0
  16. package/package.json +27 -0
  17. package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
  18. package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
  19. package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
  20. package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
  21. package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
  22. package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
  23. package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
  24. package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
  25. package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
  26. package/patch/node_modules/postcss-js/objectifier.js +90 -0
  27. package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
  28. package/patch/package-lock.json +30051 -0
  29. package/samples/AdvanceMetroWidget/App.vue +123 -0
  30. package/samples/AdvanceMetroWidget/Frame.vue +101 -0
  31. package/samples/AdvanceMetroWidget/Item.vue +58 -0
  32. package/samples/AdvanceMetroWidget/data.js +137 -0
  33. package/samples/AnimPicture/App.vue +224 -0
  34. package/samples/AnimPicture/assets/animated_webp.webp +0 -0
  35. package/samples/AnimPicture/assets/ball_3.webp +0 -0
  36. package/samples/AnimPicture/assets/girl_run.gif +0 -0
  37. package/samples/AnimPicture/assets/quan.webp +0 -0
  38. package/samples/Basic/App.vue +129 -0
  39. package/samples/Basic/assets/border.png +0 -0
  40. package/samples/Basic/assets/border2.png +0 -0
  41. package/samples/Basic/assets/icon.png +0 -0
  42. package/samples/Basic/assets/test.jpg +0 -0
  43. package/samples/Basic/components/ContentBlock.vue +36 -0
  44. package/samples/Basic/components/FontStyle.css +10 -0
  45. package/samples/Basic/components/TitleBar.vue +29 -0
  46. package/samples/Basic/components/anim/AnimGroup.vue +68 -0
  47. package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
  48. package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
  49. package/samples/Basic/components/anim/AnimTransition.vue +116 -0
  50. package/samples/Basic/components/div/DivBackground.vue +15 -0
  51. package/samples/Basic/components/div/DivClip.vue +81 -0
  52. package/samples/Basic/components/div/DivCssScoped.vue +27 -0
  53. package/samples/Basic/components/div/DivCssVar.vue +50 -0
  54. package/samples/Basic/components/div/DivGroup1.vue +33 -0
  55. package/samples/Basic/components/div/DivGroup2.vue +41 -0
  56. package/samples/Basic/components/div/DivLayout.vue +12 -0
  57. package/samples/Basic/components/div/DivRadius.vue +47 -0
  58. package/samples/Basic/components/text/TextAlign.vue +48 -0
  59. package/samples/Basic/components/text/TextFontStyle.vue +58 -0
  60. package/samples/Basic/components/text/TextGroup.vue +32 -0
  61. package/samples/Basic/components/text/TextOverflow.vue +78 -0
  62. package/samples/BasicFocusControl/App.vue +125 -0
  63. package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
  64. package/samples/BasicFocusControl/components/MainArea.vue +98 -0
  65. package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
  66. package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
  67. package/samples/BasicFocusControl/components/SideBar.vue +73 -0
  68. package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
  69. package/samples/ClassNameDemo/App.vue +119 -0
  70. package/samples/ClassNameDemo/assets/bg.jpg +0 -0
  71. package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
  72. package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
  73. package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
  74. package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
  75. package/samples/ClassNameDemo/assets/focus_border.png +0 -0
  76. package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
  77. package/samples/ClassNameDemo/assets/jrbm.png +0 -0
  78. package/samples/ClassNameDemo/assets/line_left.png +0 -0
  79. package/samples/ClassNameDemo/assets/line_mid.png +0 -0
  80. package/samples/ClassNameDemo/assets/line_right.png +0 -0
  81. package/samples/ClassNameDemo/assets/loading.png +0 -0
  82. package/samples/ClassNameDemo/assets/logo.png +0 -0
  83. package/samples/ClassNameDemo/assets/mcjx.png +0 -0
  84. package/samples/ClassNameDemo/assets/tao.png +0 -0
  85. package/samples/ClassNameDemo/assets/tmall.png +0 -0
  86. package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
  87. package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
  88. package/samples/ClassNameDemo/components/TitleView.vue +24 -0
  89. package/samples/ClassNameDemo/data.js +24 -0
  90. package/samples/ColorSpace/App.vue +135 -0
  91. package/samples/ColorSpace/bmpDemo.bmp +0 -0
  92. package/samples/ColorSpace/jpegDemo.jpeg +0 -0
  93. package/samples/ColorSpace/pngDemo.png +0 -0
  94. package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
  95. package/samples/DemoHomepage/App.vue +31 -0
  96. package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
  97. package/samples/DemoHomepage/components/Dialog.vue +94 -0
  98. package/samples/DemoHomepage/components/Item.vue +77 -0
  99. package/samples/DemoHomepage/components/TabFrame.vue +86 -0
  100. package/samples/DemoHomepage/router.js +132 -0
  101. package/samples/DemoHomepage/views/Homepage.vue +186 -0
  102. package/samples/FlipCard/App.vue +80 -0
  103. package/samples/FlipCard/FlipCard.vue +124 -0
  104. package/samples/FlipCard/assets/blue_egg.png +0 -0
  105. package/samples/FlipCard/assets/red_egg.png +0 -0
  106. package/samples/FlipCard/data.js +13 -0
  107. package/samples/FlowMultiWidget/App.vue +91 -0
  108. package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
  109. package/samples/FlowMultiWidget/components/Block.vue +107 -0
  110. package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
  111. package/samples/FlowMultiWidget/components/Item.vue +103 -0
  112. package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
  113. package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
  114. package/samples/FlowMultiWidget/data.js +446 -0
  115. package/samples/HashHistory/App.vue +124 -0
  116. package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
  117. package/samples/HashHistory/components/Item.vue +74 -0
  118. package/samples/HashHistory/router.js +30 -0
  119. package/samples/HashHistory/views/BasePage.vue +19 -0
  120. package/samples/HashHistory/views/MainPage.vue +68 -0
  121. package/samples/HashHistory/views/SubPage.vue +79 -0
  122. package/samples/HashHistory/views/SubPageFirst.vue +10 -0
  123. package/samples/HashHistory/views/SubPageSecond.vue +10 -0
  124. package/samples/LongImage/App.vue +96 -0
  125. package/samples/LongImage/Button.vue +153 -0
  126. package/samples/LongImage/LongImageScroll.vue +127 -0
  127. package/samples/LongImage/Scroll.vue +16 -0
  128. package/samples/LongImage/assets/1280x7200.jpg +0 -0
  129. package/samples/LongText/App.vue +111 -0
  130. package/samples/LongText/Button.vue +153 -0
  131. package/samples/LongText/LongTextScroll.vue +225 -0
  132. package/samples/LongText/Scroll.vue +16 -0
  133. package/samples/Preload/App.vue +146 -0
  134. package/samples/Preload/data.js +23 -0
  135. package/samples/Preload/images/awesomeface.png +0 -0
  136. package/samples/Preload/images/cat.jpg +0 -0
  137. package/samples/Preload/images/rank.png +0 -0
  138. package/samples/Preload/images/rank_focus.png +0 -0
  139. package/samples/Preload/images/rule.png +0 -0
  140. package/samples/Preload/images/rule_focus.png +0 -0
  141. package/samples/Preload/images/start.png +0 -0
  142. package/samples/Preload/images/start_focus.png +0 -0
  143. package/samples/Preload/preloadItem.vue +22 -0
  144. package/samples/QrcodeDemo/App.vue +73 -0
  145. package/samples/SimpleWidgetDemo/App.vue +204 -0
  146. package/samples/SimpleWidgetDemo/Item.vue +83 -0
  147. package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
  148. package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
  149. package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
  150. package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
  151. package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
  152. package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
  153. package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
  154. package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
  155. package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
  156. package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
  157. package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
  158. package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
  159. package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
  160. package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
  161. package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
  162. package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
  163. package/samples/SimpleWidgetDemo/border.png +0 -0
  164. package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
  165. package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
  166. package/samples/SimpleWidgetDemo/data.js +110 -0
  167. package/samples/SprayView/App.vue +270 -0
  168. package/samples/SprayView/assets/snow.png +0 -0
  169. package/samples/SpriteImage/App.vue +174 -0
  170. package/samples/SpriteImage/images/cat_run.png +0 -0
  171. package/samples/SpriteImage/images/egg_break.json +116 -0
  172. package/samples/SpriteImage/images/egg_break.png +0 -0
  173. package/samples/SpriteImage/images/sprite.png +0 -0
  174. package/samples/TextBox/App.vue +179 -0
  175. package/samples/TextBox/RenderCenter.vue +109 -0
  176. package/samples/TextBox/RenderLeft.vue +109 -0
  177. package/samples/TextBox/RenderOneLine.vue +120 -0
  178. package/samples/TextBox/RenderRight.vue +107 -0
  179. package/samples/TextShadowDemo/App.vue +98 -0
  180. package/samples/TextureSize/App.vue +142 -0
  181. package/samples/TextureSize/bmpDemo.bmp +0 -0
  182. package/samples/TextureSize/jpegDemo.jpeg +0 -0
  183. package/samples/TextureSize/jpgDemo.jpg +0 -0
  184. package/samples/TextureSize/pngDemo.png +0 -0
  185. package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
  186. package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
  187. package/samples/ThrowMoveDemo/App.vue +114 -0
  188. package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
  189. package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
  190. package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
  191. package/samples/TransitPage/App.vue +41 -0
  192. package/samples/VideoDemo/App.vue +137 -0
  193. package/samples/VideoDemo/components/Button.vue +69 -0
  194. package/samples/VideoDemo/components/Controllor.vue +195 -0
  195. package/samples/VideoDemo/components/VideoFrame.vue +152 -0
  196. package/scripts/git-commit-empty.js +21 -0
  197. package/scripts/install-local-packages.js +121 -0
  198. package/scripts/make-js.sh +181 -0
  199. package/scripts/post-build.js +132 -0
  200. package/scripts/post-install.js +127 -0
  201. package/scripts/pre-pack.js +2 -0
  202. package/scripts/run-android.js +64 -0
  203. package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
  204. package/utils/JsViewEngineWidget/index.d.ts +32 -0
  205. package/utils/JsViewEngineWidget/index.js +6 -0
  206. package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
  207. package/utils/JsViewVueTools/DebugTool.js +21 -0
  208. package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
  209. package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
  210. package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
  211. package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
  212. package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
  213. package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
  214. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
  215. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
  216. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
  217. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
  218. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
  219. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
  220. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
  221. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
  222. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
  223. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
  224. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
  225. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
  226. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
  227. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
  228. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
  229. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
  230. package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
  231. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
  232. package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
  233. package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
  234. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
  235. package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
  236. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
  237. package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
  238. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
  239. package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
  240. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
  241. package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
  242. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
  243. package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
  244. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
  245. package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
  246. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
  247. package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
  248. package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
  249. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
  250. package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
  251. package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
  252. package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
@@ -0,0 +1,122 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-20 18:27:25
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-10-21 14:07:16
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import JsvActorMove, {
10
+ JsvActorMoveControl,
11
+ } from "jsview/utils/JsViewVueWidget/JsvActorMove";
12
+ export default {
13
+ components: {
14
+ JsvActorMove,
15
+ },
16
+ props: {
17
+ name: String,
18
+ },
19
+ data() {
20
+ return {
21
+ direction: 1,
22
+ };
23
+ },
24
+ computed: {
25
+ directionDetail() {
26
+ return this.direction < 0 ? "上" : "下";
27
+ },
28
+ detail() {
29
+ return this.direction < 0 ? "向上抛物" : "向下掷物并弹起";
30
+ },
31
+ },
32
+ setup() {
33
+ let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
34
+ let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
35
+
36
+ return {
37
+ throwControl,
38
+ moveControl,
39
+ };
40
+ },
41
+ methods: {
42
+ onKeyDown(ev) {
43
+ let preDirection = this.direction;
44
+ switch (ev.keyCode) {
45
+ case 13:
46
+ this.direction = -this.direction;
47
+ this.throwControl.throwAlongY(
48
+ -400 * preDirection,
49
+ 550 * preDirection,
50
+ {
51
+ type: "catch",
52
+ position: 100 * preDirection,
53
+ direction: preDirection,
54
+ },
55
+ (x, y) => {
56
+ console.log(`Throw end with x=${x} y=${y}`);
57
+ }
58
+ );
59
+ return true;
60
+ }
61
+ return false;
62
+ },
63
+ },
64
+ };
65
+ </script>
66
+
67
+ <template>
68
+ <jsv-focus-block
69
+ ref="focusNode"
70
+ :name="name"
71
+ autoFocus
72
+ :onAction="{
73
+ onKeyDown: onKeyDown,
74
+ }"
75
+ >
76
+ <div
77
+ key="sample1"
78
+ class="detail-font"
79
+ :style="{ top: 150, left: 425, width: 430, height: 40 }"
80
+ >
81
+ {{ detail }}
82
+ </div>
83
+ <div
84
+ key="DirectText"
85
+ class="font"
86
+ :style="{ top: 250, left: 425, width: 430, height: 40 }"
87
+ >
88
+ {{ `当前方向:${directionDetail}` }}
89
+ </div>
90
+ <div :style="{ top: 590, left: 625 }">
91
+ <jsv-actor-move key="move" :control="moveControl">
92
+ <jsv-actor-move key="throw" :control="throwControl">
93
+ <div
94
+ :style="{ backgroundColor: '#ffb915', width: 30, height: 30 }"
95
+ ></div>
96
+ </jsv-actor-move>
97
+ </jsv-actor-move>
98
+ </div>
99
+ </jsv-focus-block>
100
+ </template>
101
+
102
+ <style scoped>
103
+ .font {
104
+ font-size: 32px;
105
+ color: #73665c;
106
+ line-height: 40px;
107
+ overflow: hidden;
108
+ white-space: nowrap;
109
+ text-overflow: ellipsis;
110
+ text-align: center;
111
+ }
112
+
113
+ .detail-font {
114
+ font-size: 32px;
115
+ color: #f7f7eb;
116
+ line-height: 30px;
117
+ overflow: hidden;
118
+ white-space: nowrap;
119
+ text-overflow: ellipsis;
120
+ text-align: center;
121
+ }
122
+ </style>
@@ -0,0 +1,41 @@
1
+ <script>
2
+ import { Options, Vue } from "vue-class-component";
3
+ import DemoApp from "../DemoHomepage/App.vue"
4
+ import ActivityApp from "../SimpleWidgetDemo/App.vue" // TODO
5
+ import { jJsvRuntimeBridge } from "jsview/utils/JsViewVueTools/JsvRuntimeBridge";
6
+
7
+ @Options({
8
+ components: {
9
+ DemoApp, ActivityApp,
10
+ }
11
+ })
12
+ class TransitPage extends Vue {
13
+ constructor(props) {
14
+ super(props);
15
+ this.showMode = TransitPage.getShowMode()
16
+ }
17
+ mounted() {
18
+ jJsvRuntimeBridge.notifyPageLoaded();
19
+ }
20
+
21
+ static getShowMode() {
22
+ let showMode = 0
23
+ // showMode信息可被URL中的?后缀信息替换
24
+ if (window.location.search.indexOf("showMode=0") >= 0) {
25
+ showMode = 0;
26
+ } else if (window.location.search.indexOf("showMode=1") >= 0) {
27
+ showMode = 1;
28
+ }
29
+
30
+ return showMode;
31
+ }
32
+ }
33
+ TransitPage.Router = TransitPage.getShowMode() == 0 ? DemoApp.Router : ActivityApp.Router;
34
+
35
+ export default TransitPage;
36
+ </script>
37
+
38
+ <template>
39
+ <DemoApp v-if="showMode === 0" />
40
+ <ActivityApp v-else-if="showMode === 1"/>
41
+ </template>
@@ -0,0 +1,137 @@
1
+ <script>
2
+ import { provide, reactive, ref, watch } from 'vue'
3
+ import { Options, Vue } from "vue-class-component";
4
+ import Controllor from "./components/Controllor";
5
+ import VideoFrame from "./components/VideoFrame";
6
+
7
+ @Options({
8
+ components: {
9
+ Controllor,
10
+ VideoFrame,
11
+ },
12
+ })
13
+
14
+ class App extends Vue {
15
+ constructor(props) {
16
+ super(props);
17
+ this.caption = null;
18
+ this.useTexture = ref(null);
19
+ this.videoTime = reactive({
20
+ currentTime: 0,
21
+ duration: 0,
22
+ })
23
+ this.objectFitTitle = ref(null);
24
+ this.playStatus = ref('');
25
+ provide('useTexture', this.useTexture)
26
+ provide('objectFit', ref(null))
27
+ provide('videoRect', ref({}))
28
+ provide('playVideo', ref(null))
29
+ provide('seekVideo', ref(null))
30
+ provide('enableAnimation', ref(null))
31
+ provide('videoTime', this.videoTime)
32
+ provide('objectFitTitle', this.objectFitTitle)
33
+ provide('playStatus', this.playStatus)
34
+ watch(this.useTexture, () => {
35
+ this.caption = (this.useTexture ? App.Caption.offscreenVideo : App.Caption.normalVideo);
36
+ });
37
+ }
38
+ }
39
+ App.Caption = {
40
+ offscreenVideo: "名称:OffscreenVideo(自动播放)\n"
41
+ + "功能描述:\n"
42
+ + "1.离屏视频播放、支持前进/后退控制\n"
43
+ + "2.支持圆角设置\n"
44
+ + "3.支持平移、缩放、旋转等动画\n"
45
+ + "4.支持ObjectFit调整\n",
46
+ normalVideo: "名称:Video\n"
47
+ + "功能描述:\n"
48
+ + "1.视频播放、支持前进/后退控制\n"
49
+ + "2.支持ObjectFit调整\n",
50
+ }
51
+
52
+ export default App;
53
+ </script>
54
+
55
+ <template>
56
+ <div
57
+ :style="{
58
+ top: 0, left: 0,
59
+ width: 1280, height: 720,
60
+ backgroundColor: 'rgb(222,211,140)'
61
+ }"
62
+ >
63
+ <!-- :key="useTexture" => 当useTexture属性变化时,重建VideoFrame -->
64
+ <VideoFrame
65
+ :key="useTexture"
66
+ />
67
+
68
+ <!-- :key="useTexture" => JsView bug,当useTexture属性变化时,为了保证显示在VideoFrame前面 -->
69
+ <div
70
+ class="caption"
71
+ :key="useTexture"
72
+ >
73
+ {{ caption }}
74
+ </div>
75
+ <div>
76
+ <div class="text status">
77
+ {{ '播放状态: ' + playStatus }}
78
+ </div>
79
+ <div class="text objectFit">
80
+ {{ objectFitTitle }}
81
+ </div>
82
+ <div class="text current">
83
+ {{ Math.ceil(videoTime.currentTime) }}
84
+ </div>
85
+ <div class="text duration">
86
+ {{ '/' + Math.ceil(videoTime.duration) }}
87
+ </div>
88
+ </div>
89
+ <Controllor class="controllor"/>
90
+ </div>
91
+ </template>
92
+
93
+ <style scoped>
94
+ .caption {
95
+ text-align: left;
96
+ font-size: 24px;
97
+ line-height: 30px;
98
+ color: #FFFFFF;
99
+ left: 10;
100
+ top: 10;
101
+ width: 400;
102
+ height: 180;
103
+ background-color: rgba(27,38,151,0.8);
104
+ }
105
+
106
+ .text {
107
+ color: #FF0000;
108
+ font-size: 24px;
109
+ top: 550;
110
+ width: 60;
111
+ height: 40;
112
+ }
113
+ .status {
114
+ left: 50;
115
+ width: 300;
116
+ }
117
+ .objectFit {
118
+ left: 800;
119
+ width: 200;
120
+ text-align: center;
121
+ }
122
+
123
+ .current {
124
+ left: 1060;
125
+ text-align: right;
126
+ }
127
+ .duration {
128
+ left: 1120;
129
+ text-align: left;
130
+ }
131
+
132
+ .controllor {
133
+ left: 40;
134
+ top: 600;
135
+ }
136
+
137
+ </style>
@@ -0,0 +1,69 @@
1
+ <script>
2
+ import { Options, Vue } from "vue-class-component";
3
+
4
+ @Options({
5
+ props: {
6
+ style: Object,
7
+ autoFocus: Boolean,
8
+ name: String,
9
+ onClick: Function,
10
+ }
11
+ })
12
+
13
+ class Button extends Vue {
14
+ constructor(props) {
15
+ super(props);
16
+
17
+ this.hasFocused = false;
18
+ }
19
+
20
+ onFocus() {
21
+ this.hasFocused = true;
22
+ }
23
+
24
+ onBlur() {
25
+ this.hasFocused = false;
26
+ }
27
+
28
+ onKeyDown(ev) {
29
+ if(ev.keyCode === 13) { // Enter
30
+ this.onClick?.();
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+ getAction() {
37
+ return {
38
+ onFocus: this.onFocus,
39
+ onBlur: this.onBlur,
40
+ onKeyDown: this.onKeyDown
41
+ }
42
+ }
43
+ }
44
+
45
+ export default Button;
46
+ </script>
47
+
48
+ <template>
49
+ <jsv-focus-block :name="name" :autoFocus="autoFocus?'':undefined"
50
+ :onAction="getAction()"
51
+ >
52
+ <div class="item"
53
+ :style="{
54
+ ...style,
55
+ backgroundColor: hasFocused ? '#FFFF00' : '#A8A8A8',
56
+ }"
57
+ >
58
+ <slot/>
59
+ </div>
60
+ </jsv-focus-block>
61
+ </template>
62
+
63
+ <style scoped>
64
+ .item {
65
+ text-align: center;
66
+ font-size: 24;
67
+ line-height: 40;
68
+ }
69
+ </style>
@@ -0,0 +1,195 @@
1
+ <script>
2
+ import { inject } from 'vue'
3
+ import { Options, Vue } from "vue-class-component";
4
+ import Button from "./Button.vue";
5
+
6
+ @Options({
7
+ props: {
8
+ style: { type: Object, default: {width:1400,height:50} },
9
+ },
10
+ components: {
11
+ Button,
12
+ },
13
+ })
14
+
15
+ class Controllor extends Vue {
16
+ constructor(props) {
17
+ super(props);
18
+ this.useTexture = inject('useTexture');
19
+ this.objectFit = inject('objectFit');
20
+ this.videoRect = inject('videoRect');
21
+ this.playVideo = inject('playVideo');
22
+ this.seekVideo = inject('seekVideo');
23
+ this.enableAnimation = inject('enableAnimation');
24
+ this.videoTime = inject('videoTime');
25
+ this.objectFitTitle = inject('objectFitTitle');
26
+
27
+ this.buttonList = this.getButtonList();
28
+
29
+ this.objectFitData = [
30
+ { name: "contain-horizontal", objectFit: "contain", width: 1200 },
31
+ { name: "contain-vertical", objectFit: "contain", width: 400 },
32
+ { name: "fill", objectFit: "fill", width: 1200 },
33
+ { name: "none-horizontal", objectFit: "none", width: 1200 },
34
+ { name: "none-vertical", objectFit: "none", width: 400 },
35
+ { name: "cover-horizontal", objectFit: "cover", width: 1200 },
36
+ { name: "cover-vertical", objectFit: "cover", width: 400 },
37
+ ];
38
+ this.objectFitIndex = 0;
39
+
40
+ this.focusedItemIndex = 0;
41
+ }
42
+
43
+ created() {
44
+ this.useTexture = true;
45
+ this.setObjectFit(0);
46
+ this.playVideo = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整;
47
+ this.enableAnimation = false;
48
+ }
49
+
50
+ onKeyDown(ev) {
51
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
52
+ if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
53
+ this.$router?.go(-1); // 有router时,回退
54
+ return true;
55
+ }
56
+
57
+ let changeFocusTo = -1;
58
+ const buttonCount = this.getButtonDataLength();
59
+ switch (ev.keyCode) {
60
+ case 37: // Left
61
+ changeFocusTo = (this.focusedItemIndex - 1 + buttonCount) % buttonCount;
62
+ break;
63
+ case 39: // Right
64
+ changeFocusTo = (this.focusedItemIndex + 1) % buttonCount;
65
+ break;
66
+ default:
67
+ break;
68
+ }
69
+ if (changeFocusTo >= 0) {
70
+ ev.ownerNode.findBlockByName((changeFocusTo+10).toString()).requestFocus();
71
+ this.focusedItemIndex = changeFocusTo;
72
+ return true;
73
+ }
74
+
75
+ return false;
76
+ }
77
+
78
+ getButtonList() {
79
+ const buttonList = [{
80
+ name: "ToVideoMode",
81
+ onClick: () => {
82
+ this.playVideo = null; // 停止并初始化播放
83
+ this.enableAnimation = false;
84
+ this.videoTime.currentTime = 0;
85
+ this.videoTime.duration = 0;
86
+ this.useTexture = !this.useTexture;
87
+ },
88
+ isModeButton: true,
89
+ }, {
90
+ name: "Play",
91
+ onClick: () => {
92
+ this.playVideo = !this.playVideo;
93
+ },
94
+ isPlayButton: true,
95
+ }, {
96
+ name: "Forward",
97
+ onClick: () => {
98
+ this.seekVideo = (this.seekVideo !== 5 ? 5 : 5.1/* 为了触发ref更新 */);
99
+ }
100
+ }, {
101
+ name: "Rewind",
102
+ onClick: () => {
103
+ this.seekVideo = (this.seekVideo !== -5 ? -5 : -5.1/* 为了触发ref更新 */);
104
+ }
105
+ }, {
106
+ name: "ObjectFit",
107
+ onClick: this.setObjectFit.bind(this)
108
+ }, {
109
+ name: "StartAnimation",
110
+ onClick: () => {
111
+ this.enableAnimation = !this.enableAnimation
112
+ },
113
+ isAnimationButton: true,
114
+ },
115
+ ];
116
+
117
+ return buttonList;
118
+ }
119
+
120
+ getButtonData() {
121
+ let length = this.buttonList.length;
122
+ if(!this.useTexture) { // 只有texture方式可以做animation
123
+ length -= 1;
124
+ }
125
+
126
+ let data = [];
127
+ for(let idx = 0; idx < length; idx++) {
128
+ const button = this.buttonList[idx];
129
+ data.push({
130
+ ...button,
131
+ size: {
132
+ width: 180,
133
+ height: 40,
134
+ }
135
+ });
136
+ }
137
+ return data;
138
+ }
139
+
140
+ getButtonDataLength() {
141
+ let length = this.buttonList.length;
142
+ if(!this.useTexture) { // 只有texture方式可以做animation
143
+ length -= 1;
144
+ }
145
+
146
+ return length;
147
+ }
148
+
149
+ setObjectFit(index) {
150
+ if(typeof index === 'number') {
151
+ this.objectFitIndex = index;
152
+ } else {
153
+ this.objectFitIndex = (++this.objectFitIndex % this.objectFitData.length);
154
+ }
155
+ const data = this.objectFitData[this.objectFitIndex];
156
+ this.objectFit = data.objectFit;
157
+ this.objectFitTitle = data.name;
158
+ this.videoRect = {
159
+ left: (1280 - data.width) / 2, top: 50,
160
+ width: data.width, height: 500,
161
+ }
162
+ }
163
+
164
+ getShowName(item) {
165
+ if(item.isModeButton) {
166
+ return this.useTexture ? "ToVideoMode" : "ToOffscreenMode";
167
+ } else if(item.isPlayButton) {
168
+ return this.playVideo ? 'Pause' : 'Play'
169
+ } else if(item.isAnimationButton) {
170
+ return this.enableAnimation ? "StopAnimation" : "StartAnimation";
171
+ }
172
+ return item.name;
173
+ }
174
+ }
175
+
176
+ export default Controllor;
177
+ </script>
178
+
179
+ <template>
180
+ <div :style="style" :key="useTexture" :set="leftOffset=0">
181
+ <jsv-focus-block :namespace="controllor" :onKeyDown="onKeyDown">
182
+ <Button v-for="(item,index) in getButtonData()" :key="index" :set="leftOffset+=(item.size.width+10)"
183
+ :style="{ left: leftOffset-item.size.width, width:item.size.width, height:item.size.height }"
184
+ :autoFocus="index === 0"
185
+ :name="(index+10).toString()"
186
+ :onClick="item.onClick"
187
+ >
188
+ {{ getShowName(item) }}
189
+ </Button>
190
+ </jsv-focus-block>
191
+ </div>
192
+ </template>
193
+
194
+ <style scoped>
195
+ </style>
@@ -0,0 +1,152 @@
1
+ <script>
2
+ import { inject, watch } from 'vue'
3
+ import { Options, Vue } from "vue-class-component";
4
+ import JsvVideo from "jsview/utils/JsViewVueWidget/JsvVideo.vue"
5
+
6
+ @Options({
7
+ components: {
8
+ JsvVideo
9
+ }
10
+ })
11
+
12
+ class VideoFrame extends Vue {
13
+ constructor(props) {
14
+ super(props);
15
+ this.useTexture = inject('useTexture');
16
+ this.objectFit = inject('objectFit');
17
+ this.videoRect = inject('videoRect');
18
+ this.playVideo = inject('playVideo');
19
+ this.seekVideo = inject('seekVideo');
20
+ this.enableAnimation = inject('enableAnimation');
21
+ this.videoTime = inject('videoTime');
22
+ this.playStatus = inject('playStatus')
23
+ watch(this.playVideo, this.setPlayState.bind(this));
24
+ watch(this.seekVideo, this.seekVideoStep.bind(this));
25
+
26
+ this.videoUrl = "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
27
+ this.canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
28
+
29
+ this.video = null;
30
+
31
+ this.rect = {
32
+ top: 50, left: 40,
33
+ width: 1200, height: 500,
34
+ }
35
+
36
+ this.textureAnim = null;
37
+ }
38
+
39
+ mounted() {
40
+ if(this.canAutoPlay) {
41
+ this.playVideo = true;
42
+ }
43
+ }
44
+
45
+ onVideoRef(ele) {
46
+ this.video = ele;
47
+ }
48
+
49
+ setPlayState(play) {
50
+ if(play) {
51
+ this.video?.play();
52
+ } else {
53
+ this.video?.pause();
54
+ }
55
+ }
56
+
57
+ seekVideoStep(time) {
58
+ if(this.video) {
59
+ let playEnd = false;
60
+ let seekTime = this.video.currentTime + Math.ceil(time);
61
+ if(seekTime < 0) {
62
+ seekTime = 0;
63
+ } else if(seekTime > this.videoTime.duration) {
64
+ seekTime = this.videoTime.duration;
65
+ if(this.video.currentTime != this.videoTime.duration) { // 触发一次播放,收到ended事件
66
+ playEnd = true;
67
+ }
68
+ }
69
+ this.video.currentTime = seekTime;
70
+ if(playEnd) {
71
+ this.setPlayState(true);
72
+ }
73
+ }
74
+ }
75
+
76
+ onPlayStateChange(event) {
77
+ console.log("VideoFrame.onPlayStateChangeEvent()", event);
78
+ this.playVideo = (event.type === 'play' ? true : false);
79
+ if(!(this.playStatus == 'ended' && event.type == 'pause')) { // 忽略播放结束后的pause事件
80
+ this.playStatus = event.type;
81
+ }
82
+ }
83
+
84
+ onTimeUpdate(event) {
85
+ console.log("VideoFrame.onTimeUpdateEvent()", event);
86
+ this.videoTime.currentTime = this.video.currentTime;
87
+ }
88
+
89
+ onDurationChange(event) {
90
+ console.log("VideoFrame.onDurationChangeEvent()", event);
91
+ this.videoTime.duration = this.video.duration;
92
+ }
93
+
94
+ onEvent(event) {
95
+ console.log("VideoFrame.onEvent()", event);
96
+ }
97
+ }
98
+
99
+ export default VideoFrame;
100
+ </script>
101
+
102
+ <template>
103
+ <div>
104
+ <div
105
+ :style="{
106
+ ...videoRect,
107
+ backgroundColor: 'rgb(200,100,100)'
108
+ }"
109
+ />
110
+ <JsvVideo
111
+ :onRef="onVideoRef"
112
+ :useTexture="useTexture"
113
+ :src="videoUrl"
114
+ :autoplay="canAutoPlay ? 'autoplay' : undefined"
115
+ :style="{
116
+ ...videoRect,
117
+ objectFit: objectFit,
118
+ animation: (useTexture&&enableAnimation ? 'offscreenAnim 3s infinite' : null),
119
+ borderRadius: '80px 80px 160px 240px',
120
+ }"
121
+ :onCanPlay="onEvent"
122
+ :onCanPlayThrough="onEvent"
123
+ :onDurationChange="onDurationChange"
124
+ :onEnded="onPlayStateChange"
125
+ :onError="onPlayStateChange"
126
+ :onLoad="onEvent"
127
+ :onLoadedMetadata="onEvent"
128
+ :onLoadStart="onEvent"
129
+ :onPause="onPlayStateChange"
130
+ :onPlay="onPlayStateChange"
131
+ :onPlaying="onEvent"
132
+ :onProgress="onEvent"
133
+ :onSeeking="onEvent"
134
+ :onSeeked="onTimeUpdate"
135
+ :onStalled="onEvent"
136
+ :onTimeUpdate="onTimeUpdate"
137
+ />
138
+ </div>
139
+ </template>
140
+
141
+ <style scoped>
142
+ @keyframes offscreenAnim {
143
+ from {
144
+ transform:scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
145
+ transform-origin: center center;
146
+ }
147
+ to {
148
+ transform:scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
149
+ transform-origin: center center;
150
+ }
151
+ }
152
+ </style>