forked from ZoLArk173/Authenticator
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.page.js
77 lines (61 loc) · 1.88 KB
/
index.page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import * as hmUI from '@zos/ui'
import {push} from '@zos/router'
import {getDeviceInfo} from '@zos/device'
const {width: DEVICE_WIDTH, height: DEVICE_HEIGHT} = getDeviceInfo()
const {messageBuilder} = getApp()._options.globalData
let scrollList
let otpList = [
{account: "Plex", issuer:"plex.tv/web", secret:"JBSWY3DPEHPK3PXP",algorithm:"SHA-1", digits:6 , period:30},
]
Page({
onInit() {
},
build() {
hmUI.setStatusBarVisible(false)
function showCode(item, index, data_key) {
push({
url: 'page/code.page',
params: JSON.stringify(otpList[index]),
},)
}
scrollList = hmUI.createWidget(hmUI.widget.SCROLL_LIST, {
x: 20,
y: 0,
h: DEVICE_HEIGHT,
w: DEVICE_WIDTH-40,
item_space: 20,
snap_to_center: true,
item_config: [
{
type_id: 0,
item_bg_color: 0x303030,
item_bg_radius: 40,
text_view: [
{x: 20, y: 0, w: DEVICE_WIDTH-80, h: 60, key: 'account', color: 0xffffff, text_size: px(48)},
{x: 20, y: 60, w: DEVICE_WIDTH-80, h: 40, key: 'issuer', color: 0xffffff, text_size: px(24)},
],
text_view_count: 2,
image_view_count: 0,
item_height: 100
}
],
item_config_count: 1,
data_array: otpList,
data_count: otpList.length,
item_click_func: (item, index, data_key) => {
showCode(item, index, data_key)
},
})
},
onReady() {
console.log('ready')
},
onShow() {
console.log('show')
},
onHide() {
console.log('hide')
},
onDestroy() {
},
})