效果

在这里插入图片描述

源码

Html

<div style="text-align: center;">
    <h1>查询平台</h1>
    <form action="/search" method="post">
        <p><input type="text" name="brand" placeholder="品牌,例如: 惠普" size="20"></p>
        <p><input type="text" name="model" placeholder="型号, 例如: lbp3000" size="20"></p>
        <p>
            操作系统
            <select style="width: 160px" name="os">
                <option selected="selected" value="all" name="all">全部</option>
                <option value="uos" name="uos">UOS</option>
                <option value="kylin" name="kylin">Kylin</option>
            </select>
        </p>
        <input type="submit" value="查询">
    </form>
</div>

Python3

#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
@File    :   main.py
@Time    :   2023-02-19 13:56
@Author  :   坐公交也用券
@Version :   1.0
@Contact :   faith01238@hotmail.com
@Homepage : https://liumou.site
@Desc    :   当前文件作用
"""
from ColorInfo import ColorLogger
from flask import Flask, render_template, request

app = Flask(__name__, template_folder="templates")
logger = ColorLogger()


@app.route("/", methods=['GET', 'POST'])  # 首页
def index():
	return render_template("index.html")


# return render_template("login.html")


@app.route("/search", methods=['GET', 'POST'])  # 数据查询
def search():
	# 获取数据
	brand = request.form.get("brand")  # 获取品牌
	model = request.form.get("model")  # 获取型号
	uos = request.values.get("os")  # 获取系统类型
	logger.debug("品牌: ", brand)
	logger.debug("型号: ", model)
	logger.debug("UOS: ", uos)
	return render_template("res.html", result="man.Result", path="/liuyi")


if __name__ == "__main__":
	app.run(host="localhost", port=9091, debug=True)