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.
167 lines
3.2 KiB
167 lines
3.2 KiB
// pages/pbService/appreciate/index.js
|
|
import commonApi from "../../../utils/https/common"
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
videoTags:[],
|
|
type:2,
|
|
picTags:[],
|
|
picTagId:null,
|
|
videoTagId:null,
|
|
page_no:1,
|
|
total:1,
|
|
list:[],
|
|
isTest:true
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
commonApi._post("pbservice/Other/getClientConfig",{
|
|
unique_key:"wechatxcx"
|
|
}).then(res=>{
|
|
let data = JSON.parse(res.data)
|
|
this.setData({
|
|
isTest:data.isTest
|
|
})
|
|
})
|
|
// 获取视频的标签
|
|
commonApi._post("pbservice/Artpopulate/videoTags").then(res=>{
|
|
res.data.unshift({
|
|
CatalogName:"全部",
|
|
CatalogId:null
|
|
})
|
|
this.setData({
|
|
videoTags:res.data,
|
|
videoTagId:res.data[0].CatalogId
|
|
})
|
|
this.getList();
|
|
})
|
|
// 获取图片的标签
|
|
commonApi._post("pbservice/Artpopulate/imgTags").then(res=>{
|
|
res.data.unshift({
|
|
Name:"全部",
|
|
TagId:null
|
|
})
|
|
this.setData({
|
|
picTags:res.data,
|
|
picTagId:res.data[0].TagId
|
|
})
|
|
})
|
|
},
|
|
changeType:function(e){
|
|
let type = e.currentTarget.dataset.type;
|
|
this.setData({
|
|
type:type,
|
|
list:[],
|
|
page_no:1,
|
|
total:1,
|
|
picTagId:null,
|
|
videoTagId:null
|
|
})
|
|
this.getList();
|
|
},
|
|
search:function(e){
|
|
let id = e.currentTarget.dataset.id;
|
|
this.setData({
|
|
list:[],
|
|
page_no:1,
|
|
total:1
|
|
})
|
|
if(this.data.type==1){
|
|
this.setData({
|
|
videoTagId:id
|
|
})
|
|
}
|
|
else {
|
|
this.setData({
|
|
picTagId:id
|
|
})
|
|
}
|
|
this.getList()
|
|
},
|
|
getList:function(){
|
|
if(this.data.total<this.data.page_no) return;
|
|
let service = this.data.type==1?'pbservice/Artpopulate/videoList':'pbservice/Artpopulate/imgList';
|
|
commonApi._post(service,{
|
|
tag_id:this.data.type==1?this.data.videoTagId:this.data.picTagId,
|
|
page:this.data.page_no,
|
|
keyword:""
|
|
}).then(res=>{
|
|
let list = this.data.type==1?res.data.videolist:res.data.photolist;
|
|
this.setData({
|
|
total:res.data.totalpage,
|
|
list:this.data.list.concat(list),
|
|
page_no:this.data.page_no+1
|
|
})
|
|
})
|
|
},
|
|
gotoDetail:function(e){
|
|
let info = e.currentTarget.dataset.info;
|
|
if(this.data.type==2) {
|
|
wx.previewImage({
|
|
urls: [info.Pic],
|
|
current:info.Pic
|
|
})
|
|
return;
|
|
}
|
|
info = JSON.stringify(info);
|
|
info = encodeURIComponent(info);
|
|
wx.navigateTo({
|
|
url: 'info/index?info='+info,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
this.getList();
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|