rank.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import Vue from 'vue'
  2. import lib from 'lib'
  3. import WjySdk from 'extSdk';
  4. var type = lib.getParam("type")
  5. var from = lib.getParam("from")
  6. export default {
  7. activated() {
  8. },
  9. methods: {
  10. toCommentaryDetail(commentaryId){
  11. WjySdk.toCommentaryDetail(commentaryId)
  12. },
  13. toVideoDetail(articleId){
  14. WjySdk.toVideoDetail(articleId)
  15. },
  16. toggleFilm(index){
  17. $(".item-film").eq(index).toggleClass("active");
  18. },
  19. getRanklist(){
  20. let self = this
  21. let url = `${lib.apiUrl}/functionalTopic/ranklist.do`
  22. let param = {
  23. type : type,
  24. count : 25,
  25. timeline : self.timeline,
  26. channel : "LuciferChannel",
  27. ver : 1,
  28. os : 1,
  29. uid : 1,
  30. token : "lucifer_test_token"
  31. }
  32. if(self.articles.length>=250) {
  33. self.nextFlag = false
  34. return
  35. }
  36. self.isloading = true
  37. $.ajax({
  38. type: "get",
  39. url: url,
  40. data: param,
  41. dataType: "jsonp",
  42. success: function (ret) {
  43. ret = lib.formatHttpProtocol(ret);
  44. self.isloading = false
  45. if(ret.code == 0) {
  46. let data = ret.data
  47. self.articles = self.articles.concat(data.articles)
  48. self.timeline = data.timeline
  49. self.nextFlag = data.next == 1 ? true : false
  50. } else {
  51. lib.showDialog(ret.msg)
  52. }
  53. }
  54. })
  55. }
  56. },
  57. data() {
  58. return {
  59. articles : [], //列表
  60. timeline : 0, //翻页标志
  61. isloading : false, //是否loading
  62. nextFlag : true //下一页标志
  63. }
  64. },
  65. mounted() {
  66. if(!type || type==0) {
  67. lib.setTitle("豆瓣250");
  68. } else {
  69. lib.setTitle("IMDB250");
  70. }
  71. this.getRanklist()
  72. }
  73. }