————————————————————————————————————————————
——app.js
handleRequestActivityList() {
util.fetch({
api: apis.activityList,
params: {}
}, (res) => {
if (res.code === 0) {
wx.getLocation({
type: 'wgs84',
success: function(event) {
let ThisLong = event.longitude;
let ThisLati = event.latitude;
let TheLongs = [];
let TheLatis = [];
let GetData = [];
let ZlzData = res.data.list;
let index_ZlzContentSliderWidth = res.data.list.length * 630 + 'rpx';
// 筛选出想要的数据
for (var i = 0; i < res.data.list.length; i++) {
TheLongs.push(res.data.list[i].longitude)
TheLatis.push(res.data.list[i].latitude)
GetData.push(
{
Getintro: res.data.list[i].intro.substring(0, 40) + '...',
distance: Other.distance(ThisLong, ThisLati, TheLongs[i], TheLatis[i]).toFixed(1),
Getid: res.data.list[i].id,
GetPrice: util.fixed(res.data.list[i].price),
GetAddress: res.data.list[i].address.substring(0, 18) + '...',
}
)
}
that.globalData.ZlzData = ZlzData;
typeof ZlzData == "function" && ZlzData(that.globalData.ZlzData);
}
})
}
})
},
————————————————————————————————————————————
————index.js
onLoad: function (options) {
app.handleRequestActivityList(function (ZlzData){
that.setData({
ZlzData:ZlzData
})
})
console.log(
this.data.ZlzData
)
},
浅白黄
相关分类