Skip to content

Commit

Permalink
按钮修改为左边悬浮,修复删除任务不删除日志BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
AragonSnow committed May 22, 2020
1 parent 4f07c51 commit 0919b93
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 24 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ __操作前请一定要记得备份数据库__<br>
个人项目精力有限,仅保证对Chrome浏览器的支持。如果测试了其他浏览器可以pull request让我修改。

因为需要测试,docker镜像会晚于gitHub几天更新

docker地址:[https://hub.docker.com/r/asdaragon/qiandao](https://hub.docker.com/r/asdaragon/qiandao)
docker部署命令:
``` docker run -d --name qiandao -p 12345:80 -v $(pwd)/qiandao/config:/usr/src/app/config asdaragon/qiandao ```

## 2020.5.22 更新
1. 分组增加折叠/展开功能
2. 顶部增加新建模板按钮,“↑”回到顶部, “↓”表示跳转到模板页面
2. 左侧增加新建模板按钮,“↑”回到顶部, “↓”表示跳转到模板页面
3. 修复删除任务时日志不删除bug

## 2020.5.19 更新
1. 添加手动检查模板更新的按钮。
Expand Down
5 changes: 4 additions & 1 deletion db/tasklog.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ def list(self, fields=None, limit=1000, **kwargs):
where += ' and %s = %s ORDER BY ctime DESC' % (self.escape(key), self.placeholder)
where_values.append(value)
for tasklog in self._select2dic(what=fields, where=where, where_values=where_values, limit=limit):
yield tasklog
yield tasklog

def delete(self, id):
self._delete(where="id=%s" % self.placeholder, where_values=(id, ))
5 changes: 4 additions & 1 deletion web/handlers/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ class TaskDelHandler(BaseHandler):
def post(self, taskid):
user = self.current_user
task = self.check_permission(self.db.task.get(taskid, fields=('id', 'userid', )), 'w')

logs = self.db.tasklog.list(taskid = taskid, fields=('id'))
for log in logs:
self.db.tasklog.delete(log['id'])
self.db.task.delete(task['id'])

referer = self.request.headers.get('referer', '/my/')
self.redirect(referer)

Expand Down
5 changes: 2 additions & 3 deletions web/static/my.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ form button {
}

header .container {
position: fixed;
width:100%;
z-index:9999;
position: relative;
/* 修改-顶部下划线border-bottom: 1px solid #eee */
/* 修改-新加-下划线阴影-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05) */
/* 修改-新加-下划线阴影 box-shadow:0 1px 1px rgba(0,0,0,.05); */
background: url(header.jpg) repeat-x #FFF;/* 修改-新加-头部图片 */
background-repeat: no-repeat;/* 修改-新加-头部图片 */
/* background-size:100% 100%; */
}
header .buttons {
position: absolute;
Expand Down
68 changes: 68 additions & 0 deletions web/tpl/back2top.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- 参考了 鹦鹉 的代码,在此致谢 -->
<!-- https://ezbox.idv.tw/131/back-to-top-button-without-images -->

<button type="button" id="BackTop" class="toTop-arrow" style="z-index: 100;">&#x2191;</button>
<button type="button" id="Back2tpl" class="toTop-arrow-down" style="z-index: 100;">&#x2193;</button>
<button type="button" id="newtplbtn" class="newtplclss" style="z-index: 100;">&#xFF0B;</button>
<script>
// 向上滚动的函数
$(function () {
$('#BackTop').click(function () {
$('html,body').animate({scrollTop: 0}, 500);
});
});
</script>

<script>
Back2tpl.onclick = function(){
$('html,body').scrollTop(document.getElementById("tplsection").scrollHeight)
}
</script>

<script>
newtplbtn.onclick = function(){
window.open('/har/edit','_blank',);
}
</script>

<style>
/* 按钮边框的大小、位置、样式 */
.toTop-arrow {
width: 3.5rem;
height: 3.5rem;
padding: 0;
margin: 0;
cursor: pointer;
position: fixed;
left: 1.5rem;
top: 1.5rem;
display: block;
}

/* 按钮边框的大小、位置、样式 */
.toTop-arrow-down {
width: 3.5rem;
height: 3.5rem;
padding: 0;
margin: 0;
cursor: pointer;
position: fixed;
left: 1.5rem;
top: 6rem;
display: block;
}


/* 按钮边框的大小、位置、样式 */
.newtplclss {
width: 3.5rem;
height: 3.5rem;
padding: 0;
margin: 0;
cursor: pointer;
position: fixed;
left: 1.5rem;
top: 10rem;
display: block;
}
</style>
11 changes: 1 addition & 10 deletions web/tpl/my.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
{% block body %}
{{ utils.header(current_user) }}

<div style="height:60px;"></div>
<section class="task", id="task section">
<div class="container">
<h2>
Expand Down Expand Up @@ -179,15 +178,7 @@ <h2>
}
}
</script>

<script>
scrollTplbtn.onclick = function(){
var a = document.getElementById("tplsection")
var b = a.scrollHeight
$('html,body').scrollTop(b)
}
</script>

{% include 'back2top.html' %}
{{ utils.modal_load() }}
{{ utils.apost() }}
{% endblock %}
8 changes: 0 additions & 8 deletions web/tpl/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ <h2 class="text-center">私有签到框架<sup>alpha</sup></h2>
<div class="buttons">
<a href="/" class="btn btn-default pull-left">首页</a>
{% if current_user %}
<a href="/har/edit" class="btn btn-default pull-left" target="_blank">添加模板</a>
<a id="scrollTopbtn" class="btn btn-default pull-left">&#x2191;</a>
<script>
scrollTopbtn.onclick = function(){
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
</script>
<a id="scrollTplbtn" class="btn btn-default pull-left">&#x2193;</a>
<a href="/logout" class="btn btn-default pull-right">登出</a>
{% else %}
<a href="/register" class="btn btn-default pull-right">注册</a>
Expand Down

0 comments on commit 0919b93

Please sign in to comment.