4
4
5
5
// 添加require,是为了vscode中可以正确引入包,以获得自动补全等功能
6
6
if ( typeof require === 'undefined' ) require = importModule ;
7
- const { DmYY, Runing} = require ( './DmYY' ) ;
7
+ const { DmYY, Runing } = require ( './DmYY' ) ;
8
8
9
9
const API_PARAMS = {
10
10
api4 : 'biz.vio.detail.query' ,
@@ -14,7 +14,7 @@ const API_PARAMS = {
14
14
alipay : 'alipays://platformapi/startapp?appId=2019050964403523' ,
15
15
api2 : 'biz.vio.peccancyChannelList.query' ,
16
16
status :
17
- 'alipays://platformapi/startapp?appId=2019050964403523&page=pages%2Flicense%2Flicense' ,
17
+ 'alipays://platformapi/startapp?appId=2019050964403523&page=pages%2Flicense%2Flicense' ,
18
18
update : 'https://gitcode.net/4qiao/scriptable/raw/master/api/violation.js' ,
19
19
api3 : 'biz.vio.peccancyUnhandleInfoList.query' ,
20
20
Ver : 'Version 1.2\n\nverifyToken过期需打开Quantumult-X' ,
@@ -32,19 +32,23 @@ class Widget extends DmYY {
32
32
this . en = '12123' ;
33
33
this . name = '交管 12123' ;
34
34
config . runsInApp &&
35
- this . registerAction (
36
- 'Token' ,
37
- async ( ) => {
35
+ this . registerAction ( {
36
+ icon : { name : 'paperplane' , color : '#722ed1' } ,
37
+ type : 'input' ,
38
+ title : 'Token' ,
39
+ desc : '微信小程序交管12123获取' ,
40
+ val : 'Token' ,
41
+ onClick : async ( ) => {
38
42
const token = this . settings . token ;
39
- this . settings . token = ( await this . getCache ( 'wx_12123' , false ) ) ||
40
- token ;
43
+ this . settings . token =
44
+ ( await this . getCache ( 'wx_12123' , false ) ) || token ;
41
45
if ( this . settings . token ) this . saveSettings ( false ) ;
42
46
return this . setAlertInput ( 'Token' , '设置 token' , {
43
47
token : '微信小程序交管12123获取' ,
44
48
} ) ;
45
49
} ,
46
- { name : 'paperplane' , color : '#722ed1' } ,
47
- ) ;
50
+ } ) ;
51
+
48
52
config . runsInApp && this . registerAction ( '基础设置' , this . setWidgetConfig ) ;
49
53
}
50
54
@@ -65,25 +69,25 @@ class Widget extends DmYY {
65
69
title : '川 G88888' ,
66
70
icon : 'car.fill' ,
67
71
listItem : [
68
- { label : '未处违法' , value : `0` , unit : '条' } ,
69
- { label : '车辆状态' , value : '正常' } ,
70
- { label : '上次更新' , value : '00:00' } ,
72
+ { label : '未处违法' , value : `0` , unit : '条' } ,
73
+ { label : '车辆状态' , value : '正常' } ,
74
+ { label : '上次更新' , value : '00:00' } ,
71
75
] ,
72
76
} ,
73
77
right : {
74
78
title : '驾驶证' ,
75
79
icon : 'creditcard.fill' ,
76
80
listItem : [
77
- { label : '证件状态' , value : '正常' } ,
78
- { label : '累计扣分' , value : `0` , unit : '分' } ,
79
- { label : '重置日期' , value : '—' } ,
81
+ { label : '证件状态' , value : '正常' } ,
82
+ { label : '累计扣分' , value : `0` , unit : '分' } ,
83
+ { label : '重置日期' , value : '—' } ,
80
84
] ,
81
85
} ,
82
86
} ;
83
87
84
88
init = async ( ) => {
85
89
this . settings . token =
86
- ( await this . getCache ( 'wx_12123' , false ) ) || this . settings . token ;
90
+ ( await this . getCache ( 'wx_12123' , false ) ) || this . settings . token ;
87
91
if ( this . settings . dataSource ) {
88
92
this . dataSource = this . settings . dataSource ;
89
93
} else {
@@ -117,22 +121,22 @@ class Widget extends DmYY {
117
121
118
122
const details = await this . $request . post ( API_PARAMS . infoURL , {
119
123
body : `params=${ encodeURIComponent (
120
- JSON . stringify ( {
121
- api : 'biz.user.integration.query' ,
122
- productId : API_PARAMS . productId ,
123
- ...params ,
124
- } ) ,
124
+ JSON . stringify ( {
125
+ api : 'biz.user.integration.query' ,
126
+ productId : API_PARAMS . productId ,
127
+ ...params ,
128
+ } )
125
129
) } `,
126
130
} ) ;
127
131
128
132
console . log ( details ) ;
129
133
130
134
if ( details . success ) {
131
- const { drivingLicense, vehicles} = details . data ;
135
+ const { drivingLicense, vehicles } = details . data ;
132
136
const reaccDate = drivingLicense . reaccDate . split ( '-' ) ;
133
137
this . dataSource . right . title = `驾驶证 ${ drivingLicense . allowToDrive } ` ;
134
138
this . dataSource . right . listItem [ 1 ] . value =
135
- drivingLicense . cumulativePoint ;
139
+ drivingLicense . cumulativePoint ;
136
140
this . dataSource . right . listItem [ 2 ] . value = `${ reaccDate [ 1 ] } -${ reaccDate [ 2 ] } ` ;
137
141
138
142
if ( vehicles . length ) {
@@ -146,9 +150,9 @@ class Widget extends DmYY {
146
150
this . saveSettings ( false ) ;
147
151
} else {
148
152
this . notify (
149
- `verifyToken已过期 ⚠️` ,
150
- '点击通知框自动跳转到支付宝小程序交管12123页面获取最新的Token ( 请确保已打开辅助工具 )' ,
151
- API_PARAMS . alipay ,
153
+ `verifyToken已过期 ⚠️` ,
154
+ '点击通知框自动跳转到支付宝小程序交管12123页面获取最新的Token ( 请确保已打开辅助工具 )' ,
155
+ API_PARAMS . alipay
152
156
) ;
153
157
}
154
158
} catch ( e ) {
0 commit comments