Skip to content

Commit d423363

Browse files
author
dumpling
committedFeb 8, 2023
update:优化显示效果
1 parent 7a975e2 commit d423363

File tree

4 files changed

+323
-254
lines changed

4 files changed

+323
-254
lines changed
 

‎Scripts/12123.js

+30-26
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// 添加require,是为了vscode中可以正确引入包,以获得自动补全等功能
66
if (typeof require === 'undefined') require = importModule;
7-
const {DmYY, Runing} = require('./DmYY');
7+
const { DmYY, Runing } = require('./DmYY');
88

99
const API_PARAMS = {
1010
api4: 'biz.vio.detail.query',
@@ -14,7 +14,7 @@ const API_PARAMS = {
1414
alipay: 'alipays://platformapi/startapp?appId=2019050964403523',
1515
api2: 'biz.vio.peccancyChannelList.query',
1616
status:
17-
'alipays://platformapi/startapp?appId=2019050964403523&page=pages%2Flicense%2Flicense',
17+
'alipays://platformapi/startapp?appId=2019050964403523&page=pages%2Flicense%2Flicense',
1818
update: 'https://gitcode.net/4qiao/scriptable/raw/master/api/violation.js',
1919
api3: 'biz.vio.peccancyUnhandleInfoList.query',
2020
Ver: 'Version 1.2\n\nverifyToken过期需打开Quantumult-X',
@@ -32,19 +32,23 @@ class Widget extends DmYY {
3232
this.en = '12123';
3333
this.name = '交管 12123';
3434
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 () => {
3842
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;
4145
if (this.settings.token) this.saveSettings(false);
4246
return this.setAlertInput('Token', '设置 token', {
4347
token: '微信小程序交管12123获取',
4448
});
4549
},
46-
{name: 'paperplane', color: '#722ed1'},
47-
);
50+
});
51+
4852
config.runsInApp && this.registerAction('基础设置', this.setWidgetConfig);
4953
}
5054

@@ -65,25 +69,25 @@ class Widget extends DmYY {
6569
title: '川 G88888',
6670
icon: 'car.fill',
6771
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' },
7175
],
7276
},
7377
right: {
7478
title: '驾驶证',
7579
icon: 'creditcard.fill',
7680
listItem: [
77-
{label: '证件状态', value: '正常'},
78-
{label: '累计扣分', value: `0`, unit: '分'},
79-
{label: '重置日期', value: '—'},
81+
{ label: '证件状态', value: '正常' },
82+
{ label: '累计扣分', value: `0`, unit: '分' },
83+
{ label: '重置日期', value: '—' },
8084
],
8185
},
8286
};
8387

8488
init = async () => {
8589
this.settings.token =
86-
(await this.getCache('wx_12123', false)) || this.settings.token;
90+
(await this.getCache('wx_12123', false)) || this.settings.token;
8791
if (this.settings.dataSource) {
8892
this.dataSource = this.settings.dataSource;
8993
} else {
@@ -117,22 +121,22 @@ class Widget extends DmYY {
117121

118122
const details = await this.$request.post(API_PARAMS.infoURL, {
119123
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+
})
125129
)}`,
126130
});
127131

128132
console.log(details);
129133

130134
if (details.success) {
131-
const {drivingLicense, vehicles} = details.data;
135+
const { drivingLicense, vehicles } = details.data;
132136
const reaccDate = drivingLicense.reaccDate.split('-');
133137
this.dataSource.right.title = `驾驶证 ${drivingLicense.allowToDrive}`;
134138
this.dataSource.right.listItem[1].value =
135-
drivingLicense.cumulativePoint;
139+
drivingLicense.cumulativePoint;
136140
this.dataSource.right.listItem[2].value = `${reaccDate[1]}-${reaccDate[2]}`;
137141

138142
if (vehicles.length) {
@@ -146,9 +150,9 @@ class Widget extends DmYY {
146150
this.saveSettings(false);
147151
} else {
148152
this.notify(
149-
`verifyToken已过期 ⚠️`,
150-
'点击通知框自动跳转到支付宝小程序交管12123页面获取最新的Token ( 请确保已打开辅助工具 )',
151-
API_PARAMS.alipay,
153+
`verifyToken已过期 ⚠️`,
154+
'点击通知框自动跳转到支付宝小程序交管12123页面获取最新的Token ( 请确保已打开辅助工具 )',
155+
API_PARAMS.alipay
152156
);
153157
}
154158
} catch (e) {

0 commit comments

Comments
 (0)
Please sign in to comment.