-
Notifications
You must be signed in to change notification settings - Fork 48
/
app.js
46 lines (37 loc) Β· 962 Bytes
/
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
//app.js
const AV = require('./libs/av-weapp-min');
AV.init({
appId: '5QYsrni4fqM7383D0jPb1isT-gzGzoHsz',
appKey: 'LHOhQmG8nzXRGUVBpS9IxIK0',
});
const Q = new AV.Query('poetry')
Q._limit = 500
App({
onLaunch: function () {
// ε±η€Ίζ¬ε°εε¨θ½ε
var vm = this;
Q.find().then(function (results) {
var poetrys = {}
for (var i in results) {
var item = results[i]
var poetry = {}
poetry['author'] = item.attributes.author
poetry['title']= item.attributes.title
poetry['paragraphs'] = item.attributes.paragraphs
poetry['cover'] = item.attributes.cover
poetry['id'] = item.id
poetrys[item.id] = poetry
}
wx.setStorageSync('poetrys', poetrys)
vm.globalData.poetrys = poetrys;
if (vm.poetrysCallback) {
vm.poetrysCallback(poetrys);
}
})
},
globalData: {
userInfo: null,
current: null,
poetrys: {}
}
})