Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Production and sharing of high-end web reports with weather forecast

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I've developed a lot of reports with FineReport, but this is the first time I've integrated weather forecasting to improve interaction and humanization, so I'd like to share it with you.

This report is a comprehensive store sales management analysis panel, you can query performance analysis, clerk sales analysis, store ranking analysis (you can see that it is a chain store), VIP birthday reminder. How to make a specific template, people in the industry can see at a glance, there is no need to say more, just focus on how to integrate the weather.

First, the picture above:

The method is to add a piece of JS code, as follows:

[javascript] view plaincopy

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= "p_w_picpath/s_13.png"

If (weather.indexOf ("cloudy")! = =-1 | | weather.indexOf ("clear")! =-1) {style_img= "p_w_picpath/s_1.png";}

Else if (weather.indexOf (cloudy)! =-1&&weather.indexOf (overcast)! =-1) {style_img= "p_w_picpath/s_2.png";}

Else if (weather.indexOf ("overcast")! =-1&&weather.indexOf ("rain")! =-1) {style_img= "p_w_picpath/s_3.png";}

Else if (weather.indexOf)! =-1&&weather.indexOf (Rain)! =-1) {style_img= "p_w_picpath/s_12.png";}

Else if (weather.indexOf)! =-1&&weather.indexOf (fog)! =-1) {style_img= "p_w_picpath/s_12.png";}

Else if (weather.indexOf ("clear")! =-1) {style_img= "p_w_picpath/s_13.png";}

Else if (weather.indexOf ("cloudy")! =-1) {style_img= "p_w_picpath/s_2.png";}

Else if (weather.indexOf ("shower")! =-1) {style_img= "p_w_picpath/s_3.png";}

Else if (weather.indexOf (light rain)! =-1) {style_img= "p_w_picpath/s_3.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_4.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_5.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_5.png";}

Else if (weather.indexOf (hail)! =-1) {style_img= "p_w_picpath/s_6.png";}

Else if (weather.indexOf (thunderstorm)! =-1) {style_img= "p_w_picpath/s_7.png";}

Else if (weather.indexOf (Lesser Snow)! =-1) {style_img= "p_w_picpath/s_8.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_9.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_10.png";}

Else if (weather.indexOf (Blizzard)! =-1) {style_img= "p_w_picpath/s_10.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_11.png";}

Else if (weather.indexOf)! =-1) {style_img= "p_w_picpath/s_11.png";}

Else if (weather.indexOf ("fog")! =-1) {style_img= "p_w_picpath/s_12.png";}

Else {style_img= "p_w_picpath/s_2.png";}

Return style_img;}

Function echo (city) {

$('# city') .html (city)

$('# weather') .html (window.SWther.w [city] [0] .s1)

$('# temperature') .html (window.SWther.w [city] [0] .t1 +'°')

$('# wind') .html (window.SWther.w [city] [0] .p1)

$('# direction') .html (window.SWther.w [city] [0] .d1)

Var T_weather_img=dis_img (window.SWther.w [city] [0] .s1)

$('# thanks weatherproof img'). Html ("

"/spanspan+window.SWther.w[city][0].s1+/spanspan"

")

/ / $('# city feature') .html (window.SWther.w [city] [0] .t1 +'~'+ window.SWther.w [window] [0] .t2 +'°')

$('# Thumblature') .html (window.SWther.w [city] [0] .t1)

$('# Tweeweather') .html (window.SWther.w [city] [0] .s1)

$('# Tubwind') .html (window.SWther.w [city] [0] .p1)

$('# Tunable direction') .html (window.SWther.w [city] [0] .d1)

$('# Mitchweather') .html (window.SWther.w [city] [1] .s1)

Var M_weather_img=dis_img (window.SWther.w [city] [1] .s1)

$('# html weatherproof IMG').

"/spanspan+window.SWther.w[city][1].s1+/spanspan"

")

) .html (window.SWther.w [city] [1] .T1 +'~'+ window.SWther.w [city] [1] .T2 +'°')

$('# Mainwind') .html (window.SWther.w [city] [1] .p1)

$('# Manners direction') .html (window.SWther.w [city] [1] .d1)

$('# Lawweather') .html (window.SWther.w [city] [2] .s1)

Var L_weather_img=dis_img (window.SWther.w [city] [2] .s1)

$('# lazy weatherproof img'). Html ("

"/spanspan+window.SWther.w[city][2].s1+/spanspan"

")

) .html (window.SWther.w [city] [2] .T1 +'~'+ window.SWther.w [city] [2] .T2 +'°')

$('# Lawwind') .html (window.SWther.w [city] [2] .p1); $('# Laterdirection`) .html (window.SWther.w [city] [2] .d1)

}

}

/ / weather is over

Function jintian () {

Weather_.getWeather (city,'js')

}

In this way, the job is done.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report