Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加学习计时提示 #88

Open
wants to merge 2 commits into
base: version-14.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions 学习强国.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ function random_time(time) {
return time + random(100, 1000);
}

/**
* @description: 学习计时函数
* @param: 学习时间 (秒数*1000)
* @return: null
*/
function counting_time(waiting_time)
{
var seconds = parseInt(waiting_time/1000)
for(var i=0;i<seconds;i++)
{
sleep(1000);
toastLog("已经观看"+(i+1)+"秒,剩余"+(seconds-i-1)+"秒!");
}
sleep(waiting_time-seconds*1000) // 补上剩余的时间
}

// 刷新页面
function refresh() {
swipe(device.width / 2, device.height * 6 / 15, device.width / 2, device.height * 12 / 15, random_time(delay_time / 2));
Expand Down Expand Up @@ -221,7 +237,7 @@ while ((count < 6 - completed_count) && !finish_list[0]) {
}

// 观看时长
sleep(random_time(65000));
counting_time(random_time(65000));

// 分享两次
if (count < 2 && !finish_list[10]) {
Expand Down Expand Up @@ -260,7 +276,7 @@ if (!finish_list[1] || !finish_list[2]) {
sleep(random_time(delay_time));
if (text('继续播放').exists()) click('继续播放');
// 阅读时间
sleep(random_time(370000 - completed_time));
counting_time(random_time(370000 - completed_time));
back();
}

Expand Down