|
|
|
|
// 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:[],
|
|
|
|
|
list:[],
|
|
|
|
|
total:1
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
commonApi._post("pbservice/Other/getClientConfig",{
|
|
|
|
|
unique_key:"wechatxcx"
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
let info = JSON.parse(res.data);
|
|
|
|
|
console.log(info)
|
|
|
|
|
this.setData({
|
|
|
|
|
tags:info.subway
|
|
|
|
|
})
|
|
|
|
|
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,
|
|
|
|
|
del_html:true
|
|
|
|
|
}).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 () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|