flask输入备注信息建设中, 显示图片问题已解决
This commit is contained in:
parent
0cb9f98575
commit
515e17b1b8
|
|
@ -11,3 +11,4 @@
|
|||
*使用指南*.html
|
||||
**/*test*
|
||||
*.sh
|
||||
*static
|
||||
|
|
|
|||
|
|
@ -10,5 +10,19 @@ def index():
|
|||
return render_template('result.html', checkboxes=selected_checkboxes, radioboxes=selected_radioboxes)
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/testhello')
|
||||
def hello():
|
||||
return "Hello World"
|
||||
|
||||
|
||||
@app.route('/blog/<int:blog_id>')
|
||||
def blog_detail(blog_id):
|
||||
return f"您访问的博客是: {blog_id}"
|
||||
|
||||
@app.route('/book/list')
|
||||
def book_list():
|
||||
page = request.args.get("page", default=1, type=int)
|
||||
return f"您获取的是第{page}页图书列表"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
|
@ -1,29 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Flask App</title>
|
||||
<style>
|
||||
.checkbox-container {
|
||||
margin-right: 20px; /* Adjust the value to increase or decrease the horizontal spacing */
|
||||
}
|
||||
</style>
|
||||
<title>登记备注</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World</h1>
|
||||
<form method="POST">
|
||||
<div style="display: flex;">
|
||||
<div class="checkbox-container">
|
||||
<input type="checkbox" name="checkbox" value="Checkbox 1"> Checkbox 1<br>
|
||||
<input type="checkbox" name="checkbox" value="Checkbox 2"> Checkbox 2<br>
|
||||
<input type="checkbox" name="checkbox" value="Checkbox 3"> Checkbox 3<br>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="radiobox" value="Radiobox 1"> Radiobox 1<br>
|
||||
<input type="radio" name="radiobox" value="Radiobox 2"> Radiobox 2<br>
|
||||
<input type="radio" name="radiobox" value="Radiobox 3"> Radiobox 3<br>
|
||||
<input type="radio" name="radiobox" value="Radiobox 4"> Radiobox 4<br>
|
||||
</div>
|
||||
</div>
|
||||
<h1>登记备注</h1>
|
||||
<form action="/show_image" method="POST">
|
||||
<label for="question_number">题号:</label>
|
||||
<input type="text" id="question_number" name="question_number">
|
||||
<input type="submit" value="提交">
|
||||
</form>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>输入备注</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>输入备注</h1>
|
||||
<form action="/submit_remarks" method="POST">
|
||||
<label for="remarks">输入备注:</label>
|
||||
<textarea id="remarks" name="remarks"></textarea><br><br>
|
||||
<label for="category">选择备注类型:</label>
|
||||
<select id="category" name="category">
|
||||
<option value="主要错误">主要错误</option>
|
||||
<option value="主要错因">主要错因</option>
|
||||
<option value="主要错因">批改建议</option>
|
||||
<option value="其他">其它</option>
|
||||
</select><br><br>
|
||||
<input type="submit" value="提交备注">
|
||||
</form>
|
||||
<h1>题目内容</h1>
|
||||
<img src="{{ image_path }}" alt="Question Image">
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>显示备注</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>显示备注</h1>
|
||||
<p>备注类型: {{ category }}</p>
|
||||
<p>备注内容: {{ remarks }}</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,19 +1,25 @@
|
|||
from flask import Flask, render_template, request
|
||||
from database_tools_2 import *
|
||||
from flask import Flask, render_template, request, redirect, url_for
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/show_image', methods=['POST'])
|
||||
def show_image():
|
||||
if request.method == 'POST':
|
||||
text1 = request.form['text1']
|
||||
text2 = request.form['text2']
|
||||
category = request.form['category']
|
||||
AppendTextFile(f"{text1.zfill(6)}\n({GetDate()}{category}){RefinePunctuations(text2)}\n","临时文件/备注收集.txt")
|
||||
global question_number
|
||||
question_number = request.form['question_number']
|
||||
|
||||
return "备注收集完成, 感谢支持数据库建设"
|
||||
return render_template('show_image.html', image_path=f'/static/{question_number}.png')
|
||||
|
||||
return render_template('remarkindex.html')
|
||||
@app.route('/submit_remarks', methods=['POST'])
|
||||
def submit_remarks():
|
||||
category = request.form['category']
|
||||
remarks = request.form['remarks']
|
||||
return render_template('show_remarks.html', category=category, remarks=remarks)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
Reference in New Issue