/**
* 弹窗类
*/
define([
'html!templates/meteo/popup1', //弹窗
'html!templates/meteo/popup_surf', //弹窗
'html!templates/meteo/popup_global', //弹窗
'html!templates/meteo/popup_army', //弹窗
'html!templates/meteo/popup_auto', //弹窗
], function (html, surfHtml, globalHtml, armyHtml, autoHtml) {
var popup = {
options: [],
length: [],
chart: null,
initImage: function () {
for (var i = 0; i < 100; i++) {
var image = new Image();
var dayUrl = "";
if (i < 10) {
dayUrl = 'images/meteo/weatherIcon/cww0' + i + '.png';
} else {
dayUrl = 'images/meteo/weatherIcon/cww' + i + '.png';
}
image.src = dayUrl;
}
var dayAndNightImageId = [0, 1, 2, 3, 25, 26, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90];
for (var j = 0; j < dayAndNightImageId.length; j++) {
var image = new Image();
var nightUrl = "";
if (dayAndNightImageId[i] < 10) {
nightUrl = 'images/meteo/weatherIcon/cww0' + i + 'n.png';
} else {
nightUrl = 'images/meteo/weatherIcon/cww' + i + 'n.png';
}
image.src = nightUrl;
}
},
init: function () {
// $('.meteo-popup').remove();
$('.meteo-popup-surf').remove();
$('.meteo-popup-global').remove();
$('.meteo-popup-army').remove();
$('.meteo-popup-auto').remove();
if ($('#meteo-popup-title').html()) {
return;
}
//初始化弹窗
$('body').append(html);
require(['meteoDir/other/jquery.easyui.min'], function () {
$('.meteo-popup').draggable();
});
ONEMAP.C.publisher.subscribe(popup.popup_html_css, 'change23D');
//滚动条
$(".content_scrollx").mCustomScrollbar({
axis: "x",
advanced: {
autoExpandHorizontalScroll: true,
}
});
//------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
$('.meteo-weather-dot').click(function (event) {
$('.meteo-popup').show();
if (map23DData.display.map2D) {
$(".meteo-popup .popup_html").removeClass('TD');
} else {
$(".meteo-popup .popup_html").addClass('TD');
}
});
//----------------------------------------------------------------------
//实况 菜单切换
$('.meteo-popup #meteo-popup-bt1').addClass('current');
$('.meteo-popup .meteo-popup-chart>div').eq(0).show().siblings().hide();
$('.meteo-popup .meteo-popup-buttons a').click(function () {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
})
$('.meteo-popup .metie-popup-buttons-main').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
});
$('.meteo-popup .metie-popup-buttons-chart').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup .meteo-popup-chart').addClass('current').siblings().removeClass('current');
});
//关闭按钮可关闭弹窗
$('.meteo-popup .meteo-delete').click(function (event) {
$('.meteo-popup').hide();
$('.meteo-popup .meteo-popup-main-warp,.meteo-popup .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
});
//点击地图关闭弹窗 2D
map2DViewer.map.on('click', function () {
$('.meteo-popup').hide();
})
//todo 点击地图关闭弹窗 3D
// locaSpaceMap.attachEvent('Click', function () {
// PubSub.publish('map3D.click', {
// from:'3D'
// });
// // $('#meteo-popup').hide();
// })
},
initSurf: function () {
// $('.meteo-popup-surf').remove();
$('.meteo-popup').remove();
$('.meteo-popup-global').remove();
$('.meteo-popup-army').remove();
$('.meteo-popup-auto').remove();
if ($('#meteo-popup-surf-title').html()) {
return;
}
//初始化弹窗
$('body').append(surfHtml);
if (meteo.c.map.mapType == '3d') {
$(".meteo-popup-surf .popup_html").addClass('TD');
} else {
$(".meteo-popup-surf .popup_html").removeClass('TD');
}
require(['meteoDir/other/jquery.easyui.min'], function () {
$('.meteo-popup-surf').draggable();
});
ONEMAP.C.publisher.subscribe(popup.popup_html_surf_css, 'change23D');
//滚动条
$(".content_scrollx").mCustomScrollbar({
axis: "x",
advanced: {
autoExpandHorizontalScroll: true,
}
});
//------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
$('.meteo-weather-dot').click(function (event) {
$('.meteo-popup-surf').show();
if (map23DData.display.map2D) {
$(".meteo-popup-surf .popup_html").removeClass('TD');
} else {
$(".meteo-popup-surf .popup_html").addClass('TD');
}
});
//----------------------------------------------------------------------
//实况 菜单切换
$('.meteo-popup-surf #meteo-popup-surf-bt1').addClass('current');
$('.meteo-popup-surf .meteo-popup-chart>div').eq(0).show().siblings().hide();
$('.meteo-popup-surf .meteo-popup-buttons a').click(function () {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-surf .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
})
$('.meteo-popup-surf .meteo-popup-buttons-main').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-surf .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
});
$('.meteo-popup-surf .meteo-popup-buttons-chart').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-surf .meteo-popup-chart').addClass('current').siblings().removeClass('current');
});
//关闭按钮可关闭弹窗
$('.meteo-popup-surf .meteo-delete').click(function (event) {
$('.meteo-popup-surf').hide();
$('.meteo-popup-surf .meteo-popup-main-warp,.meteo-popup-surf .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
});
//点击地图关闭弹窗 2D
map2DViewer.map.on('click', function () {
$('.meteo-popup-surf').hide();
})
//todo 点击地图关闭弹窗 3D
// locaSpaceMap.attachEvent('Click', function () {
// PubSub.publish('map3D.click', {
// from:'3D'
// });
// // $('#meteo-popup').hide();
// })
},
initGlobal: function () {
$('.meteo-popup').remove();
$('.meteo-popup-surf').remove();
// $('.meteo-popup-global').remove();
$('.meteo-popup-army').remove();
$('.meteo-popup-auto').remove();
if ($('#meteo-popup-global-title').html()) {
return;
}
//初始化弹窗
$('body').append(globalHtml);
if (meteo.c.map.mapType == '3d') {
$(".meteo-popup-global .popup_html").addClass('TD');
} else {
$(".meteo-popup-global .popup_html").removeClass('TD');
}
require(['meteoDir/other/jquery.easyui.min'], function () {
$('.meteo-popup-global').draggable();
});
ONEMAP.C.publisher.subscribe(popup.popup_html_global_css, 'change23D');
//滚动条
$(".content_scrollx").mCustomScrollbar({
axis: "x",
advanced: {
autoExpandHorizontalScroll: true,
}
});
//------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
$('.meteo-weather-dot').click(function (event) {
$('.meteo-popup-global').show();
if (map23DData.display.map2D) {
$(".meteo-popup-global .popup_html").removeClass('TD');
} else {
$(".meteo-popup-global .popup_html").addClass('TD');
}
});
//----------------------------------------------------------------------
//实况 菜单切换
$('.meteo-popup-global #meteo-popup-global-bt1').addClass('current');
$('.meteo-popup-global .meteo-popup-chart>div').eq(0).show().siblings().hide();
$('.meteo-popup-global .meteo-popup-buttons a').click(function () {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-global .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
})
$('.meteo-popup-global .metie-popup-buttons-main').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-global .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
});
$('.meteo-popup-global .metie-popup-buttons-chart').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-global .meteo-popup-chart').addClass('current').siblings().removeClass('current');
});
//关闭按钮可关闭弹窗
$('.meteo-popup-global .meteo-delete').click(function (event) {
$('.meteo-popup-global').hide();
$('.meteo-popup-global .meteo-popup-main-warp,.meteo-popup-global .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
});
//点击地图关闭弹窗 2D
map2DViewer.map.on('click', function () {
$('.meteo-popup-global').hide();
})
//todo 点击地图关闭弹窗 3D
// locaSpaceMap.attachEvent('Click', function () {
// PubSub.publish('map3D.click', {
// from:'3D'
// });
// // $('#meteo-popup').hide();
// })
},
initArmy: function () {
$('.meteo-popup').remove();
$('.meteo-popup-surf').remove();
$('.meteo-popup-global').remove();
// $('.meteo-popup-army').remove();
$('.meteo-popup-auto').remove();
if ($('#meteo-popup-army-title').html()) {
return;
}
//初始化弹窗
$('body').append(armyHtml);
if (meteo.c.map.mapType == '3d') {
$(".meteo-popup-army .popup_html").addClass('TD');
} else {
$(".meteo-popup-army .popup_html").removeClass('TD');
}
require(['meteoDir/other/jquery.easyui.min'], function () {
$('.meteo-popup-army').draggable();
});
ONEMAP.C.publisher.subscribe(popup.popup_html_army_css, 'change23D');
//滚动条
$(".content_scrollx").mCustomScrollbar({
axis: "x",
advanced: {
autoExpandHorizontalScroll: true,
}
});
//------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
$('.meteo-weather-dot').click(function (event) {
$('.meteo-popup-army').show();
if (map23DData.display.map2D) {
$(".meteo-popup-army .popup_html").removeClass('TD');
} else {
$(".meteo-popup-army .popup_html").addClass('TD');
}
});
//----------------------------------------------------------------------
//实况 菜单切换
$('.meteo-popup-army #meteo-popup-army-bt1').addClass('current');
$('.meteo-popup-army .meteo-popup-chart>div').eq(0).show().siblings().hide();
$('.meteo-popup-army .meteo-popup-buttons a').click(function () {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-army .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
})
$('.meteo-popup-army .metie-popup-buttons-main').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-global .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
});
$('.meteo-popup-army .metie-popup-buttons-chart').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-army .meteo-popup-chart').addClass('current').siblings().removeClass('current');
});
//关闭按钮可关闭弹窗
$('.meteo-popup-army .meteo-delete').click(function (event) {
$('.meteo-popup-army').hide();
$('.meteo-popup-army .meteo-popup-main-warp,.meteo-popup-army .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
});
//点击地图关闭弹窗 2D
map2DViewer.map.on('click', function () {
$('.meteo-popup-army').hide();
})
//todo 点击地图关闭弹窗 3D
// locaSpaceMap.attachEvent('Click', function () {
// PubSub.publish('map3D.click', {
// from:'3D'
// });
// // $('#meteo-popup').hide();
// })
},
initAuto: function () {
$('.meteo-popup').remove();
$('.meteo-popup-surf').remove();
$('.meteo-popup-global').remove();
$('.meteo-popup-army').remove();
// $('.meteo-popup-auto').remove();
if ($('#meteo-popup-auto-title').html()) {
return;
}
//初始化弹窗
$('body').append(autoHtml);
if (meteo.c.map.mapType == '3d') {
$(".meteo-popup-auto .popup_html").addClass('TD');
} else {
$(".meteo-popup-auto .popup_html").removeClass('TD');
}
require(['meteoDir/other/jquery.easyui.min'], function () {
$('.meteo-popup-auto').draggable();
});
ONEMAP.C.publisher.subscribe(popup.popup_html_auto_css, 'change23D');
//滚动条
$(".content_scrollx").mCustomScrollbar({
axis: "x",
advanced: {
autoExpandHorizontalScroll: true,
}
});
//------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
$('.meteo-weather-dot').click(function (event) {
$('.meteo-popup-auto').show();
if (map23DData.display.map2D) {
$(".meteo-popup-auto .popup_html").removeClass('TD');
} else {
$(".meteo-popup-auto .popup_html").addClass('TD');
}
});
//----------------------------------------------------------------------
//实况 菜单切换
$('.meteo-popup-auto #meteo-popup-auto-bt1').addClass('current');
$('.meteo-popup-auto .meteo-popup-chart>div').eq(0).show().siblings().hide();
$('.meteo-popup-auto .meteo-popup-buttons a').click(function () {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-auto .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
})
$('.meteo-popup-auto .metie-popup-buttons-main').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-auto .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
});
$('.meteo-popup-auto .metie-popup-buttons-chart').click(function (event) {
$(this).addClass('current').siblings().removeClass('current');
$('.meteo-popup-auto .meteo-popup-chart').addClass('current').siblings().removeClass('current');
});
//关闭按钮可关闭弹窗
$('.meteo-popup-auto .meteo-delete').click(function (event) {
$('.meteo-popup-auto').hide();
$('.meteo-popup-auto .meteo-popup-main-warp,.meteo-popup-auto .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
});
//点击地图关闭弹窗 2D
map2DViewer.map.on('click', function () {
$('.meteo-popup-auto').hide();
})
//todo 点击地图关闭弹窗 3D
// locaSpaceMap.attachEvent('Click', function () {
// PubSub.publish('map3D.click', {
// from:'3D'
// });
// // $('#meteo-popup').hide();
// })
},
popup_html_css: function (type) {
if (type == '2d') {
$(".meteo-popup .popup_html").removeClass('TD');
} else if (type == '3d') {
$(".meteo-popup .popup_html").addClass('TD');
}
},
popup_html_surf_css: function (type) {
if (type == '2d') {
$(".meteo-popup-surf .popup_html").removeClass('TD');
} else if (type == '3d') {
$(".meteo-popup-surf .popup_html").addClass('TD');
}
},
popup_html_global_css: function (type) {
if (type == '2d') {
$(".meteo-popup-global .popup_html").removeClass('TD');
} else if (type == '3d') {
$(".meteo-popup-global .popup_html").addClass('TD');
}
},
popup_html_army_css: function (type) {
if (type == '2d') {
$(".meteo-popup-army .popup_html").removeClass('TD');
} else if (type == '3d') {
$(".meteo-popup-army .popup_html").addClass('TD');
}
},
popup_html_auto_css: function (type) {
if (type == '2d') {
$(".meteo-popup-auto .popup_html").removeClass('TD');
} else if (type == '3d') {
$(".meteo-popup-auto .popup_html").addClass('TD');
}
},
getUrlForType: function (type) {
var urls =
//地面站
type == 0 ? [meteo.c.http.stationInfo, meteo.c.http.stationReal,
meteo.c.http.stationFcst, meteo.c.http.stationFcstDay] :
//5000站点
type == 1 ? [meteo.c.http.stationGInfo, meteo.c.http.stationGReal, meteo.c.http.stationGFcst] :
//JD站
type == 2 ? [meteo.c.http.amsuInfo, meteo.c.http.amsuReal, meteo.c.http.amsuFcst] :
//自动站
type == 3 ? [meteo.c.http.awsInfo, meteo.c.http.awsReal, meteo.c.http.amsuFcst] :
//船舶报
type == 4 ? [meteo.c.http.shipInfo] :
null;
return urls;
},
showPopup: function (station, name, type, day, day2) {
day = null;
day2 = null;
popup.count = 0;
$(".meteo-popup-button").hide(); //隐藏所有按钮
var urls = popup.getUrlForType(type);
if (!urls) return;
if (type == 0) {////地面站
//弹框 实况按钮选中
this.initSurf();
$('.meteo-popup-surf').css('left', '260px');
$('.meteo-popup-surf').css('top', '100px');
$('.meteo-popup-surf #meteo-popup-surf-bt1').addClass('current').siblings().removeClass('current');
popup.setSurfContent(station, name, urls[0], function () {
$('.meteo-popup-button').removeClass('.current');
$('.meteo-popup-chart-list').hide();
$('.meteo-shikuang-div').show();
$('.meteo-popup-surf').show();
$('#meteo-popup-surf-bt2').hide();
$('#meteo-popup-surf-bt3').hide();
popup.setSurfFcst(station, urls[2], day2);
popup.setSurfFcstD(station, urls[3], day2);
}, day, type);
} else if (type == 1) {//5000站点
//弹框 实况按钮选中
$('.meteo-popup-global #meteo-popup-global-bt1').addClass('current').siblings().removeClass('current');
this.initGlobal();
$('.meteo-popup-global').css('left', '260px');
$('.meteo-popup-global').css('top', '100px');
popup.setGlobalContent(station, name, urls[0], function () {
}, day, type);
$('.meteo-popup-button').removeClass('.current');
$('.meteo-popup-chart-list').hide();
$('.meteo-shikuang-div').show();
$('.meteo-popup-global').show();
$('#meteo-popup-global-bt3').hide();
popup.setGlobalFcstD(station, urls[2], day2);
} else if (type == 2) {//JD站
//弹框 实况按钮选中
$('.meteo-popup-army #meteo-popup-army-bt1').addClass('current').siblings().removeClass('current');
this.initArmy();
$('.meteo-popup-army').css('left', '260px');
$('.meteo-popup-army').css('top', '100px');
popup.setArmyContent(station, name, urls[0], function () {
}, day, type);
$('.meteo-popup-button').removeClass('.current');
$('.meteo-popup-chart-list').hide();
$('.meteo-popup-army').show();
// popup.setArmyFcst(station, urls[1], day2);
} else if (type == 3) {//自动站
//弹框 实况按钮选中
$('.meteo-popup-auto #meteo-popup-auto-bt1').addClass('current').siblings().removeClass('current');
this.initAuto();
$('.meteo-popup-auto').css('left', '260px');
$('.meteo-popup-auto ').css('top', '100px');
popup.setAutoContent(station, name, urls[0], function () {
}, day, type);
$('.meteo-popup-button').removeClass('.current');
$('.meteo-popup-chart-list').hide();
$('.meteo-popup-auto').show();
} else if (type == 4) {
$('.meteo-popup #meteo-popup-bt1').addClass('current').siblings().removeClass('current');
this.init();
popup.setContent(station, name, urls[0], function () {
}, day, type);
$('.meteo-popup').show();
} else {
$('.meteo-popup #meteo-popup-bt1').addClass('current').siblings().removeClass('current');
this.init();
popup.setContent(station, name, urls[0], function () {}, day, type);
$('.meteo-popup').show();
}
},
setContent: function (station, name, url, callback, day, type) {
var par = null;
if (day) {
par = {
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json) {
var date = json.ldate;
if (type == 0) date = "01/09";
popup.setTitle('#meteo-popup-title', name, station, date);
var wth = meteo.c.process.setWth(json.wth);
popup.setPopupData('#meteo-popup-wth', wth);
var tt = meteo.c.process.setTt(json.tt);
popup.setPopupData('#meteo-popup-tt', tt);
var wth1 = meteo.c.process.setWth(json.wth1);
popup.setPopupData('#meteo-popup-wth1', wth1);
var wth2 = meteo.c.process.setWth(json.wth2);
popup.setPopupData('#meteo-popup-wth2', wth2);
var td = meteo.c.process.setTt(json.td);
popup.setPopupData('#meteo-popup-td', td);
var pr = meteo.c.process.setPr(json.pr);
popup.setPopupData('#meteo-popup-pr', pr);
var vis = meteo.c.process.setVis(json.vis);
popup.setPopupData('#meteo-popup-vis', vis);
var rh = meteo.c.process.setRh(json.rh);
popup.setPopupData('#meteo-popup-rh', rh);
var rn = meteo.c.process.setRn(json.rn06);
popup.setPopupData('#meteo-popup-rn06', rn);
var cn = meteo.c.process.setCn(json.cn);
popup.setPopupData('#meteo-popup-cn', cn);
var wd = meteo.c.process.setWd(json.wd);
var ws = meteo.c.process.setWs(json.ws);
popup.setPopupData('#meteo-popup-wd', wd + " " + ws);
// popup.setPopupData('#meteo-popup-ws', wd, '');
var dp = meteo.c.process.setPr(json.dp03);
popup.setPopupData('#meteo-popup-dp03', dp);
var cm = meteo.c.process.setCn(json.cm);
popup.setPopupData('#meteo-popup-cm', cm);
var ch = meteo.c.process.setCh(json.ch);
popup.setPopupData('#meteo-popup-ch', ch);
callback ? callback() : null;
} else {
alert('暂无数据');
}
})
},
setSurfContent: function (station, name, url, callback, day, type) {
var par = null;
if (day) {
par = {
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
var date = json.ldate;
// if (type == 0) date = "01/09";
popup.setTitle('#meteo-popup-surf-title', name, station, date);
var wth = meteo.c.process.setWth(json.wth);
popup.setPopupData('#meteo-popup-surf-wth', wth);
var tt = meteo.c.process.setTt(json.tt);
popup.setPopupData('#meteo-popup-surf-tt', tt);
var wth1 = meteo.c.process.setWth(json.wth1);
popup.setPopupData('#meteo-popup-surf-wth1', wth1);
var wth2 = meteo.c.process.setWth(json.wth2);
popup.setPopupData('#meteo-popup-surf-wth2', wth2);
var td = meteo.c.process.setTt(json.td);
popup.setPopupData('#meteo-popup-surf-td', td);
var pr = meteo.c.process.setPr(json.pr);
popup.setPopupData('#meteo-popup-surf-pr', pr);
var vis = meteo.c.process.setVis(json.vis);
popup.setPopupData('#meteo-popup-surf-vis', vis);
var rh = meteo.c.process.setRh(json.rh);
popup.setPopupData('#meteo-popup-surf-rh', rh);
var rn = meteo.c.process.setRn(json.rn06);
popup.setPopupData('#meteo-popup-surf-rn06', rn);
var cn = meteo.c.process.setCn(json.cn);
popup.setPopupData('#meteo-popup-surf-cn', cn);
var wd = meteo.c.process.setWd(json.wd);
var ws = meteo.c.process.setWs(json.ws);
popup.setPopupData('#meteo-popup-surf-wd', wd + " " + ws);
// popup.setPopupData('#meteo-popup-ws', wd, '');
var dp = meteo.c.process.setPr(json.dp03);
popup.setPopupData('#meteo-popup-surf-dp03', dp);
var cm = meteo.c.process.setCn(json.cm);
popup.setPopupData('#meteo-popup-surf-cm', cm);
var ch = meteo.c.process.setCh(json.ch);
popup.setPopupData('#meteo-popup-surf-ch', ch);
callback ? callback() : null;
}, function () {
ONEMAP.C.publisher.publish({type: 'warning', message: '暂无当前站点数据'}, 'noteBar::add');
$('.meteo-popup-surf').remove();
})
},
setGlobalContent: function (station, name, url, callback, day, type) {
var par = null;
if (day) {
par = {
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json) {
var date = json.ldate;
popup.setTitle('#meteo-popup-global-title', name, station, date);
var wth = meteo.c.process.setWth(json.wth);
popup.setPopupData('#meteo-popup-global-wth', wth);
var tt = meteo.c.process.setTt(json.tt);
popup.setPopupData('#meteo-popup-global-tt', tt);
var wth1 = meteo.c.process.setWth(json.wth1);
popup.setPopupData('#meteo-popup-global-wth1', wth1);
var wth2 = meteo.c.process.setWth(json.wth2);
popup.setPopupData('#meteo-popup-global-wth2', wth2);
var td = meteo.c.process.setTt(json.td);
popup.setPopupData('#meteo-popup-global-td', td);
var pr = meteo.c.process.setPr(json.pr);
popup.setPopupData('#meteo-popup-global-pr', pr);
var vis = meteo.c.process.setVis(json.vis);
popup.setPopupData('#meteo-popup-global-vis', vis);
var rh = meteo.c.process.setRh(json.rh);
popup.setPopupData('#meteo-popup-global-rh', rh);
var rn = meteo.c.process.setRn(json.rn06);
popup.setPopupData('#meteo-popup-global-rn06', rn);
var cn = meteo.c.process.setCn(json.cn);
popup.setPopupData('#meteo-popup-global-cn', cn);
var wd = meteo.c.process.setWd(json.wd);
var ws = meteo.c.process.setWs(json.ws);
popup.setPopupData('#meteo-popup-global-wd', wd + " " + ws);
// popup.setPopupData('#meteo-popup-ws', wd, '');
var dp = meteo.c.process.setPr(json.dp03);
popup.setPopupData('#meteo-popup-global-dp03', dp);
var cm = meteo.c.process.setCn(json.cm);
popup.setPopupData('#meteo-popup-global-cm', cm);
var ch = meteo.c.process.setCh(json.ch);
popup.setPopupData('#meteo-popup-global-ch', ch);
callback ? callback() : null;
} else {
alert('暂无数据');
}
}, function () {
$('.meteo-popup-global').remove();
})
},
setArmyContent: function (station, name, url, callback, day, type) {
var par = null;
if (day) {
par = {
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json) {
var date = json.ldate;
popup.setTitle('#meteo-popup-army-title', name, station, date);
var wth = meteo.c.process.setWth(json.wth);
popup.setPopupData('#meteo-popup-army-wth', wth);
var tt = meteo.c.process.setTt(json.tt);
popup.setPopupData('#meteo-popup-army-tt', tt);
var wth1 = meteo.c.process.setWth(json.wth1);
popup.setPopupData('#meteo-popup-army-wth1', wth1);
var wth2 = meteo.c.process.setWth(json.wth2);
popup.setPopupData('#meteo-popup-army-wth2', wth2);
var td = meteo.c.process.setTt(json.td);
popup.setPopupData('#meteo-popup-army-td', td);
var pr = meteo.c.process.setPr(json.pr);
popup.setPopupData('#meteo-popup-army-pr', pr);
var vis = meteo.c.process.setVis(json.vis);
popup.setPopupData('#meteo-popup-army-vis', vis);
var rh = meteo.c.process.setRh(json.rh);
popup.setPopupData('#meteo-popup-army-rh', rh);
var rn = meteo.c.process.setRn(json.rn06);
popup.setPopupData('#meteo-popup-army-rn06', rn);
var cn = meteo.c.process.setCn(json.cn);
popup.setPopupData('#meteo-popup-army-cn', cn);
var wd = meteo.c.process.setWd(json.wd);
var ws = meteo.c.process.setWs(json.ws);
popup.setPopupData('#meteo-popup-army-wd', wd + " " + ws);
// popup.setPopupData('#meteo-popup-ws', wd, '');
var dp = meteo.c.process.setPr(json.dp03);
popup.setPopupData('#meteo-popup-army-dp03', dp);
var cm = meteo.c.process.setCn(json.cm);
popup.setPopupData('#meteo-popup-army-cm', cm);
var ch = meteo.c.process.setCh(json.ch);
popup.setPopupData('#meteo-popup-army-ch', ch);
callback ? callback() : null;
} else {
alert('暂无数据');
}
}, function () {
$('.meteo-popup-army').remove();
})
},
setAutoContent: function (station, name, url, callback, day, type) {
var par = null;
if (day) {
par = {
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json) {
var date = json.ldate;
popup.setTitle('#meteo-popup-auto-title', name, station, date);
var wth = meteo.c.process.setWth(json.wth);
popup.setPopupData('#meteo-popup-auto-wth', wth);
var tt = meteo.c.process.setTt(json.tt);
popup.setPopupData('#meteo-popup-auto-tt', tt);
var wth1 = meteo.c.process.setWth(json.wth1);
popup.setPopupData('#meteo-popup-auto-wth1', wth1);
var wth2 = meteo.c.process.setWth(json.wth2);
popup.setPopupData('#meteo-popup-auto-wth2', wth2);
var td = meteo.c.process.setTt(json.td);
popup.setPopupData('#meteo-popup-auto-td', td);
var pr = meteo.c.process.setPr(json.pr);
popup.setPopupData('#meteo-popup-auto-pr', pr);
var vis = meteo.c.process.setVis(json.vis);
popup.setPopupData('#meteo-popup-auto-vis', vis);
var rh = meteo.c.process.setRh(json.rh);
popup.setPopupData('#meteo-popup-auto-rh', rh);
var rn = meteo.c.process.setRn(json.rn06);
popup.setPopupData('#meteo-popup-auto-rn06', rn);
var cn = meteo.c.process.setCn(json.cn);
popup.setPopupData('#meteo-popup-auto-cn', cn);
var wd = meteo.c.process.setWd(json.wd);
var ws = meteo.c.process.setWs(json.ws);
popup.setPopupData('#meteo-popup-auto-wd', wd + " " + ws);
// popup.setPopupData('#meteo-popup-ws', wd, '');
var dp = meteo.c.process.setPr(json.dp03);
popup.setPopupData('#meteo-popup-auto-dp03', dp);
var cm = meteo.c.process.setCn(json.cm);
popup.setPopupData('#meteo-popup-auto-cm', cm);
var ch = meteo.c.process.setCh(json.ch);
popup.setPopupData('#meteo-popup-auto-ch', ch);
callback ? callback() : null;
} else {
alert('暂无数据');
}
}, function () {
$('.meteo-popup-auto').remove();
})
},
setReal: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-bt1').show();
$('#meteo-popup-cdiv1').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-chart');
var option = meteo.c.chart.getChartOption(json, "实况");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
});
},
setSurfReal: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-surf-bt1').show();
$('#meteo-popup-surf-cdiv1').hide();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-surf-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-surf-chart');
var option = meteo.c.chart.getChartOption(json, "实况");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
});
},
setGlobalReal: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-global-bt1').show();
$('#meteo-popup-global-cdiv1').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-global-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-global-chart');
var option = meteo.c.chart.getChartOption(json, "实况");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
});
},
setArmyReal: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-army-bt1').show();
$('#meteo-popup-army-cdiv1').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-army-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-army-chart');
var option = meteo.c.chart.getChartOption(json, "实况");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
});
},
setAutoReal: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-auto-bt1').show();
$('#meteo-popup-auto-cdiv1').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-auto-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-auto-chart');
var option = meteo.c.chart.getChartOption(json, "实况");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
});
},
setFcst: function (station, url, type, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
if (type == 1) {
$('#meteo-popup-bt2').hide();
$('#meteo-popup-bt4').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-chart4').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-chart4');
var option = meteo.c.chart.getGlobalData(json, "预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
} else {
$('#meteo-popup-bt4').hide();
$('#meteo-popup-bt2').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-chart2').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-chart2');
var option = meteo.c.chart.getChartOption(json, "预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}
}, function () {
})
},
setSurfFcst: function (station, url, day) {
if (!url) {
$('#meteo-popup-surf-bt2').hide();
return;
}
var par = null;
// if (day) {
// par = {
// ldate: day,
// odate: day
// }
// }
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-surf-bt4').hide();
$('#meteo-popup-surf-bt2').show();
$('#meteo-popup-surf-chart').show();
var chartWidth = json.length * 60;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-surf-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-surf-chart');
chart.clear();
// var option = meteo.c.chart.getChartOption(json, "预报");
var option = meteo.c.chart.getSurfHourChartOption(json, "预报");
// chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
} else {
$('#meteo-popup-surf-chart').hide();
$('#meteo-popup-surf-bt2').hide();
}
}, function () {
$('#meteo-popup-surf-bt2').hide();
})
},
setGlobalFcst: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-global-bt4').hide();
$('#meteo-popup-global-bt2').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-global-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-global-chart');
var option = meteo.c.chart.getChartOption(json, "预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
setArmyFcst: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-army-bt4').hide();
$('#meteo-popup-army-bt2').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-army-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-army-chart');
var option = meteo.c.chart.getHourChartOption(json, "预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
setAutoFcst: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-auto-bt4').hide();
$('#meteo-popup-auto-bt2').show();
var chartWidth = json.length * 50;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-auto-chart').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-auto-chart');
var option = meteo.c.chart.getAutoHourChartOption(json, "预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
setFcstD: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-bt3').show();
var chartWidth = json.length * 40;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-chart2').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-chart2');
var option = meteo.c.chart.getChartOption(json, "七天预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
setSurfFcstD: function (station, url, day) {
if (!url) {
$('#meteo-popup-surf-bt3').hide();
return;
}
var par = null;
// if (day) {
// par = {
// ldate: day,
// odate: day
// }
// }
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-surf-bt3').show();
$('#meteo-popup-surf-chart2').show();
var chartWidth = json.length * 60;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-surf-chart2').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-surf-chart2');
chart.clear();
var option = meteo.c.chart.getSurfDaysChartOption(json, "七天预报");
// var option = meteo.c.chart.getChartOption(json, "七天预报");
// chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
} else {
$('#meteo-popup-surf-chart2').hide();
$('#meteo-popup-surf-bt3').hide();
}
}, function () {
$('#meteo-popup-surf-bt3').hide();
})
},
setGlobalFcstD: function (station, url, day) {
if (!url) {
$('#meteo-popup-global-bt3').hide();
return;
}
var par = null;
// if (day) {
// par = {
// ldate: day,
// odate: day
// }
// }
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-global-bt3').show();
$('#meteo-popup-global-chart1').show();
var chartWidth = json.length * 40;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-global-chart1').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-global-chart1');
chart.clear();
// var option = meteo.c.chart.getChartOption(json, "七天预报");
var option = meteo.c.chart.getGlobalDaysChartOption(json, "七天预报");
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
} else {
$('#meteo-popup-global-bt3').hide();
$('#meteo-popup-global-chart1').hide();
}
}, function () {
$('#meteo-popup-global-bt3').hide();
})
},
setArmyFcstD: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-army-bt3').show();
var chartWidth = json.length * 40;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-army-chart2').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-army-chart2');
var option = meteo.c.chart.getChartOption(json, "七天预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
setAutoFcstD: function (station, url, day) {
if (!url) {
return;
}
var par = null;
if (day) {
par = {
ldate: day,
odate: day
}
}
meteo.c.http.httpFunction(url, station, par, function (json) {
if (json.length > 0) {
$('#meteo-popup-auto-bt3').show();
var chartWidth = json.length * 40;
chartWidth = chartWidth < 740 ? 740 : chartWidth;
$('#meteo-popup-auto-chart2').css('width', chartWidth); //设置宽度
var chart = meteo.c.chart.getChart('meteo-popup-auto-chart2');
var option = meteo.c.chart.getChartOption(json, "七天预报");
chart.resize();
chart.setOption(option);
$(".content_scrollx").mCustomScrollbar('update');
}
}, function () {
})
},
hidePopup: function () {
$('.meteo-popup').hide();
$('.meteo-popup-surf').hide();
$('.meteo-popup-global').hide();
$('.meteo-popup-army').hide();
$('.meteo-popup-auto').hide();
},
setPopupData: function (id, data) {
var html = data ? data : "--";
$(id).html(html);
},
setTitle: function (id, name, station, ldate) {
// var html = data == 0 || data ? data + company : "--";
if (name == "undefined" || !name) name = null;
var html = name ? name + " (" + station + ")" : "(" + station + ")";
html = ldate ? html + " " + ldate : html;
$(id).html(html);
},
}
// popup.init();
// popup.initImage();
return popup;
});