index.js
5.2 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
//index.js
//获取应用实例
const app = getApp()
import mock from './mock.js'//拿到的数据
Page({
data: {
items: mock,
slide: [{image: '../../images/banner.png'}, {image: '../../images/banner.png'}],
images: [{src: '../../images/duantu@2x.png', text: '短途郊游'},
{src: '../../images/changtu@2x.png', text: '长途旅游'},
{src: '../../images/finecanting@2x.png', text: 'Fine Dining 餐厅'},
{src: '../../images/huwai@2x.png', text: '户外运动'},
{src: '../../images/juhui@2x.png', text: '聚会'},
{src: '../../images/yinyuejie@2x.png', text: '音乐节'},
{src: '../../images/dianying@2x.png', text: '电影'},
{src: '../../images/qingshe@2x.png', text: '轻奢餐厅'},
{src: '../../images/zhanlan@2x.png', text: '展览'},
{src: '../../images/wutaiju@2x.png', text: '舞台剧'},
],
banner: [{image: '../../images/banner.png'}, {image: '../../images/b1@2x (1).png'}, {image: '../../images/b1@2x (2).png'}, {image: '../../images/banner.png'}],
currentBannerIndex:0,
tabcurrent: {tab: 0,bubble: ''},
noticeList:[{url:'',name:'https://github.com/wux-weapp/wux-weapp'},
{url:'',name:'北京首展11奥拉维尔·埃利亚松北京首展北京首展11奥拉维尔·埃利亚松北京首展'},
{url:'',name:'https://github.com/wux-weapp/wux-weapphttps://github.com/wux-weapp/wux-weapp'},
{url:'',name:'奥拉维尔'},
{url:'',name:'奥拉维尔https://github.com/wux-weapp/wux-weapp'},
{url:'',name:'奥拉维尔·埃利亚松北京首展https://github.com/wux-weapp/wux-weapp'},
],
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onClick() {
wx.navigateTo({
url: '/pages/search/search',
})
},
//搜索
search() {
wx.navigateTo({
url: '/pages/search/search',
})
},
bannerChange(e){
// console.log(e,'current', current);
const current = e.detail.current;
this.setData({currentBannerIndex: current})
},
//事件处理函数
bindViewTap: function () {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
this._doRefreshMasonry(this.data.items)
},
onReachBottom: function () {
this._doAppendMasonry(this.data.items)
},
_doRefreshMasonry(items) {
this.masonryListComponent = this.selectComponent('#masonry');
this.masonryListComponent.start(items).then(() => {
console.log('refresh completed')
})
},
_doAppendMasonry(items) {
this.masonryListComponent = this.selectComponent('#masonry')
// 获取接口数据后使用瀑布流组件append方法,当append完成后调用then,是否可触底价在的标志位可以在这里处理
this.masonryListComponent.append(items).then(() => {
console.log('refresh completed,加载更多')
})
},
//首页-导航
service(e) {
var tindex = e.currentTarget.dataset.tindex;
var tabcurrent = this.data.tabcurrent;
if (tabcurrent == tindex) {
return false
} else {
this.setData({
tabcurrent: tindex
})
wx.redirectTo({
url: '/pages/index/index',
})
}
},
//拼单-导航
consult(e) {
var tindex = e.currentTarget.dataset.tindex
var tabcurrent = this.data.tabcurrent
if (tabcurrent == tindex) {
return false
} else {
this.setData({
tabcurrent: tindex
})
// wx.showToast({
// title: '该功能正在开发中',
// icon: 'none'
// })
wx.redirectTo({
url: '/pages/spell-list/spell-list',
})
}
},
//发布按钮
release(e) {
let that = this;
that.setData({
releasepopup: true
})
},
//取消发布弹窗
cancelPopup() {
let that = this;
that.setData({
releasepopup: false
})
},
//订单-导航
wish(e) {
var tindex = e.currentTarget.dataset.tindex
var tabcurrent = this.data.tabcurrent
if (tabcurrent == tindex) {
return false
} else {
this.setData({
tabcurrent: tindex
})
// wx.showToast({
// title: '该功能正在开发中',
// icon: 'none'
// })
wx.redirectTo({
url: '/pages/order/order',
})
}
},
//我的-导航
my(e) {
var tindex = e.currentTarget.dataset.tindex
var tabcurrent = this.data.tabcurrent
if (tabcurrent == tindex) {
return false
} else {
this.setData({
tabcurrent: tindex
})
wx.redirectTo({
url: '/pages/my/my',
})
}
},
})