flask编制备注信息收集框架, 待完善

This commit is contained in:
weiye.wang 2024-05-10 23:23:20 +08:00
parent 426eb6008e
commit b27296befd
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Save Data</title>
</head>
<body>
<form method="POST">
<label for="text1">题号:</label>
<input type="text" id="text1" name="text1"><br><br>
<label for="text2">备注内容:</label>
<input type="text" id="text2" name="text2"><br><br>
<label for="category">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="Save Data">
</form>
</body>
</html>

View File

@ -0,0 +1,19 @@
from flask import Flask, render_template, request
from database_tools_2 import *
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
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")
return "备注收集完成, 感谢支持数据库建设"
return render_template('remarkindex.html')
if __name__ == '__main__':
app.run(debug=True)