Skip to content

Commit

Permalink
我写代码像蔡徐坤
Browse files Browse the repository at this point in the history
  • Loading branch information
interestingLSY committed Jul 23, 2019
1 parent 5bf2588 commit 2384bcc
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 85 deletions.
1 change: 1 addition & 0 deletions web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def Login():
def Logout():
try:
link = request.args['url'] if 'url' in request.args else '/'
if link == '/logout': link = '/'
resp = make_response(redirect(link))
resp.delete_cookie('username')
resp.delete_cookie('client_key')
Expand Down
4 changes: 2 additions & 2 deletions web/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ p{

a{
color: #4183c4;
text-decoration:none;
text-decoration: none;
transition: all 0.2s;
}
a.uncolored{ color: inherit !important; }
a:hover{ color: #FF0000; }
a:focus{ outline:0; }
a.uncolored{ color: inherit !important; }
a.full{ width: 100%; display: block; }
p code{
margin: auto 2px;
Expand Down
39 changes: 39 additions & 0 deletions web/static/css/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,42 @@ div.tagsblock{
margin-bottom: 10px;
background-color: #ffffff00 !important;
}

.column{
height: 100%;
display: flex;
flex-direction: column;
}
.centered{
margin: auto;
}
.row{
display: flex;
flex-direction: row;
width: 100%;
}
.item-vertical-centered:not(.column){ /* 竖直方向上居中 */
display: flex;
align-items: center;
}
.item-horizontal-centered:not(.column){ /* 水平方向上居中 */
display: flex;
justify-content: center;
}
.item-centered{ /* 两个方向上同时居中 */
display: flex;
align-items: center;
justify-content: center;
}
.item-vertical-centered.column{ /* 竖直方向上居中 */
display: flex;
justify-content: center;
}
.item-horizontal-centered.column{ /* 水平方向上居中 */
display: flex;
align-items: center;
}

.hover-animation{ transition: .1s; }
.hover-animation:hover{ background-color: #eee; }
.hover-animation-ddd:hover{ background-color: #ddd; }
177 changes: 94 additions & 83 deletions web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,87 +46,98 @@
</head>
<body onresize="Resize();" onload="Render();Resize();Cannotselect();Icheck_Init();Wrap()">
<script> Messagerinit(); </script>
<div class="ui topbar">
<div class="topbar-container" style="margin: 0px auto;">
<a href="/"> <span class="topbaritem"> <img src="/static/pic/icon1.png" style="height: 50px;"> </img> </span> </a>
<a href="/" style="flex: 2;" class="uncolored">
<span class="topbaritem onewidth unselect {% block selected_home %}{% endblock %}">
<div class="topbarindex"> <i class="icon-home" aria-hidden="true"></i>
<span class="topbarword"> 首页 </span>
<div class="ui row item-centered" style="position: fixed; top: 0px; left: 0px; z-index: 233;">
<div class="column" style="width: 100%; max-width: 1100px;">
<div class="row item-centered" style="width: 100%;">
<a href="/" style="flex: 2; height: 100%;">
<span style="display: flex; align-items: center;">
<img src="/static/pic/icon1.png" style="height: 50px;"> </img>
</span>
</a>
<a href="/" style="flex: 2; height: 100%;" class="uncolored hover-animation-ddd">
<div class="column item-centered">
<div class="row item-centered">
<i class="icon-home" aria-hidden="true" style="font-size: 22px; margin-right: 4px;"> </i>
<span style="font-size: 18px"> 首页 </span>
</div>
</div>
</span>
</a>
<a href="/problemlist" style="flex: 2;" class="uncolored">
<span class="topbaritem onewidth unselect {% block selected_problem %}{% endblock %}">
<div class="topbarindex"> <i class="icon-list" aria-hidden="true"></i>
<span class="topbarword"> 题目 </span>
</a>
<a href="/problemlist" style="flex: 2; height: 100%;" class="uncolored hover-animation-ddd">
<div class="column item-centered">
<div class="row item-centered">
<i class="icon-list" aria-hidden="true" style="font-size: 22px; margin-right: 4px;"> </i>
<span style="font-size: 18px"> 题目 </span>
</div>
</div>
</span>
</a>
<a href="/contestlist" style="flex: 2;" class="uncolored">
<span class="topbaritem onewidth unselect {% block selected_contest %}{% endblock %}">
<div class="topbarindex"> <i class="icon-fire" aria-hidden="true"></i>
<span class="topbarword"> 比赛 </span>
</a>
<a href="/contestlist" style="flex: 2; height: 100%;" class="uncolored hover-animation-ddd">
<div class="column item-centered">
<div class="row item-centered">
<i class="icon-fire" aria-hidden="true" style="font-size: 22px; margin-right: 4px;"> </i>
<span style="font-size: 18px"> 比赛 </span>
</div>
</div>
</span>
</a>
<a href="/status" style="flex: 2;" class="uncolored">
<span class="topbaritem onewidth unselect {% block selected_status %}{% endblock %}">
<div class="topbarindex"> <i class="icon-tasks" aria-hidden="true"></i>
<span class="topbarword"> 评测 </span>
</a>
<a href="/status" style="flex: 2; height: 100%;" class="uncolored hover-animation-ddd">
<div class="column item-centered">
<div class="row item-centered">
<i class="icon-tasks" aria-hidden="true" style="font-size: 22px; margin-right: 4px;"> </i>
<span style="font-size: 18px"> 评测 </span>
</div>
</div>
</span>
</a>
<a href="/help" style="flex: 2;" class="uncolored">
<span class="topbaritem onewidth unselect {% block selected_help %}{% endblock %}">
<div class="topbarindex"> <i class="icon-question-sign" aria-hidden="true"></i>
<span class="topbarword"> 帮助 </span>
</a>
<a href="/help" style="flex: 2; height: 100%;" class="uncolored hover-animation-ddd">
<div class="column item-centered">
<div class="row item-centered">
<i class="icon-question-sign" aria-hidden="true" style="font-size: 22px; margin-right: 4px;"> </i>
<span style="font-size: 18px"> 帮助 </span>
</div>
</div>
</a>
<span style="flex: 2;">
</span>
</a>
<span class="topbaritem-noanimation onewidth" style="flex: 2;">
</span>
{% if Is_Loggedin() %}
<span class="topbaritem unselect" style="width:auto">
<span class="button-dropdown button-dropdown-primary" data-buttons="dropdown">
<button class="button button-large button-nobg" style="padding: 0px 10px; width:200px;">
{{- request.cookies['username'] -}} &nbsp; <i class="icon-caret-down"> </i>
</button>
<div class="button-dropdown-list is-below list" style="background-color: #eeeeee;">
<a class="uncolored" href="/user/{{request.cookies['username']}}">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-home"></i> &nbsp; &nbsp; 个人中心
</div>
</a>
<a class="uncolored" href="/user/{{request.cookies['username']}}/edit">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-edit"></i> &nbsp; &nbsp; 编辑资料
</div>
{% if Is_Loggedin() %}
<span class="hover-animation-ddd" style="width:auto">
<span class="button-dropdown button-dropdown-primary" data-buttons="dropdown">
<button class="button button-large button-nobg" style="padding: 0px 10px; width:200px;">
{{- request.cookies['username'] -}} &nbsp; <i class="icon-caret-down"> </i>
</button>
<div class="button-dropdown-list is-below list" style="background-color: #eeeeee;">
<a class="uncolored" href="/user/{{request.cookies['username']}}">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-home"></i> &nbsp; &nbsp; 个人中心
</div>
</a>
<a class="uncolored" href="/user/{{request.cookies['username']}}/edit">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-edit"></i> &nbsp; &nbsp; 编辑资料
</div>
</a>
<a class="uncolored" href="/logout?url={{request.url}}">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-off"></i> &nbsp; &nbsp; 注销
</div>
</a>
</div>
</span>
</span>
{% else %}
<span style="width:80px; flex-grow:0">
<a href="/login?url={{request.url}}" class="uncolored">
<button class="button button-small button-primary button-rounded" style="width: 70px; padding: 0px 10px;">
登录
</button>
</a>
<a class="uncolored" href="/logout?url={{request.url}}">
<div class="listline listline-animation" style="display:flex; align-items:center; justify-content: flex-start;">
&nbsp; &nbsp; &nbsp; <i class="icon-off"></i> &nbsp; &nbsp; 注销
</div>
</span>
<span style="width:80px; flex-grow:0">
<a href="/register" class="uncolored">
<button class="button button-small button-highlight button-rounded" style="width: 70px; padding: 0px 10px;">
注册
</button>
</a>
</div>
</span>
</span>
{% else %}
<span class="topbaritem-noanimation onewidth" style="width:80px; flex-grow:0">
<a href="/login?url={{request.url}}" class="uncolored">
<button class="button button-small button-primary button-rounded" style="width: 70px; padding: 0px 10px;">
登录
</button>
</a>
</span>
<span class="topbaritem-noanimation onewidth" style="width:80px; flex-grow:0">
<a href="/register" class="uncolored">
<button class="button button-small button-highlight button-rounded" style="width: 70px; padding: 0px 10px;">
注册
</button>
</a>
</span>
{% endif %}
</span>
{% endif %}
</div>
</div>
</div>
{% for ok in get_flashed_messages(category_filter=["ok"]) %}
Expand All @@ -144,16 +155,16 @@
{% if Is_Loggedin() %}
{% set background_url = Read_User_Byname(request.cookies['username'])['background_url'] %}
{% if background_url not in [None,''] %}
{% if background_url[0] == '#' %}
$("body").css('background-color','{{background_url}}')
$("body").css('background-image','initial')
{% else %}
var img = new Image();
img.src = '{{background_url}}'
img.onload = function(){
$("body").css('background-image','url("{{background_url}}")')
}
{% endif %}
{% if background_url[0] == '#' %}
$("body").css('background-color','{{background_url}}')
$("body").css('background-image','initial')
{% else %}
var img = new Image();
img.src = '{{background_url}}'
img.onload = function(){
$("body").css('background-image','url("{{background_url}}")')
}
{% endif %}
{% endif %}
{% endif %}
</script>
Expand Down

0 comments on commit 2384bcc

Please sign in to comment.