Fix weather icon issue
- using openweather's one

1. Support unread message notification on widjet
This commit is contained in:
Joel,Kim
2022-04-26 16:43:11 +09:00
parent eaba23783d
commit 8b0160bfda
6 changed files with 86 additions and 20 deletions

View File

@@ -1823,7 +1823,7 @@ HotelTV.ui_appfull = (function() {
const _mpinfo = HotelTV.tvguide.program[_mmIdx].children;
// 메시지 팝업 빌드 및 화면 전환
if (HotelTV.tvguide.program[_mmIdx].children[_state.menu.main[_mmIdx].cur].type == 'message') {
const _msginf = HotelTV.message;
let _msginf = HotelTV.message;
let _cur_msglst_idx = _state.menu.main[_mmIdx]['message']['cur'];
// 현재 선택된 메시지의 디테일 정보 가져오기
let _cur_msgnum = $($('.main>.mypage>.bg>.owl-carousel .owl-item.center #mp_msg_tblrec tbody .focus')[0]).attr('msgnum');
@@ -1874,7 +1874,9 @@ HotelTV.ui_appfull = (function() {
//메시지 읽음 처리
HotelTV.api.SetMessageStatus(_cur_msgdesc._id);
_cur_msgdesc.read = true;
$('.main>.mypage>.bg>.owl-carousel .owl-item #mp_msg_tblrec tr').filter("[msgidx='" + _cur_msglst_idx.toString() + "']").children('td#num').addClass('read');
__uifxn_AppFull_Widjet_ShowMsgCnt();
});
}
}
@@ -3180,7 +3182,6 @@ HotelTV.ui_appfull = (function() {
}
/**
* HotelTV UI Wrapper Function::> Show Top Widjet Weather
* @param {boolean} _en show/hide
@@ -3193,6 +3194,37 @@ HotelTV.ui_appfull = (function() {
}
/**
* HotelTV UI Wrapper Function::> Show Top Widjet Message Cnt(Unread)
* @param {boolean} _en show/hide
*/
function __uifxn_AppFull_Widjet_ShowMsgCnt(_en) {
let _msgCnt = 0;
const _state = HotelTV.state;
const _guest = HotelTV.guestinfo;
let _trTbl = HotelTV.translation;
const _get_unread_msgCnt = function(_object) {
let _msg_unread_cnt = 0;
for (__j = 1; __j <= _object.length; __j++) {
if (_object[__j].read == false) {
_msg_unread_cnt++;
}
}
return _msg_unread_cnt;
}
_msgCnt = _get_unread_msgCnt(HotelTV.message);
if (_msgCnt > 0) {
$('.widjet .top .message #unread_cnt').text(_msgCnt.toString());
$('.widjet .top .message').show();
} else {
$('.widjet .top .message').hide();
}
$('div#lst_mypagebg div #mp_message_title').text(_guest.name + _trTbl.ui.mypage.message.title.title[_state.lang].replace("_XX", _msgCnt.toString()));
}
/**
* HotelTV UI Wrapper Function::> Build Main Menu::> Flight
*/
@@ -3361,11 +3393,7 @@ HotelTV.ui_appfull = (function() {
let _wData = _weather.daily[Number(_idx) + 1];
let _time = _wData.dt_txt.split(' ')[1];
let _temp = _wData.main.temp;
//OpenWeather API관련 아이콘 URL을 가져오는 방법은 아래 링크 참조:
//https://openweathermap.org/weather-conditions
$(_eltbl_fc_daily_items[_idx]).css('background-image', 'url(http://openweathermap.org/img/wn/' + _wData.weather.icon + '@2x.png)');
//$(_eltbl_fc_daily_items[_idx]).css('background-image', 'url(' + _weather.icon_image[_wData.weather.id] + ')');
$(_eltbl_fc_daily_items[_idx]).css('background-image', 'url(' + _weather.icon_image[_wData.weather.code] + ')');
$(_eltbl_fc_daily_items[_idx].children.time)[0].innerText = _time.split(":")[0] + ":" + _time.split(":")[1];
$(_eltbl_fc_daily_items[_idx].children.temp)[0].innerText = _temp.toString() + " °C";
}
@@ -3491,6 +3519,9 @@ HotelTV.ui_appfull = (function() {
//상단 날씨 아이콘 및 온도 표시
__uifxn_AppFull_Widjet_ShowWeather();
//상단 메시지(unread)개수 표시
__uifxn_AppFull_Widjet_ShowMsgCnt();
// //상단 시계 표시
_hndl_widget_topTime = setInterval(() => {
let _szCurTm = HotelTV.ui_utils.GetCur_DateTime();
@@ -4107,6 +4138,9 @@ HotelTV.ui_appfull = (function() {
}
}
$('div#lst_mypagebg div #mp_message_title').text(_guest.name + _trTbl.ui.mypage.message.title.title[_state.lang].replace("_XX", _msg_unread_cnt.toString()));
//widjet 상단 메시지(unread)개수 표시
__uifxn_AppFull_Widjet_ShowMsgCnt();
}).catch(_error => {
console.log("Fail to get Message info");
});