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.
 

287 lines
5.1 KiB

// pages/activity/subway/index.js
import commonApi from "../../../utils/https/common"
import util from "../../../utils/util"
Page({
/**
* 页面的初始数据
*/
data: {
line:0,
colors:["#2EAE4F","#00A5AF","#E99A10","#278AE7","#C652A7"],
tagIndex:0,
isFixed:false,
tags:[
[{
id:74,
name:"全部"
},{
id:31,
name:"木渎站"
},{
id:32,
name:"西环路站"
},{
id:33,
name:"养育巷站"
},{
id:34,
name:"乐桥站"
},{
id:35,
name:"临顿路站"
},{
id:36,
name:"相门站"
},{
id:37,
name:"东方之门站"
},{
id:38,
name:"文化博览中心站"
},{
id:39,
name:"时代广场站"
}],[{
id:75,
name:"全部"
},{
id:40,
name:"山塘街站"
},{
id:41,
name:"石路站"
},{
id:42,
name:"桐泾公园站"
},{
id:43,
name:"独墅湖邻里中心站"
},{
id:44,
name:"月亮湾站"
},{
id:45,
name:"桑田岛站"
}],[{
id:76,
name:"全部"
},{
id:46,
name:"文昌路站"
},{
id:47,
name:"索山桥西站"
},{
id:48,
name:"石湖北站"
},{
id:48,
name:"石湖北站"
},{
id:49,
name:"新郭站"
},{
id:50,
name:"迎春路站"
},{
id:51,
name:"李公堤西站"
},{
id:52,
name:"东方之门站"
},{
id:53,
name:"唯亭站"
}],[{
id:77,
name:"全部"
},{
id:54,
name:"龙道浜站"
},{
id:55,
name:"孙武纪念园站"
},{
id:56,
name:"北寺塔站"
},{
id:57,
name:"乐桥站"
},{
id:58,
name:"三元坊站"
},{
id:59,
name:"南门站"
},{
id:60,
name:"苏州湾东站"
},{
id:61,
name:"松陵大道站"
},{
id:62,
name:"同里站"
},{
id:63,
name:"越溪站"
}],[{
id:78,
name:"全部"
},{
id:64,
name:"太湖香山站"
},{
id:65,
name:"胥口站"
},{
id:66,
name:"灵岩山站"
},{
id:67,
name:"索山桥西站"
},{
id:68,
name:"新市桥站"
},{
id:69,
name:"南门站"
},{
id:70,
name:"李公堤南站"
},{
id:71,
name:"斜塘站"
},{
id:72,
name:"苏州奥体中心站"
},{
id:73,
name:"阳澄湖南站"
}]
],
list:[],
total:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getList()
},
changeLine:function(e){
this.setData({
line:e.currentTarget.dataset.index,
tagIndex:0,
list:[],
total:1
})
this.getList();
},
changeTag:function(e){
this.setData({
tagIndex:e.currentTarget.dataset.index,
list:[],
total:1
})
this.getList();
},
getList:function(){
if(this.data.list.length>=this.data.total) return;
commonApi._post('scene/get_scene_by_tag',{
tag_id:this.data.tags[this.data.line][this.data.tagIndex].id,
limit:10,
offset:this.data.list.length
}).then(res=>{
this.setData({
total:res.data.count,
list:this.data.list.concat(res.data.list)
})
})
},
toTop:function(){
wx.pageScrollTo({
duration: 200,
scrollTop:0
})
},
showMap:function(e){
wx.showLoading({
title: '加载中',
})
let src = e.currentTarget.dataset.src;
wx.downloadFile({
url: src,
success:function(e){
wx.previewImage({
urls: [e.tempFilePath],
current:e.tempFilePath
})
},
complete:function(){
wx.hideLoading({
})
}
})
},
gotoDetail:function(e){
let item = e.currentTarget.dataset.item;
util.gotoDetail(item)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onPageScroll:function(e){
let sys = wx.getSystemInfoSync(),ratio = sys.screenWidth/750,height = 949 * ratio;
this.setData({
isFixed:e.scrollTop>=height
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})