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.
180 lines
3.5 KiB
180 lines
3.5 KiB
// pages/activity/artfestival/index.js
|
|
import commonApi from "../../../utils/https/common"
|
|
let app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
index:1,
|
|
page:1,
|
|
total:1,
|
|
list:[],
|
|
left:[],
|
|
right:[],
|
|
imgIndex:-1,
|
|
leftHeight:0,
|
|
rightHeight:0,
|
|
ajaxFlag:true
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
getList:function(){
|
|
if((this.data.left.length+this.data.right.length)>=this.data.total || !this.data.ajaxFlag) return;
|
|
this.setData({
|
|
ajaxFlag:false
|
|
})
|
|
commonApi._post("multimedia/media_list",{
|
|
page:this.data.page,
|
|
limit:10,
|
|
tenscenic_id:0,
|
|
class_id:this.data.index,
|
|
type:2
|
|
}).then(res=>{
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
})
|
|
this.setData({
|
|
total:res.data.total,
|
|
page:this.data.page+1,
|
|
list:res.data.data,
|
|
imgIndex:0
|
|
})
|
|
})
|
|
},
|
|
imageLoad:function(e){
|
|
if(this.data.imgIndex==-1) return;
|
|
let h = 304 * e.detail.height/e.detail.width + 33 + 26,leftHeight=this.data.leftHeight,rightHeight = this.data.rightHeight,left=this.data.left,right=this.data.right;
|
|
let item = this.data.list[this.data.imgIndex];
|
|
item.h = h - 33 - 26;
|
|
if(leftHeight<=rightHeight){
|
|
left.push(item);
|
|
leftHeight = leftHeight + h;
|
|
}
|
|
else {
|
|
right.push(item);
|
|
rightHeight = rightHeight + h;
|
|
}
|
|
this.setData({
|
|
// imgIndex:this.data.imgIndex+1,
|
|
left:left,
|
|
right:right,
|
|
leftHeight:leftHeight,
|
|
rightHeight:rightHeight
|
|
})
|
|
if(this.data.imgIndex>=this.data.list.length-1){
|
|
wx.hideLoading({
|
|
});
|
|
this.setData({
|
|
ajaxFlag:true
|
|
})
|
|
}
|
|
else {
|
|
this.setData({
|
|
imgIndex:this.data.imgIndex+1
|
|
})
|
|
}
|
|
},
|
|
changeType:function(e){
|
|
let index = e.currentTarget.dataset.type;
|
|
this.setData({
|
|
list:[],
|
|
total:1,
|
|
page:1,
|
|
index:index,
|
|
left:[],
|
|
right:[],
|
|
leftHeight:0,
|
|
rightHeight:0,
|
|
imgIndex:-1,
|
|
ajaxFlag:true
|
|
})
|
|
this.getList()
|
|
},
|
|
goTop:function(){
|
|
wx.pageScrollTo({
|
|
duration: 200,
|
|
scrollTop:0
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
previewImg:function(e){
|
|
let item = e.currentTarget.dataset.item;
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
})
|
|
wx.downloadFile({
|
|
url: item.head_img,
|
|
success:function(r){
|
|
console.log(r)
|
|
wx.previewImage({
|
|
urls: [r.tempFilePath],
|
|
current:r.tempFilePath
|
|
})
|
|
},
|
|
complete:function(){
|
|
wx.hideLoading({
|
|
})
|
|
}
|
|
})
|
|
},
|
|
goVr:function(){
|
|
app.globalData.weburl = "https://video.9jiexia.com/QuanJMY/suzhou/suzhoumeishuguan/index.html"
|
|
wx.navigateTo({
|
|
url: '/pages/pbService/web/index'
|
|
})
|
|
},
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|