index.html
<body>
<div class="header">
<div class="bg-color">
<div class="container">
<img src="img/11.png" alt="" height="100px" />
<h1>软件展示</h1>
<a href="#" class="read-more-bg"><i class="fa fa-download"></i> Download</a>
<div class="bg-top-img"></div>
</div>
</div>
</div>
<div class="buildt-bt">
<div class="container">
<div class="buildt-bt-headline">
<h2>功能和特点</h2>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
<div class="m-box">
<div class="glyph">
<div class="fs1" aria-hidden="true" data-icon=""></div>
</div>
<h1>发布笔记</h1>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
<div class="m-box">
<div class="glyph">
<div class="fs1" aria-hidden="true" data-icon=""></div>
</div>
<h1>拥有标题和内容的笔记列表</h1>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
<div class="m-box">
<div class="glyph">
<div class="fs1" aria-hidden="true" data-icon=""></div>
</div>
<h1>详细的个人信息</h1>
</div>
</div>
</div>
</div>
</div>
<div class="buildt-bt">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="our-team">
<div class="pic">
<img src="" >
</div>
<div class="team-content">
<h3 class="title">名称</h3>
<span class="post">xxxxx</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="our-team">
<div class="pic">
<img src="" >
</div>
<div class="team-content">
<h3 class="title">名称</h3>
<span class="post">xxxxx</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="our-team">
<div class="pic">
<img src="" >
</div>
<div class="team-content">
<h3 class="title">名称</h3>
<span class="post">xxxxx</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="our-team">
<div class="pic">
<img src="" >
</div>
<div class="team-content">
<h3 class="title">名称</h3>
<span class="post">xxxxx</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="buildt-bt">
<div class="container">
<div class="row">
<h1>问题反馈</h1>
<form role="form" class="form-horizontal" style="float: left;margin-left: 50px;">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label" style="padding-left: 0px;">姓名:</label>
<div class="col-sm-10">
<input type="text" id="firstname" placeholder="请输入名字" class="form-control" style="width: 300px;"/>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label" style="padding-left: 0px;">邮箱:</label>
<div class="col-sm-10">
<input type="email" id="firstname" placeholder="请输入邮箱" class="form-control" style="width: 300px;"/>
</div>
</div>
<div class="form-group">
<label for="name" >问题反馈</label>
<textarea class="form-control" rows="3" style="width: 370px;"></textarea>
</div>
<p style="margin-left: 100px;">
<button type="button" class="btn btn-default btn-lg" style="width: 200px;">提交</button>
</p>
</form>
<blockquote style="float: right; margin-top: 150px;">
联系我们
<small>xxxxxxxx<cite title="Source Title"></cite></small>
</blockquote>
</div>
</div>
</div><!--/ buildt-bt -->
</body>
</html>
style.css
* {
margin: 0px;
padding: 0px;
}
.header {
width: 100%;
height: 900px;
float: left;
}
.header .bg-color {
background-color: #1f9bc9;
width: 100%;
height: 100%;
text-align: center;
padding-top: 80px;
}
.header .bg-color h1 {
font-family: 'Lato', sans-serif;
color: #fff;
font-size: 56px;
margin-bottom: 30px;
}
.header .bg-color a.read-more-bg {
font-family: 'Lato', sans-serif;
padding: 20px 30px;
color: #fff;
font-size: 18px;
background: #084E5A;
border: 1px solid #084E5A;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-decoration: none;
}
.bg-top-img {
width: 100%;
background: url(img/screen.png) no-repeat center top;
height: 450px;
margin-top: 98px;
}
.buildt-bt {
padding: 70px 0;
width: 100%;
height: auto;
float: left;
border-bottom: 1px solid #eee;
}
.buildt-bt-headline {
text-align: center;
width: 100%;
height: auto;
margin-bottom: 30px;
}
.m-box {
width: 100%;
height: auto;
text-align: center;
}
.our-team {
padding: 30px 0 40px;
background: #f7f5ec;
text-align: center;
overflow: hidden;
position: relative;
}
.our-team .pic {
display: inline-block;
width: 130px;
height: 130px;
margin-bottom: 50px;
z-index: 1;
position: relative;
}
.our-team .pic:after {
content: "";
width: 100%;
height: 100%;
border-radius: 50%;
background: #ee4266;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
note.py
import datetime
import time
import traceback
from flaskimport Flask, render_template, redirect, request, jsonify, make_response, Response
import pymysql
app = Flask(__name__)
# app.debug = True
conn = pymysql.connect(
host='localhost',
port=3306,
user='root',
password='',
database='note',
charset='utf8',
autocommit=True
)
cursor = conn.cursor()
def Response_headers(content):
resp = Response(content)
resp.headers['Access-Control-Allow-Origin'] ='*'
return resp
@app.route("/getNote/id=<int:id>", methods=['GET'])
def getNote(id):
note ='select id,detail,date_format(time,"%Y-%m-%d"),userId from getnote where userId={} order by time desc'.format(id)
cursor.execute(note)
reslut = cursor.fetchall()
payload = []
content = {}
for reslutin reslut:
content = {'id': reslut[0], 'detail': reslut[1], 'time': reslut[2], 'userId': reslut[3]}
payload.append(content)
content = {}
# print(reslut)
return jsonify(payload)
@app.route('/login', methods=['GET', 'POST'])
def login():
userName = request.json.get("userName")
passWord = request.json.get("passWord")
login ='select * from login where userName="{}" and passWord="{}"'.format(userName, passWord)
payload = []
try:
cursor.execute(login)
reslut = cursor.fetchall()
length =len(reslut)
# print(len(reslut))
if length ==1:
pass
elif (length !=1):
return jsonify(error=400,msg="账号或密码错误")
for reslutin reslut:
content = {'userName': reslut[0], 'daycount': reslut[2], 'notecount': reslut[3], 'userId': reslut[4]}
payload.append(content)
content = {}
return jsonify(payload)
except:
traceback.print_exc()
conn.rollback()
@app.route('/addNote/id=<int:id>',methods=['POST',"GET"])
def addnote(id):
detail=request.json.get("detail")
# print(detail)
date=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
add="insert into getnote(detail,time,userId) values ('"+detail+"','"+date+"','"+str(id)+"');"
cursor.execute(add)
reslut=cursor.fetchall()
return jsonify(msg="添加成功",token=1)
@app.route('/getFolder/id=<int:id>')
def getFolder(id):
folder ='select id,folderName,date_format(createTime,"%Y-%m-%d"),userId from folder where userId={} order by createTime desc'.format(id)
cursor.execute(folder)
reslut = cursor.fetchall()
payload = []
content = {}
for reslutin reslut:
content = {'id': reslut[0], 'folderName': reslut[1], 'createTime': reslut[2], 'userId': reslut[3]}
payload.append(content)
content = {}
# print(reslut)
return jsonify(payload,msg="成功",token=1)
@app.route('/addFolder/id=<int:id>',methods=['POST',"GET"])
def addFolder(id):
folderName=request.json.get("folderName")
# print(folderName)
date=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
add="insert into folder(folderName,createTime,userId) values ('"+folderName+"','"+date+"','"+str(id)+"');"
cursor.execute(add)
reslut=cursor.fetchall()
return jsonify(msg="添加成功",token=1)
if __name__ =="__main__":
app.run()
数据库
create table login(
userName varchar(20),
passWord varchar(20),
daycount int,
notecount int,
userId int primary key auto_increment
);
create table getNote(
id int primary key auto_increment,
detail varchar(20),
time datetime,
userId int
);
create table folder(
id int primary key auto_increment,
folderName varchar(20),
createTime datetime,
userId int
);