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.
 

138 lines
2.9 KiB

// pages/activity/springten/list/index.js
import commonApi from "../../../../utils/https/common"
import util from "../../../../utils/util"
Page({
/**
* 页面的初始数据
*/
data: {
types:['必赏','必吃','必游','必玩','必购','必住','赏夜戏','品夜饮','尝夜宴','逛夜市'],
type:0,
list:[],
area_id:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
type:options.type,
area_id:options.area_id
})
this.getList();
},
getList:function(){
if(this.data.total<=this.data.list.length) return;
commonApi._post("scene/get_scene_by_tag",{
offset:this.data.list.length,
limit:30,
tag_id:this.data.type!=0?17+Number(this.data.type):27,
area_id:this.data.area_id
}).then(res=>{
res.data.list.map(item=>{
if(item.type && item.type.indexOf('tenscenic')!=-1){
item.isYunHe = true;
}
else {
item.isYunHe = false;
}
item.brief_intro = item.brief_intro.replace(/<\/?.+?>/g,"");
item.display_tags = item.display_tags?item.display_tags.split(","):[];
item.display_tags = item.display_tags.splice(0,2);
})
this.setData({
list:this.data.list.concat(res.data.list),
total:res.data.count
})
})
},
detail:function(e){
let item = e.currentTarget.dataset.item;
if(item.is_nav){
this.gotoLocation(e);
}
else if(item.type && item.type.indexOf('tenscenic')!=-1){
this.gotoFoodInfo(e)
}
else {
this.gotoDetail(e)
}
},
gotoWeb:function(e){
let item = e.currentTarget.dataset.item;
app.globalData.weburl = item.ext_link;
wx.navigateTo({
url: '/pages/pbService/web/index',
})
},
gotoDetail:function(e){
let item = e.currentTarget.dataset.item;
util.gotoDetail(item)
},
gotoLocation:function(e){
let item = e.currentTarget.dataset.item;
wx.openLocation({
latitude: item.lat,
longitude: item.lon,
name:item.title,
address:item.address
})
},
gotoFoodInfo:function(e){
let item = e.currentTarget.dataset.item;
wx.navigateTo({
url: '/pages/info/foodInfo/index?id='+item.id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})