Skip to content

Commit

Permalink
修改天气定位问问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmarfreitaso committed Jul 25, 2021
1 parent a0e0ee8 commit dee8fb3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"iPad"
],
"id": "H55C29548",/*应用的标识,创建应用时自动生成,勿手动修改*/
"name": "小助手",/*应用名称,程序桌面图标名称*/
"name": "贴身管家",/*应用名称,程序桌面图标名称*/
"version": {
"name": "1.1.1",/*应用版本名称*/
"code": "83"
Expand Down
12 changes: 6 additions & 6 deletions pages/weather.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@

mui.plusReady(function() {
//获取当前地理位置信息
plus.geolocation.getCurrentPosition(function(data) {
console.log(JSON.stringify(data))
//address = data.address.district;
var dat = data;
plus.geolocation.getCurrentPosition(function(res) {
//alert(JSON.stringify(data))
console.log(JSON.stringify(res))
//请求数据
var url = 'https://free-api.heweather.com/s6/weather/now?key=9aab750e479648829ea03e5646a3bc36&location=' + dat.address.district;
var url = 'https://free-api.heweather.com/s6/weather/now?key=9aab750e479648829ea03e5646a3bc36&location='+res.coords.longitude+','+res.coords.latitude;
mui.ajax(url, {
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
Expand All @@ -135,10 +134,11 @@
},
success: function(data) {
if(data.HeWeather6[0].status == "ok") {
var dz = data.HeWeather6[0].basic.admin_area +" "+data.HeWeather6[0].basic.parent_city+" "+data.HeWeather6[0].basic.location;
var data = data.HeWeather6[0].now;
//赋值
document.getElementById('whimg').setAttribute('src', '../images/weather1/' + data.cond_code + '.png')
document.getElementById('city').innerText = dat.address.province + ' ' + dat.address.city + ' ' + dat.address.district;
document.getElementById('city').innerText = dz;
document.getElementById('cond_txt').innerText = data.cond_txt;
document.getElementById('wind_dir').innerText = data.wind_dir;
document.getElementById('wind_sc').innerText = data.wind_sc;
Expand Down
Binary file added unpackage/release/H55C29548_1201173700.apk
Binary file not shown.
Binary file added unpackage/release/H55C29548_1201174324.apk
Binary file not shown.
Binary file added unpackage/release/H55C29548_1201175524.apk
Binary file not shown.
Binary file added unpackage/release/H55C29548_1201175637.apk
Binary file not shown.

0 comments on commit dee8fb3

Please sign in to comment.