commit
c17794e7db
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="Flask">
|
||||
<option name="enabled" value="true" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/../cov\templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/cov.iml" filepath="$PROJECT_DIR$/.idea/cov.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c7fdb731-0d74-46da-bd31-48c9c5beb017" name="默认更改列表" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Flask Main" />
|
||||
<option value="Python Script" />
|
||||
<option value="HTML File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="1atpF0cC7wMuqehLrqJ41IvQ8pP" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showExcludedFiles" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../cov2019/app.py" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\Administrator\Desktop\2020春课件\数据库\2020春数据库大作业\cov" />
|
||||
<recent name="C:\Users\Administrator\Desktop\2020春课件\数据库\2020春数据库大作业\cov\py" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Flask server.Flask (app.py)">
|
||||
<configuration name="utils (1)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="cov" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/utils.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="utils" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="cov" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/py" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="C:\Users\Administrator\Desktop\2020春课件\数据库\2020春数据库大作业\cov\utils.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="Flask (app.py)" type="Python.FlaskServer" temporary="true" nameIsGenerated="true">
|
||||
<module name="cov" />
|
||||
<option name="target" value="$PROJECT_DIR$/app.py" />
|
||||
<option name="targetType" value="PATH" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="launchJavascriptDebuger" value="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="cov" type="Python.FlaskServer">
|
||||
<module name="cov" />
|
||||
<option name="target" value="$PROJECT_DIR$/app.py" />
|
||||
<option name="targetType" value="PATH" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="launchJavascriptDebuger" value="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Flask server.Flask (app.py)" />
|
||||
<item itemvalue="Python.utils (1)" />
|
||||
<item itemvalue="Python.utils" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="c7fdb731-0d74-46da-bd31-48c9c5beb017" name="默认更改列表" comment="" />
|
||||
<created>1587564636359</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1587564636359</updated>
|
||||
<workItem from="1587564650828" duration="1620000" />
|
||||
<workItem from="1587566401227" duration="1000000" />
|
||||
<workItem from="1587600653560" duration="34117000" />
|
||||
<workItem from="1587656493930" duration="958000" />
|
||||
<workItem from="1587683070047" duration="3564000" />
|
||||
<workItem from="1587780766059" duration="2513000" />
|
||||
<workItem from="1587871661469" duration="722000" />
|
||||
<workItem from="1588166112825" duration="2481000" />
|
||||
<workItem from="1588203382338" duration="2817000" />
|
||||
<workItem from="1588644618574" duration="7643000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="549" y="170" key="FileChooserDialogImpl" timestamp="1587565793326">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="549" y="170" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1587565793326" />
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.bottom" timestamp="1588682474873">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1588682474873" />
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.center" timestamp="1588682474873">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1588682474873" />
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.left" timestamp="1588682474873">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1588682474873" />
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.right" timestamp="1588682474873">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="200" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1588682474873" />
|
||||
<state x="479" y="240" key="com.intellij.ide.util.TipDialog" timestamp="1588644618750">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="479" y="240" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1588644618750" />
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/cov$Flask__app_py_.coverage" NAME="Flask (app.py) Coverage Results" MODIFIED="1588682474812" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/cov$utils.coverage" NAME="utils Coverage Results" MODIFIED="1587566114522" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/py" />
|
||||
<SUITE FILE_PATH="coverage/cov$utils__1_.coverage" NAME="utils (1) Coverage Results" MODIFIED="1587634939851" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>cov</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.aptana.ide.core.unifiedBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.aptana.projects.webnature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1587565254010</id>
|
||||
<name></name>
|
||||
<type>26</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-node_modules</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,186 @@
|
||||
from flask import Flask,request,redirect
|
||||
import time
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask import render_template
|
||||
from flask import Flask as _Flask
|
||||
from flask.json import JSONEncoder as _JSONEncoder
|
||||
class JSONEncoder(_JSONEncoder):
|
||||
def default(self, o):
|
||||
import decimal
|
||||
if isinstance(o, decimal.Decimal):
|
||||
|
||||
return float(o)
|
||||
|
||||
super(JSONEncoder, self).default(o)
|
||||
|
||||
class Flask(_Flask):
|
||||
json_encoder = JSONEncoder
|
||||
|
||||
import utils
|
||||
from flask import jsonify
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:130031@127.0.0.1:3306/cov2019'
|
||||
db=SQLAlchemy(app)
|
||||
|
||||
class Administator(db.Model):
|
||||
ad_id = db.Column(db.String(32), primary_key=True)
|
||||
password = db.Column(db.String(32))
|
||||
|
||||
class China(db.Model):
|
||||
id = db.Column(db.Integer,primary_key=True,autoincrement=True)
|
||||
date=db.Column(db.String(255))
|
||||
province = db.Column(db.String(255))
|
||||
city = db.Column(db.String(255))
|
||||
current_diagnosis=db.Column(db.Integer)
|
||||
cumulative_diagnosis = db.Column(db.Integer)
|
||||
suspected_case = db.Column(db.Integer)
|
||||
cumulative_deaths = db.Column(db.Integer)
|
||||
cumulative_cure = db.Column(db.Integer)
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return render_template("index.html")
|
||||
|
||||
@app.route('/index')
|
||||
def hello_world2():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
#管理页面
|
||||
@app.route("/massage_page")
|
||||
def massage_page():
|
||||
china_list = China.query.order_by(China.id.desc()).all()
|
||||
return render_template("massage.html",china_list=china_list)
|
||||
|
||||
#删除数据
|
||||
@app.route("/delete",methods=['GET'])
|
||||
def delete():
|
||||
id = request.args.get("id")
|
||||
china = China.query.filter_by(id=id).first()
|
||||
db.session.delete(china)
|
||||
db.session.commit()
|
||||
return redirect('/massage_page')
|
||||
|
||||
#添加页面
|
||||
@app.route("/insert_page")
|
||||
def insert_page():
|
||||
return render_template("insert.html")
|
||||
# 添加数据
|
||||
@app.route("/insert",methods=['GET','POST'])
|
||||
def insert():
|
||||
id = request.form["id"]
|
||||
province = request.form['province']
|
||||
city = request.form['city']
|
||||
current_diagnosis = request.form['current_diagnosis']
|
||||
cumulative_diagnosis = request.form['cumulative_diagnosis']
|
||||
suspected_case = request.form['suspected_case']
|
||||
cumulative_deaths = request.form['cumulative_deaths']
|
||||
cumulative_cure = request.form['cumulative_cure']
|
||||
china = China(id=id,province=province,city=city,current_diagnosis=current_diagnosis,cumulative_diagnosis=cumulative_diagnosis,suspected_case=suspected_case,cumulative_deaths=cumulative_deaths,cumulative_cure=cumulative_cure)
|
||||
db.session.add(china)
|
||||
db.session.commit()
|
||||
return redirect('/massage_page')
|
||||
|
||||
#修改页面
|
||||
@app.route("/alter_page")
|
||||
def alter_page():
|
||||
return render_template("alter.html")
|
||||
#修改操作
|
||||
@app.route("/alter",methods=['GET','POST'])
|
||||
def alter():
|
||||
if request.method == 'GET':
|
||||
id = request.args.get("id")
|
||||
province = request.args.get("provincename")
|
||||
city = request.args.get("cityname")
|
||||
current_diagnosis = request.args.get("current_diagnosisnumber")
|
||||
cumulative_diagnosis = request.args.get("cumulative_diagnosisnumber")
|
||||
suspected_case = request.args.get("suspected_casenumber")
|
||||
cumulative_deaths = request.args.get("cumulative_deathsnumber")
|
||||
cumulative_cure = request.args.get("cumulative_curenumber")
|
||||
china = China(id = id,province=province,city=city,current_diagnosis = current_diagnosis,cumulative_diagnosis = cumulative_diagnosis,suspected_case = suspected_case,cumulative_deaths = cumulative_deaths,cumulative_cure = cumulative_cure)
|
||||
return render_template("alter.html",china = china)
|
||||
else:
|
||||
id = request.form["id"]
|
||||
province = request.form['province']
|
||||
cityname = request.form['city']
|
||||
current_diagnosis = request.form['current_diagnosis']
|
||||
cumulative_diagnosis = request.form['cumulative_diagnosis']
|
||||
suspected_case = request.form['suspected_case']
|
||||
cumulative_deaths = request.form['cumulative_deaths']
|
||||
cumulative_cure = request.form['cumulative_cure']
|
||||
china = China.query.filter_by(id = id).first()
|
||||
china.province = province
|
||||
china.city = cityname
|
||||
china.current_diagnosis = current_diagnosis
|
||||
china.cumulative_diagnosis = cumulative_diagnosis
|
||||
china.suspected_case = suspected_case
|
||||
china.cumulative_deaths = cumulative_deaths
|
||||
china.cumulative_cure = cumulative_cure
|
||||
db.session.commit()
|
||||
return redirect('/massage_page')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route("/login_page")
|
||||
def tiaozhuan():
|
||||
return render_template("login.html")
|
||||
|
||||
@app.route("/login",methods=['GET','POST'])
|
||||
def login():
|
||||
#接收用户数据
|
||||
user_list = Administator.query.all()
|
||||
root = request.form['ad_id']
|
||||
password = request.form['password']
|
||||
user = Administator(ad_id=root ,password=password)
|
||||
for user1 in user_list:
|
||||
if user.ad_id==user1.ad_id and user.password==user1.password:
|
||||
# 将网页重定向到管理页
|
||||
return redirect("/massage_page")
|
||||
#返回主页
|
||||
return redirect("/index")
|
||||
|
||||
@app.route('/m1')
|
||||
def get_m1_data():
|
||||
data=utils.get_m1_data()
|
||||
return jsonify({"现有确诊":data[0],"累计确诊":data[1],"疑似病例":data[2],"累计死亡":data[3],"累计治愈":data[4]})
|
||||
pass
|
||||
|
||||
@app.route('/m2')
|
||||
def get_m2_data():
|
||||
res=[]
|
||||
for tup in utils.get_m2_data():
|
||||
res.append({"name":tup[0],"value":int(tup[1])})
|
||||
return jsonify({"data":res})
|
||||
|
||||
@app.route('/l1')
|
||||
def get_l1_data():
|
||||
data =utils.get_l1_data()
|
||||
day,nconfirm,confirm,dead,heal =[],[],[],[],[]
|
||||
for a,b,c,d,e in data:
|
||||
day.append(a.strftime("%m-%d"))
|
||||
nconfirm.append(b)
|
||||
confirm.append(c)
|
||||
dead.append(d)
|
||||
heal.append(e)
|
||||
return jsonify({"日期":day,"现有确诊":nconfirm,"累计确诊":confirm,"累计死亡":dead,"累计治愈":heal})
|
||||
|
||||
@app.route('/r1')
|
||||
def get_r1_data():
|
||||
data =utils.get_r1_data()
|
||||
city=[]
|
||||
nc=[]
|
||||
for a,b in data:
|
||||
city.append(a)
|
||||
nc.append(b)
|
||||
return jsonify({"city":city,"nc":nc})
|
||||
|
||||
@app.route('/time')
|
||||
def get_time():
|
||||
return utils.get_time()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
@ -0,0 +1,101 @@
|
||||
body{
|
||||
margin=0;
|
||||
background: #333;
|
||||
}
|
||||
|
||||
#title{
|
||||
position:absolute;
|
||||
width:40%;
|
||||
height:10%;
|
||||
top:0;
|
||||
left:30%;
|
||||
color:white;
|
||||
font-size:35px;
|
||||
/*居中分布*/
|
||||
display:flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#time{
|
||||
position:absolute;
|
||||
height:10%;
|
||||
top:5%;
|
||||
right:2%;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
||||
#l1{
|
||||
position:absolute;
|
||||
width:30%;
|
||||
height:45%;
|
||||
top:10%;
|
||||
left:0%;
|
||||
|
||||
}
|
||||
|
||||
#l2{
|
||||
position:absolute;
|
||||
width:30%;
|
||||
height:45%;
|
||||
top:55%;
|
||||
left:0%;
|
||||
|
||||
}
|
||||
|
||||
#m1{
|
||||
position:absolute;
|
||||
width:40%;
|
||||
height:30%;
|
||||
top:10%;
|
||||
left:30%;
|
||||
|
||||
}
|
||||
|
||||
.num{
|
||||
width:20%;
|
||||
float:left;
|
||||
display:flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: gold;
|
||||
font-size: 20px;
|
||||
}
|
||||
.txt{
|
||||
width: 20%;
|
||||
float:left;
|
||||
font-family: "幼圆";
|
||||
color: white;
|
||||
display:flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#m2{
|
||||
position:absolute;
|
||||
width:40%;
|
||||
height:60%;
|
||||
top:40%;
|
||||
left:30%;
|
||||
}
|
||||
|
||||
#r1{
|
||||
position:absolute;
|
||||
width:30%;
|
||||
height:45%;
|
||||
top:10%;
|
||||
right:0%;
|
||||
|
||||
}
|
||||
|
||||
#r2{
|
||||
position:absolute;
|
||||
width:30%;
|
||||
height:45%;
|
||||
top:55%;
|
||||
right:0%;
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 719 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 235 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,84 @@
|
||||
function gettime(){
|
||||
$.ajax({
|
||||
url:"/time",
|
||||
timeout:10000,
|
||||
success:function(data){
|
||||
$("#time").html(data)
|
||||
},
|
||||
error:function(xhr,type,errorThrown){
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function get_m1_data(){
|
||||
$.ajax({
|
||||
url:"/m1",
|
||||
success:function(data){
|
||||
$(".num h1").eq(0).text(data.现有确诊);
|
||||
$(".num h1").eq(1).text(data.累计确诊);
|
||||
$(".num h1").eq(2).text(data.疑似病例);
|
||||
$(".num h1").eq(3).text(data.累计死亡);
|
||||
$(".num h1").eq(4).text(data.累计治愈);
|
||||
},
|
||||
error:function(xhr,type,errorThrown){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function get_m2_data() {
|
||||
$.ajax({
|
||||
url: "/m2",
|
||||
success: function (data) {
|
||||
ec_center.hideLoading();
|
||||
ec_center_option.series[0].data=data.data;
|
||||
ec_center.setOption(ec_center_option);
|
||||
},
|
||||
error:function(xhr,type,errorThrown){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_l1_data() {
|
||||
$.ajax({
|
||||
url: "/l1",
|
||||
success: function (data) {
|
||||
ec_left1.hideLoading();
|
||||
ec_left1_Option.xAxis[0].data=data.日期;
|
||||
ec_left1_Option.series[0].data=data.现有确诊;
|
||||
ec_left1_Option.series[1].data=data.累计确诊;
|
||||
ec_left1_Option.series[2].data=data.累计死亡;
|
||||
ec_left1_Option.series[3].data=data.累计治愈;
|
||||
ec_left1.setOption(ec_left1_Option);
|
||||
},
|
||||
error:function(xhr,type,errorThrown){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
function get_r1_data() {
|
||||
$.ajax({
|
||||
url: "/r1",
|
||||
success: function (data) {
|
||||
ec_right1_Option.xAxis.data=data.city;
|
||||
ec_right1_Option.series[0].data=data.nc;
|
||||
ec_right1.setOption(ec_right1_Option);
|
||||
},
|
||||
error:function(xhr,type,errorThrown){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
setInterval(gettime,1000)
|
||||
get_m1_data()
|
||||
get_m2_data()
|
||||
get_l1_data()
|
||||
get_r1_data()
|
@ -0,0 +1,66 @@
|
||||
var ec_center =echarts.init(document.getElementById("m2","dark"));
|
||||
var mydata=[{'name':"上海","value":318},{'name':"云南","value":162}]
|
||||
var ec_center_option ={
|
||||
title:{
|
||||
text:'',
|
||||
subtext:'',
|
||||
x:'left'
|
||||
},
|
||||
tooltip:{
|
||||
trigger:'item'
|
||||
},
|
||||
//左侧小导航图标
|
||||
visualMap:{
|
||||
|
||||
show: true,
|
||||
x: 'left',
|
||||
y: 'bottom',
|
||||
|
||||
textStyle: {
|
||||
fontSize: 8,
|
||||
|
||||
},
|
||||
splitList: [{ start: 1,end: 9 },
|
||||
{start: 10,end: 99 },
|
||||
{start: 100 , end: 999},
|
||||
{start: 1000 , end: 9999 },
|
||||
{ start: 10000 }],
|
||||
|
||||
color:['#8A3310','#C64918','#E55B25','#F2AD92','#F9DCD1']
|
||||
},
|
||||
|
||||
//配置属性
|
||||
series:[{
|
||||
name: '累计确诊人数',
|
||||
type: 'map',
|
||||
mapType: 'china',
|
||||
roam: false,
|
||||
itemStyle:{
|
||||
normal: {
|
||||
borderWidth: .5,
|
||||
borderColor: '#009fe8',
|
||||
areaColor: '#ffefd5',
|
||||
},
|
||||
|
||||
emphasis: { //鼠标高亮
|
||||
borderWidth: .5,
|
||||
borderColor: '#4b0082',
|
||||
areaColor: '#fff',
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
label:{
|
||||
normal: {
|
||||
show:true,
|
||||
fontSize:8,
|
||||
},
|
||||
emphasis: {
|
||||
show:true,
|
||||
fontSize:8,
|
||||
}
|
||||
},
|
||||
data:mydata //数据
|
||||
}]
|
||||
};
|
||||
ec_center.setOption(ec_center_option)
|
@ -0,0 +1,90 @@
|
||||
var ec_left1 = echarts.init(document.getElementById('l1'), "dark");
|
||||
var ec_left1_Option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
//指示器
|
||||
axisPointer: {
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
color: '#7171C6'
|
||||
}
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ['现有确诊', '累计确诊',"累计死亡", "累计治愈"],
|
||||
left: "right"
|
||||
},
|
||||
//标题样式
|
||||
title: {
|
||||
text: "全国累计趋势",
|
||||
textStyle: {
|
||||
color: 'white',
|
||||
},
|
||||
left: 'left'
|
||||
},
|
||||
//图形位置
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '6%',
|
||||
bottom: '4%',
|
||||
top: 50,
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
//x轴坐标点开始与结束点位置都不在最边缘
|
||||
// boundaryGap : true,
|
||||
data: []
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
//y轴字体设置
|
||||
axisLabel: {
|
||||
show: true,
|
||||
color: 'white',
|
||||
fontSize: 12,
|
||||
formatter: function(value) {
|
||||
if (value >= 1000) {
|
||||
value = value / 1000 + 'k';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
//y轴线设置显示
|
||||
axisLine: {
|
||||
show: true
|
||||
},
|
||||
//与x轴平行的线样式
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#17273B',
|
||||
width: 1,
|
||||
type: 'solid',
|
||||
}
|
||||
}
|
||||
}],
|
||||
series: [{
|
||||
name: "现有确诊",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}, {
|
||||
name: "累计确诊",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}, {
|
||||
name: "累计死亡",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}, {
|
||||
name: "累计治愈",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}]
|
||||
};
|
||||
|
||||
ec_left1.setOption(ec_left1_Option)
|
@ -0,0 +1,82 @@
|
||||
var ec_left2 = echarts.init(document.getElementById('l2'), "dark");
|
||||
var ec_left2_Option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
//指示器
|
||||
axisPointer: {
|
||||
type: 'line',
|
||||
lineStyle: {
|
||||
color: '#7171C6'
|
||||
}
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ['新增确诊', '新增疑似'],
|
||||
left: "right"
|
||||
},
|
||||
//标题样式
|
||||
title: {
|
||||
text: "全国新增趋势",
|
||||
textStyle: {
|
||||
color: 'white',
|
||||
},
|
||||
left: 'left'
|
||||
},
|
||||
//图形位置
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '6%',
|
||||
bottom: '4%',
|
||||
top: 50,
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
//x轴坐标点开始与结束点位置都不在最边缘
|
||||
// boundaryGap : true,
|
||||
|
||||
data: []
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
//y轴字体设置
|
||||
|
||||
//y轴线设置显示
|
||||
axisLine: {
|
||||
show: true
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
color: 'white',
|
||||
fontSize: 12,
|
||||
formatter: function(value) {
|
||||
if (value >= 1000) {
|
||||
value = value / 1000 + 'k';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
//与x轴平行的线样式
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#17273B',
|
||||
width: 1,
|
||||
type: 'solid',
|
||||
}
|
||||
}
|
||||
}],
|
||||
series: [{
|
||||
name: "新增确诊",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}, {
|
||||
name: "新增疑似",
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: []
|
||||
}]
|
||||
};
|
||||
|
||||
ec_left2.setOption(ec_left2_Option)
|
@ -0,0 +1,26 @@
|
||||
var ec_right1 = echarts.init(document.getElementById('r1'), "dark");
|
||||
var ec_right1_Option= {
|
||||
title: {
|
||||
text: "风险度前五地区",
|
||||
textStyle: {
|
||||
color: 'white',
|
||||
},
|
||||
left: 'left'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['銃槍','變調夾艾蓓家']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
type: 'bar',
|
||||
data: [120,50],
|
||||
showBackground: true,
|
||||
backgroundStyle: {
|
||||
color: 'rgba(220, 220, 220, 0.8)'
|
||||
}
|
||||
}]
|
||||
};
|
||||
ec_right1.setOption(ec_right1_Option)
|
@ -0,0 +1,279 @@
|
||||
/**
|
||||
* echarts-gl
|
||||
* Extension pack of ECharts providing 3d plots and globe visualization
|
||||
*
|
||||
* Copyright (c) 2014, echarts-gl
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module echarts-gl
|
||||
* @author Yi Shen(http://github.com/pissang)
|
||||
*/
|
||||
|
||||
// PENDING Use a single canvas as layer or use image element?
|
||||
var echartsGl = {
|
||||
version: '1.1.1',
|
||||
dependencies: {
|
||||
echarts: '4.1.0',
|
||||
claygl: '1.2.1'
|
||||
}
|
||||
};
|
||||
import echarts from 'echarts/lib/echarts';
|
||||
import clayVersion from 'claygl/src/version';
|
||||
import LayerGL from './core/LayerGL';
|
||||
import backwardCompat from './preprocessor/backwardCompat';
|
||||
import graphicGL from './util/graphicGL';
|
||||
|
||||
// Version checking
|
||||
var deps = echartsGl.dependencies;
|
||||
function versionTooOldMsg(name) {
|
||||
throw new Error(
|
||||
name + ' version is too old, needs ' + deps[name] + ' or higher'
|
||||
);
|
||||
}
|
||||
function checkVersion(version, name) {
|
||||
if ((version.replace('.', '') - 0) < (deps[name].replace('.', '') - 0)) {
|
||||
versionTooOldMsg(name);
|
||||
}
|
||||
// console.log('Loaded ' + name + ', version ' + version);
|
||||
}
|
||||
checkVersion(clayVersion, 'claygl');
|
||||
checkVersion(echarts.version, 'echarts');
|
||||
|
||||
function EChartsGL (zr) {
|
||||
this._layers = {};
|
||||
|
||||
this._zr = zr;
|
||||
}
|
||||
|
||||
EChartsGL.prototype.update = function (ecModel, api) {
|
||||
var self = this;
|
||||
var zr = api.getZr();
|
||||
|
||||
if (!zr.getWidth() || !zr.getHeight()) {
|
||||
console.warn('Dom has no width or height');
|
||||
return;
|
||||
}
|
||||
|
||||
function getLayerGL(model) {
|
||||
var zlevel;
|
||||
// Host on coordinate system.
|
||||
if (model.coordinateSystem && model.coordinateSystem.model) {
|
||||
zlevel = model.get('zlevel');
|
||||
}
|
||||
else {
|
||||
zlevel = model.get('zlevel');
|
||||
}
|
||||
|
||||
var layers = self._layers;
|
||||
var layerGL = layers[zlevel];
|
||||
if (!layerGL) {
|
||||
layerGL = layers[zlevel] = new LayerGL('gl-' + zlevel, zr);
|
||||
|
||||
if (zr.painter.isSingleCanvas()) {
|
||||
layerGL.virtual = true;
|
||||
// If container is canvas, use image to represent LayerGL
|
||||
// FIXME Performance
|
||||
var img = new echarts.graphic.Image({
|
||||
z: 1e4,
|
||||
style: {
|
||||
image: layerGL.renderer.canvas
|
||||
},
|
||||
silent: true
|
||||
});
|
||||
layerGL.__hostImage = img;
|
||||
|
||||
zr.add(img);
|
||||
}
|
||||
|
||||
zr.painter.insertLayer(zlevel, layerGL);
|
||||
}
|
||||
if (layerGL.__hostImage) {
|
||||
layerGL.__hostImage.setStyle({
|
||||
width: layerGL.renderer.getWidth(),
|
||||
height: layerGL.renderer.getHeight()
|
||||
});
|
||||
}
|
||||
|
||||
return layerGL;
|
||||
}
|
||||
|
||||
function setSilent(groupGL, silent) {
|
||||
if (groupGL) {
|
||||
groupGL.traverse(function (mesh) {
|
||||
if (mesh.isRenderable && mesh.isRenderable()) {
|
||||
mesh.ignorePicking = mesh.$ignorePicking != null
|
||||
? mesh.$ignorePicking : silent;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (var zlevel in this._layers) {
|
||||
this._layers[zlevel].removeViewsAll();
|
||||
}
|
||||
|
||||
ecModel.eachComponent(function (componentType, componentModel) {
|
||||
if (componentType !== 'series') {
|
||||
var view = api.getViewOfComponentModel(componentModel);
|
||||
var coordSys = componentModel.coordinateSystem;
|
||||
// View with __ecgl__ flag is a echarts-gl component.
|
||||
if (view.__ecgl__) {
|
||||
var viewGL;
|
||||
if (coordSys) {
|
||||
if (!coordSys.viewGL) {
|
||||
console.error('Can\'t find viewGL in coordinateSystem of component ' + componentModel.id);
|
||||
return;
|
||||
}
|
||||
viewGL = coordSys.viewGL;
|
||||
}
|
||||
else {
|
||||
if (!componentModel.viewGL) {
|
||||
console.error('Can\'t find viewGL of component ' + componentModel.id);
|
||||
return;
|
||||
}
|
||||
viewGL = coordSys.viewGL;
|
||||
}
|
||||
|
||||
viewGL = coordSys.viewGL;
|
||||
var layerGL = getLayerGL(componentModel);
|
||||
|
||||
layerGL.addView(viewGL);
|
||||
|
||||
view.afterRender && view.afterRender(
|
||||
componentModel, ecModel, api, layerGL
|
||||
);
|
||||
|
||||
setSilent(view.groupGL, componentModel.get('silent'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
var chartView = api.getViewOfSeriesModel(seriesModel);
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
if (chartView.__ecgl__) {
|
||||
if ((coordSys && !coordSys.viewGL) && !chartView.viewGL) {
|
||||
console.error('Can\'t find viewGL of series ' + chartView.id);
|
||||
return;
|
||||
}
|
||||
var viewGL = (coordSys && coordSys.viewGL) || chartView.viewGL;
|
||||
// TODO Check zlevel not same with component of coordinate system ?
|
||||
var layerGL = getLayerGL(seriesModel);
|
||||
layerGL.addView(viewGL);
|
||||
|
||||
chartView.afterRender && chartView.afterRender(
|
||||
seriesModel, ecModel, api, layerGL
|
||||
);
|
||||
|
||||
setSilent(chartView.groupGL, seriesModel.get('silent'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Hack original getRenderedCanvas. Will removed after new echarts released
|
||||
// TODO
|
||||
var oldInit = echarts.init;
|
||||
echarts.init = function () {
|
||||
var chart = oldInit.apply(this, arguments);
|
||||
chart.getZr().painter.getRenderedCanvas = function (opts) {
|
||||
opts = opts || {};
|
||||
if (this._singleCanvas) {
|
||||
return this._layers[0].dom;
|
||||
}
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
var dpr = opts.pixelRatio || this.dpr;
|
||||
canvas.width = this.getWidth() * dpr;
|
||||
canvas.height = this.getHeight() * dpr;
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.dpr = dpr;
|
||||
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
if (opts.backgroundColor) {
|
||||
ctx.fillStyle = opts.backgroundColor;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
var displayList = this.storage.getDisplayList(true);
|
||||
|
||||
var scope = {};
|
||||
var zlevel;
|
||||
|
||||
var self = this;
|
||||
function findAndDrawOtherLayer(smaller, larger) {
|
||||
var zlevelList = self._zlevelList;
|
||||
if (smaller == null) {
|
||||
smaller = -Infinity;
|
||||
}
|
||||
var intermediateLayer;
|
||||
for (var i = 0; i < zlevelList.length; i++) {
|
||||
var z = zlevelList[i];
|
||||
var layer = self._layers[z];
|
||||
if (!layer.__builtin__ && z > smaller && z < larger) {
|
||||
intermediateLayer = layer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (intermediateLayer && intermediateLayer.renderToCanvas) {
|
||||
ctx.save();
|
||||
intermediateLayer.renderToCanvas(ctx);
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
var layer = {
|
||||
ctx: ctx
|
||||
};
|
||||
for (var i = 0; i < displayList.length; i++) {
|
||||
var el = displayList[i];
|
||||
|
||||
if (el.zlevel !== zlevel) {
|
||||
findAndDrawOtherLayer(zlevel, el.zlevel);
|
||||
zlevel = el.zlevel;
|
||||
}
|
||||
this._doPaintEl(el, layer, true, scope);
|
||||
}
|
||||
|
||||
findAndDrawOtherLayer(zlevel, Infinity);
|
||||
|
||||
return canvas;
|
||||
};
|
||||
return chart;
|
||||
};
|
||||
|
||||
|
||||
echarts.registerPostUpdate(function (ecModel, api) {
|
||||
var zr = api.getZr();
|
||||
|
||||
var egl = zr.__egl = zr.__egl || new EChartsGL(zr);
|
||||
|
||||
egl.update(ecModel, api);
|
||||
});
|
||||
|
||||
echarts.registerPreprocessor(backwardCompat);
|
||||
|
||||
echarts.graphicGL = graphicGL;
|
||||
|
||||
export default EChartsGL;
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>修改</title>
|
||||
</head>
|
||||
<body background="../static/image/n.jpg" >
|
||||
|
||||
<div class="layui-main">
|
||||
<div class="site-content">
|
||||
<br><br>
|
||||
<h1 class="site-h1">修改信息</h1>
|
||||
<br><br>
|
||||
<form class="layui-form" action="alter" method="post">
|
||||
<input type="hidden" name = 'id' value="{{china.id}}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">省份</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="province" required lay-verify="required" placeholder="请输入省份"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.province}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">城市</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="city" required lay-verify="required" placeholder="请输入城市名称" autocomplete="off"
|
||||
class="layui-input" value="{{china.cityname}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">当前确诊人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="current_diagnosis" required lay-verify="required" placeholder="请输入人数"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.current_diagnosis}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计确诊人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_diagnosis" required lay-verify="required" placeholder="请输入人数"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.cumulative_diagnosis}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">疑似病例人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="suspected_case" required lay-verify="required" placeholder="请输入人数"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.suspected_case}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计死亡人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_deaths" required lay-verify="required" placeholder="请输入人数"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.cumulative_deaths}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计治愈人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_cure" required lay-verify="required" placeholder="请输入人数"
|
||||
autocomplete="off"
|
||||
class="layui-input" value="{{china.cumulative_cure}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>疫情数据追踪</title>
|
||||
<script src="../static/js/jquery-3.4.1.min.js"></script>
|
||||
<script src="../static/js/echarts.min.js"></script>
|
||||
<script src="../static/js/china.js"></script>
|
||||
<link href="../static/css/index.css" rel='stylesheet'/>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h4><a href="login_page">登录管理</a></h4>
|
||||
<div id="title">全国疫情实时追踪</div>
|
||||
<div id="time">我是时间</div>
|
||||
<div id="l1">我是左1</div>
|
||||
<div id="l2">我是左2</div>
|
||||
<div id="m1">
|
||||
<div class="num"><h1>123</h1></div>
|
||||
<div class="num"><h1>123</h1></div>
|
||||
<div class="num"><h1>123</h1></div>
|
||||
<div class="num"><h1>123</h1></div>
|
||||
<div class="num"><h1>123</h1></div>
|
||||
<div class="txt"><h2>现有确诊</h2></div>
|
||||
<div class="txt"><h2>累计确诊</h2></div>
|
||||
<div class="txt"><h2>疑似病例</h2></div>
|
||||
<div class="txt"><h2>累计死亡</h2></div>
|
||||
<div class="txt"><h2>累计治愈</h2></div>
|
||||
</div>
|
||||
|
||||
<div id="m2">我是中2</div>
|
||||
<div id="r1">我是右1</div>
|
||||
<div id="r2">我是右二</div>
|
||||
|
||||
<script src="../static/js/ec_center.js"></script>
|
||||
<script src="../static/js/ec_left1.js" ></script>
|
||||
<script src="../static/js/control.js" ></script>
|
||||
<script src="../static/js/ec_right1.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>添加数据</title>
|
||||
</head>
|
||||
<body background="../static/image/n.jpg" >
|
||||
<div class="layui-main">
|
||||
<div class="site-content">
|
||||
<br><br>
|
||||
<h1 class="site-h1">添加信息</h1>
|
||||
<br><br>
|
||||
<form class="layui-form" action="insert" method="post">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="id" required lay-verify="required" placeholder="请输入用户数量" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">省份</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="province" required lay-verify="required" placeholder="请输入省份" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">城市</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="city" required lay-verify="required" placeholder="请输入城市" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">当前确诊人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="current_diagnosis" required lay-verify="required" placeholder="请输入人数" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计确诊人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_diagnosis" required lay-verify="required" placeholder="请输入人数" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">疑似病例人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="suspected_case" required lay-verify="required" placeholder="请输入人数" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计死亡人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_deaths" required lay-verify="required" placeholder="请输入人数" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">累计治愈人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="cumulative_cure" required lay-verify="required" placeholder="请输入人数" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>登录管理</title>
|
||||
</head>
|
||||
<body background="../static/image/武汉加油.jpg" >
|
||||
<form action="/login" method="post">
|
||||
<tr>用户名:<input type="text" name="ad_id"/></tr>
|
||||
<tr>密 码:<input type="password" name="password"/></tr>
|
||||
<tr><input type = "submit" value = "登陆"/></tr>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>管理页面</title>
|
||||
</head>
|
||||
<body background="../static/image/n.jpg" >
|
||||
<center>
|
||||
<h1>新冠病毒疫情一览表</h1>
|
||||
<h1><a href="index">退出</a></h1>
|
||||
<table width="800px" border="1" cellspacing="0" cellpadding="0">
|
||||
<h2>国内疫情</h2>
|
||||
<tr><a href='/insert_page'>添加数据</a></tr>
|
||||
<tr>
|
||||
<td>编号</td>
|
||||
<td>日期</td>
|
||||
<td>省份</td>
|
||||
<td>城市</td>
|
||||
<td>现有确诊</td>
|
||||
<td>累计确诊</td>
|
||||
<td>疑似病例</td>
|
||||
<td>累计死亡</td>
|
||||
<td>累计治愈</td>
|
||||
<td>操作</td>
|
||||
</tr>
|
||||
{% for item in china_list %}
|
||||
<tr>
|
||||
<td>{{ item.id }}</td>
|
||||
<td>{{ item.date }}</td>
|
||||
<td>{{ item.province }}</td>
|
||||
<td>{{ item.city }}</td>
|
||||
<td>{{ item.current_diagnosis }}</td>
|
||||
<td>{{ item.cumulative_diagnosis }}</td>
|
||||
<td>{{ item.suspected_case }}</td>
|
||||
<td>{{ item.cumulative_deaths }}</td>
|
||||
<td>{{ item.cumulative_cure }}</td>
|
||||
<td><a href='/alter?id={{item.id}}&provincename={{ item.province }}&cityname={{ item.city }}¤t_diagnosisnumber={{item.current_diagnosis}}&cumulative_diagnosisnumber={{item.cumulative_diagnosis}}&suspected_casenumber={{item.suspected_case}}&cumulative_deathsnumber={{item.cumulative_deaths}}&cumulative_curenumber={{item.cumulative_cure}}'>编辑</a>
|
||||
<a href="/delete?id={{ item.id }}">删除</a> </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,71 @@
|
||||
import time
|
||||
import pymysql
|
||||
|
||||
|
||||
def get_time():
|
||||
time_str= time.strftime("%Y{}%m{}%d{} %X")
|
||||
return time_str.format("年","月","日")
|
||||
pass
|
||||
|
||||
def get_conn():
|
||||
conn =pymysql.connect(host="localhost",
|
||||
user="root",
|
||||
password="130031",
|
||||
db="cov2019",
|
||||
charset="utf8" )
|
||||
|
||||
cursor=conn.cursor()
|
||||
return conn,cursor
|
||||
|
||||
def close_conn(conn,cursor):
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
def query(sql,*args):
|
||||
conn,cursor=get_conn()
|
||||
cursor.execute(sql,args)
|
||||
res=cursor.fetchall()
|
||||
close_conn(conn,cursor)
|
||||
return res
|
||||
|
||||
def get_m1_data():
|
||||
|
||||
sql="select sum(现有确诊),sum(累计确诊),sum(疑似病例),sum(累计死亡),sum(累计治愈)" \
|
||||
"from chinadetail " \
|
||||
"where 日期=(select 日期 from chinadetail order by 日期 desc limit 1)"
|
||||
res=query(sql)
|
||||
return res[0]
|
||||
|
||||
def get_m2_data():
|
||||
|
||||
sql="select 省名,sum(累计确诊)" \
|
||||
"from chinadetail " \
|
||||
"where 日期=(select 日期 from chinadetail order by 日期 desc limit 1)" \
|
||||
"group by 省名"
|
||||
res=query(sql)
|
||||
return res
|
||||
|
||||
def get_l1_data():
|
||||
|
||||
sql="select 日期,现有确诊,累计确诊,累计死亡,累计治愈 from chinatotal "
|
||||
res=query(sql)
|
||||
return res
|
||||
|
||||
def get_r1_data():
|
||||
sql="select * from (select 省名,sum(现有确诊) a from chinadetail where 日期=(select 日期 from chinadetail order by 日期 desc limit 1)" \
|
||||
"group by 省名 order by a desc)r" \
|
||||
"where limit 5"
|
||||
res=query(sql)
|
||||
return res
|
||||
|
||||
def get_r2_data():
|
||||
|
||||
sql="select sum(现有确诊),sum(累计确诊),sum(疑似病例),sum(累计死亡),sum(累计治愈)" \
|
||||
"from chinadetail " \
|
||||
"where 日期=(select 日期 from chinadetail order by 日期 desc limit 1)"
|
||||
res=query(sql)
|
||||
return res[0]
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(get_time())
|
||||
print(get_r1_data())
|
Loading…
Reference in new issue