From 161764f13671738709a8ee49605d30ca4c8c6aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E6=98=AD=E5=B1=B1?= <1290344919@qq.com> Date: Wed, 14 Jul 2021 09:18:35 +0800 Subject: [PATCH] over --- project.config.json | 68 +++++++++++++++++++ .../weatherSearch/pages/index/index.js" | 33 ++++++++- .../weatherSearch/pages/index/index.wxml" | 46 ++++--------- .../weatherSearch/pages/index/index.wxss" | 40 ++++++++++- 4 files changed, 149 insertions(+), 38 deletions(-) create mode 100644 project.config.json diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..f26881a --- /dev/null +++ b/project.config.json @@ -0,0 +1,68 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "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, + "useApiHook": true, + "useApiHostProcess": false, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false + }, + "compileType": "miniprogram", + "libVersion": "2.18.0", + "appid": "wx7cc3e303d5902b33", + "projectname": "weather", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file diff --git "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.js" "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.js" index f970764..457e222 100644 --- "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.js" +++ "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.js" @@ -17,6 +17,7 @@ Page({ this.getLocationXY() } }, + //获得当前的坐标,通过百度地图API // getLocationXY: function () { @@ -94,7 +95,25 @@ Page({ fail:function(res){}, }) - + //获取生活指数 + wx.request({ + url: 'https://devapi.qweather.com/v7/indices/1d', + data:{ + location:locationY+","+locationX, + type:"3,1", + key: '6c764218c0694a068da82b510b7a5ec8', + }, + success:function(res){ + // console.log('------',res) + var liveO = res.data.daily[0] + var liveT = res.data.daily[1] + that.setData({liveO:liveO,liveT:liveT}); + console.log('指数',that.data.liveT); + }, + fail:function(res){}, + complete:function(res){}, + + }); }, onShow: function () { @@ -106,7 +125,11 @@ Page({ }, onUnload: function () { - + wx.showToast({ + title: '欢迎回来', + icon: 'success', + duration: 2000 + }) }, onPullDownRefresh: function () { @@ -114,7 +137,11 @@ Page({ }, onReachBottom: function () { - + wx.showToast({ + title: '没有内容咯!', + icon:'none', + duration: 2000 + }) }, onShareAppMessage: function () { diff --git "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxml" "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxml" index 48ba22d..145023a 100644 --- "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxml" +++ "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxml" @@ -30,37 +30,19 @@ ☁ {{item.textDay}} {{item.tempMin}}℃/{{item.tempMax}}℃ - - + + 生活指数 + + + {{liveO.name}} + 类型:{{liveO.category}} + {{liveO.text}} + + + + {{liveT.name}} + 类型:{{liveT.category}} + {{liveT.text}} + \ No newline at end of file diff --git "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxss" "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxss" index e288bd5..7df9312 100644 --- "a/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxss" +++ "b/\345\272\204\346\230\255\345\261\261/weatherSearch/pages/index/index.wxss" @@ -16,11 +16,13 @@ color: white; font-size: 15px; font-family: 微软雅黑,宋体; + background-image: linear-gradient(to bottom right, rgb(0,44,130), skyblue); } .location{ background-size: 100% 100%; height: auto; /* text-align: center; */ + display: block; } .dq{ font-size: 30px; @@ -54,10 +56,10 @@ color: white; } .future{ - height: 100%; + height: auto; flex-direction: row; justify-content: space-around; - background-image: linear-gradient(to bottom right, rgb(0,44,130), skyblue); + } .img{ width: 60rpx; @@ -89,4 +91,36 @@ display: flex; flex-direction: column; box-sizing: border-box; -} \ No newline at end of file +} +.live_text{ + font-size: 20px; + display: flex; + padding: 50rpx 0rpx 0rpx 20rpx; +} +.live{ + height: 350rpx; + padding: 30rpx 0rpx 0rpx 0rpx; + /* background-color: red; */ + display: flex; + justify-content: space-around; +} +.live_fgx{ + border: 1px solid gray; +} +.first{ + text-align: center; + /* border: 1px solid gray; */ + /* float: left; */ + +} +.second{ + text-align: center; + /* border: 1px solid gray; */ + /* float: left; */ +} +.live_name{ + padding-bottom: 20rpx; +} +.info{ + padding-bottom: 20rpx; +} \ No newline at end of file -- Gitee