题目:好家园房产中介网后台管理

一、语言和环境
1.实现语言:python语言。
2.环境要求:pycharm + mysql。
在Bootstrap这里下载js和css
在echarts在柱状图
二、实现功能
使用flask技术开发“好家园房产中介网”的后台管理功能,具体实现功能如下:
1.首页index.html显示现有的所有房产信息,如图1所示。

图1显示所有房产信息
2.点击页面中的“发布住房信息”超链接,跳转到发布房产页面addHouse.html,初始的页面效果如 下图2所示。该页面首次加载时要从数据库中读取所有的房型信息,并显示在下拉列表框中。

图2 添加房产信息
2.点击图2中 “提交”按钮后,即可实现将用户输入的有效房产信息添加到对应的数据表中。并提示操作成功
3.点击页面中的“汇总住房信息”超链接,即可实现用echarts图表展示不同房型的数据。页面效果如下图3所示

图3 汇总房产信息

注意:
1)页面效果要求用模板继承实现
2)表格要求用bootstrap美化
3)图表展示要求用echarts
三、数据库设计
1.创建数据库(HouseDB)。
2.创建房型表(HouseTypes),结构如下:
字段名 说明 字段类型 长度 备注

创建房产信息表(Houses),结构如下:


四、步骤得分
步骤 分值
步骤1:正确创建数据库 10分

CREATE TABLE `housetypes` (`housetypeid` int NOT NULL AUTO_INCREMENT,`housetypename` varchar(20) NOT NULL,PRIMARY KEY (`housetypeid`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3;

CREATE TABLE `houses` (`houseid` int NOT NULL AUTO_INCREMENT,`housetypeid` int NOT NULL,`area` int NOT NULL,`price` float NOT NULL,`address` varchar(50) NOT NULL,`housedesc` varchar(100) DEFAULT NULL,PRIMARY KEY (`houseid`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3;

步骤2:正确搭建了项目框架 10分

步骤3:正确创建了3个页面 15分,每个页面5分
app.py

from  flask import  Flask,render_template,request
app=Flask(__name__)
from DBHelper import  DBHelper
global rows@app.route("/")
def index():#查询所有的房屋信息global rowsdb=DBHelper()sql="select * from housetypes  a,houses b where  a.housetypeid=b.housetypeid "db.cursor.execute(sql)rows=db.cursor.fetchall()return  render_template("index.html",rows=rows)
@app.route("/addHouse",methods=["GET","POST"])
def addHouse():global rowsif request.method=="GET":db = DBHelper()sql = "select * from housetypes"db.cursor.execute(sql)rowTypes= db.cursor.fetchall()return render_template("addhouse.html",rowTypes=rowTypes)else:  #获取表单提交的值housetypeid=request.form.get("selType") #获取类型idarea=request.form.get("txtArea")price = request.form.get("txtPrice")address = request.form.get("txtAddress")desc= request.form.get("txtDesc")sql="insert into houses values(null,%s,%s,%s,'%s','%s')"%(housetypeid,area,price,address,desc)print(sql)db=DBHelper()db.cursor.execute(sql)db.con.commit() #执行添加语句一定要提交,否则不能生效return "<h1>发布成功!</h1><a href='/'>返回首页</a>"
@app.route("/echartshow")
def echartshow():global rowsdf=pd.DataFrame(rows)#print(df)df2=df.groupby("housetypename").count()["houseid"].sort_values(ascending=False).head(5)# print(df2)return render_template("echartshow.html" ,x=list(df2.index),y=list(df2))if __name__ == '__main__':app.run(debug=True)

DBHelper.py

import pymysql
class DBHelper:  # 定义操作数据库的类def __init__(self):   #在构造函数中,先创建好连接对象和游标对象,self.con = pymysql.connect(host="127.0.0.1", port=3306,user="root", passwd="123456", db="housedb",charset="utf8")  # 创建连接self.cursor =self.con.cursor(pymysql.cursors.DictCursor)  # 获取游标对象,用来执行sql语句def close(self):  #定义关闭连接的方法self.con.close()

base.html

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><link rel="stylesheet" href="static/css/bootstrap.css"><style type="text/css">*{margin:0px; padding:0px;}#top,#content{margin:5px auto;}#top  #toprow1{text-align: center;font-size: 40px;}</style>
</head>
<body>
<div id="top"><div id="toprow1">好家园房产中介网后台管理</div><div id="toprow2"><a href="/">查看住房信息</a>|<a href="/addHouse">发布住房信息</a>|<a href="/echartshow">汇总住房信息</a><hr/></div>
</div>
<div id="content">{% block  content %}  {% endblock   %}
</div>
</body>
</html>

index.html

{% extends  "base.html"  %}
{% block content  %}
<table class="table table-striped"><caption><strong>查看房产信息</strong></caption><thead><tr><th>房产编号</th><th>房型编号</th><th>面积(平方米)</th><th>价格(万)</th><th>地址</th><th>描述</th></tr></thead><tbody>{% for row in rows %}<tr><td>{{row["houseid"]}}</td><td>{{row["housetypename"]}}</td><td>{{row["area"]}}</td><td>{{row["price"]}}</td><td>{{row["address"]}}</td><td>{{row["housedesc"]}}</td></tr>
{% endfor  %}</tbody>
</table>
{%  endblock  %}

addHouse.html

{% extends  "base.html"  %}
{% block content  %}
<form class="form-horizontal" role="form" method="post" action="/addHouse" onsubmit="return check()" ><div class="form-group"><label for="firstname" class="col-sm-2 control-label">房型编号</label><div class="col-sm-6"><select name="selType"  class="form-control">{% for row in rowTypes %}<option value='{{row["HouseTypeID"]}}'>{{row["HouseTypeName"]}}</option>{% endfor %}</select></div></div><div class="form-group"><label for="firstname" class="col-sm-2 control-label">面积</label><div class="col-sm-6"><input type="text" class="form-control" name="txtArea" id="txtArea"  placeholder="请输入面积"></div></div><div class="form-group"><label for="lastname" class="col-sm-2 control-label">价格</label><div class="col-sm-6"><input type="text" class="form-control" name="txtPrice" id="txtPrice"  placeholder="请输入价格"></div></div><div class="form-group"><label for="firstname" class="col-sm-2 control-label">地址</label><div class="col-sm-6"><input type="text" class="form-control" name="txtAddress" id="txtAddress"  placeholder="请输入地址"></div></div><div class="form-group"><label for="lastname" class="col-sm-2 control-label">描述</label><div class="col-sm-6"><input type="text" class="form-control" name="txtDesc" id="txtDesc"  placeholder="请输入描述"></div></div><div class="form-group"><div class="col-sm-offset-2 col-sm-10"><button type="submit" class="btn btn-default">发布</button></div></div></form><script src="static/js/jQuery-3.3.1.min.js"></script><script>function check() {var txtArea=document.getElementById("txtArea").valuevar txtPrice=document.getElementById("txtPrice").valuevar txtAddress=document.getElementById("txtAddress").valuevar txtDesc=document.getElementById("txtDesc").valueif (txtArea==""||txtPrice==""||txtAddress==""||txtDesc==""){alert("请输入相对应的信息")return false}else {{#alert("")#}return true}}</script>
{%  endblock  %}

echartshow.html

{% extends  "base.html"  %}
{% block content  %}
<div id="box" style="width: 800px;height: 900px;margin: 0 auto"></div>
<script src="static/js/echarts.min.js"></script>
<script>myecharts=echarts.init(document.getElementById("box"))option = {title : {text: '好家园房产中介网后台管理',},tooltip : {trigger: 'axis'},legend: {data:['汇总住房信息']},toolbox: {show : true,feature : {mark : {show: true},dataView : {show: true, readOnly: false},magicType : {show: true, type: ['line', 'bar']},restore : {show: true},saveAsImage : {show: true}}},calculable : true,xAxis : [{type : 'category',data : {{ x|safe }}}],yAxis : [{type : 'value'}],series : [{name:'汇总住房信息',type:'bar',data:{{ y|safe }}},]
};myecharts.setOption(option)</script>
{%  endblock  %}

步骤4:正确完成了查看房产信息的功能 15分

步骤5:正确完成了添加房产信息的功能 15分

步骤6:正确完成了汇总房产信息的功能 15分

步骤7:正确用bootstrap完成了表格美化 10分

步骤8:编码规范,有适量的js验证 10分

好家园房产中介网后台管理相关推荐

  1. “好家园房产中介网后台管理”python项目

    一.语言和环境 1.实现语言:python语言. 2.环境要求:pycharm + mysql. 二.实现功能 使用flask技术开发"好家园房产中介网"的后台管理功能,具体实现功 ...

  2. 好家园房产中介网后台管理项目

    base.html–(父模板) <!DOCTYPE html> <html lang="en"> <head><meta charset= ...

  3. 国内最大的房产中介公司如何管理上千门店固定资产?

    国内最大的房产中介公司如何管理上千门店固定资产? 众所周知房产中介公司作为轻资产运营公司,虽然其单体门店的投资成本并不重,但单体门店的服务辐射范围仅在1.5公里到3公里范围之内,作为国内最大的房产中介 ...

  4. 【计算机毕业设计】家政服务中介网

    一.系统截图(需要演示视频可以私聊) 摘  要 21世纪的今天,随着社会的不断发展与进步,人们对于信息科学化的认识,已由低层次向高层次发展,由原来的感性认识向理性认识提高,管理工作的重要性已逐渐被人们 ...

  5. 房源管理系统php,房产中介房源管理系统 v1.1

    房产中介管理系统 v1.1使用说明 声明:本系统无任何功能限制 升级说明: 1.优化网站数据的调用方法 2.提供会员的数据处理能力 运行环境:IIS+ASP+ACCESS/MS SQL    版本号: ...

  6. springboot毕设项目房产中介管理yjk0h(java+VUE+Mybatis+Maven+Mysql)

    springboot毕设项目房产中介管理yjk0h(java+VUE+Mybatis+Maven+Mysql) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBui ...

  7. Springboot毕设项目房产中介管理yjk0hjava+VUE+Mybatis+Maven+Mysql+sprnig)

    Springboot毕设项目房产中介管理yjk0hjava+VUE+Mybatis+Maven+Mysql+sprnig) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql ...

  8. Axure 经典实例高保真原型下载(Axure高保真酒店管理交互组件连锁酒店erp酒店企业web端后台管理财务管理会员管理网销管理报表管理))

    作品介绍:Axure高保真酒店管理交互组件&连锁酒店erp&酒店企业web端后台管理&财务管理&会员管理&网销管理&报表管理 Axure原型演示及下载地 ...

  9. Node.js+Vue.js全栈开发王者荣耀手机端官网和管理后台(一)

    文章目录 [全栈之巅]Node.js+Vue.js全栈开发王者荣耀手机端官网和管理后台(一) 工具安装和环境搭建 初始化项目 基于ElementUI的后台管理基础界面搭建 创建分类(客户端) 创建分类 ...

最新文章

  1. 干货丨入门机器学习,从搞懂这8大经典算法开始
  2. 向日葵win10远程linux主机,小猪为你win10系统使用向日葵远程桌面软件远程的设置方法...
  3. 神策数据如何助力36氪实现数据运营?
  4. (转)__declspec(dllimport)和__declspec(dllexport)的区别,以及有关c/c++调用约定
  5. selenium webdriver 启动三大浏览器Firefox,Chrome,IE
  6. Entity Framework Core 实现MySQL 的TimeStamp/RowVersion 并发控制
  7. 内存泄漏–测量频率和严重性
  8. 《Effective Java》 第二讲:对于所有对象都通用的方法
  9. Python调用Windows API函数编写录音机和音乐播放器
  10. MindSpore手写数字识别初体验,深度学习也没那么神秘嘛
  11. 智能门禁(3)---汉王智能人脸门禁系统
  12. TensorFlow 实战(三)—— 实现常见公式
  13. python之matplotlib中plt.show()不显示
  14. python datetime和unix时间戳之间相互转换
  15. 微信小程序下载文件,后端PHP处理流程
  16. hive教程:启动hive客户端
  17. 二维图像中EMD 法与 Mura 检测的总结
  18. 解决Jenkins不能在线安装maven持续集成插件(百度云离线下载)
  19. 树莓派hwclock命令参数及用法详解--linux显示/设置硬件时钟命令
  20. 前端上班第一天-开发环境配置

热门文章

  1. 物联网工程实践实训 DAY3
  2. Cache Maintenance-关于cache 清除(invalidate)和清理(clean)操作的基础知识
  3. 超级干货 产品发布会活动策划知识整理一
  4. 淘宝的一键上下架工具怎么批量上传商品的?
  5. [笔记][总结] MIT线性代数 Gilbert Strang 矩阵运算
  6. Unity资源加载管理
  7. 18. IAB Considerations【IAB 注意事项】
  8. 【趣谈】终于让我找到了比栈更适合描述先进后出结构的词
  9. 地图协作——mapus、MapBoard、亿景智图
  10. Java实现数字的千分位的处理