post.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import Vue from 'vue'
  2. import lib from 'lib'
  3. import _ from 'underscore'
  4. var cid = lib.getParam("cid"); //解说视频id
  5. var articleId = lib.getParam("articleId"); //关联影片Id
  6. var initMoreCommentaries = {} //初始化的解说视频列表
  7. export default {
  8. data() {
  9. return {
  10. cid : cid,
  11. articleId : articleId,
  12. article : {}, //影片详情
  13. watchOnline : {}, //在线源
  14. moreCommentaries : {}, //更多解说
  15. curVideoUp : {},//当前up主
  16. curVideoUrl : "",
  17. curCommentarie : {},
  18. commentaryCount : 0,
  19. downloadUrl : lib.downloadUrl, //app下载地址
  20. articleType: 1,// 1:电影,2:电视剧,3:动画
  21. areas : [], //地区
  22. categories : [], //电影分类
  23. actors : [{name : "不详"}], //演员
  24. recommends : [] //相关推荐
  25. }
  26. },
  27. mounted() {
  28. this.winHeight = window.innerHeight
  29. this.getCommentary();
  30. this.getRecommend();
  31. },
  32. activated() {
  33. },
  34. methods: {
  35. changeCommentTag(index){
  36. $(".tag-nav li").eq(index).addClass("active").siblings().removeClass("active");
  37. $(".tag-cont .tag-panel").eq(index).addClass("active").siblings().removeClass("active");
  38. },
  39. //获取文章详情
  40. getCommentary(callback){
  41. let self = this;
  42. let url = `${lib.apiUrl}/share/commentary.do`;
  43. let param = {
  44. cid : cid,
  45. channel : "LuciferChannel",
  46. ver : 1,
  47. os : 1,
  48. uid : 1,
  49. token : "lucifer_test_token"
  50. }
  51. $.ajax({
  52. type: "get",
  53. url: url,
  54. data: param,
  55. dataType: "jsonp",
  56. success: (ret) => {
  57. var ret = lib.formatHttpProtocol(ret);
  58. if (ret.result == 1){
  59. let data = ret.data;
  60. let article = data.article;
  61. self.articleId = data.article.id;
  62. self.article = data.article;
  63. self.articleType = article.type;
  64. self.moreCommentaries = data.moreCommentaries
  65. self.commentaryCount = data.commentaryCount
  66. self.areas = article.areas;
  67. self.watchOnline = article.watchOnline ? article.watchOnline : 0;
  68. self.curCommentarie = data.moreCommentaries[0]
  69. self.curVideoUp = self.curCommentarie["up"];
  70. self.curVideoUrl = self.curCommentarie["video"]["videoUrls"][0]["urls"][0];
  71. if (article.filmmakers) {
  72. let actors = article.filmmakers.actors
  73. self.actors = actors ? actors : [];
  74. }
  75. lib.setTitle(`${lib.appName}-${data.moreCommentaries[0].title}`);
  76. lib.setWxShare({
  77. title: `我在看《${data.moreCommentaries[0].title}》`,
  78. desc: `更多【${data.moreCommentaries[0]["up"].nick}】解说视频,快上${lib.appName}`,
  79. link: `${location.href}`,
  80. imgUrl: `${data.moreCommentaries[0].cover}`
  81. });
  82. }
  83. }
  84. });
  85. },
  86. //相关推荐
  87. getRecommend(){
  88. let self = this;
  89. let url = `${lib.apiUrl}/share/recommend.do`;
  90. let param = {
  91. commentaryId : cid,
  92. channel : "LuciferChannel",
  93. ver : 1,
  94. os : 1,
  95. uid : 1,
  96. token : "lucifer_test_token"
  97. }
  98. $.ajax({
  99. type: "get",
  100. url: url,
  101. data: param,
  102. dataType: "jsonp",
  103. success: (ret) => {
  104. var ret = lib.formatHttpProtocol(ret);
  105. if(ret.code == 0) {
  106. if(ret.data) self.recommends = ret.data;
  107. } else {
  108. }
  109. }
  110. });
  111. }
  112. },
  113. filters : {
  114. parseReleaseDate(value){
  115. return lib.handleTime(value).substring(0,11)
  116. }
  117. }
  118. }