代码拉取完成,页面将自动刷新
var e = require('@babel/runtime/helpers/interopRequireDefault'),
t = require('@babel/runtime/helpers/objectSpread2'),
o = require('@babel/runtime/helpers/createForOfIteratorHelper'),
a = e(require('@babel/runtime/regenerator')),
n = require('@babel/runtime/helpers/asyncToGenerator'),
s = require('./utils/getD14.js').login
require('./utils/getD4.js'),
App({
onLaunch: function (e) {
var t = this
return n(
a.default.mark(function o() {
var n, s, r, c
return a.default.wrap(function (o) {
for (;;)
switch ((o.prev = o.next)) {
case 0:
console.log('启动参数', e),
(n = e.scene),
(s = e.query),
(r = s.top_c),
(c = s.sub_c),
(t.globalData.scene = n),
(t.globalData.top_c = r),
(t.globalData.sub_c = c),
(t.globalData.deviceInfo = wx.getSystemInfoSync()),
(t.globalData.start_ts = Date.now()),
t.ks()
case 9:
case 'end':
return o.stop()
}
}, o)
})
)()
},
globalData: { userInfo: null, speed_time: 4, state: '' },
pushLog: function () {
console.log('预留上传')
},
addEvent: function (e) {
;(e.ts = new Date().toLocaleString()),
console.log('====addEvent 添加埋点===='),
console.log(e),
console.log('========')
var t = wx.getStorageSync('logs') || []
t.push(e), wx.setStorageSync('logs', t)
},
initLogin: function () {
var e = this
return n(
a.default.mark(function t() {
return a.default.wrap(
function (t) {
for (;;)
switch ((t.prev = t.next)) {
case 0:
if (
(console.log('--登录--'),
(t.prev = 1),
wx.getStorageSync('token'))
) {
t.next = 8
break
}
return console.log('用户未登录'), (t.next = 6), e.wxLogin()
case 6:
t.next = 10
break
case 8:
;(e.globalData.userInfo = wx.getStorageSync('userInfo')),
(e.globalData.openid = wx.getStorageSync('openid'))
case 10:
t.next = 16
break
case 12:
return (
(t.prev = 12),
(t.t0 = t.catch(1)),
console.log('检查登录异常了'),
t.abrupt('return', !1)
)
case 16:
case 'end':
return t.stop()
}
},
t,
null,
[[1, 12]]
)
})
)()
},
wxLogin: function () {
var e = this,
o = this.globalData.deviceInfo,
r = o.brand,
c = o.system,
l = o.platform,
i = o.version,
u = o.model,
g = {
scene: this.globalData.scene,
sub_c: this.globalData.sub_c,
top_c: this.globalData.top_c,
brand: r,
system: c,
platform: l,
model: u,
version: i
}
return new Promise(function (o, r) {
var c
wx.login({
success:
((c = n(
a.default.mark(function n(c) {
var l, i, u, d, p, f
return a.default.wrap(function (a) {
for (;;)
switch ((a.prev = a.next)) {
case 0:
return (l = c.code), (a.next = 3), s(t({ code: l }, g))
case 3:
console.log('测试', (i = a.sent).code)
0 == (i = a.sent).code
? (console.log('登录成功', i),
(u = i.data),
(d = u.openid),
(p = u.token),
(f = u.user),
(e.globalData.userInfo = f),
(e.globalData.openid = d),
wx.setStorageSync('token', p),
wx.setStorageSync('openid', d),
wx.setStorageSync('userInfo', f),
o(!0))
: (console.log('登录失败', i), r(!1))
case 5:
case 'end':
return a.stop()
}
}, n)
})
)),
function (e) {
return c.apply(this, arguments)
})
})
})
},
onHide: function () {
console.log('onHide'),
this.addEvent({
id: 'onHide',
duration: Date.now() - this.globalData.start_ts
})
// this.pushLog()
},
ks: function () {},
getAd: function () {},
getSettings: function () {}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。