mirror of https://gitee.com/godoos/godoos.git
27 changed files with 137 additions and 1012 deletions
@ -1,57 +0,0 @@ |
|||||
// import * as fs from "@tauri-apps/plugin-fs";
|
|
||||
// import { BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
||||
// import { convertFileSrc } from "@tauri-apps/api/core";
|
|
||||
// console.log(convertFileSrc("data"))
|
|
||||
// const basePath = "/Users/rt008/www/osData";
|
|
||||
// const baseFilePath = "/Users/rt008/www/osData/"
|
|
||||
// export const useFile = () => {
|
|
||||
// return {
|
|
||||
// async readdir(path) {
|
|
||||
// return fs.readDir(basePath + path);
|
|
||||
// },
|
|
||||
// async stat(path) {
|
|
||||
// return fs.stat(basePath + path);
|
|
||||
// },
|
|
||||
// async exists(path) {
|
|
||||
// return fs.exists(basePath + path);
|
|
||||
// },
|
|
||||
// async readFile(path) {
|
|
||||
// return fs.readFile(basePath + path);
|
|
||||
// },
|
|
||||
// async unlink(path) {
|
|
||||
// return fs.remove(basePath + path);
|
|
||||
// },
|
|
||||
// async rename(oldPath, newPath) {
|
|
||||
// return fs.rename(basePath + oldPath, basePath + newPath);
|
|
||||
// },
|
|
||||
// async rmdir(path) {
|
|
||||
// return fs.remove(basePath + path);
|
|
||||
// },
|
|
||||
// async mkdir(path) {
|
|
||||
// return fs.mkdir(basePath + path);
|
|
||||
// },
|
|
||||
// async copyFile(src, dest) {
|
|
||||
// return fs.copyFile(basePath + src, basePath + dest);
|
|
||||
// },
|
|
||||
// async writeFile(path, content) {
|
|
||||
// return fs.writeFile(basePath + path, content);
|
|
||||
// },
|
|
||||
// async appendFile(path, content) {
|
|
||||
// return fs.writeFile(basePath + path, content, { append: true });
|
|
||||
// },
|
|
||||
// serializeFileSystem() {
|
|
||||
// return Promise.reject('fs 不支持序列化');
|
|
||||
// },
|
|
||||
// deserializeFileSystem(files) {
|
|
||||
// return Promise.reject('fs 不支持序列化');
|
|
||||
// },
|
|
||||
// removeFileSystem() {
|
|
||||
// return Promise.reject('fs 不支持清空');
|
|
||||
// },
|
|
||||
// registerWatcher(path, callback) {
|
|
||||
// return fs.watch(basePath + path, (event) => {
|
|
||||
// callback(path);
|
|
||||
// });
|
|
||||
// },
|
|
||||
// }
|
|
||||
// };
|
|
@ -1,3 +0,0 @@ |
|||||
# 番茄钟 |
|
||||
|
|
||||
- godoos应用商店Demo |
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,206 +0,0 @@ |
|||||
|
|
||||
/* 设置字体 */ |
|
||||
@font-face { |
|
||||
font-family: 'lcd'; |
|
||||
src: url('../font/lcd.ttf') format('truetype'); |
|
||||
} |
|
||||
@font-face { |
|
||||
font-family: 'icon'; |
|
||||
src: url('../font/iconfont.ttf') format('truetype'); |
|
||||
} |
|
||||
/*css 初始化 */ |
|
||||
html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img { margin:0; padding:0; } |
|
||||
fieldset, img,input,button { font-family:"Times New Roman","Microsoft YaHei","SimSun"; ;border:none; padding:0;margin:0;outline-style:none; } /*去掉边框、去掉轮廓(比如输入框外面的蓝边框)*/ |
|
||||
/*去掉列表前面的圆点*/ |
|
||||
ul, ol { |
|
||||
list-style: none; |
|
||||
} |
|
||||
/* 设置隐藏 */ |
|
||||
.none { |
|
||||
display: none; |
|
||||
} |
|
||||
.flex { |
|
||||
display: flex; |
|
||||
} |
|
||||
/* 设置版心并居中 */ |
|
||||
.w { |
|
||||
position: absolute; |
|
||||
top:50%; |
|
||||
left:50%; |
|
||||
transform: translate(-50%,-50%); |
|
||||
width: 95vw; |
|
||||
} |
|
||||
/* 设置字体 */ |
|
||||
.iconfont { |
|
||||
font-family:"icon" !important; |
|
||||
font-style:normal; |
|
||||
-webkit-font-smoothing: antialiased; |
|
||||
-webkit-text-stroke-width: 0.2px; |
|
||||
-moz-osx-font-smoothing: grayscale; |
|
||||
} |
|
||||
#n1,#n2,#n4,#n5{ |
|
||||
width: 23%; |
|
||||
} |
|
||||
#n3 { |
|
||||
width: 8%; |
|
||||
transform: translate(20%,-25%); |
|
||||
} |
|
||||
.lcd { |
|
||||
font-family:"lcd" !important; |
|
||||
font-size:45vw;font-style:normal; |
|
||||
-webkit-font-smoothing: antialiased; |
|
||||
-webkit-text-stroke-width: 0.2px; |
|
||||
-moz-osx-font-smoothing: grayscale; |
|
||||
} |
|
||||
/* 帮助界面 */ |
|
||||
.p0 { |
|
||||
margin: 0 auto; |
|
||||
padding: 0 14vw; |
|
||||
position: relative; |
|
||||
|
|
||||
} |
|
||||
h3 { |
|
||||
position: absolute; |
|
||||
left: 50%; |
|
||||
top: -7vw; |
|
||||
transform: translateX(-50%); |
|
||||
font-size: 4vw; |
|
||||
} |
|
||||
.tip { |
|
||||
border: 1px solid #999; |
|
||||
} |
|
||||
.p0 p { |
|
||||
margin: 2vw 0 ; |
|
||||
text-align: center; |
|
||||
font-size: 3vw; |
|
||||
} |
|
||||
/* 开始第一页 */ |
|
||||
.top { |
|
||||
position: relative; |
|
||||
z-index: 999; |
|
||||
} |
|
||||
.top div{ |
|
||||
width: 33.3%; |
|
||||
font-size: 3vw; |
|
||||
} |
|
||||
.top-left { |
|
||||
text-align: left; |
|
||||
} |
|
||||
.top-center { |
|
||||
text-align: center; |
|
||||
} |
|
||||
.top-right { |
|
||||
text-align: right; |
|
||||
white-space: nowrap; |
|
||||
} |
|
||||
.footer div{ |
|
||||
width: 33.3%; |
|
||||
text-align: center; |
|
||||
font-size: 5vw; |
|
||||
} |
|
||||
|
|
||||
.main { |
|
||||
margin: 1.5vw 0 2.5vw; |
|
||||
padding: 1vw 3vw; |
|
||||
border-top: 1px solid black; |
|
||||
border-bottom: 1px solid black; |
|
||||
} |
|
||||
|
|
||||
/* 开始第二页 */ |
|
||||
ol { |
|
||||
margin: 0 auto; |
|
||||
width: 50vw; |
|
||||
} |
|
||||
ol li { |
|
||||
text-align: center; |
|
||||
line-height: 7.4vw; |
|
||||
font-size: 4vw; |
|
||||
border-bottom: 1px solid #e1e1e1; |
|
||||
} |
|
||||
ol li:nth-last-child(1){ |
|
||||
border-bottom: none; |
|
||||
} |
|
||||
|
|
||||
/* 开始第三页 */ |
|
||||
.p3 { |
|
||||
font-size: 4vw; |
|
||||
padding: 0 20%; |
|
||||
overflow: hidden; |
|
||||
} |
|
||||
button{ |
|
||||
background-color: #fff; |
|
||||
border: 1px solid black; |
|
||||
font-size: 4vw; |
|
||||
padding: 0.2vw 0.7vw; |
|
||||
} |
|
||||
.line1,.line2 { |
|
||||
margin: 5vw auto; |
|
||||
display: flex; |
|
||||
justify-content: space-between; |
|
||||
} |
|
||||
.line1 { |
|
||||
margin-top: 0; |
|
||||
} |
|
||||
.p3 input{ |
|
||||
width: 100%; |
|
||||
text-align: center; |
|
||||
font-size: 4vw; |
|
||||
border: 1px solid black; |
|
||||
} |
|
||||
.p3-main span{ |
|
||||
width: 50%; |
|
||||
} |
|
||||
.p3-bottom { |
|
||||
padding: 0 2vw; |
|
||||
display: flex; |
|
||||
justify-content: space-between; |
|
||||
} |
|
||||
.p3-bottom button{ |
|
||||
width: 40%; |
|
||||
} |
|
||||
/* 第四页 */ |
|
||||
.p4 { |
|
||||
font-size: 4vw; |
|
||||
padding: 0 20%; |
|
||||
overflow: hidden; |
|
||||
} |
|
||||
|
|
||||
.p4 input{ |
|
||||
width: 100%; |
|
||||
text-align: center; |
|
||||
font-size: 4vw; |
|
||||
border: 1px solid black; |
|
||||
} |
|
||||
.p4-main span{ |
|
||||
width: 50%; |
|
||||
} |
|
||||
.p4-bottom { |
|
||||
padding: 0 2vw; |
|
||||
display: flex; |
|
||||
justify-content: space-between; |
|
||||
} |
|
||||
.p4-bottom button{ |
|
||||
width: 40%; |
|
||||
} |
|
||||
.p5 { |
|
||||
position: relative; |
|
||||
} |
|
||||
.p5 .back { |
|
||||
position: absolute; |
|
||||
right: 10%; |
|
||||
bottom: 2vw; |
|
||||
font-size: 2vw; |
|
||||
border: 1px solid black; |
|
||||
padding: 0.5vw; |
|
||||
} |
|
||||
|
|
||||
/* 全屏 */ |
|
||||
::backdrop { |
|
||||
z-index:0; |
|
||||
background-color: white !important; |
|
||||
} |
|
||||
|
|
||||
html, *:fullscreen, *:-webkit-full-screen, *:-moz-full-screen { |
|
||||
background-color: white !important; |
|
||||
z-index:1; |
|
||||
} |
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,105 +0,0 @@ |
|||||
<!DOCTYPE html> |
|
||||
<html lang="zh_CN" > |
|
||||
<head> |
|
||||
<meta charset="UTF-8" /> |
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
||||
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon"> |
|
||||
<title>番茄钟</title> |
|
||||
<link rel="stylesheet" href="css/index.css"> |
|
||||
</head> |
|
||||
<body> |
|
||||
<script src="js/NoSleep.min.js"></script> |
|
||||
<script src="js/jquery-3.6.0.min.js"></script> |
|
||||
<script src="js/echarts.min.js"></script> |
|
||||
<script src="js/tools.js"></script> |
|
||||
<script src="js/index.js"></script> |
|
||||
<!-- 版心 --> |
|
||||
<div class="w"> |
|
||||
<!-- 帮助界面 --> |
|
||||
<div class="class page p0 "> |
|
||||
<h3>提示(点击进入主页)</h3> |
|
||||
<div class="tip"> |
|
||||
<p>点击屏幕中间进入/退出全屏</p> |
|
||||
<p>点击左上角的番茄钟获取提示</p> |
|
||||
<p>点击中上角的时间电量切换钟表模式</p> |
|
||||
<p>点击右上角的已工作时间切换显示计划时间</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- 第一页:主界面 --> |
|
||||
<div class="page p1 none"> |
|
||||
<div class="top flex"> |
|
||||
<!-- 顶部状态栏 --> |
|
||||
<div class="top-left iconfont">番茄钟</div> |
|
||||
<div class="top-center"><span class="now-time">00:00:00</span></div> |
|
||||
<div class="top-right">好好学习,天天向上</div> |
|
||||
</div> |
|
||||
<div class="main flex "> |
|
||||
<!-- 主要的时钟部分 --> |
|
||||
<div class="lcd" id="n1">4</div> |
|
||||
<div class="lcd" id="n2">5</div> |
|
||||
<div class="lcd" id="n3">:</div> |
|
||||
<div class="lcd" id="n4">0</div> |
|
||||
<div class="lcd" id="n5">0</div> |
|
||||
</div> |
|
||||
<div class="footer flex"> |
|
||||
<!-- 底部 --> |
|
||||
<div class="footer-left play iconfont"></div> |
|
||||
<div class="footer-center reset iconfont"></div> |
|
||||
<div class="footer-right setting iconfont"></div> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- 第二页:设置界面 --> |
|
||||
<div class="page p2 none"> |
|
||||
<ol> |
|
||||
<li class="option">设置工作/休息时间</li> |
|
||||
<li class="option">设置计划倒计时</li> |
|
||||
<li class="option">查看工作历史</li> |
|
||||
<li class="option">清除本地数据</li> |
|
||||
<li class="option">返回</li> |
|
||||
</ol> |
|
||||
</div> |
|
||||
<!-- 第三页:设置工作/休息时间 --> |
|
||||
<div class="page p3 none"> |
|
||||
<div class="p3-main"> |
|
||||
<div class="line1"> |
|
||||
<span>工作时间(分):</span> |
|
||||
<span><input type="text" name="study-time" id="input-study-time" value="45"></span> |
|
||||
</div> |
|
||||
<div class="line2"> |
|
||||
<span>休息时间(分):</span> |
|
||||
<span ><input type="text" name="rest-time" id="input-rest-time" value="5"></span> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="p3-bottom"> |
|
||||
<button>应用</button> |
|
||||
<button>返回</button> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- 第四页:设置计划倒计时 --> |
|
||||
<div class="page p4 none"> |
|
||||
<div class="p4-main"> |
|
||||
<div class="line1"> |
|
||||
<span>计划名称:</span> |
|
||||
<span><input type="text" name="plan-name" id="input-plan-name" value=""></span> |
|
||||
</div> |
|
||||
<div class="line2"> |
|
||||
<span>截止日期:</span> |
|
||||
<span ><input type="text" name="plan-time" id="input-plan-time" value="2021/12/31"></span> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="p4-bottom"> |
|
||||
<button>应用</button> |
|
||||
<button>返回</button> |
|
||||
</div> |
|
||||
</div> |
|
||||
<!-- 第五页:展示历史工作时间 --> |
|
||||
<div class="page p5 none "> |
|
||||
<div id="echarts" style="width:85vw;height: 50vw; margin: 0 auto;"> |
|
||||
|
|
||||
|
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</body> |
|
||||
</html> |
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,182 +0,0 @@ |
|||||
|
|
||||
|
|
||||
// 入口函数
|
|
||||
$(()=>{ |
|
||||
let myChart ; |
|
||||
let isFullScreen = false; |
|
||||
//屏幕常量!
|
|
||||
let noSleep = new NoSleep(); |
|
||||
let playSound = (src) => { |
|
||||
au = document.createElement("audio"); |
|
||||
au.preload="auto"; |
|
||||
au.src = '/admin/tools/clock/audio/' + src + '.mp3'; |
|
||||
au.play(); |
|
||||
} |
|
||||
//绑定事件
|
|
||||
// 全屏
|
|
||||
$(".main").on("click",()=>{ |
|
||||
if(isFullScreen){ |
|
||||
document.exitFullscreen(); |
|
||||
} |
|
||||
else{ |
|
||||
document.body.requestFullscreen(); |
|
||||
} |
|
||||
isFullScreen = !isFullScreen; |
|
||||
}); |
|
||||
//绑定提示取消
|
|
||||
$(".p0").on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p1").show(); |
|
||||
noSleep.enable(); |
|
||||
}); |
|
||||
$(".top-left").on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p0").show(); |
|
||||
}); |
|
||||
//切换工作时间/计划倒计时
|
|
||||
$(".top-right").on("click",()=>{ |
|
||||
isShowPlan = !isShowPlan; |
|
||||
}); |
|
||||
//切换时钟
|
|
||||
$(".top-center").on("click",()=>{ |
|
||||
isClock = !isClock; |
|
||||
showNowTime(); |
|
||||
}); |
|
||||
//播放按钮
|
|
||||
$(".play").on("click",()=>{ |
|
||||
//如果没播放并且在休息,按两下直接开始工作
|
|
||||
if (!isPlay && isRest){ |
|
||||
res_time = t_study; |
|
||||
isRest = false; |
|
||||
} |
|
||||
if (!isPlay){ |
|
||||
$(".play").html(icon_stop); |
|
||||
playSound('tick'); |
|
||||
} |
|
||||
if (isPlay){ |
|
||||
$(".play").html(icon_play); |
|
||||
} |
|
||||
|
|
||||
isPlay = !isPlay; |
|
||||
}); |
|
||||
//重置时间
|
|
||||
$(".reset").on("click",()=>{ |
|
||||
if (isRest){ |
|
||||
res_time = t_rest ; |
|
||||
} |
|
||||
else { |
|
||||
res_time = t_study ; |
|
||||
} |
|
||||
showRestTime(); |
|
||||
}); |
|
||||
//设置
|
|
||||
$(".setting").on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p2").show(); |
|
||||
}); |
|
||||
//设置工作/休息时间
|
|
||||
$(".p2 .option").eq(0).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p3").show(); |
|
||||
}); |
|
||||
//设置计划倒计时
|
|
||||
$(".p2 .option").eq(1).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p4").show(); |
|
||||
}); |
|
||||
//查看工作历史
|
|
||||
$(".p2 .option").eq(2).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p5").show(); |
|
||||
myChart = showEcharts(); |
|
||||
}); |
|
||||
//清除本地数据
|
|
||||
$(".p2 .option").eq(3).on("click",()=>{ |
|
||||
window.localStorage.clear(); |
|
||||
localData = []; |
|
||||
|
|
||||
|
|
||||
alert("已清除!"); |
|
||||
}); |
|
||||
//返回
|
|
||||
$(".p2 .option").eq(4).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p1").show(); |
|
||||
}); |
|
||||
//第三页设置工作/休息时间
|
|
||||
$(".p3-bottom button").eq(0).on("click",()=>{ |
|
||||
t_study = $(".p3 input").eq(0).val() * 60; |
|
||||
t_rest = $(".p3 input").eq(1).val() * 60; |
|
||||
if(isRest){ |
|
||||
res_time = t_rest; |
|
||||
} |
|
||||
else { |
|
||||
res_time = t_study; |
|
||||
} |
|
||||
showRestTime(); |
|
||||
saveSetting(); |
|
||||
// alert("完成!");
|
|
||||
// console.log(t_study);
|
|
||||
}); |
|
||||
$(".p3-bottom button").eq(1).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p2").show(); |
|
||||
}); |
|
||||
//第四页 设置计划倒计时
|
|
||||
$(".p4-bottom button").eq(0).on("click",()=>{ |
|
||||
plan_name = $(".p4 input").eq(0).val(); |
|
||||
plan_time = $(".p4 input").eq(1).val() + " " + "08:00:00"; |
|
||||
if(isShowPlan){ |
|
||||
showPlan(); |
|
||||
} |
|
||||
saveSetting(); |
|
||||
// alert("完成!");
|
|
||||
// console.log(plan_name);
|
|
||||
}); |
|
||||
$(".p4-bottom button").eq(1).on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p2").show(); |
|
||||
}); |
|
||||
//第五页返回
|
|
||||
$(".p5").on("click",()=>{ |
|
||||
$(".page").hide(); |
|
||||
$(".p2").show(); |
|
||||
myChart.clear(); |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
|
|
||||
//开始初始化,设置计时器
|
|
||||
|
|
||||
loadLocalData(); |
|
||||
|
|
||||
setInterval(()=>{ |
|
||||
showTopBar(); |
|
||||
//如果倒计时归零
|
|
||||
if(!res_time){ |
|
||||
isRest = !isRest; |
|
||||
//该休息了
|
|
||||
if(isRest){ |
|
||||
$(".top-left").html(icon_rest+"休息中"); |
|
||||
playSound('rest'); |
|
||||
res_time = t_rest; |
|
||||
} |
|
||||
//该工作了
|
|
||||
else{ |
|
||||
$(".top-left").html(icon_study+"工作中"); |
|
||||
playSound('work'); |
|
||||
res_time = t_study; |
|
||||
} |
|
||||
} |
|
||||
//如果在播放
|
|
||||
if (isPlay && !isClock){ |
|
||||
if(!isRest){ |
|
||||
$(".top-left").html(icon_study+"工作中"); |
|
||||
study_time++; |
|
||||
} |
|
||||
res_time--; |
|
||||
saveStudyTime(); |
|
||||
showRestTime(); |
|
||||
} |
|
||||
},1000); |
|
||||
}); |
|
File diff suppressed because one or more lines are too long
@ -1,304 +0,0 @@ |
|||||
// 初始化变量和常量
|
|
||||
const icon_play = ""; |
|
||||
const icon_stop = ""; |
|
||||
const icon_study = ""; |
|
||||
const icon_rest = ""; |
|
||||
let t_study = 45*60; |
|
||||
let t_rest = 5*60; |
|
||||
let plan_name = "godo发布"; |
|
||||
let plan_time = "2021/12/31 18:00:00"; |
|
||||
let isPlay = false; |
|
||||
let isRest = false; |
|
||||
let isShowPlan = false; |
|
||||
let isClock = false; |
|
||||
let localData = {}; |
|
||||
let today = null; |
|
||||
let res_time = t_study; |
|
||||
let study_time = 0; |
|
||||
//获取现在的日期并返回
|
|
||||
function getToday(){ |
|
||||
let t = new Date(); |
|
||||
let day = t.getDate(); |
|
||||
let month = t.getMonth() +1 ; |
|
||||
let year = t.getFullYear(); |
|
||||
let tmp = year + |
|
||||
(month < 10 ? "0" + month : month) + |
|
||||
(day < 10 ? "0" + day : day); |
|
||||
return tmp; |
|
||||
} |
|
||||
//更新today变量为最新的当前日期
|
|
||||
function updateToday(){ |
|
||||
today = getToday(); |
|
||||
} |
|
||||
|
|
||||
//读取本地的存储,放到localDate对象中
|
|
||||
function loadLocalData(){ |
|
||||
updateToday(); |
|
||||
//如果存在本地数据
|
|
||||
if(window.localStorage && window.localStorage.length){ |
|
||||
for (let i=0;i<window.localStorage.length;i++){ |
|
||||
let date = window.localStorage.key(i); |
|
||||
let data = window.localStorage.getItem(date); |
|
||||
localData[date] = data; |
|
||||
} |
|
||||
//console.log('本地数据读取完成:'+JSON.stringify(localData));
|
|
||||
//如果有今天的数据,那今天的工作时间叠加
|
|
||||
if(localData[today]){ |
|
||||
study_time+=localData[today]; |
|
||||
} |
|
||||
if(localData['plan-name']){ |
|
||||
plan_name = localData['plan-name']; |
|
||||
$(".p4 input").eq(0).val(plan_name); |
|
||||
} |
|
||||
if(localData['plan-time']){ |
|
||||
plan_time = localData['plan-time']; |
|
||||
$(".p4 input").eq(1).val(plan_time.substr(0,10)); |
|
||||
} |
|
||||
if(localData['t_rest']){ |
|
||||
t_rest = localData['t_rest']; |
|
||||
$(".p3 input").eq(1).val(t_rest/60); |
|
||||
} |
|
||||
if(localData['t_study']){ |
|
||||
t_study = localData['t_study']; |
|
||||
$(".p3 input").eq(0).val(t_study/60); |
|
||||
res_time = t_study; |
|
||||
showRestTime(); |
|
||||
} |
|
||||
} |
|
||||
else { |
|
||||
study_time = 0; |
|
||||
} |
|
||||
} |
|
||||
//把剩余的秒数计算成四个要显示的数字并返回
|
|
||||
function calTime(t){ |
|
||||
let min = Math.floor(t/60); |
|
||||
let sec = t %60; |
|
||||
return [Math.floor(min/10) , min%10 , Math.floor(sec/10) , sec %10]; |
|
||||
} |
|
||||
//更新计数器时间
|
|
||||
function showRestTime(){ |
|
||||
let arr = calTime(res_time); |
|
||||
$("#n1").text(arr[0]); |
|
||||
if(arr[0]==1){ |
|
||||
$("#n1").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n1").css("transform","none"); |
|
||||
} |
|
||||
$("#n2").text(arr[1]); |
|
||||
if(arr[1]==1){ |
|
||||
$("#n2").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n2").css("transform","none"); |
|
||||
} |
|
||||
$("#n4").text(arr[2]); |
|
||||
if(arr[2]==1){ |
|
||||
$("#n4").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n4").css("transform","none"); |
|
||||
} |
|
||||
$("#n5").text(arr[3]); |
|
||||
if(arr[3]==1){ |
|
||||
$("#n5").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n5").css("transform","none"); |
|
||||
} |
|
||||
} |
|
||||
//更新现在的时间和电量
|
|
||||
function showNowTime(){ |
|
||||
let t = new Date(); |
|
||||
let h = t.getHours(); |
|
||||
h = h < 10 ? "0" + h : h; |
|
||||
let m = t.getMinutes(); |
|
||||
m = m < 10 ? "0" + m : m; |
|
||||
let s = t.getSeconds(); |
|
||||
s = s < 10 ? "0" + s : s; |
|
||||
if(navigator.getBattery){ |
|
||||
navigator.getBattery().then((result)=>{ |
|
||||
$(".now-time").text(h + ":" + m + ":" + s +" 电量:"+parseInt(result.level*100)+"%") ; |
|
||||
}) |
|
||||
} |
|
||||
else { |
|
||||
$(".now-time").text(h + ":" + m + ":" + s); |
|
||||
} |
|
||||
//是否开启钟表模式
|
|
||||
if(isClock){ |
|
||||
//console.log(h+m);
|
|
||||
let arr = [h.toString()[0],h.toString()[1],m.toString()[0],m.toString()[1]] |
|
||||
$("#n1").text(arr[0]); |
|
||||
$("#n2").text(arr[1]); |
|
||||
$("#n4").text(arr[2]); |
|
||||
$("#n5").text(arr[3]); |
|
||||
if(arr[0]==1){ |
|
||||
$("#n1").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n1").css("transform","none"); |
|
||||
} |
|
||||
$("#n2").text(arr[1]); |
|
||||
if(arr[1]==1){ |
|
||||
$("#n2").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n2").css("transform","none"); |
|
||||
} |
|
||||
$("#n4").text(arr[2]); |
|
||||
if(arr[2]==1){ |
|
||||
$("#n4").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n4").css("transform","none"); |
|
||||
} |
|
||||
$("#n5").text(arr[3]); |
|
||||
if(arr[3]==1){ |
|
||||
$("#n5").css("transform","translate(30%)"); |
|
||||
} |
|
||||
else { |
|
||||
$("#n5").css("transform","none"); |
|
||||
} |
|
||||
} |
|
||||
else{ |
|
||||
showRestTime(); |
|
||||
} |
|
||||
} |
|
||||
//更新计划倒计时
|
|
||||
function showPlan(){ |
|
||||
let t = new Date(); |
|
||||
let t0 = new Date(plan_time); |
|
||||
let ss = t0.getTime() - t.getTime(); |
|
||||
let r_plan_days = parseInt(ss / 1000/60/60/24); |
|
||||
let r_plan_hours = parseInt((ss / 1000/60/60)%24); |
|
||||
$(".top-right").text("距" + plan_name+"还有:" + r_plan_days + "天" + r_plan_hours + "小时"); |
|
||||
} |
|
||||
//存储工作时间
|
|
||||
function saveStudyTime(){ |
|
||||
console.log('存储数据'); |
|
||||
if (getToday()!==today){ |
|
||||
study_time = 0 ; |
|
||||
updateToday(); |
|
||||
} |
|
||||
localData[today]=study_time.toFixed(2); |
|
||||
window.localStorage.setItem(today,study_time); |
|
||||
} |
|
||||
//更新今天已工作时间
|
|
||||
function showStudyTime(){ |
|
||||
$(".top-right").text("今天已工作:" + |
|
||||
String(Math.floor(study_time / 60)) + |
|
||||
"分钟" + |
|
||||
String(study_time % 60) + |
|
||||
"秒"); |
|
||||
} |
|
||||
|
|
||||
//更新最上面一栏
|
|
||||
function showTopBar(){ |
|
||||
showNowTime(); |
|
||||
if(isShowPlan){ |
|
||||
showPlan(); |
|
||||
} |
|
||||
else{ |
|
||||
showStudyTime(); |
|
||||
} |
|
||||
} |
|
||||
//保存数据
|
|
||||
function saveSetting (){ |
|
||||
localData['plan-name'] = plan_name; |
|
||||
localData['plan-time'] = plan_name; |
|
||||
localData['t_study'] = t_study; |
|
||||
localData['t_rest'] = t_rest; |
|
||||
window.localStorage.setItem('plan-name',plan_name); |
|
||||
window.localStorage.setItem('plan-time',plan_time); |
|
||||
window.localStorage.setItem('t_study',t_study); |
|
||||
window.localStorage.setItem('t_rest',t_rest); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
//展示图表
|
|
||||
function showEcharts(){ |
|
||||
//console.log("缓存数据:"+ window.localStorage);
|
|
||||
//console.log('localData'+localData);
|
|
||||
let myChart = echarts.init(document.getElementById('echarts')); |
|
||||
let dateArr = []; |
|
||||
let timeArr = []; |
|
||||
let re = /^20[0-9]{2}/; |
|
||||
for (let i in localData){ |
|
||||
if(re.test(i)){ |
|
||||
timeArr.push((localData[i]/60).toFixed(2)); |
|
||||
//处理原来的数据
|
|
||||
let re1 = /^0/; |
|
||||
if (re1.test(i.substr(4,4))){ |
|
||||
dateArr.push(i[5]+'/'+i[6]+i[7]); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//处理数据补0
|
|
||||
if (dateArr.length<4){ |
|
||||
let n = 4 - dateArr.length; |
|
||||
if (dateArr.length==0){ |
|
||||
let t = new Date(); |
|
||||
t = t.getMonth()+1 + '/'+t.getDate(); |
|
||||
dateArr.push(t); |
|
||||
timeArr.push(0); |
|
||||
} |
|
||||
for (let j=0;j<n;j++){ |
|
||||
let t = new Date(); |
|
||||
t=t.setDate(t.getDate()+j+1); |
|
||||
t = new Date(t); |
|
||||
dateArr.push(t.getMonth()+1+'/'+t.getDate()); |
|
||||
timeArr.push(0); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
// console.log(dateArr);
|
|
||||
// console.log(timeArr);
|
|
||||
let option = { |
|
||||
title: { |
|
||||
text: '工作记录', |
|
||||
subtext: '任意点击返回', |
|
||||
subtextStyle: { |
|
||||
align: 'right' |
|
||||
}, |
|
||||
left: 'center', |
|
||||
icon : 'none', |
|
||||
textStyle: { |
|
||||
fontSize: 26 |
|
||||
}, |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
|
|
||||
xAxis: { |
|
||||
data: dateArr, |
|
||||
name: '日期' |
|
||||
}, |
|
||||
yAxis: { |
|
||||
name: '工作时间/分钟', |
|
||||
max: function(value){ |
|
||||
return value.max<30?30:value.max; |
|
||||
} |
|
||||
}, |
|
||||
series: [{ |
|
||||
name: '时间(分)', |
|
||||
type: 'bar', |
|
||||
data: timeArr, |
|
||||
barMaxWidth: '40%', |
|
||||
itemStyle:{ |
|
||||
color: '#555', |
|
||||
normal: { |
|
||||
label: { |
|
||||
show: true, |
|
||||
position: 'top', |
|
||||
formatter: '{c}分钟' |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
}] |
|
||||
}; |
|
||||
myChart.setOption(option); |
|
||||
return myChart; |
|
||||
} |
|
@ -1,18 +0,0 @@ |
|||||
{ |
|
||||
"name": "todo", |
|
||||
"version": "0.0.1", |
|
||||
"description": "todo worker", |
|
||||
"main": "frontend/index.html", |
|
||||
"icon":"", |
|
||||
"position":["desktop","magnet"], |
|
||||
"width":800, |
|
||||
"height":600, |
|
||||
"usetype":["person","member","compony"], |
|
||||
"category":["work","life","productivity"], |
|
||||
"releases":[""], |
|
||||
"platform": "any", |
|
||||
"arch": "any", |
|
||||
"author": "aiok", |
|
||||
"license": "MIT", |
|
||||
"dependencies": {} |
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
{ |
|
||||
"name" : "godoos", |
|
||||
"version" : "0.0.1", |
|
||||
"description" : "godoos", |
|
||||
"main" : "frontend", |
|
||||
"platform" : ["windows","darwin","linux"], |
|
||||
"author" : "aiok", |
|
||||
"license" : "MIT", |
|
||||
"dependencies" : {} |
|
||||
} |
|
Loading…
Reference in new issue