ynkszx-applet-study-player 1.0.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 (62) hide show
  1. package/README.md +275 -0
  2. package/package.json +19 -0
  3. package/src/api/auth.js +102 -0
  4. package/src/api/player.js +27 -0
  5. package/src/api/upload.js +28 -0
  6. package/src/components/jjb-auth/code-comp/code-comp.js +83 -0
  7. package/src/components/jjb-auth/code-comp/code-comp.json +8 -0
  8. package/src/components/jjb-auth/code-comp/code-comp.wxml +33 -0
  9. package/src/components/jjb-auth/code-comp/code-comp.wxss +19 -0
  10. package/src/components/jjb-auth/face-comp/face-comp.js +125 -0
  11. package/src/components/jjb-auth/face-comp/face-comp.json +4 -0
  12. package/src/components/jjb-auth/face-comp/face-comp.wxml +39 -0
  13. package/src/components/jjb-auth/face-comp/face-comp.wxss +39 -0
  14. package/src/components/jjb-auth/face-conf/face-conf.js +36 -0
  15. package/src/components/jjb-auth/face-conf/face-conf.json +4 -0
  16. package/src/components/jjb-auth/face-conf/face-conf.wxml +17 -0
  17. package/src/components/jjb-auth/face-conf/face-conf.wxss +26 -0
  18. package/src/components/jjb-auth/jjb-auth.js +200 -0
  19. package/src/components/jjb-auth/jjb-auth.json +11 -0
  20. package/src/components/jjb-auth/jjb-auth.wxml +44 -0
  21. package/src/components/jjb-auth/living-comp/living-comp.js +221 -0
  22. package/src/components/jjb-auth/living-comp/living-comp.json +4 -0
  23. package/src/components/jjb-auth/living-comp/living-comp.wxml +44 -0
  24. package/src/components/jjb-auth/living-comp/living-comp.wxss +48 -0
  25. package/src/components/jjb-auth/msg-comp/msg-comp.js +27 -0
  26. package/src/components/jjb-auth/msg-comp/msg-comp.json +8 -0
  27. package/src/components/jjb-auth/msg-comp/msg-comp.wxml +16 -0
  28. package/src/components/jjb-auth/msg-comp/msg-comp.wxss +17 -0
  29. package/src/components/jjb-auth/qa-auth.wxss +9 -0
  30. package/src/components/jjb-auth/tip-comp/tip-comp.js +38 -0
  31. package/src/components/jjb-auth/tip-comp/tip-comp.json +4 -0
  32. package/src/components/jjb-auth/tip-comp/tip-comp.wxml +20 -0
  33. package/src/components/jjb-auth/tip-comp/tip-comp.wxss +25 -0
  34. package/src/components/jjb-player/jjb-player.js +73 -0
  35. package/src/components/jjb-player/jjb-player.json +7 -0
  36. package/src/components/jjb-player/jjb-player.wxml +19 -0
  37. package/src/components/jjb-player/jjb-player.wxss +1 -0
  38. package/src/components/jjb-player/video-comp/time.wxs +11 -0
  39. package/src/components/jjb-player/video-comp/video-comp.js +250 -0
  40. package/src/components/jjb-player/video-comp/video-comp.json +4 -0
  41. package/src/components/jjb-player/video-comp/video-comp.wxml +52 -0
  42. package/src/components/jjb-player/video-comp/video-comp.wxss +35 -0
  43. package/src/components/jjb-verify/verify-idcard/verify-idcard.js +47 -0
  44. package/src/components/jjb-verify/verify-idcard/verify-idcard.json +4 -0
  45. package/src/components/jjb-verify/verify-idcard/verify-idcard.wxml +3 -0
  46. package/src/components/jjb-verify/verify-idcard/verify-idcard.wxss +2 -0
  47. package/src/components/jjb-verify/verify-move/verify-move.js +44 -0
  48. package/src/components/jjb-verify/verify-move/verify-move.json +4 -0
  49. package/src/components/jjb-verify/verify-move/verify-move.wxml +3 -0
  50. package/src/components/jjb-verify/verify-move/verify-move.wxss +9 -0
  51. package/src/components/jjb-verify/verify-number/verify-number.js +60 -0
  52. package/src/components/jjb-verify/verify-number/verify-number.json +4 -0
  53. package/src/components/jjb-verify/verify-number/verify-number.wxml +9 -0
  54. package/src/components/jjb-verify/verify-number/verify-number.wxss +2 -0
  55. package/src/lib/crypto.js +55 -0
  56. package/src/style/common.wxss +113 -0
  57. package/src/utils/crypto.js +43 -0
  58. package/src/utils/http/config/index.js +7 -0
  59. package/src/utils/http/index.js +173 -0
  60. package/src/utils/oss/config/index.js +5 -0
  61. package/src/utils/oss/index.js +6 -0
  62. package/src/utils/storage.js +22 -0
@@ -0,0 +1,221 @@
1
+ // plugin/components/jjb-auth/face/face-comp.js
2
+ import { upload } from '../../../api/upload'
3
+ import { checkLiving } from '../../../api/auth'
4
+ import { oss } from '../../../utils/oss/index'
5
+
6
+ const defaultD = {
7
+ loading: false,
8
+ error: {},
9
+ faceType: 0,
10
+ isFlag: false, // 是否录像失败
11
+ status: 0,
12
+ result: {},
13
+ }
14
+
15
+ Component({
16
+ /**
17
+ * 组件的属性列表
18
+ */
19
+ properties: {
20
+ seconds: {
21
+ type: Number,
22
+ value: null,
23
+ observer(value) {
24
+ const { status } = this.data
25
+ if (value === 0 && status === 0) this.setData({ status: 2 })
26
+ }
27
+ },
28
+ validateId: {
29
+ type: String,
30
+ value: '',
31
+ observer() {
32
+ this.setData({ ...defaultD })
33
+ this.resetDraw()
34
+ }
35
+ },
36
+ },
37
+ /**
38
+ * 组件的初始数据
39
+ */
40
+ data: {
41
+ conf: [
42
+ { text: '识别中', color: 'primary' },
43
+ { text: '验证成功', ico: oss('cg', 'sdk/face'), color: 'green' },
44
+ { text: '验证超时', ico: oss('cs', 'sdk/face'), color: 'orange' },
45
+ { text: '验证失败', ico: oss('cw', 'sdk/face'), color: 'red' },
46
+ ],
47
+ tips: [
48
+ { text: '光线充足', ico: oss('gxcz', 'sdk/face') },
49
+ { text: '正对手机', ico: oss('zdsj', 'sdk/face') },
50
+ { text: '脸无遮挡', ico: oss('lwzd', 'sdk/face') }
51
+ ],
52
+ faceArr: [
53
+ '左右缓慢摇头',
54
+ '眨眨眼',
55
+ '上下缓慢点头',
56
+ '张张嘴',
57
+ ],
58
+ ...defaultD,
59
+ },
60
+
61
+ ready() {
62
+ console.log('LIVINGBODY=>', 'ready')
63
+ this.cameraCtx = wx.createCameraContext('jjb-camera', this)
64
+ this.onCanvas()
65
+ },
66
+
67
+ /**
68
+ * 组件的方法列表
69
+ */
70
+ methods: {
71
+ onStart() {
72
+ this.resetDraw()
73
+ this.setData({ loading: true, faceType: Math.floor(Math.random() * 4) })
74
+ this.cameraCtx.startRecord({
75
+ success: () => this.onDraw(),
76
+ fail: () => {
77
+ this.setData({ isFlag: true, loading: false })
78
+ this.checkCamera()
79
+ },
80
+ })
81
+ },
82
+ onStop() {
83
+ this.cameraCtx.stopRecord({
84
+ success: ({ tempVideoPath }) => {
85
+ this.setData({ isFlag: false })
86
+ this.onUpload(tempVideoPath)
87
+ },
88
+ fail: () => {
89
+ this.setData({ isFlag: true, loading: false })
90
+ wx.showToast({
91
+ title: '录像失败,请点击按钮重新开始',
92
+ icon: 'none'
93
+ })
94
+ },
95
+ })
96
+ },
97
+ async onUpload(url) {
98
+ try {
99
+ const data = await upload(url)
100
+ this.onCheck(data)
101
+ } catch (e) {
102
+ this.resetDraw()
103
+ this.setData({ isFlag: true, loading: false })
104
+ }
105
+ },
106
+ async onCheck(videoUrl) {
107
+ const { validateId } = this.data
108
+ try {
109
+ const data = await checkLiving({ validateId, videoUrl })
110
+ const result = { verifySuccess: data.verifySuccess === 1 ? 1 : 0 }
111
+ this.setData({
112
+ status: data.verifySuccess === 1 ? 1 : 3,
113
+ result
114
+ })
115
+ this.triggerEvent('check', result)
116
+ } catch (e) {
117
+ this.triggerEvent('check', { verifySuccess: 0 })
118
+ this.setData({ loading: false, status: 3 })
119
+ }
120
+ },
121
+ onRefresh() {
122
+ const { result } = this.data
123
+ this.triggerEvent('refresh', result)
124
+ },
125
+ onCanvas() {
126
+ this.angel = 0;
127
+ wx.createSelectorQuery()
128
+ .in(this)
129
+ .select('#canvas')
130
+ .fields({
131
+ node: true,
132
+ size: true
133
+ })
134
+ .exec((res) => {
135
+ this.canvas = res[0].node;
136
+ this.ctx = this.canvas.getContext('2d');
137
+ const width = res[0].width;
138
+ const height = res[0].height;
139
+ const dpr = wx.getWindowInfo().pixelRatio;
140
+ this.canvas.width = width * dpr;
141
+ this.canvas.height = height * dpr;
142
+ this.ctx.scale(dpr, dpr);
143
+ this.xy = width / 2;
144
+ this.radius = this.xy - dpr;
145
+ this.resetDraw()
146
+ })
147
+ },
148
+ onDraw() {
149
+ const { ctx, requestId, canvas, angel, xy, radius } = this
150
+ if (angel >= 361) {
151
+ canvas.cancelAnimationFrame(requestId)
152
+ this.onStop()
153
+ return
154
+ }
155
+ ctx.strokeStyle = '#2563eb';
156
+ ctx.lineWidth = 3;
157
+ ctx.beginPath();
158
+ ctx.arc(xy, xy, radius, 0, (Math.PI / 180) * angel, false);
159
+ ctx.stroke();
160
+ this.angel = angel + 1.2;
161
+ this.requestId = canvas.requestAnimationFrame(this.onDraw.bind(this))
162
+ },
163
+ resetDraw() {
164
+ const { ctx, canvas, xy, radius } = this;
165
+ if (!ctx) return
166
+ this.angel = 0;
167
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
168
+ ctx.strokeStyle = '#ccc';
169
+ ctx.lineWidth = 3;
170
+ ctx.beginPath();
171
+ ctx.arc(xy, xy, radius, 0, (Math.PI / 180) * 360, false);
172
+ ctx.stroke();
173
+ },
174
+ checkCamera() {
175
+ wx.getSetting({
176
+ success: (res) => {
177
+ if (!res.authSetting['scope.record']) {
178
+ this.setData(
179
+ { error: { type: 2, msg: '录音权限', scope: 'scope.record' } },
180
+ () => this.onError()
181
+ )
182
+ }
183
+ }
184
+ })
185
+ },
186
+ onError() {
187
+ const { error } = this.data
188
+ !error.type
189
+ ? this.setData(
190
+ { error: { type: 1, msg: '摄像头权限', scope: 'scope.camera' } },
191
+ () => this.onSetting()
192
+ )
193
+ : this.onSetting()
194
+ },
195
+ onSetting() {
196
+ const { error } = this.data
197
+ wx.showModal({
198
+ title: '温馨提示',
199
+ content: '您拒绝了' + error.msg,
200
+ showCancel: true,
201
+ confirmText: '去授权',
202
+ success: ({ confirm }) => {
203
+ if (confirm) {
204
+ wx.openSetting({
205
+ success: res => {
206
+ if (res.authSetting[error.scope]) {
207
+ this.setData({ error: {} })
208
+ } else {
209
+ this.onError()
210
+ }
211
+ },
212
+ fail: err => {
213
+ // 出错
214
+ }
215
+ })
216
+ }
217
+ }
218
+ })
219
+ }
220
+ }
221
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,44 @@
1
+ <!--plugin/components/jjb-auth/face/face-comp.wxml-->
2
+ <scroll-view scroll-y style="height: 100vh">
3
+ <view class="jjb-face-page jjb-flex-col">
4
+ <view class="jjb-text-weight-b jjb-text-size-2xl">
5
+ 拿起手机,{{faceArr[faceType]}}
6
+ </view>
7
+ <view style="height: 800rpx">
8
+ <view class="jjb-camera-box jjb-flex-col">
9
+ <camera
10
+ wx:if="{{error.type !== 1}}"
11
+ id="jjb-camera"
12
+ class="jjb-camera"
13
+ mode="normal"
14
+ device-position="front"
15
+ flash="auto"
16
+ resolution="medium"
17
+ binderror="onError"
18
+ />
19
+ <canvas type="2d" class="canvas" id="canvas"></canvas>
20
+ </view>
21
+ <view class="jjb-text-{{conf[status].color}} jjb-text-size-2xl">
22
+ <image wx:if="{{conf[status].ico}}" src="{{conf[status].ico}}" style="width: 44rpx;height: 44rpx; margin-right: 16rpx" />
23
+ <view>{{conf[status].text}}</view>
24
+ </view>
25
+ <view wx:if="{{status === 0}}" class="jjb-tip jjb-text-size-m jjb-text-grey">
26
+ 请在<text class="jjb-text-red">{{seconds}}</text>秒内完成验证,验证通过后可继续观看
27
+ </view>
28
+ <view wx:elif="{{status === 1}}" class="jjb-tip jjb-text-size-m jjb-text-grey">
29
+ 马上关闭验证,开始学习
30
+ </view>
31
+ <button wx:if="{{error.type}}" class="jjb-btn" bindtap="onError">
32
+ 获取{{error.msg}}
33
+ </button>
34
+ <button wx:elif="{{status === 0}}" class="jjb-btn" loading="{{loading}}" bindtap="onStart">开始验证</button>
35
+ <button wx:elif="{{status > 1}}" class="jjb-btn" bindtap="onRefresh">重新验证</button>
36
+ </view>
37
+ <view class="jjb-tips jjb-flex-center-between jjb-text-size-m jjb-text-grey">
38
+ <view wx:for="{{tips}}" wx:key="text">
39
+ <image src="{{item.ico}}" style="width: 52rpx;height: 52rpx" />
40
+ <view style="margin-top: 18rpx">{{ item.text }}</view>
41
+ </view>
42
+ </view>
43
+ </view>
44
+ </scroll-view>
@@ -0,0 +1,48 @@
1
+ /* plugin/components/jjb-auth/face/face-comp.wxss */
2
+ @import "../../../style/common.wxss";
3
+
4
+ .jjb-face-page {
5
+ background-color: #fff;
6
+ width: 100vw;
7
+ min-height: 100vh;
8
+ text-align: center;
9
+ flex-direction: column;
10
+ }
11
+
12
+ .jjb-camera-box {
13
+ width: 428rpx;
14
+ height: 428rpx;
15
+ margin: 60rpx auto 40rpx;
16
+ flex-direction: column;
17
+ position: relative;
18
+ }
19
+
20
+ .canvas {
21
+ width: 428rpx;
22
+ height: 428rpx;
23
+ position: absolute;
24
+ left: 0px;
25
+ top: 0px;
26
+ }
27
+
28
+ .jjb-camera {
29
+ width: 400rpx;
30
+ height: 400rpx;
31
+ border-radius: 200rpx;
32
+ }
33
+
34
+ .jjb-tip {
35
+ margin-top: 24rpx;
36
+ }
37
+
38
+ .jjb-btn {
39
+ width: 590rpx;
40
+ margin-top: 50rpx;
41
+ }
42
+
43
+ .jjb-tips {
44
+ width: 506rpx;
45
+ padding-top: 84rpx;
46
+ margin: 28rpx auto 0px;
47
+ border-top: 1px solid #eee;
48
+ }
@@ -0,0 +1,27 @@
1
+ // plugin/components/jjb-auth/msg-comp/msg-comp.js
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ msg: {
8
+ type: String,
9
+ value: ''
10
+ }
11
+ },
12
+
13
+ /**
14
+ * 组件的初始数据
15
+ */
16
+ data: {
17
+ },
18
+
19
+ /**
20
+ * 组件的方法列表
21
+ */
22
+ methods: {
23
+ onConfirm() {
24
+ this.triggerEvent('confirm')
25
+ }
26
+ }
27
+ })
@@ -0,0 +1,8 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "verify-move": "../../jjb-verify/verify-move/verify-move",
5
+ "verify-number": "../../jjb-verify/verify-number/verify-number",
6
+ "verify-idcard": "../../jjb-verify/verify-idcard/verify-idcard"
7
+ }
8
+ }
@@ -0,0 +1,16 @@
1
+ <!--plugin/components/jjb-auth/code/code-comp.wxml-->
2
+ <view class="jjb-modal">
3
+ <view class="jjb-modal-content">
4
+ <view class="jjb-text-size-lg jjb-text-weight-b jjb-text-align-center">
5
+ 温馨提示
6
+ </view>
7
+ <scroll-view
8
+ scroll-y
9
+ class="jjb-tip jjb-text-darken-2 jjb-text-size-n {{msg.length < 17 ? 'jjb-text-align-center' : ''}}"
10
+ style="max-height: 58vh"
11
+ >
12
+ <view class="jjb-box"><rich-text nodes="{{msg}}"></rich-text></view>
13
+ </scroll-view>
14
+ <view class="jjb-box" style="margin-top: 12rpx"><button class="jjb-btn" bindtap="onConfirm">重试</button></view>
15
+ </view>
16
+ </view>
@@ -0,0 +1,17 @@
1
+ /* plugin/components/jjb-auth/code/code-comp.wxss */
2
+ @import "../../../style/common.wxss";
3
+
4
+ .jjb-modal-content {
5
+ padding-left: 0px;
6
+ padding-right: 0px;
7
+ }
8
+
9
+ .jjb-box {
10
+ padding-left: 28rpx;
11
+ padding-right: 28rpx;
12
+ }
13
+
14
+ .jjb-tip {
15
+ margin: 28rpx 0px 48rpx;
16
+ line-height: 48rpx;
17
+ }
@@ -0,0 +1,9 @@
1
+ /* plugin/components/jjb-auth/jjb-auth.wxss */
2
+ @import "../../style/common.wxss";
3
+
4
+ #auth {
5
+ width: 100%;
6
+ height: 100%;
7
+ position: fixed;
8
+ z-index: 999;
9
+ }
@@ -0,0 +1,38 @@
1
+ // plugin/components/jjb-auth/msg-comp/msg-comp.js
2
+ import { oss } from '../../../utils/oss/index'
3
+
4
+ Component({
5
+ /**
6
+ * 组件的初始数据
7
+ */
8
+ data: {
9
+ ico: {
10
+ safe: oss('safe', 'sdk/face')
11
+ },
12
+ hide: true,
13
+ content: `
14
+ 点播课程学习开通了学时监管,为了保证你的学时有效,请注意:<br/>
15
+ 1. 如在电脑进行学习,推荐使用谷歌浏览器、Edge浏览器;<br/>
16
+ 2. 视频播放过程中会出现随机验证,请务必按要求完成验证;<br/>
17
+ 3. 学习过程中禁止使用小窗模式、快进、倍速等插件播放视频;<br/>
18
+ 4. 请勿同时在多设备、多窗口观看学习视频;<br/>
19
+ 5. 请勿采用非法手段刷视频,一经发现,将清空学时并拉入黑名单;<br/>
20
+ 6.进入黑名单人员处理规则如下:本人携带身份证原件及复印件、解除黑名单情况说明、学员证书复印件等证明材料至滇池路1177号一楼政务服务大厅窗口(以上材料需本人带到现场,原则上不接收委托),由建设注册考试中心接件并审核材料,审核通过后完成学时清零处理并解除黑名单;<br/>
21
+ 由以上原因造成的学时无效,无法正常获取证书的,自行承担相关责任,如有疑问请联系客服。
22
+ `
23
+ },
24
+
25
+ /**
26
+ * 组件的方法列表
27
+ */
28
+ methods: {
29
+ onConfirm() {
30
+ const { hide } = this.data
31
+ this.triggerEvent('confirm', hide)
32
+ },
33
+ toggleHide() {
34
+ const { hide } = this.data
35
+ this.setData({ hide: !hide })
36
+ }
37
+ }
38
+ })
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,20 @@
1
+ <!--plugin/components/jjb-auth/code/code-comp.wxml-->
2
+ <view class="jjb-modal">
3
+ <view class="jjb-modal-content">
4
+ <image class="jjb-ico" src="{{ico.safe}}" />
5
+ <view class="jjb-text-size-lg jjb-text-weight-b jjb-text-align-center">
6
+ 重要说明
7
+ </view>
8
+ <scroll-view
9
+ scroll-y
10
+ class="jjb-tip jjb-text-darken-2 jjb-text-size-m"
11
+ style="max-height: 58vh"
12
+ >
13
+ <view style="padding: 0px 28rpx 20rpx"><rich-text nodes="{{content}}"></rich-text></view>
14
+ </scroll-view>
15
+ <button class="jjb-btn" bindtap="onConfirm">我已知晓</button>
16
+ <label class="jjb-text-size-m jjb-flex" bindtap="toggleHide" style="margin-top: 24rpx">
17
+ <radio value="r1" color="#2563EB" checked="{{hide}}"/> 不再提示
18
+ </label>
19
+ </view>
20
+ </view>
@@ -0,0 +1,25 @@
1
+ /* plugin/components/jjb-auth/code/code-comp.wxss */
2
+ @import "../../../style/common.wxss";
3
+
4
+ .jjb-tip {
5
+ margin: 28rpx 0px 48rpx;
6
+ line-height: 44rpx;
7
+ }
8
+
9
+ .jjb-ico {
10
+ width: 80rpx;
11
+ height: 80rpx;
12
+ position: absolute;
13
+ right: 12rpx;
14
+ top: 12rpx;
15
+ }
16
+
17
+ .jjb-modal-content {
18
+ width: 90vw;
19
+ padding: 28rpx 0px;
20
+ background-image: linear-gradient(to bottom, #E6EEFF, #FFFFFF);
21
+ }
22
+
23
+ .jjb-btn {
24
+ margin: 0px 28rpx;
25
+ }
@@ -0,0 +1,73 @@
1
+ // plugin/components/jjb-player/jjb-player.js
2
+ const { storage } = require("../../utils/storage");
3
+
4
+ Component({
5
+ /**
6
+ * 组件的属性列表
7
+ */
8
+ properties: {
9
+ baseUrl: {
10
+ type: String,
11
+ value: "",
12
+ },
13
+ appId: {
14
+ type: String,
15
+ value: "",
16
+ },
17
+ videoSty: {
18
+ // 播放相关
19
+ type: String,
20
+ value: "width: 100%; height: 420rpx", // video样式,
21
+ },
22
+ options: {
23
+ type: Object,
24
+ value: {},
25
+ },
26
+ },
27
+ observers: {
28
+ baseUrl: function (value) {
29
+ this.onInit(value, 2);
30
+ },
31
+ appId: function (value) {
32
+ this.onInit(value, 3);
33
+ },
34
+ },
35
+ /**
36
+ * 组件的初始数据
37
+ */
38
+ data: {
39
+ video: {},
40
+ error: {
41
+ msg: "",
42
+ tag: null, // 1为视频播放错误
43
+ }, // 视频播放错误信息
44
+ },
45
+ ready() {
46
+ this.video = this.selectComponent("#jjb-video");
47
+ this.auth = this.selectComponent("#jjb-auth");
48
+ },
49
+ /**
50
+ * 组件的方法列表
51
+ */
52
+ methods: {
53
+ onInit(value, type) {
54
+ storage.set(type, value);
55
+ },
56
+ onPlay({ detail }) {
57
+ this.video?.start(detail);
58
+ },
59
+ onAuth({ detail }) {
60
+ this.auth?.auth(detail);
61
+ },
62
+ onError({ detail }) {
63
+ this.setData({ error: detail });
64
+ },
65
+ // 视频播放出错,点击确定通知客户端刷新视频地址
66
+ onVideoErr() {
67
+ this.triggerEvent("error");
68
+ },
69
+ onEnd() {
70
+ this.triggerEvent("end");
71
+ },
72
+ },
73
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "jjb-auth": "../jjb-auth/jjb-auth",
5
+ "jjb-video": "./video-comp/video-comp"
6
+ }
7
+ }
@@ -0,0 +1,19 @@
1
+ <!--plugin/components/jjb-player/jjb-player.wxml-->
2
+ <jjb-video
3
+ id="jjb-video"
4
+ code="{{options.sectionCode + ''}}"
5
+ title="{{options.sectionName}}"
6
+ duration="{{options.duration}}"
7
+ poster="{{options.poster}}"
8
+ url="{{options.url}}"
9
+ bind:auth="onAuth"
10
+ bind:error="onError"
11
+ bind:end="onEnd"
12
+ />
13
+ <jjb-auth
14
+ id="jjb-auth"
15
+ err="{{error}}"
16
+ options="{{options}}"
17
+ bind:complete="onPlay"
18
+ bind:error="onVideoErr"
19
+ ></jjb-auth>
@@ -0,0 +1 @@
1
+ /* plugin/components/jjb-player/jjb-player.wxss */
@@ -0,0 +1,11 @@
1
+ var formatN = function (num) {
2
+ num = Math.floor(num)
3
+ return num < 10 ? '0' + num : num
4
+ }
5
+ var format = function (time) {
6
+ var m = formatN(time / 60)
7
+ var s = formatN(time % 60)
8
+ return m + ':' + s
9
+ }
10
+
11
+ module.exports.format = format