1 Star 11 Fork 5

tomatocc/wxmap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
app.js 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
tomatocc 提交于 2020-05-27 12:13 . 全量代码提交
//app.js
import CFG from "config.js";
App({
onLaunch: function () {
//天气start
wx.cloud.init({
env: 'cloud env',
traceUser: true,
})
//天气end
wx.getSystemInfo({
success: (res) => {
this.globalData.systeminfo = res
this.globalData.isIPhoneX = /iphonex/gi.test(res.model.replace(/\s+/, ''))
},
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
},
globalData: {
//天气start
// 是否保持常亮,离开小程序失效
keepscreenon:false,
systeminfo: {},
key :"",//和风天气 key
weatherIconUrl: 'https://cdn.heweather.com/cond_icon/',
requestUrl: {
weather: 'https://free-api.heweather.com/s6/weather',
hourly: 'https://free-api.heweather.com/s6/weather/hourly',
air: 'https://free-api.heweather.com/s6/air/now',
yiyan:'https://v1.hitokoto.cn'
},
//天气end
userInfo: null
},getConfig:function(){
return CFG.config;
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tomatocc/wxmap.git
git@gitee.com:tomatocc/wxmap.git
tomatocc
wxmap
wxmap
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385