-
-
-
diff --git a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc index ed3d187..22c4966 100644 Binary files a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc and b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc differ diff --git a/数据分析和可视化/新冠疫情/hello.py b/数据分析和可视化/新冠疫情/hello.py index 4322941..a3ed7ef 100644 --- a/数据分析和可视化/新冠疫情/hello.py +++ b/数据分析和可视化/新冠疫情/hello.py @@ -37,31 +37,43 @@ def chinasummary(): diedRelative=results[16],updateTime=nowtime,area=[x[0] for x in provinces], proconfirmed=[x[1] for x in provinces],suspect=results[5],suspectRelative=results[6], top5province=[x[0] for x in top5data],top5confirmed=[x[1] for x in top5data], - asymptomacNum=[x[1] for x in asymp],asymptomaticArea=[x[0] for x in asymp]) + asymptomacNum=[x[1] for x in asymp],asymptomaticArea=[x[0] for x in asymp], + proconfirmedRelative=[x[2] for x in provinces],prodied=[x[3] for x in provinces]) return data -@app.route("/gloabalInfo/",methods=['POST']) +@app.route("/globalInfo/",methods=['POST']) def GlobalInfomation(): - print('----------------------------------') + nowtime=time.strftime('%Y-%m-%d',time.localtime(time.time())) db = GetFromDB() - results=db.searchForeignInformation('2020-08-10') + results=db.searchForeignInformation(nowtime) #由于查询到的数据中没有中国的信息,因此需要查询中国的信息加到世界信息中 country = [x[3] for x in results] country.append("中国") confirmed = [x[0] for x in results] confirmed.append(db.searchSummaryChina('2020-08-10')[0][1]) + + summaryData=db.querySummaryForeign(nowtime)[0] data=jsonify(country=country, confirmed=confirmed,died=[x[1] for x in results], - crued=[x[2] for x in results],curConfirm=[x[4] for x in results],confirmedRelative=[x[5] for x in results]) + crued=[x[2] for x in results],curConfirm=[x[4] for x in results], + confirmedRelative=[x[5] for x in results],updateTime=nowtime, + TotalConfirmed=summaryData[1],TotalCurConfirm=summaryData[2], + TotalconfirmRelative=summaryData[3],TotalCrued=summaryData[4], + TotalDied=summaryData[6],TotalDiedRelative=summaryData[7], + TotalCruedRelative=summaryData[5],TotalcurConfirmRelative=summaryData[9]) return data @app.route("/") def hello(): - return render_template('index.html') + return render_template('/index.html') + +@app.route("/index") +def helloindex(): + return render_template('/index.html') @app.route("/foreign/") def foreign(): - return render_template('index.html') + return render_template('foreign.html') @app.route("/fanghu/") def hello1(): diff --git a/数据分析和可视化/新冠疫情/models.py b/数据分析和可视化/新冠疫情/models.py index 91a18b8..2c717e3 100644 --- a/数据分析和可视化/新冠疫情/models.py +++ b/数据分析和可视化/新冠疫情/models.py @@ -41,7 +41,7 @@ class GetFromDB(): #查询各省的确诊人数 def searchProvinceConfirmed(self,date): thedate = date + "%" - sql='select area,confirmed from ProvinceTable where pub_date like "%s"'%(thedate) + sql='select area,confirmed,confirmedRelative,died from ProvinceTable where pub_date like "%s"'%(thedate) self.cursor.execute(sql) return self.cursor.fetchall() @@ -60,4 +60,23 @@ class GetFromDB(): self.cursor.execute(sql) return self.cursor.fetchall() + #查询世界各国的疫情信息 + def query_foreignInfo(self,date): + thedate=date+"%" + sql='select * from ForeignCountry where pub_date like "%s"'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() + + def querySummaryForeign(self,date): + thedate=date+"%" + sql='select * from OutsideChina where updateTime like "%s"'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() + + #新增国家top10 + def query_top10(self,date): + thedate=date+"%" + sql='select confirmed,confirmedRelative from ForeignCountry where pub_date like "%s" order by confirmed desc limit 10'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() diff --git a/数据分析和可视化/新冠疫情/static/css/index.css b/数据分析和可视化/新冠疫情/static/css/index.css index fa0a83c..213e7c7 100644 --- a/数据分析和可视化/新冠疫情/static/css/index.css +++ b/数据分析和可视化/新冠疫情/static/css/index.css @@ -50,7 +50,7 @@ li{list-style:none;} } .top .logo_text .content { - + height:100%; text-align:center; } @@ -141,7 +141,7 @@ li{list-style:none;} font-size:0.25rem; background: #fff; color:rgb(56, 128, 220); - + } .middle_con .wrap .tabs .tabs_wrap span.sty { background:rgb(56, 128, 220); @@ -156,6 +156,7 @@ li{list-style:none;} .middle_con .wrap .tabs_content .tabs_list { width:92%; + display: none; position: absolute; top: 0; left: 0; @@ -168,7 +169,6 @@ li{list-style:none;} font-size:0.25rem; } - /* detail4 */ .tabs_list.gailan .detail4 { height:1.4rem; @@ -179,15 +179,12 @@ li{list-style:none;} border-bottom: 1px solid #dfdddd; margin-top:0.2rem; } - .tabs_list.gailan .detail4 .list4 p { text-align:center; } - .tabs_list.gailan .detail4 .list4 .num{ font-size:0.45rem; } - .tabs_list.gailan .detail4 .list4 .color1 { color:rgb(234, 51, 35); } @@ -255,27 +252,16 @@ li{list-style:none;} } .table_pro .title span.t_area{ - width:20%; + width:40%; background:rgb(227, 231, 243); } .table_pro .title span.t_confirm { - width:20%; background: rgb(243, 186, 176); } .table_pro .title span.t_dead { - width:20%; background: rgb(180, 192, 213); } .table_pro .title span.t_heal { - width:20%; - background: rgb(102, 204, 153); - } - .table_pro .title span.t_add { - width:10%; - background: rgb(102, 104, 100); - } - .table_pro .title span.t_all { - width:10%; background: rgb(102, 204, 153); } .table_pro .content { @@ -315,7 +301,7 @@ li{list-style:none;} width:100%; /* height:0.6rem; */ display:none; - + } .table_pro .content .c_line .line_hide .hide_content{ width:100%; @@ -344,7 +330,14 @@ li{list-style:none;} transform: rotate(90deg); } + /* 最新动态 */ + .tabs_list.dongtai { + width:100%; + } + .tabs_list.dongtai .main{ + width:100%; + } .cbp_tmtimeline { margin: 0; padding: 0; diff --git a/数据分析和可视化/新冠疫情/static/js/update.js b/数据分析和可视化/新冠疫情/static/js/update.js index 8b13789..d940037 100644 --- a/数据分析和可视化/新冠疫情/static/js/update.js +++ b/数据分析和可视化/新冠疫情/static/js/update.js @@ -1 +1,20 @@ - +console.log('----------------------------update'); +function eachchina(province,confirmed,curconfirm,died) { + var str = ''; + if (province.length!=0) { + for (var i = 0, len = province.length; i < len; i++) { + str += `
截止2020-02-02 11:52全国数据统计
+截止2020-02-02 11:52统计
较昨日+110
+较昨日
0
较昨日110
+较昨日+110
0
0
较昨日+110
-0
-