12 Star 107 Fork 46

7gugu / Energym

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.js 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
7gugu 提交于 2020-08-17 16:33 . 第一次提交
//app.js
App({
onLaunch: function() {
let that = this;
if (!wx.cloud) {
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
} else {
wx.cloud.init({
env: 'lebu-t05b2',
traceUser: true,
})
}
// wx.cloud.callFunction({
// name:'getopenid',
// complete:res=>{
// //记录openid
// this.globalData.openid = res.result.openid;
// }
// })
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
// 登录
wx.login({success: res => {}})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: res => {
this.globalData.userInfo = res.userInfo
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null,
openid: null
}
})
JavaScript
1
https://gitee.com/7gugu/Energym.git
git@gitee.com:7gugu/Energym.git
7gugu
Energym
Energym
master

搜索帮助