3 Star 0 Fork 0

wilsonJ / blxb_microHelper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
wilsonJ 提交于 2017-09-02 01:47 . 第一次提交
//app.js
import Util from "utils/util";
import Config from "config";
App({
globalData: {
systemInfo: null,
userInfo: null,
openId: 1,
code: null,
sessionKey: null,
},
"Util": Util,
"Config": Config,
// 小程序初始化
onLaunch() {
const that = this;
// 获取系统信息
wx.getSystemInfo({
success(res) {
that.globalData.systemInfo = res;
},
});
that.inIt();
},
// 小程序初始化
inIt: function () {
const that = this;
that.Util.login() // 登录
.then((res) => {
// console.log(res);
that.globalData.code = res.code;
return that.Util.getUserInfo(); // 获取用户信息
})
.then((res) => {
// console.log(res);
that.globalData.userInfo = res.userInfo;
return that.Util.getOpenIdAndKey(that.globalData.code); // 获取openId 和 access_key
})
.then((res) => {
// console.log(res.data.data.openId); // 后台需要改!
that.globalData.openId = res.data.data.openId;
})
.catch((res) => {
that.globalData.userRefuse = true;
})
},
})
1
https://gitee.com/wilsonJ/blxb_microHelper.git
git@gitee.com:wilsonJ/blxb_microHelper.git
wilsonJ
blxb_microHelper
blxb_microHelper
master

搜索帮助