master
luoxinyu 2 years ago
parent 711918bbab
commit 5e42e5f965

@ -0,0 +1,5 @@
{
"pages": [
"pages/weather/weather"
]
}

@ -0,0 +1,40 @@
// pages/index/weather.js
//定义城市、天气、温度、风级、图片、日期参数
const app = getApp()
Page({
data: {
adcode:'',
city:'',
humidity:'',
province:'',
reporttime:'',
temperature:'',
weather:'',
winddirection:'',
windpower:'',
},
//动态获取input输入值 城市名称
onLoad:function(){
var self = this
wx.request({
url: 'https://restapi.amap.com/v3/weather/weatherInfo',
data:{
'key':'57c5604fb2700562654f29fd995ddb4a',
'city':'511302'
},
success: function(res) {
console.log(res.data);
self.setData({
city: res.data.lives[0].city,
weather:res.data.lives[0].weather,
temp:res.data.lives[0].temperature,
winddirection:res.data.lives[0].winddirection,
windpower:res.data.lives[0].windpower,
date:res.data.lives[0].reporttime
})
}
})
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,17 @@
<!--pages/index/weather.wxml-->
<input placeholder="输入城市名进行搜索" bindinput="bindKeyInput"></input>
<view>
<icon type="search" size="25" bindtap="search" />
</view>
<view>
<view class="city"><text>地区:{{city}}</text></view>
<view class="tody"><text>时间:{{date}}</text></view>
</view>
<view class="bottom">
<view class="weather"><text>天气:{{weather}}</text></view>
<view class="right">
<view class="temp"><text>温度:{{temp}}</text></view>
<view class="wind"><text>风向:{{winddirection}}</text></view>
<view class="wind"><text>风力(单位:级):{{windpower}}</text></view>
</view>
</view>

@ -0,0 +1 @@
/* pages/index/weather.wxss */

@ -0,0 +1,50 @@
{
"description": "项目配置文件",
"setting": {
"bundle": false,
"userConfirmedBundleSwitch": false,
"urlCheck": true,
"scopeDataCheck": false,
"coverView": true,
"es6": true,
"postcss": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"preloadBackgroundData": false,
"minified": true,
"autoAudits": false,
"newFeature": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"useIsolateContext": true,
"nodeModules": false,
"enhance": true,
"useMultiFrameRuntime": true,
"showShadowRootInWxmlPanel": true,
"packNpmManually": false,
"enableEngineNative": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false,
"minifyWXML": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"condition": false,
"ignoreUploadUnusedFiles": true
},
"compileType": "miniprogram",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "2.19.4",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx5df977e384485ad6"
}

@ -0,0 +1,8 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5",
"setting": {
"compileHotReLoad": true,
"urlCheck": false
}
}
Loading…
Cancel
Save