/** * ## 根据天气编码,获取对应的天气图片. * @param {number} code * @returns {string} 图片的路径 * @see http://www.weatherdt.com/help.html */ function get_img_by_weatherCode(code) { var imgUrl = ''; switch (code) { case 0: imgUrl = '/weather/ico/00.png'; break; case 1: imgUrl = '/weather/ico/01.png'; break; case 2: imgUrl = '/weather/ico/02.png'; break; case 3: imgUrl = '/weather/ico/03.png'; break; case 4: imgUrl = '/weather/ico/04.png'; break; case 5: imgUrl = '/weather/ico/05.png'; break; case 6: imgUrl = '/weather/ico/06.png'; break; case 7: imgUrl = '/weather/ico/07.png'; break; case 8: imgUrl = '/weather/ico/08.png'; break; case 9: imgUrl = '/weather/ico/09.png'; break; case 10: imgUrl = '/weather/ico/10.png'; break; case 11: imgUrl = '/weather/ico/11.png'; break; case 12: imgUrl = '/weather/ico/12.png'; break; case 13: imgUrl = '/weather/ico/13.png'; break; case 14: imgUrl = '/weather/ico/14.png'; break; case 15: imgUrl = '/weather/ico/15.png'; break; case 16: imgUrl = '/weather/ico/16.png'; break; case 17: imgUrl = '/weather/ico/17.png'; break; case 18: imgUrl = '/weather/ico/18.png'; break; case 19: imgUrl = '/weather/ico/19.png'; break; case 20: imgUrl = '/weather/ico/20.png'; break; case 21: imgUrl = '/weather/ico/21.png'; break; case 22: imgUrl = '/weather/ico/22.png'; break; case 23: imgUrl = '/weather/ico/23.png'; break; case 24: imgUrl = '/weather/ico/24.png'; break; case 25: imgUrl = '/weather/ico/25.png'; break; case 26: imgUrl = '/weather/ico/26.png'; break; case 27: imgUrl = '/weather/ico/27.png'; break; case 28: imgUrl = '/weather/ico/28.png'; break; case 29: imgUrl = '/weather/ico/29.png'; break; case 30: imgUrl = '/weather/ico/30.png'; break; case 31: imgUrl = '/weather/ico/31.png'; break; case 53: imgUrl = '/weather/ico/53.png'; break; case 99: imgUrl = '/weather/ico/99.png'; break; case 32: imgUrl = '/weather/ico/32.png'; break; case 49: imgUrl = '/weather/ico/49.png'; break; case 54: imgUrl = '/weather/ico/54.png'; break; case 55: imgUrl = '/weather/ico/55.png'; break; case 56: imgUrl = '/weather/ico/56.png'; break; case 57: imgUrl = '/weather/ico/57.png'; break; case 58: imgUrl = '/weather/ico/58.png'; break; case 301: imgUrl = '/weather/ico/301.png'; break; case 302: imgUrl = '/weather/ico/302.png'; break; default: imgUrl = '/weather/ico/00.png'; break; } return imgUrl; } /** * ## 根据参数,解析景区等级 5 -> 'AAAAA' ,'AAA'->'AAA' * @param {string} rankStr 等级字符串 */ function scenic_rank_resolver(rankStr) { var rank = rankStr; try { var rankNum = parseInt(rank); if (rankNum) { rank = ''; for (var i = 1; i <= rankNum; i++) { rank += 'A'; } } if(rank == ''){ rank = '未评级'; } } catch (e) { console.log(e); } return rank; }