1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- // app.js
- App({
- onLaunch() {
- // 展示本地存储能力
- const logs = wx.getStorageSync('logs') || []
- logs.unshift(Date.now())
- wx.setStorageSync('logs', logs)
-
- // 登录
- wx.login({
- success: (res) => {
- if (res.code) {
- //获取openid
- wx.request({
- url: this.mangerUrl + '/service/weixin/getWxOpenId',
- data: {
- appNum: 11,
- js_code: res.code
- },
- success: (result) => {
- if (!!result.data && result.data.openid) {
- // this.globalData.openid = result.data.openid;
- this.globalData.appid = result.data.appid;
- this.globalData.sessionKey = result.data.sessionKey;
- }
- }
- })
- } else {
- wx.showToast({
- title: '获取登录信息失败',
- icon: 'none',
- duration: 2000
- })
- }
- }
- })
- },
- globalData: {
- userInfo: null,
- openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
- appid: "",
- sessionKey: "",
- suiteCode: "",
- customerId: "",
- },
- // mangerUrl: 'http://test2.hhrchina.com',
- mangerUrl: "http://192.168.18.156",
- // mangerUrl: "https://www.hhrchina.com",
- // mangerUrlPath: "https://www.hhrchina.com",
- })
|