weapps-plugin-jingtong-verify 1.6.1 → 1.6.2-beta.2
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/README.md +1 -2
- package/app.json +33 -33
- package/package.json +20 -20
- package/sdk.js +313 -289
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
- package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
- package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -179
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +236 -236
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -206
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -39
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -9
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
- package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
- package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
- package/weapps-plugin-jingtong-verify/i18n/rules.js +262 -262
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1557 -1547
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +504 -504
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -133
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +120 -120
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +865 -854
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
- package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -328
- package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
- package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
- package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
- package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
- package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
- package/weapps-plugin-jingtong-verify/utils/request.js +1 -1
- package/weapps-plugin-jingtong-verify/utils/rules.js +301 -301
- package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
- package/weapps-plugin-jingtong-verify/utils/validate.js +772 -772
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// pages/g-index-list/index.js
|
|
3
|
-
const DEFAULT_DATA = {
|
|
4
|
-
_list: [],
|
|
5
|
-
_keys: [],
|
|
6
|
-
_isTouch: false,
|
|
7
|
-
_currentKey: '',
|
|
8
|
-
_scrollTop: 0,
|
|
9
|
-
_scrollViewHeight: 0
|
|
10
|
-
};
|
|
11
|
-
Component({
|
|
12
|
-
__firstIndexTop__: 0,
|
|
13
|
-
__indexHeight__: 0,
|
|
14
|
-
__itemListTop__: [],
|
|
15
|
-
__headerHeight__: 0,
|
|
16
|
-
options: {
|
|
17
|
-
multipleSlots: true
|
|
18
|
-
},
|
|
19
|
-
externalClasses: ['component-class'],
|
|
20
|
-
properties: {
|
|
21
|
-
list: {
|
|
22
|
-
type: Array,
|
|
23
|
-
observer() {
|
|
24
|
-
this.initLayout();
|
|
25
|
-
this.initList();
|
|
26
|
-
},
|
|
27
|
-
__type__: (v) => v
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
data: DEFAULT_DATA,
|
|
31
|
-
ready() {
|
|
32
|
-
this.initLayout();
|
|
33
|
-
},
|
|
34
|
-
methods: {
|
|
35
|
-
// 初始化尺寸大小
|
|
36
|
-
initLayout() {
|
|
37
|
-
const query = this.createSelectorQuery();
|
|
38
|
-
query.selectViewport().boundingClientRect();
|
|
39
|
-
query.select('.list__header').boundingClientRect();
|
|
40
|
-
query.select('.index__list__key').boundingClientRect();
|
|
41
|
-
query.selectAll('.list__item').boundingClientRect();
|
|
42
|
-
query.exec((result) => {
|
|
43
|
-
// console.log(result);
|
|
44
|
-
const viewport = result[0];
|
|
45
|
-
const listHeader = result[1];
|
|
46
|
-
const indexList = result[2];
|
|
47
|
-
const itemList = result[3];
|
|
48
|
-
if (!indexList || !viewport || !itemList)
|
|
49
|
-
return;
|
|
50
|
-
const _scrollViewHeight = viewport.height - listHeader.height;
|
|
51
|
-
this.__firstIndexTop__ = indexList.top;
|
|
52
|
-
this.__indexHeight__ = indexList.height;
|
|
53
|
-
this.__headerHeight__ = listHeader.height;
|
|
54
|
-
this.__itemListTop__ = itemList.map((item) => item.top);
|
|
55
|
-
this.setData({ _scrollViewHeight });
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
// 初始化 list
|
|
59
|
-
initList() {
|
|
60
|
-
const { list } = this.properties;
|
|
61
|
-
const _keys = Array.from(new Set(list.map((item) => item.key)));
|
|
62
|
-
// 转化 list 结构
|
|
63
|
-
const _list = _keys.map((key) => {
|
|
64
|
-
const data = {
|
|
65
|
-
key,
|
|
66
|
-
list: []
|
|
67
|
-
};
|
|
68
|
-
list.forEach((item) => {
|
|
69
|
-
if (item.key === key) {
|
|
70
|
-
data.list.push(item);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return data;
|
|
74
|
-
});
|
|
75
|
-
this.setData({ _keys, _list });
|
|
76
|
-
},
|
|
77
|
-
handleTouch(e) {
|
|
78
|
-
const { __firstIndexTop__, __indexHeight__, __itemListTop__ } = this;
|
|
79
|
-
const { _currentKey, _keys, _isTouch } = this.data;
|
|
80
|
-
if (e.touches.length > 0 && __firstIndexTop__ > 0 && __indexHeight__ > 0) {
|
|
81
|
-
const touches = e.touches[0];
|
|
82
|
-
const clientY = touches.clientY;
|
|
83
|
-
// 根据触摸位置计算出当前是第几个 key
|
|
84
|
-
const index = Math.ceil((clientY - __firstIndexTop__) / __indexHeight__) - 1;
|
|
85
|
-
const currentKey = _keys[index];
|
|
86
|
-
if (currentKey) {
|
|
87
|
-
this.setData({ _scrollTop: __itemListTop__[index] - this.__headerHeight__ });
|
|
88
|
-
if (_currentKey !== currentKey) {
|
|
89
|
-
wx.vibrateShort();
|
|
90
|
-
this.setData({ _currentKey: currentKey });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (!_isTouch) {
|
|
94
|
-
this.setData({ _isTouch: true });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
handleTouchEnd(e) {
|
|
99
|
-
this.setData({
|
|
100
|
-
_isTouch: false
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
handleChoose(e) {
|
|
104
|
-
this.triggerEvent('choose', e.currentTarget.dataset.item);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
module.exports = {};
|
|
1
|
+
"use strict";
|
|
2
|
+
// pages/g-index-list/index.js
|
|
3
|
+
const DEFAULT_DATA = {
|
|
4
|
+
_list: [],
|
|
5
|
+
_keys: [],
|
|
6
|
+
_isTouch: false,
|
|
7
|
+
_currentKey: '',
|
|
8
|
+
_scrollTop: 0,
|
|
9
|
+
_scrollViewHeight: 0
|
|
10
|
+
};
|
|
11
|
+
Component({
|
|
12
|
+
__firstIndexTop__: 0,
|
|
13
|
+
__indexHeight__: 0,
|
|
14
|
+
__itemListTop__: [],
|
|
15
|
+
__headerHeight__: 0,
|
|
16
|
+
options: {
|
|
17
|
+
multipleSlots: true
|
|
18
|
+
},
|
|
19
|
+
externalClasses: ['component-class'],
|
|
20
|
+
properties: {
|
|
21
|
+
list: {
|
|
22
|
+
type: Array,
|
|
23
|
+
observer() {
|
|
24
|
+
this.initLayout();
|
|
25
|
+
this.initList();
|
|
26
|
+
},
|
|
27
|
+
__type__: (v) => v
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
data: DEFAULT_DATA,
|
|
31
|
+
ready() {
|
|
32
|
+
this.initLayout();
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
// 初始化尺寸大小
|
|
36
|
+
initLayout() {
|
|
37
|
+
const query = this.createSelectorQuery();
|
|
38
|
+
query.selectViewport().boundingClientRect();
|
|
39
|
+
query.select('.list__header').boundingClientRect();
|
|
40
|
+
query.select('.index__list__key').boundingClientRect();
|
|
41
|
+
query.selectAll('.list__item').boundingClientRect();
|
|
42
|
+
query.exec((result) => {
|
|
43
|
+
// console.log(result);
|
|
44
|
+
const viewport = result[0];
|
|
45
|
+
const listHeader = result[1];
|
|
46
|
+
const indexList = result[2];
|
|
47
|
+
const itemList = result[3];
|
|
48
|
+
if (!indexList || !viewport || !itemList)
|
|
49
|
+
return;
|
|
50
|
+
const _scrollViewHeight = viewport.height - listHeader.height;
|
|
51
|
+
this.__firstIndexTop__ = indexList.top;
|
|
52
|
+
this.__indexHeight__ = indexList.height;
|
|
53
|
+
this.__headerHeight__ = listHeader.height;
|
|
54
|
+
this.__itemListTop__ = itemList.map((item) => item.top);
|
|
55
|
+
this.setData({ _scrollViewHeight });
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
// 初始化 list
|
|
59
|
+
initList() {
|
|
60
|
+
const { list } = this.properties;
|
|
61
|
+
const _keys = Array.from(new Set(list.map((item) => item.key)));
|
|
62
|
+
// 转化 list 结构
|
|
63
|
+
const _list = _keys.map((key) => {
|
|
64
|
+
const data = {
|
|
65
|
+
key,
|
|
66
|
+
list: []
|
|
67
|
+
};
|
|
68
|
+
list.forEach((item) => {
|
|
69
|
+
if (item.key === key) {
|
|
70
|
+
data.list.push(item);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return data;
|
|
74
|
+
});
|
|
75
|
+
this.setData({ _keys, _list });
|
|
76
|
+
},
|
|
77
|
+
handleTouch(e) {
|
|
78
|
+
const { __firstIndexTop__, __indexHeight__, __itemListTop__ } = this;
|
|
79
|
+
const { _currentKey, _keys, _isTouch } = this.data;
|
|
80
|
+
if (e.touches.length > 0 && __firstIndexTop__ > 0 && __indexHeight__ > 0) {
|
|
81
|
+
const touches = e.touches[0];
|
|
82
|
+
const clientY = touches.clientY;
|
|
83
|
+
// 根据触摸位置计算出当前是第几个 key
|
|
84
|
+
const index = Math.ceil((clientY - __firstIndexTop__) / __indexHeight__) - 1;
|
|
85
|
+
const currentKey = _keys[index];
|
|
86
|
+
if (currentKey) {
|
|
87
|
+
this.setData({ _scrollTop: __itemListTop__[index] - this.__headerHeight__ });
|
|
88
|
+
if (_currentKey !== currentKey) {
|
|
89
|
+
wx.vibrateShort();
|
|
90
|
+
this.setData({ _currentKey: currentKey });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!_isTouch) {
|
|
94
|
+
this.setData({ _isTouch: true });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
handleTouchEnd(e) {
|
|
99
|
+
this.setData({
|
|
100
|
+
_isTouch: false
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
handleChoose(e) {
|
|
104
|
+
this.triggerEvent('choose', e.currentTarget.dataset.item);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
module.exports = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"component": true,
|
|
3
|
-
"usingComponents": {
|
|
4
|
-
"g-search": "../g-search/index"
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"component": true,
|
|
3
|
+
"usingComponents": {
|
|
4
|
+
"g-search": "../g-search/index"
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<!--pages/g-index-list/index.wxml-->
|
|
2
|
-
<view class="list component-class">
|
|
3
|
-
<!-- 可定制内容 -->
|
|
4
|
-
<view class="list__header"><slot name="header"/></view>
|
|
5
|
-
<view class="list__container" wx:if="{{list && list.length > 0}}" style="height: {{_scrollViewHeight}}px" wx:key="key">
|
|
6
|
-
<!-- 正常滚动索引状态 -->
|
|
7
|
-
<scroll-view class="list__scrollview" scroll-y scroll-top="{{_scrollTop}}">
|
|
8
|
-
<view class="list__slot__content"><slot name="content"/></view>
|
|
9
|
-
<view class="list__item" wx:for="{{_list}}" wx:key="key">
|
|
10
|
-
<view class="list__title">{{item.key}}</view>
|
|
11
|
-
<view class="list__wrapper">
|
|
12
|
-
<view
|
|
13
|
-
class="list__block"
|
|
14
|
-
wx:for="{{item.list}}"
|
|
15
|
-
wx:key="subIndex"
|
|
16
|
-
wx:for-item="subItem"
|
|
17
|
-
wx:for-index="subIndex"
|
|
18
|
-
hover-class="view--hover"
|
|
19
|
-
hover-stay-time="250"
|
|
20
|
-
catch:tap="handleChoose"
|
|
21
|
-
data-item="{{subItem}}"
|
|
22
|
-
>
|
|
23
|
-
<view class="list__block__content">{{ subItem.name }}</view>
|
|
24
|
-
<view class="list__block__desc" wx:if="{{subItem.desc}}">{{subItem.desc}}</view>
|
|
25
|
-
</view>
|
|
26
|
-
</view>
|
|
27
|
-
</view>
|
|
28
|
-
</scroll-view>
|
|
29
|
-
|
|
30
|
-
<!-- 索引列表 -->
|
|
31
|
-
<view class="index__list">
|
|
32
|
-
<view
|
|
33
|
-
class="index__list__key"
|
|
34
|
-
wx:for="{{_keys}}"
|
|
35
|
-
wx:key="index"
|
|
36
|
-
catch:tap="handleTouch"
|
|
37
|
-
catch:touchstart="handleTouch"
|
|
38
|
-
catch:touchmove="handleTouch"
|
|
39
|
-
catch:touchend="handleTouchEnd"
|
|
40
|
-
>
|
|
41
|
-
{{item || ''}}
|
|
42
|
-
</view>
|
|
43
|
-
</view>
|
|
44
|
-
|
|
45
|
-
<view class="key__mask" wx:if="{{_currentKey && _isTouch}}">
|
|
46
|
-
{{_currentKey}}
|
|
47
|
-
</view>
|
|
48
|
-
</view>
|
|
49
|
-
<!-- 空列表 -->
|
|
50
|
-
<view wx:else class="list__container--empty" style="height: {{_scrollViewHeight}}px">
|
|
51
|
-
<view>暂无结果</view>
|
|
52
|
-
</view>
|
|
53
|
-
</view>
|
|
1
|
+
<!--pages/g-index-list/index.wxml-->
|
|
2
|
+
<view class="list component-class">
|
|
3
|
+
<!-- 可定制内容 -->
|
|
4
|
+
<view class="list__header"><slot name="header"/></view>
|
|
5
|
+
<view class="list__container" wx:if="{{list && list.length > 0}}" style="height: {{_scrollViewHeight}}px" wx:key="key">
|
|
6
|
+
<!-- 正常滚动索引状态 -->
|
|
7
|
+
<scroll-view class="list__scrollview" scroll-y scroll-top="{{_scrollTop}}">
|
|
8
|
+
<view class="list__slot__content"><slot name="content"/></view>
|
|
9
|
+
<view class="list__item" wx:for="{{_list}}" wx:key="key">
|
|
10
|
+
<view class="list__title">{{item.key}}</view>
|
|
11
|
+
<view class="list__wrapper">
|
|
12
|
+
<view
|
|
13
|
+
class="list__block"
|
|
14
|
+
wx:for="{{item.list}}"
|
|
15
|
+
wx:key="subIndex"
|
|
16
|
+
wx:for-item="subItem"
|
|
17
|
+
wx:for-index="subIndex"
|
|
18
|
+
hover-class="view--hover"
|
|
19
|
+
hover-stay-time="250"
|
|
20
|
+
catch:tap="handleChoose"
|
|
21
|
+
data-item="{{subItem}}"
|
|
22
|
+
>
|
|
23
|
+
<view class="list__block__content">{{ subItem.name }}</view>
|
|
24
|
+
<view class="list__block__desc" wx:if="{{subItem.desc}}">{{subItem.desc}}</view>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</view>
|
|
28
|
+
</scroll-view>
|
|
29
|
+
|
|
30
|
+
<!-- 索引列表 -->
|
|
31
|
+
<view class="index__list">
|
|
32
|
+
<view
|
|
33
|
+
class="index__list__key"
|
|
34
|
+
wx:for="{{_keys}}"
|
|
35
|
+
wx:key="index"
|
|
36
|
+
catch:tap="handleTouch"
|
|
37
|
+
catch:touchstart="handleTouch"
|
|
38
|
+
catch:touchmove="handleTouch"
|
|
39
|
+
catch:touchend="handleTouchEnd"
|
|
40
|
+
>
|
|
41
|
+
{{item || ''}}
|
|
42
|
+
</view>
|
|
43
|
+
</view>
|
|
44
|
+
|
|
45
|
+
<view class="key__mask" wx:if="{{_currentKey && _isTouch}}">
|
|
46
|
+
{{_currentKey}}
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
<!-- 空列表 -->
|
|
50
|
+
<view wx:else class="list__container--empty" style="height: {{_scrollViewHeight}}px">
|
|
51
|
+
<view>暂无结果</view>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|