index.js
2.81 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
function o(o) {
return o && o.__esModule ? o : {
default: o
};
}
var e = o(require("../../utils/restapi.js")), n = o(require("./service.js")), t = getApp();
Page({
data: {
agree: !1,
protocol: !0,
service: n.default
},
noScroll: function() {},
showProtocol: function(e) {
// this.setData({
// protocol: !1
// });
let id = e.currentTarget.dataset.id;
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/privacy.html'
if(id == 'agreement'){
url = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/agreement.html'
}
wx.navigateTo({
url: '/pages/webpage/webpage?path=' + encodeURIComponent(url),
})
},
choose: function() {
this.setData({
agree: !this.data.agree
});
},
closeProtocol: function() {
this.setData({
protocol: !0
});
},
agree: function() {
this.setData({
agree: !0,
protocol: !0
});
},
getUserInfo: function(o) {
console.log(o);
var e = this;
o.detail.userInfo && wx.getUserInfo({
withCredentials: !0,
lang: "zh_CN",
success: function(o) {
console.log("授权:", o), e.data.gender = o.userInfo.gender, wx.checkSession({
success: function() {
e.authUserInfo(o);
},
fail: function() {
wx.login({
success: function(n) {
t.globalData.code = n.code, e.authUserInfo(o);
}
});
}
});
},
fail: function(o) {
console.log(o);
}
});
},
authUserInfo: function(o) {
var n = t.globalData.sceneData, a = this;
o.code = t.globalData.code, o.appId = t.globalData.appId, o.gender = a.data.gender,
o.sceneUrl = n.path, n.query.employeeId && (o.sceneParam = n.query.employeeId),
e.default.authUserInfo(o, function(o) {
console.log("授权用户信息登录", o), 0 == o.returnCode ? wx.redirectTo({
url: "../login/index/index"
}) : wx.showToast({
title: o.message,
icon: "none"
});
}, function() {
wx.showToast({
title: "授权用户信息失败",
icon: "none"
});
});
},
onLoad: function(o) {},
onReady: function() {},
onShow: function() {},
onHide: function() {},
onUnload: function() {},
onPullDownRefresh: function() {},
onReachBottom: function() {}
});