1.利用两天的周末,参考逍遥的风格,推出了一个天气小程序【逍遥天气】。2.功能很简单,查看当前区域的天气和搜索其他区域的天气,添加生成图片分享的功能。3、上线后发现一个问题,就是极速提供的天气界面不区分区级城市。比如上海有宝山区,东北有一个。没有区别。这是一个bug4。如果您还有其他问题,请提出您的意见和建议。欢迎大家扫码体验详情如下:<按钮类="keep"catchtap='eventSave'>{{shareText}}返回历史记录0"bindtap="goWeather">{{list}}热门城市定位{{list}}getWeatherData:function(city){var_this=this,thisdata=this.data,historyArea=thisdata.historyArea;wx.request({url:_this.data.api,数据:{"city":city},方法:'get',标头:{'Content-Type':'application/json'},dataType:'jsonp',jsonp:'callback',成功:函数(res){varres=res.datares=JSON.parse(res)if(res.status==="0"){vardata=res['result']data.img='../images/condicon/'+data.img+'b.png'_this.setData({getSuccess:'true',getLotion:city,realdata:data,clock:data.updatetime,aqi:data['aqi'],aqiMsg:data.aqi.aqiinfo['affect']+','+data.aqi.aqiinfo['measure'],life:data['index'],daily:data['daily'],hourly:data['hourly'],airPredict:'两小时后的天气'+data.hourly[2].weather+',temperature'+data.hourly[2].temp+'°',quality:data['aqi'].quality})//搜索返回成功后,清空输入框,放入Enterhistory中的搜索结果//_this.$refs.clearText.value=''if(thisdata.inpuText!==''){if(thisdata.historyArea.indexOf(thisdata.inpuText)===-1){historyArea.push(thisdata.inpuText)_this.setData({historyArea:historyArea})}}_this.back()}else{wx.showModal({title:'提示',content:res.msg,success:function(res){if(res.confirm){_this.setData({msgText:'位置获取失败!!!Pleaseselectmanually',loadingBtn:true})}elseif(res.cancel){console.log('Userclickedcancel')}}})}},//定位并获取selectLocation:function(){let_this=这个_this.getlocation();},getlocation:function(){var_this=thiswx.getLocation({type:'wgs84',success:function(res){console.log(res)varlatitude=res.latitudevarlongitude=res.longitudevarspeed=res.speedvaraccuracy=res.accuracyqqmapsdk.reverseGeocoder({location:{latitude:latitude,longitude:longitude},success:function(res){console.log(res)_this.setData({getLotion:res.result.address_component.district?res.result.address_component.district:res.result.address_component.city})wx.setNavigationBarTitle({title:res.result.address_component.district})_this.getWeatherData(res.result.address_component.district)}})},fail:function(res){_this.setData({msgText:'位置获取失败!!!请手动选择',loadingBtn:true})}})},