我用FineReport開發(fā)了挺多報表,但集成天氣預(yù)報這樣提高交互和人性化的還是第一次,所以跟大家分享下。
成都創(chuàng)新互聯(lián)公司專注于金口河企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。金口河網(wǎng)站建設(shè)公司,為金口河等地區(qū)提供建站服務(wù)。全流程按需定制設(shè)計,專業(yè)設(shè)計,全程項目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
這個報表是綜合的門店銷售管理分析面板,可以查詢業(yè)績分析、店員銷售分析,店鋪排行分析(可以看出是個連鎖店),VIP生日提醒。怎么具體制作模板,業(yè)內(nèi)人士一看即明,無需多講,就重點說下怎么集成天氣吧。
先上圖:
方法是加一段JS代碼,具體如下:
[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("多云")!==-1||weather.indexOf("晴")!==-1){style_img="p_w_picpath/s_1.png";}
else if(weather.indexOf("多云")!==-1&&weather.indexOf("陰")!==-1){style_img="p_w_picpath/s_2.png";}
else if(weather.indexOf("陰")!==-1&&weather.indexOf("雨")!==-1){style_img="p_w_picpath/s_3.png";}
else if(weather.indexOf("晴")!==-1&&weather.indexOf("雨")!==-1){style_img="p_w_picpath/s_12.png";}
else if(weather.indexOf("晴")!==-1&&weather.indexOf("霧")!==-1){style_img="p_w_picpath/s_12.png";}
else if(weather.indexOf("晴")!==-1){style_img="p_w_picpath/s_13.png";}
else if(weather.indexOf("多云")!==-1){style_img="p_w_picpath/s_2.png";}
else if(weather.indexOf("陣雨")!==-1){style_img="p_w_picpath/s_3.png";}
else if(weather.indexOf("小雨")!==-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("冰雹")!==-1){style_img="p_w_picpath/s_6.png";}
else if(weather.indexOf("雷陣雨")!==-1){style_img="p_w_picpath/s_7.png";}
else if(weather.indexOf("小雪")!==-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("暴雪")!==-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("霧")!==-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);
$('#T_weather_img').html("<img src='"+T_weather_img+"' title='"+window.SWther.w[city][0].s1+"' alt='"+window.SWther.w[city][0].s1+"' /><br><span id=\"T_weather\"></span>");
//$('#T_temperature').html(window.SWther.w[city][0].t1+'~'+window.SWther.w[city][0].t2+'°');
$('#T_temperature').html(window.SWther.w[city][0].t1);
$('#T_weather').html(window.SWther.w[city][0].s1);
$('#T_wind').html(window.SWther.w[city][0].p1);
$('#T_direction').html(window.SWther.w[city][0].d1);
$('#M_weather').html(window.SWther.w[city][1].s1);
var M_weather_img=dis_img(window.SWther.w[city][1].s1);
$('#M_weather_img').html("<img src='"+M_weather_img+"' title='"+window.SWther.w[city][1].s1+"' alt='"+window.SWther.w[city][1].s1+"' />");
$('#M_temperature').html(window.SWther.w[city][1].t1+'~'+window.SWther.w[city][1].t2+'°');
$('#M_wind').html(window.SWther.w[city][1].p1);
$('#M_direction').html(window.SWther.w[city][1].d1);
$('#L_weather').html(window.SWther.w[city][2].s1);
var L_weather_img=dis_img(window.SWther.w[city][2].s1);
$('#L_weather_img').html("<img src='"+L_weather_img+"' title='"+window.SWther.w[city][2].s1+"' alt='"+window.SWther.w[city][2].s1+"' />");
$('#L_temperature').html(window.SWther.w[city][2].t1+'~'+window.SWther.w[city][2].t2+'°');
$('#L_wind').html(window.SWther.w[city][2].p1);$('#L_direction').html(window.SWther.w[city][2].d1);
}
}
//weather結(jié)束了
function jintian(){
weather_.getWeather(city,'js');
};
如此,大功告成。
當(dāng)前文章:帶有天氣預(yù)報的高大上web報表制作分享
轉(zhuǎn)載來于:http://jinyejixie.com/article4/pgeeoe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、ChatGPT、網(wǎng)站設(shè)計公司、手機網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)站營銷
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)