-
Notifications
You must be signed in to change notification settings - Fork 17
/
app.js
75 lines (72 loc) · 1.71 KB
/
app.js
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
//app.js
App({
onLaunch () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
//封装请求数据的方法
ajax:function(url, data, callback, method) {
var method = method ? method : "GET";
wx.request({
url: url,
data: data,
method: method,
header: {
'Content-Type': 'application/json'
},
success(res) {
callback(res.data);
},
fail(e) {
callback(e);
}
})
},
getUserInfo:function(cb){
var that = this
if(this.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success () {
wx.getUserInfo({
success (res) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
})
}
},
updateContactData: function(arr) {
this.globalData.contactData = arr;
},
updateMeetingrooms: function(arr) {
this.globalData.meetingrooms = arr;
},
updateCheckList: function(arr) {
this.globalData.checkList = arr;
},
updateCheckBrList: function(arr) {
this.globalData.checkBrList = arr;
},
updateContactsList: function(arr) {
this.globalData.contactsList = arr;
},
updateBoardroomList: function(arr) {
this.globalData.boardroomList = arr;
},
globalData:{
userInfo:null,
contactData: [],//联系人列表
checkList:[],//选中联系人
meetingrooms: [],//会议室列表
checkBrList:[],//选中会议室
contactsList: [],
boardroomList: []
}
})