样式优化
This commit is contained in:
parent
e3c9aacece
commit
6c77a4ba05
|
@ -7,10 +7,10 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container text-center pt-5">
|
<div class="container-fluid text-center pt-5">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<footer class="footer mt-auto py-3 bg-light">
|
<footer class="footer text-center mt-auto py-3 bg-light">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="pt-1 mb-3">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="dateSelect" class="form-select" aria-label="日期选择">
|
<select id="dateSelect" class="form-select" aria-label="日期选择">
|
||||||
|
@ -20,7 +19,6 @@
|
||||||
<button type="button" class="btn btn-outline-secondary" onclick="back()">返回</button>
|
<button type="button" class="btn btn-outline-secondary" onclick="back()">返回</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div id="main" style="width: 100%;height:400px;"></div>
|
<div id="main" style="width: 100%;height:400px;"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,17 @@
|
||||||
</div>
|
</div>
|
||||||
<form id="inputForm" class="form-inline" onsubmit="return false;">
|
<form id="inputForm" class="form-inline" onsubmit="return false;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<div class="accordion">
|
||||||
|
<div class="accordion-item">
|
||||||
|
<h2 class="accordion-header">
|
||||||
|
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#collapseMyChoice" aria-expanded="true"
|
||||||
|
aria-controls="collapseMyChoice">
|
||||||
|
我选择
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="collapseMyChoice" class="accordion-collapse collapse show">
|
||||||
|
<div class="accordion-body">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label class="input-group-text" for="inputName" id="basic-addon1">姓名</label>
|
<label class="input-group-text" for="inputName" id="basic-addon1">姓名</label>
|
||||||
|
@ -26,27 +37,25 @@
|
||||||
id="inputName" name="nickname" value="{{ user_menu.nickname }}">
|
id="inputName" name="nickname" value="{{ user_menu.nickname }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
|
||||||
<label class="input-group-addon">我选择</label>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3 row p-2">
|
<div class="mb-3 row p-2">
|
||||||
{% for choice in all_choice %}
|
{% for choice in all_choice %}
|
||||||
<div class="col-6 mb-1 p-1 border rounded {{ loop.cycle("rounded-end-0", "border-start-0 rounded-start-0") }}">
|
<div class="col-6 mb-1 p-1 border rounded {{ loop.cycle("rounded-end-0", "border-start-0 rounded-start-0") }}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="range{{ loop.index }}" class="col-12">
|
<label for="range{{ loop.index }}"
|
||||||
<span>{{ choice.label }} - </span>
|
class="col-12 d-flex justify-content-between align-items-center">
|
||||||
<span class="percentage">{{ '{:.2f}'.format((user_menu.menu.get(choice.name) or 0) * 100) }}</span>
|
<span>{{ choice.label }}</span>
|
||||||
<span>%</span>
|
<span class="percentage">{{ '{:.1f}'.format((user_menu.menu.get(choice.name) or 0) * 100) }}%</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="col-8">
|
<div class="col-sm-8 col-md-9 col-lg-10">
|
||||||
<input type="range" class="form-range" data-skip-falsy="true"
|
<input type="range" class="form-range" data-skip-falsy="true"
|
||||||
id="range{{ loop.index }}" name="choice[{{ choice.name }}]:number"
|
id="range{{ loop.index }}"
|
||||||
|
name="choice[{{ choice.name }}]:number"
|
||||||
min="0" max="10" step="1"
|
min="0" max="10" step="1"
|
||||||
value="{{ (user_menu.menu.get(choice.name) or 0) * 10 }}">
|
value="{{ (user_menu.menu.get(choice.name) or 0) * 10 }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-auto">
|
||||||
<input class="form-check-input" type="checkbox" name="dislike[]"
|
<input class="form-check-input" type="checkbox" name="dislike[]"
|
||||||
id="checkDislike{{ loop.index }}" value="{{ choice.name }}"
|
id="checkDislike{{ loop.index }}" value="{{ choice.name }}"
|
||||||
{{ 'checked' if choice.name in user_menu.dislike else '' }}>
|
{{ 'checked' if choice.name in user_menu.dislike else '' }}>
|
||||||
|
@ -58,26 +67,42 @@
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<button type="button" class="btn btn-outline-primary" onclick="update()">更新</button>
|
<button type="button" class="btn btn-outline-primary" onclick="update()">更新</button>
|
||||||
<button type="button" class="btn btn-outline-secondary" onclick="clearValue()">不吃</button>
|
<button type="button" class="btn btn-outline-secondary" onclick="clearValue()">不吃</button>
|
||||||
<button type="button" id="btnRoll"
|
<button type="button" id="btnRoll"
|
||||||
class="btn btn-outline-secondary" {{ "" if can_roll == True else ' disabled="disabled"' | safe }}
|
class="btn btn-outline-secondary" {{ "" if can_roll == True else ' disabled="disabled"' | safe }}
|
||||||
onclick="roll()">开始抽签
|
onclick="roll()">开始抽签
|
||||||
</button>
|
</button>
|
||||||
<div class="pt-3">
|
|
||||||
<label>大家的选择 - 总投票人数:{{ total_vote }}</label>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-item">
|
||||||
|
<h2 class="accordion-header">
|
||||||
|
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#collapseAllChoice" aria-expanded="true"
|
||||||
|
aria-controls="collapseAllChoice">
|
||||||
|
大家的选择
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="collapseAllChoice" class="accordion-collapse collapse show">
|
||||||
|
<div class="accordion-body">
|
||||||
|
<label class="d-flex justify-content-between">
|
||||||
|
总投票人数:{{ total_vote }}
|
||||||
|
</label>
|
||||||
<ul class="list-group pt-2 mb-4">
|
<ul class="list-group pt-2 mb-4">
|
||||||
{% for key in summary_keys %}
|
{% for key in summary_keys %}
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center{{ " active" if result == key else "" }} {{ " list-group-item-primary" if predict_result == key else "" }}">
|
<li class="list-group-item d-flex justify-content-between align-items-center{{ " active" if result == key else "" }} {{ " list-group-item-primary" if predict_result == key else "" }}">
|
||||||
<span class="col-5">{{ key }}</span>
|
<span class="col-5">{{ key }}</span>
|
||||||
<span class="col-3">{{ '{:.2f}'.format(summary[key] | round(2)) }}票</span>
|
<span class="col-3">{{ '{:.1f}'.format(summary[key] | round(2)) }}票</span>
|
||||||
<span class="col-3">{{ '{:.2f}'.format(summary[key] / total_vote * 100 | round(2)) }}%</span>
|
<span class="col-3">{{ '{:.1f}'.format(summary[key] / total_vote * 100 | round(2)) }}%</span>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="list-group-item">
|
||||||
|
<span>大家还没有选择</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
{% if (users|length) > 3 %}
|
{% if (users|length) > 3 %}
|
||||||
<div class="pt-1 mb-3">
|
<div class="pt-1 mb-3">
|
||||||
<label class="mb-2">参与投票人员</label>
|
<label class="mb-2">参与投票人员</label>
|
||||||
|
@ -98,8 +123,20 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-item">
|
||||||
|
<h2 class="accordion-header">
|
||||||
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#collapseRecentResult" aria-expanded="false"
|
||||||
|
aria-controls="collapseRecentResult">
|
||||||
|
最近点餐结果
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="collapseRecentResult" class="accordion-collapse collapse">
|
||||||
|
<div class="accordion-body">
|
||||||
<div class="pt-1 mb-3">
|
<div class="pt-1 mb-3">
|
||||||
<label class="mb-2">最近点餐结果</label>
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for recent_result in recent_results %}
|
{% for recent_result in recent_results %}
|
||||||
<li onclick="viewChart('{{ recent_result.datestr }}')"
|
<li onclick="viewChart('{{ recent_result.datestr }}')"
|
||||||
|
@ -110,6 +147,12 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
@ -130,7 +173,7 @@
|
||||||
const summary = values.reduce((a, b) => parseInt(a) + parseInt(b));
|
const summary = values.reduce((a, b) => parseInt(a) + parseInt(b));
|
||||||
const spans = $(".percentage")
|
const spans = $(".percentage")
|
||||||
for (let i = 0; i < values.length; i++) {
|
for (let i = 0; i < values.length; i++) {
|
||||||
spans[i].innerHTML = summary > 0 ? (parseFloat(values[i]) * 100 / summary).toFixed(2) : '0.00';
|
spans[i].innerHTML = (summary > 0 ? (parseFloat(values[i]) * 100 / summary).toFixed(1) : '0.0') + '%';
|
||||||
if (values[i] > 0 && checkBoxs[i].checked) {
|
if (values[i] > 0 && checkBoxs[i].checked) {
|
||||||
checkBoxs[i].checked = false;
|
checkBoxs[i].checked = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue