ceshi3.js
5.14 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
limit: 0,
show: 0,
limitto: 5,
loadHidden: true,
datalaiy: '中国福利彩票官网',
newstitle: '彩经新闻',
lists: [
{
'id': '1',
'image': 'http://img1.huiyijingling.cn/UploadImage/Meet/20161010/4ntia7d5/636117184529372567.png',
'title': '双色球17102期开奖结果',
'num': '304',
'state': '进行中',
'time': '2017-03-28',
'keywords': '双色球17102期开奖结果'
}
],
list: [
{
'id': '1',
'image': 'http://img1.huiyijingling.cn/UploadImage/Meet/20161010/4ntia7d5/636117185105463337.png',
'title': '福彩3D开奖结果',
'num': '150',
'state': '已结束',
'time': '2017-03-28',
'keywords': '福彩3D开奖结果'
}
],
kjlist: [
{
'id': '1', 'name': '双色球',
'bid': '0', 'caipiaoid': '13',
'ball': [{ id: 1, num: '2', tp: 1 }, { id: 2, num: '3', tp: 1 }, { id: 3, num: '4', tp: 1 }, { id: 4, num: '8', tp: 1 },
{ id: 5, num: '12', tp: 1 },
{ id: 6, num: '17', tp: 1 },
{ id: 7, num: '7', tp: 2 }
],
'issueno': '17031',
'opendate': '2017-03-28'
}
],
imgUrls: [
'/images/1.jpg',
'/images/2.jpg'
],
//配置tabBar
tabBar: {
"color": "#9E9E9E",
"selectedColor": "#f00",
"backgroundColor": "#fff",
"borderStyle": "#ccc",
"num": 4,
"list": [
{
"pagePath": "/page/index/index",
"text": "主页",
"iconPath": "../../images/1.png",
"selectedIconPath": "../../images/1-2.png",
//"selectedColor": "#4EDF80",
active: true
},
{
"pagePath": "/page/kj/list",
"text": "开奖查询",
"iconPath": "../../images/2.png",
"selectedIconPath": "../../images/2-2.png",
active: false
},
{
"pagePath": "/page/news/index",
"text": "彩经新闻",
"iconPath": "../../images/3.png",
"selectedIconPath": "../../images/3-2.png",
active: false
},
{
"pagePath": "/page/line/index",
"text": "预测分析",
"iconPath": "../../images/4.png",
"selectedIconPath": "../../images/4-2.png",
active: false
}
],
"position": "bottom"
}
},
scrollR: function (e) {
var that = this;
that.setData({ loadHidden: false })
wx.request({
//主页信息
url: app.url + '/apiArticleIndex.php', //首页接口地址
data: { limit: that.data.limit, limitto: that.data.limitto },
header: { 'Content-Type': 'application/json' },
success: function (res) {
that.setData({
list: res.data.aarr
})
that.setData({ limit: that.data.limit + 3 })
that.setData({ limitto: that.data.limitto + 3 })
that.setData({
lists: that.data.lists.concat(that.data.list),
});
},
fail: function (res) {
console.log('失败')
},
complete: function () {
//隐藏 加载中的提示
that.setData({ loadHidden: true })
},
})
},
getDatas: function (e) {
var that = this;
wx.request({
//主页信息
url: app.url + '/apiIndex.php', //首页接口地址
data: {},
success: function (res) {
that.setData({
kjlist: res.data.kjlist
})
that.setData({
datalaiy: res.data.datalaiy
})
that.setData({
newstitle: res.data.newstitle
})
},
fail: function (res) {
console.log('失败')
}
})
},
getArticleDatas: function (e) {
var that = this;
that.setData({ loadHidden: false })
wx.request({
//主页信息
url: app.url + '/apiArticleIndex.php', //首页接口地址
data: { limit: that.data.limit, limitto: that.data.limitto },
header: { 'Content-Type': 'application/json' },
success: function (res) {
that.setData({
lists: res.data.aarr
})
that.setData({ limit: that.data.limit + 3 })
that.setData({ limitto: that.data.limitto + 3 })
console.log('limit数据' + that.data.limit)
},
fail: function (res) {
console.log('失败')
},
complete: function () {
//隐藏 加载中的提示
that.setData({ loadHidden: true })
},
})
},
onLoad: function (e) {
// this.scrollR(e);
this.getDatas();
this.getArticleDatas();
},
//事件处理函数
bindViewTap: function () {
wx.navigateTo({
url: '../kjdetail/index',
success: function (res) {
console.log('跳转到news页面成功')// success
},
fail: function () {
console.log('跳转到news页面失败') // fail
},
complete: function () {
console.log('跳转到news页面完成') // complete
}
})
},
scroll: function (e) {
console.log('首页加载了scroll')
this.scrollR();
},
onShareAppMessage: function () {
}
})