You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.3 KiB
114 lines
2.3 KiB
// pages/activity/graduate/index.js
|
|
import commonApi from "../../../utils/https/common"
|
|
import util from "../../../utils/util"
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
list:[[],[],[],[]]
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
let ajaxes = [],list = [];
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
});
|
|
['62','63','64'].map(item=>{
|
|
ajaxes.push(commonApi._post("product/get_product_by_tag",{
|
|
tag_id: item,
|
|
offset: 0,
|
|
limit: 100
|
|
}))
|
|
});
|
|
ajaxes.push(commonApi._post("scene/get_scene_by_tag",{
|
|
tag_id: 30,
|
|
offset: 0,
|
|
limit: 100
|
|
}))
|
|
Promise.all(ajaxes).then(res=>{
|
|
res.map(item=>{
|
|
item.data.list.map(i=>{
|
|
i.display_tags = i.display_tags?i.display_tags.split(","):[];
|
|
i.display_tags = i.display_tags.slice(0,2);
|
|
})
|
|
list.push(item.data.list);
|
|
})
|
|
this.setData({
|
|
list:list
|
|
})
|
|
wx.hideLoading({})
|
|
})
|
|
},
|
|
gotoDetail:function(e){
|
|
let item = e.currentTarget.dataset.item;
|
|
util.gotoDetail(item)
|
|
},
|
|
scrollToBox:function(e){
|
|
let index = e.currentTarget.dataset.index;
|
|
const query=wx.createSelectorQuery(); //创建节点查询器
|
|
query.select("#box"+index).boundingClientRect() //选择toViewid获取位置信息
|
|
query.selectViewport().scrollOffset() //获取页面查询位置的
|
|
query.exec(function(res) {
|
|
console.log(res)
|
|
let scrollTop = res[0].top + res[1].scrollTop ;
|
|
wx.pageScrollTo({
|
|
scrollTop: scrollTop - 60,
|
|
duration: 200
|
|
})
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|