6 Star 89 Fork 34

奇乐俱乐部/hioshop-miniprogram

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.js 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
var util = require('utils/util.js');
var api = require('config/api.js');
App({
data: {
deviceInfo: {}
},
onLaunch: function () {
this.data.deviceInfo = wx.getSystemInfoSync();
console.log(this.data.deviceInfo);
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: (res) => {
util.request(api.AuthLoginByWeixin, {
code: res.code
}, 'POST').then(function (res) {
if (res.errno === 0) {
let userInfo = res.data.userInfo;
wx.setStorageSync('token', res.data.token);
wx.setStorageSync('userInfo', userInfo);
}
});
},
});
let that = this;
wx.getSystemInfo({ // 获取页面的有关信息
success: function (res) {
wx.setStorageSync('systemInfo', res)
var ww = res.windowWidth;
var hh = res.windowHeight;
that.globalData.ww = ww;
that.globalData.hh = hh;
}
});
},
globalData: {
userInfo: {
nickname: '点我登录',
username: '点击登录',
avatar: 'http://lucky-icon.meiweiyuxian.com/hio/default_avatar_big.png'
},
token: '',
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mwyx/hioshop-miniprogram.git
[email protected]:mwyx/hioshop-miniprogram.git
mwyx
hioshop-miniprogram
hioshop-miniprogram
master

搜索帮助