Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
enoyee
Scriptable
提交
240bbe1e
S
Scriptable
项目概览
enoyee
/
Scriptable
通知
9
Star
0
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Scriptable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
240bbe1e
编写于
12月 13, 2022
作者:
AndroidLeaves
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
f240f5f7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
43 deletion
+49
-43
世界杯.js
世界杯.js
+30
-37
今日事项.js
今日事项.js
+19
-6
未找到文件。
世界杯.js
浏览文件 @
240bbe1e
...
...
@@ -3,7 +3,7 @@
// icon-color: red; icon-glyph: user-astronaut;
/**
* Author:LSP
* Date:2022-12-1
1
* Date:2022-12-1
3
*/
// -------------------------------------------------------
// 是否是开发环境,配合手机端调试使用,正式发布设置为false
...
...
@@ -318,53 +318,46 @@ class Widget extends BaseWidget {
const
URL
=
'
https://api5-normal-lq.toutiaoapi.com/vertical/sport/go/world_cup/match_info
'
;
const
RES
=
await
this
.
httpGet
(
URL
);
const
match_infos
=
JSON
.
parse
(
RES
.
data
).
match_infos
;
const
fullDate
=
this
.
getDateStr
(
new
Date
(),
'
yyyyMMdd
'
);
const
matchInfoKeys
=
Object
.
keys
(
match_infos
);
let
preDateIndex
=
-
1
;
let
currDateIndex
=
0
;
for
(
let
index
=
0
;
index
<
matchInfoKeys
.
length
;
index
++
)
{
const
info
=
matchInfoKeys
[
index
];
if
(
info
>=
fullDate
)
{
currDateIndex
=
index
;
let
key
=
matchInfoKeys
[
currDateIndex
];
let
tmpArr
=
match_infos
[
key
];
let
hasMatch
=
tmpArr
.
find
(
item
=>
item
.
match_type
==
1
);
if
(
hasMatch
)
{
break
}
}
// -------------------------------------------------
const
currDateKey
=
this
.
getDateStr
(
new
Date
(),
'
yyyyMMdd
'
);
let
currDateIndex
=
matchInfoKeys
.
indexOf
(
currDateKey
);
// -------------------------------------------------
let
preDateIndex
=
currDateIndex
-
1
;
let
preDateKey
=
matchInfoKeys
[
preDateIndex
];
// -------------------------------------------------
let
afterDateIndex
=
currDateIndex
+
1
;
let
afterDateKey
=
''
;
if
(
currDateIndex
==
matchInfoKeys
.
length
-
1
)
{
afterDateIndex
=
-
1
;
}
else
{
afterDateKey
=
matchInfoKeys
[
afterDateIndex
];
}
if
(
currDateIndex
!=
0
)
{
preDateIndex
=
currDateIndex
-
1
;
console
.
log
(
`preDateKey->
${
preDateKey
}
, afterDateKey:
${
afterDateKey
}
, currDateKey=
${
currDateKey
}
`
);
// -------------------------------------------------
// match_status:1未开始,2:进行中,3:已结束,其他非比赛
let
currMatch
=
match_infos
[
currDateKey
];
let
preMatch
=
match_infos
[
preDateKey
];
let
afterMatch
;
if
(
afterDateKey
.
length
>
0
)
{
afterMatch
=
match_infos
[
afterDateKey
];
}
const
currDateInfo
=
match_infos
[
fullDate
]
||
[];
//
let
showInfoArr
=
[];
const
infoArr
=
[];
if
(
preDateIndex
!=
-
1
)
{
let
preInfoKey
=
matchInfoKeys
[
preDateIndex
];
let
preInfoArr
=
match_infos
[
preInfoKey
]
||
[];
preInfoArr
=
preInfoArr
.
filter
(
item
=>
item
.
match_status
==
2
);
showInfoArr
=
showInfoArr
.
concat
(
preInfoArr
);
}
showInfoArr
=
showInfoArr
.
concat
(
currDateInfo
);
let
hasGroup
=
true
;
if
(
showInfoArr
.
length
>
0
)
{
hasGroup
=
showInfoArr
[
0
].
group_name
!=
undefined
if
(
preMatch
.
match_status
==
2
)
{
showInfoArr
=
showInfoArr
.
concat
(
preMatch
);
}
if
(
hasGroup
)
{
showInfoArr
=
showInfoArr
.
filter
(
item
=>
item
.
group_name
);
if
(
[
1
,
2
,
3
].
indexOf
(
currMatch
.
match_status
)
!=
-
1
)
{
showInfoArr
=
showInfoArr
.
concat
(
currMatch
);
}
showInfoArr
=
showInfoArr
.
filter
(
item
=>
item
.
host_team
.
team_id
>
0
);
if
(
filterFinished
)
{
showInfoArr
=
showInfoArr
.
filter
(
item
=>
item
.
match_status
!=
3
);
if
(
showInfoArr
.
length
==
0
&&
currDateIndex
!=
match_infos
.
length
)
{
let
key
=
matchInfoKeys
[
currDateIndex
+
1
];
showInfoArr
=
showInfoArr
.
concat
(
match_infos
[
key
]);
if
(
showInfoArr
.
length
==
0
&&
afterDateKey
.
length
>
0
)
{
showInfoArr
=
showInfoArr
.
concat
(
afterMatch
);
}
}
const
infoArr
=
[];
for
(
const
info
of
showInfoArr
)
{
const
{
round_name
=
''
,
...
...
今日事项.js
浏览文件 @
240bbe1e
...
...
@@ -131,7 +131,8 @@ class Widget extends BaseWidget {
textSpan
.
lineLimit
=
1
;
// ------------
leftStack
.
addSpacer
(
4
);
textSpan
=
leftStack
.
addText
(
`完成率:
${
totalCount
>
0
?
Math
.
floor
((
finishedCount
/
totalCount
)
*
100
)
:
0
}
%`
);
const
percent
=
totalCount
>
0
?
Math
.
floor
((
finishedCount
/
totalCount
)
*
100
)
:
0
;
textSpan
=
leftStack
.
addText
(
`完成率:
${
percent
}
%`
);
textSpan
.
textColor
=
leftTextColor
;
textSpan
.
font
=
leftTextFont
;
textSpan
.
lineLimit
=
1
;
...
...
@@ -143,12 +144,24 @@ class Widget extends BaseWidget {
const
perHeight
=
height
/
6
;
const
list
=
unfinishedList
.
slice
(
0
,
unfinishedList
.
length
>
4
?
4
:
unfinishedList
.
length
);
rightStack
.
addSpacer
(
10
);
if
(
list
.
length
===
0
)
{
rightStack
.
url
=
'
x-apple-reminderkit://
'
;
const
completeIcoStack
=
rightStack
.
addStack
();
completeIcoStack
.
addSpacer
();
img
=
await
this
.
getImageByUrl
(
'
https://s3.uuu.ovh/imgs/2022/12/11/13440f7a07d814d3.png
'
);
// ---------------------------------------
rightStack
.
url
=
'
x-apple-reminderkit://
'
;
let
percentIndex
=
0
;
if
(
percent
>
0
&&
percent
<=
25
)
{
percentIndex
=
25
;
}
else
if
(
percent
>
25
&&
percent
<=
50
)
{
percentIndex
=
50
;
}
else
if
(
percent
>
50
&&
percent
<=
75
)
{
percentIndex
=
75
;
}
else
if
(
percent
>
75
)
{
percentIndex
=
100
;
}
if
(
percentIndex
>
0
)
{
img
=
await
this
.
getImageByUrl
(
`https://gitcode.net/enoyee/scriptable/-/raw/master/img/bg_celebrate_
${
percentIndex
}
.png`
);
rightStack
.
backgroundImage
=
img
;
}
// ---------------------------------------
if
(
list
.
length
===
0
)
{
[
'
全
'
,
'
步
'
,
'
完
'
,
'
成
'
].
forEach
(
_
=>
{
let
rdStack
=
rightStack
.
addStack
();
rdStack
.
url
=
'
x-apple-reminderkit://
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录