This commit is contained in:
ZaneYork 2024-09-12 18:00:26 +08:00
parent e5af152d14
commit aefcaf4311
2 changed files with 12 additions and 7 deletions

View File

@ -97,7 +97,7 @@ def dinner_update():
if not nickname:
return make_response(json.dumps(dict(code=-1, data="姓名必须填写")))
if not is_valid_user(nickname):
abort(403)
return make_response(json.dumps(dict(code=-1, data="你不能投票(*^_^*)")))
if not user_menu:
set_user_menu('', nickname)
return make_response(json.dumps(dict(code=0, data="OK")))

View File

@ -8,16 +8,16 @@
<div class="container text-center pt-5">
<p>每天8:00-17:30间开放匿名投票更新17:30以后允许发起抽签抽签结果确定后不可更改</p>
<p>第一名与第二名得票数相差不超过10%时随机抽签,按其得票数决定中签概率,否则选择第一名</p>
<p>投票结果仅供参考,最终解释权归部门总经理、副总经理所有</p>
{% for last_result in last_results %}
<p>今日{{ last_result }}最终得票数降低{{ 2 + loop.index0 }}0%</p>
{% endfor %}
<form id="inputForm" class="form-inline">
<div class="form-group">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">姓名</span>
<input type="text" id="inputName" class="form-control"
name="nickname"
value="{{ nickname }}">
<label class="input-group-text" for="inputName" id="basic-addon1">姓名</label>
<input type="text" class="form-control"
id="inputName" name="nickname" value="{{ nickname }}">
</div>
<div class="input-group mb-2">
<span class="input-group-addon">我选择</span>
@ -39,7 +39,7 @@
<button type="button" class="btn btn-primary" onclick="update()">更新</button>
<button type="button" class="btn btn-secondary" onclick="clearValue()">不吃</button>
<button type="button" id="btnRoll"
class="btn btn-secondary" {{ "" if can_roll == True else 'disabled="disabled"' | safe }}
class="btn btn-secondary{{ "" if can_roll == True else ' disabled="disabled"' | safe }}"
onclick="roll()">开始抽签
</button>
<div class="pt-3">
@ -89,6 +89,11 @@
<!--suppress JSUnresolvedReference -->
<script>
document.addEventListener('keydown', function (event) {
if (event.key === 'Enter' || event.keyCode === 13) {
update();
}
});
$("input[type=range]").change(function () {
const values = $("input[type=range]").map(function () {
return $(this).val();