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.

161 lines
3.2 KiB

// pages/opera/IP_detail/IP_detail.js
import {
httpUtil,
http,
login_check
} from '../../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
show: false,
rolled: true
},
bindPlayCallBack: function (e) {
console.log('当前视频', e.target.id);
var current_video = e.target.id;
var that = this;
let video = that.data.IP_detail.wonderful_list;
for (var i in video) {
var index_video = 'video_' + i;
var videoContextPrev = wx.createVideoContext(index_video);
if (current_video != index_video) {
// 暂停其他的
videoContextPrev.pause();
}
}
},
_like() {
if (login_check()) {
let status
if (this.data.IP_detail.ip_info.is_follow) {
status = 0
} else if (!this.data.IP_detail.ip_info.is_follow) {
status = 1
}
http("/api/v1/follow", "get", {
abb_id: this.data.IP_detail.ip_info.abb_id,
status
}).then(res => {
if( status == 1){
wx.showToast({
icon:'success',
title:'已添加到想看的演出列表',
duration: 2000
})}else if( status == 0){
wx.showToast({
icon:'success',
title:'已取消想看',
duration: 2000
})}
let IP_detail = this.data.IP_detail
IP_detail.ip_info.is_follow = !IP_detail.ip_info.is_follow
this.setData({
IP_detail
})
})
}
},
pop() {
this.setData({
show: true
})
},
onClose() {
this.setData({
show: false
});
},
nav(e) {
let cycle_id = e.currentTarget.dataset.cycle_id
wx.navigateTo({
url: '/pages/opera/show/show_detail?cycle_id=' + cycle_id
})
},
roll_spread() {
this.setData({
rolled: !this.data.rolled
})
},
previewMedia(e) {
wx.previewMedia({
sources: this.data.IP_detail.wonderful_list,
current: e.currentTarget.dataset.index
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let abb_id = options.abb_id
http("/api/v1/ip-info", "get", {
abb_id
}).then(res => {
wx.setNavigationBarTitle({
title:res.ip_info.title_name
})
this.setData({
IP_detail: res
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
var that = this;
console.log(that.data)
return { //自定义转发内容
title: that.data.IP_detail.ip_info.show_name, //自定义转发标题
imageUrl: that.data.IP_detail.ip_info.background_pic //不设置此字段时,默认截取当前页面作为展示的图片
}
}
})