High-end web reports with weather forecasts for production and sharing, and web reports for Weather Forecasts
I used FineReport to develop many reports, but it was the first time I integrated the weather forecast to improve interaction and humanization. So I would like to share with you.
This report is a comprehensive store sales management analysis panel that can query performance analysis, shop assistant sales analysis, shop ranking analysis (it can be seen that it is a chain store), VIP birthday reminder. How to Create a template is clearly visible in the industry. If you don't need to talk about it, let's focus on how to integrate the weather.
First:
The method is to add a piece of JS Code as follows:
Var weather = function () {var tmp = 0; var SWther = {w: [{}], add :{}}; var SWther ={}; this. getWeather = function (city, type) {// city = utf8ToGBK (city);/* $. getScript ("http://php.weather.sina.com.cn/iframe/index/w_cl.php? Code = js & day = 2 & city = "+ city +" & dfc = 3 ", function () {if (type = 'js ') {echo (city) ;}}); **/$. ajax ({dataType: 'script', scriptCharset: 'gb2312', // url: "http://php.weather.sina.com.cn/iframe/index/w_cl.php? Code = js & day = 2 & city = "+ city +" & dfc = 3 ", success: function () {if (type = 'js ') {echo (city) ;}})} function dis_img (weather) {var style_img = "image/s_13.png"; if (weather. indexOf ("Multi-cloud ")! =-1 | weather. indexOf ("clear ")! =-1) {style_img = "image/s_1.png";} else if (weather. indexOf ("Multi-cloud ")! =-1 & weather. indexOf ("Overcast ")! =-1) {style_img = "image/s_2.png";} else if (weather. indexOf ("Overcast ")! =-1 & weather. indexOf ("Rain ")! =-1) {style_img = "image/s_3.png";} else if (weather. indexOf ("clear ")! =-1 & weather. indexOf ("Rain ")! =-1) {style_img = "image/s_12.png";} else if (weather. indexOf ("clear ")! =-1 & weather. indexOf ("fog ")! =-1) {style_img = "image/s_12.png";} else if (weather. indexOf ("clear ")! =-1) {style_img = "image/s_13.png";} else if (weather. indexOf ("Multi-cloud ")! =-1) {style_img = "image/s_2.png";} else if (weather. indexOf ("Shower ")! =-1) {style_img = "image/s_3.png";} else if (weather. indexOf ("light rain ")! =-1) {style_img = "image/s_3.png";} else if (weather. indexOf ("moderate rain ")! =-1) {style_img = "image/s_4.png";} else if (weather. indexOf ("Heavy Rain ")! =-1) {style_img = "image/s_5.png";} else if (weather. indexOf ("rainstorm ")! =-1) {style_img = "image/s_5.png";} else if (weather. indexOf ("Hail ")! =-1) {style_img = "image/s_6.png";} else if (weather. indexOf ("thundershower ")! =-1) {style_img = "image/s_7.png";} else if (weather. indexOf ("snow ")! =-1) {style_img = "image/s_8.png";} else if (weather. indexOf ("moderate snow ")! =-1) {style_img = "image/s_9.png";} else if (weather. indexOf (" ")! =-1) {style_img = "image/s_10.png";} else if (weather. indexOf ("blizzard ")! =-1) {style_img = "image/s_10.png";} else if (weather. indexOf ("yangsha ")! =-1) {style_img = "image/s_11.png";} else if (weather. indexOf ("dust ")! =-1) {style_img = "image/s_11.png";} else if (weather. indexOf ("fog ")! ==- 1) {style_img = "image/s_12.png";} else {style_img = "image/s_2.png" ;}return style_img ;}; function echo (city) {users ('{city'{.html (city); users ('{weather'}.html (window. SWther. w [city] [0]. s1); parameter ('your temperature'your .html (window. SWther. w [city] [0]. t1 + '& deg;'); ('{wind'{.html (window. SWther. w [city] [0]. p1); Comment ('{ction'}.html (window. SWther. w [city] [0]. d1); var T_weather_img = dis_img (window. SWther. w [city] [0]. s1); $ ('# T _ Weather_img'mirror.html (" <br> <span id = \" T_weather \ "> </span>"); // ('{t_temperature'{.html (window. SWther. w [city] [0]. t1 + '~ '+ Window. SWther. w [city] [0]. t2 + '& deg;'); values (window. SWther. w [city] [0]. s1); Comment ('{t_wind'{.html (window. SWther. w [city] [0]. p1); Comment ('{t_direction'}.html (window. SWther. w [city] [0]. d1); Certificate ('{m_weather'}.html (window. SWther. w [city] [1]. s1); var M_weather_img = dis_img (window. SWther. w [city] [1]. s1); Certificate ('{m_weather_img'}.html ("
That's all!