import Vue from 'vue' import lib from 'lib' import _ from 'underscore' var articleId = lib.getParam("articleId"); var vid = lib.getParam("vid"); export default { data() { return { articleId : articleId, article : {}, //影片 areas : [], //地区 categories : [], //电影分类 moreCommentaries : {},//更多解说 filmComments : [], //电影评论 articleType: 1,// 1:电影,2:电视剧,3:动画 alias : ["无"], //别名 releaseDate : "", trailers : {}, videos : [], curVideo : {}, curVideoPic : "", curVideoUrl : "", downloadUrl : lib.downloadUrl, isiOS : navigator.userAgent.match(/(iPhone|iPod|iPad);?/i) //ios终端 } }, filters : { parseReleaseDate(value){ return lib.handleTime(value).substring(0,11) }, parseVideoLen(value){ let minute = Math.floor(value / 60) let second = Math.floor(value % 60) minute = minute >= 10 ? minute : "0"+minute second = second >= 10 ? second : "0"+second return minute + ":" + second } }, mounted() { this.getArticle() }, activated() { }, methods: { changeVideo(index){ this.curVideo = this.videos[index] this.curVideoPic = this.videos[index].cover this.curVideoUrl = this.videos[index].videoUrls[0].urls[0] $(".v-mod-preview .list-preview li").eq(index).addClass("active").siblings().removeClass("active") lib.setParam("vid",this.curVideo.vid) lib.setWxShare({ title: `我在看《${this.article.name}》预告片`, desc: `${this.curVideo.title}`, link: `${location.href}`, imgUrl: `${this.curVideo.cover}` }); }, //处理预告片列表 handelVideo(list){ let arr = [] let self = this let showVideo = {} if (vid) { _.each(list,(item)=>{ if(item.vid == vid) { arr.splice(0,0,item) showVideo = item } else { arr.push(item) } }) self.videos = arr.splice(0,5) } else { showVideo = list[0] self.videos = list.splice(0,5) } self.curVideo = showVideo self.curVideoPic = showVideo.cover self.curVideoUrl = showVideo.videoUrls[0].urls[0] lib.setWxShare({ title: `我在看《${self.article.name}》预告片`, desc: `${self.curVideo.title}`, link: `${location.href}`, imgUrl: `${self.curVideo.cover}` }); }, //获取文章详情 getArticle(){ let self = this; let url = `${lib.apiUrl}/share/article.do`; let param = { articleId : articleId, channel : "LuciferChannel", ver : 1, os : 1, uid : 1, token : "lucifer_test_token" } $.ajax({ type: "get", url: url, data: param, dataType: "jsonp", success: (ret) => { var ret = lib.formatHttpProtocol(ret); if (ret.result == 1){ var data = ret.data; var article = data.article; self.article = article; self.areas = article.areas; self.categories = article.categories; self.articleType = article.type; self.trailers = data.trailers; if (data.moreCommentaries) self.moreCommentaries = data.moreCommentaries; if (article.alias && article.alias.length>0){ self.alias = article.alias.slice(0,1); } self.handelVideo(data.trailers.videos) lib.setTitle(`${lib.appName}-${article.name}`) } } }); } } }