|
@@ -7,8 +7,9 @@
|
|
|
<form action="/simple_backtest" method="post" enctype="multipart/form-data" class="mb-3">
|
|
<form action="/simple_backtest" method="post" enctype="multipart/form-data" class="mb-3">
|
|
|
<div class="input-group mb-3">
|
|
<div class="input-group mb-3">
|
|
|
<div class="custom-file">
|
|
<div class="custom-file">
|
|
|
- <input type="file" class="custom-file-input" name="file" id="fileInput">
|
|
|
|
|
- <label class="custom-file-label" for="fileInput">文件路径</label>
|
|
|
|
|
|
|
+ <input type="file" class="custom-file-input" name="file" id="fileInput"
|
|
|
|
|
+ onchange="updateLabel()">
|
|
|
|
|
+ <label class="custom-file-label" for="fileInput">选择文件</label>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="input-group-append">
|
|
<div class="input-group-append">
|
|
|
<button class="btn btn-outline-secondary" type="submit">上传</button>
|
|
<button class="btn btn-outline-secondary" type="submit">上传</button>
|
|
@@ -19,7 +20,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{% if tables %}
|
|
{% if tables %}
|
|
|
- <h2 class="text-center">分析结果</h2>
|
|
|
|
|
|
|
+ <h2 class="text-center">{{ file_name }}分析结果</h2>
|
|
|
<div class="table-responsive">
|
|
<div class="table-responsive">
|
|
|
{% for table in tables %}
|
|
{% for table in tables %}
|
|
|
{{ table|safe }}
|
|
{{ table|safe }}
|
|
@@ -28,4 +29,24 @@
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
-{% endblock %}
|
|
|
|
|
|
|
+ <script>
|
|
|
|
|
+ // 当文件选择变化时,保存文件名到本地存储
|
|
|
|
|
+ function updateLabel() {
|
|
|
|
|
+ var input = document.getElementById('fileInput');
|
|
|
|
|
+ var label = input.nextElementSibling;
|
|
|
|
|
+ var fileName = input.files[0].name;
|
|
|
|
|
+ label.innerHTML = fileName;
|
|
|
|
|
+ localStorage.setItem('lastUploadedFileName', fileName); // 保存文件名到本地存储
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 页面加载完成后,检查是否有保存的文件名
|
|
|
|
|
+ document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
|
+ var lastFileName = localStorage.getItem('lastUploadedFileName');
|
|
|
|
|
+ if (lastFileName) {
|
|
|
|
|
+ var label = document.querySelector('.custom-file-label');
|
|
|
|
|
+ label.innerHTML = lastFileName;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ </script>
|
|
|
|
|
+
|
|
|
|
|
+{% endblock %}
|