logs.js
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//logs.js
const util = require('../../utils/util.js')
const app = getApp()
Page({
data: {
imageUrl: app.globalData.imageUrl,
logs: [],
code: ''
},
onLoad: function () {
// this.setData({
// logs: (wx.getStorageSync('logs') || []).map(log => {
// return util.formatTime(new Date(log))
// })
// })
this.getCodeFun()
},
getCodeFun() {
let t = this;
wx.login({
success: (r) => {
console.log(r.code)
t.setData({
code: r.code,
// rawData: r.rawData
})
}
});
},
//暂不授权
zhanbsq(){
// wx.navigateBack({//返回
// delta: 1
// })
wx.reLaunch({
url: '/pages/index/index'
})
},
getDenlu(e){
console.log(e)
let t = this;
let u = "common/login";
let d = {
code: t.data.code,
rawData: e.detail.rawData,
}
// console.log(t.data.code)
app.post(u, d).then((res) => {
// console.log(res)
if (res.code == 1) {
console.log(res);
wx.setStorageSync("token", res.data.userInfo.token)
wx.navigateBack({//返回
delta: 1
})
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
})