app.js
4.7 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var e = require("./utils/network.js");
require("./utils/util.js");
App({
onLaunch: function() {
wx.login({
success: function(s) {
if (s.code) {
var o = s.code;
wx.getSetting({
success: function(s) {
s.authSetting["scope.userInfo"] || wx.authorize({
scope: "scope.userInfo",
success: function() {
wx.getUserInfo ? wx.getUserInfo({
success: function(s) {
wx.showToast({
title: "加载中",
icon: "loading",
duration: 1500,
mask: !0
});
var t = s.userInfo;
wx.setStorage({
key: "userInfo",
data: t
}), wx.getStorage({
key: "userInfo",
success: function(s) {
console.log(s), e.POST({
url: "User/register",
header: "application/x-www-form-urlencoded",
params: {
code: o,
nickname: s.data.nickName,
headimg: s.data.avatarUrl
},
success: function(e) {
var s = e.data.ouid;
wx.setStorage({
key: "ouid",
data: s,
success: function(e) {
console.log(e), wx.hideToast(), wx.showToast({
title: "登录成功!",
icon: "success",
mask: !0,
duration: 1e3
});
}
});
}
});
}
});
}
}) : wx.showToast({
title: "版本过低",
icon: "none"
});
},
fail: function() {
var e = new Object();
e.userid = "", wx.setStorage({
key: "userInfo",
data: e
});
}
}), wx.hideToast();
}
});
}
}
});
},
uploadimg: function(e) {
var s = this, o = e.i ? e.i : 0, t = e.success ? e.success : 0, a = e.fail ? e.fail : 0;
wx.uploadFile({
url: e.url,
filePath: e.path[o],
name: "logo",
formData: {
id: e.id
},
success: function(e) {
t++;
},
fail: function(e) {
a++;
},
complete: function(i) {
++o == e.path.length || (e.i = o, e.success = t, e.fail = a, s.uploadimg(e));
}
});
}
});