@quicktvui/tv-ad-unlock 1.0.3 → 1.0.4
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/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +5 -6
- package/src/TVAdUnlockView.vue +1 -1
- package/src/TVAdUnlock.vue +0 -218
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ESRouteType } from '@extscreen/es3-router';
|
|
2
|
-
import TVAdUnlockView from '
|
|
2
|
+
import TVAdUnlockView from '../src/TVAdUnlockView.vue';
|
|
3
3
|
export const TV_AD_UNLOCK_KEY = Symbol('tvAdUnlock');
|
|
4
4
|
const DEFAULT_PAGE_CONFIG = {
|
|
5
5
|
title: '观看30秒广告 当日解锁',
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAMnD,OAAO,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAMnD,OAAO,cAAc,MAAM,2BAA2B,CAAA;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAA2C,MAAM,CAAC,YAAY,CAAC,CAAA;AAE5F,MAAM,mBAAmB,GAAmC;IAC1D,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,YAAY;IACzB,SAAS,EAAE,gBAAgB;IAC3B,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;CACrB,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,CAAC,GAAQ,EAAE,OAAgC;QAChD,MAAM,UAAU,GAAmC;YACjD,GAAG,mBAAmB;YACtB,GAAG,OAAO,CAAC,UAAU;SACtB,CAAA;QAED,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC5B,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,WAAW,CAAC,oBAAoB;KACvC,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicktvui/tv-ad-unlock",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "TV广告解锁组件 - 用于QuickTVUI框架的电视端广告解锁功能",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"src/TVAdUnlock.vue",
|
|
10
9
|
"src/TVAdUnlockView.vue",
|
|
11
10
|
"src/assets"
|
|
12
11
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc"
|
|
15
|
-
},
|
|
16
12
|
"keywords": [
|
|
17
13
|
"quicktvui",
|
|
18
14
|
"tv",
|
|
@@ -34,5 +30,8 @@
|
|
|
34
30
|
"repository": {
|
|
35
31
|
"type": "git",
|
|
36
32
|
"url": ""
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc"
|
|
37
36
|
}
|
|
38
|
-
}
|
|
37
|
+
}
|
package/src/TVAdUnlockView.vue
CHANGED
package/src/TVAdUnlock.vue
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ad-container">
|
|
3
|
-
<div class="content">
|
|
4
|
-
<div class="content-bg" />
|
|
5
|
-
<span class="title">{{ title }}</span>
|
|
6
|
-
<span class="sub-title">{{ subTitle }}</span>
|
|
7
|
-
<div class="qrcode-container">
|
|
8
|
-
<qt-qr-code
|
|
9
|
-
v-if="adQrCode && !isInvalid && qrCodeState !== 1"
|
|
10
|
-
class="qrcode"
|
|
11
|
-
:content="adQrCode"
|
|
12
|
-
/>
|
|
13
|
-
<img
|
|
14
|
-
v-if="isInvalid"
|
|
15
|
-
class="invalid-code"
|
|
16
|
-
:src="invalidCodeImage"
|
|
17
|
-
/>
|
|
18
|
-
<img
|
|
19
|
-
v-if="qrCodeState === 1"
|
|
20
|
-
class="invalid-code"
|
|
21
|
-
:src="scannedCodeImage"
|
|
22
|
-
>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup lang="ts">
|
|
29
|
-
import { ref, computed } from 'vue'
|
|
30
|
-
import { ESKeyCode, useESRuntime, useESToast, useESLocalStorage } from '@extscreen/es3-core'
|
|
31
|
-
import { useESRouter } from '@extscreen/es3-router'
|
|
32
|
-
import { useTVAdUnlock, useTVAdUnlockStorage } from './useTVAdUnlock'
|
|
33
|
-
import type { TVAdUnlockConfig, TVAdUnlockParams, TVAdUnlockStorageKeys, RequestManager } from './types'
|
|
34
|
-
|
|
35
|
-
interface Props {
|
|
36
|
-
config: TVAdUnlockConfig
|
|
37
|
-
storageKeys: TVAdUnlockStorageKeys
|
|
38
|
-
requestManager: RequestManager
|
|
39
|
-
title?: string
|
|
40
|
-
subTitle?: string
|
|
41
|
-
invalidCodeImage?: string
|
|
42
|
-
scannedCodeImage?: string
|
|
43
|
-
scanTitle?: string
|
|
44
|
-
scanContent?: string
|
|
45
|
-
scanToast?: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
49
|
-
title: '观看30秒广告 当日解锁',
|
|
50
|
-
subTitle: '手机打开【微信】扫码',
|
|
51
|
-
invalidCodeImage: '',
|
|
52
|
-
scannedCodeImage: '',
|
|
53
|
-
scanTitle: '观看奖励',
|
|
54
|
-
scanContent: '观看广告后可获得奖励',
|
|
55
|
-
scanToast: '奖励已获得,请前往电视端观看'
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const emit = defineEmits<{
|
|
59
|
-
(e: 'unlockSuccess'): void
|
|
60
|
-
(e: 'unlockFailed', error: Error): void
|
|
61
|
-
(e: 'qrCodeInvalid'): void
|
|
62
|
-
(e: 'qrCodeScanned'): void
|
|
63
|
-
}>()
|
|
64
|
-
|
|
65
|
-
const toast = useESToast()
|
|
66
|
-
const storage = useESLocalStorage()
|
|
67
|
-
const router = useESRouter()
|
|
68
|
-
const runtime = useESRuntime()
|
|
69
|
-
const dnum = runtime.getRuntimeDeviceId()
|
|
70
|
-
|
|
71
|
-
const payParams = ref<TVAdUnlockParams>({
|
|
72
|
-
assetId: '',
|
|
73
|
-
assetName: '',
|
|
74
|
-
fromId: '',
|
|
75
|
-
fromName: ''
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
adQrCode,
|
|
80
|
-
isInvalid,
|
|
81
|
-
qrCodeState,
|
|
82
|
-
isLoading,
|
|
83
|
-
isShowConfirmToast,
|
|
84
|
-
getAdQrCode,
|
|
85
|
-
stopPollTvADStatusTimer,
|
|
86
|
-
stopInvalidTimer,
|
|
87
|
-
reset
|
|
88
|
-
} = useTVAdUnlock(
|
|
89
|
-
props.config,
|
|
90
|
-
props.storageKeys,
|
|
91
|
-
props.requestManager,
|
|
92
|
-
{
|
|
93
|
-
onUnlockSuccess: () => handleUnlockSuccess(),
|
|
94
|
-
onUnlockFailed: (error) => emit('unlockFailed', error),
|
|
95
|
-
onQrCodeInvalid: () => emit('qrCodeInvalid'),
|
|
96
|
-
onQrCodeScanned: () => emit('qrCodeScanned')
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
const adStorage = useTVAdUnlockStorage(storage, props.storageKeys)
|
|
101
|
-
|
|
102
|
-
async function handleUnlockSuccess() {
|
|
103
|
-
await adStorage.setTodayUnlocked()
|
|
104
|
-
emit('unlockSuccess')
|
|
105
|
-
toast.showToast('解锁成功,继续观看吧!')
|
|
106
|
-
router.back()
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function onKeyDown(event: any) {
|
|
110
|
-
switch (event.keyCode) {
|
|
111
|
-
case ESKeyCode.ES_KEYCODE_DPAD_CENTER:
|
|
112
|
-
case ESKeyCode.ES_KEYCODE_ENTER:
|
|
113
|
-
if (isInvalid.value || qrCodeState.value === 1) {
|
|
114
|
-
getAdQrCode(dnum, props.scanTitle, props.scanContent, props.scanToast)
|
|
115
|
-
}
|
|
116
|
-
break
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function onESCreate(params: TVAdUnlockParams) {
|
|
121
|
-
payParams.value = params || { assetId: '', assetName: '', fromId: '', fromName: '' }
|
|
122
|
-
getAdQrCode(dnum, props.scanTitle, props.scanContent, props.scanToast)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function onBackPressed() {
|
|
126
|
-
if (!isShowConfirmToast.value && qrCodeState.value === 1) {
|
|
127
|
-
toast.showToast('广告播放中,请不要关闭弹窗')
|
|
128
|
-
isShowConfirmToast.value = true
|
|
129
|
-
return true
|
|
130
|
-
} else {
|
|
131
|
-
stopPollTvADStatusTimer()
|
|
132
|
-
stopInvalidTimer()
|
|
133
|
-
router.back()
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function onESDestroy() {
|
|
138
|
-
stopPollTvADStatusTimer()
|
|
139
|
-
stopInvalidTimer()
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
defineExpose({
|
|
143
|
-
onESCreate,
|
|
144
|
-
onKeyDown,
|
|
145
|
-
onBackPressed,
|
|
146
|
-
onESDestroy
|
|
147
|
-
})
|
|
148
|
-
</script>
|
|
149
|
-
|
|
150
|
-
<style scoped>
|
|
151
|
-
.ad-container {
|
|
152
|
-
width: 1920px;
|
|
153
|
-
height: 1080px;
|
|
154
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
155
|
-
display: flex;
|
|
156
|
-
justify-content: center;
|
|
157
|
-
align-items: center;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.content {
|
|
161
|
-
width: 892px;
|
|
162
|
-
height: 646px;
|
|
163
|
-
display: flex;
|
|
164
|
-
flex-direction: column;
|
|
165
|
-
align-items: center;
|
|
166
|
-
justify-content: center;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.content-bg {
|
|
170
|
-
position: absolute;
|
|
171
|
-
width: 892px;
|
|
172
|
-
height: 646px;
|
|
173
|
-
background-color: #FBE6C4;
|
|
174
|
-
border-radius: 30px;
|
|
175
|
-
border-width: 1px;
|
|
176
|
-
border-color: #979797;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.title {
|
|
180
|
-
font-weight: 500;
|
|
181
|
-
font-size: 46px;
|
|
182
|
-
color: #000000;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.sub-title {
|
|
186
|
-
margin-top: 32px;
|
|
187
|
-
font-weight: 400;
|
|
188
|
-
font-size: 30px;
|
|
189
|
-
color: rgba(0, 0, 0, 0.65);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.qrcode-container {
|
|
193
|
-
margin-top: 32px;
|
|
194
|
-
width: 300px;
|
|
195
|
-
height: 300px;
|
|
196
|
-
border-radius: 30px;
|
|
197
|
-
background-color: #FFFFFF;
|
|
198
|
-
display: flex;
|
|
199
|
-
justify-content: center;
|
|
200
|
-
align-items: center;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.qrcode {
|
|
204
|
-
position: absolute;
|
|
205
|
-
width: 260px;
|
|
206
|
-
height: 260px;
|
|
207
|
-
border-radius: 30px;
|
|
208
|
-
background-color: #FFFFFF;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.invalid-code {
|
|
212
|
-
position: absolute;
|
|
213
|
-
width: 300px;
|
|
214
|
-
height: 300px;
|
|
215
|
-
border-radius: 30px;
|
|
216
|
-
background-color: transparent;
|
|
217
|
-
}
|
|
218
|
-
</style>
|