rank.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import Vue from 'vue'
  2. import lib from 'lib'
  3. export default {
  4. data() {
  5. return {
  6. winHeight : 0,
  7. isHasDlfooter : !lib.checkWjyAgent(),
  8. latestUsers : [], //上一期排行榜用户列表
  9. latestShow : {}, //上一场次的信息
  10. userBonus : {}, //当前用户信息
  11. userHeadInfo : {},
  12. totalTopUsers : [], //总榜前三用户
  13. totalLastUsers : [] //总榜剩余用户
  14. }
  15. },
  16. mounted() {
  17. this.winHeight = $(window).height()
  18. this.getOscarRankList()
  19. },
  20. activated() {
  21. let page = lib.getParam("page")
  22. if(page.match("totalrank")) {
  23. lib.setTitle("玩家总榜")
  24. } else {
  25. lib.setTitle("上期榜单")
  26. }
  27. lib.setWxShare({
  28. title : "百万奥斯卡-微剧院",
  29. desc : "【百万奥斯卡】影视知识大问答,百万奖金等你拿。",
  30. link : location.href,
  31. imgUrl: `//h5-glance.duowan.com/_src/img/icon-logo.png`
  32. })
  33. },
  34. methods: {
  35. clossDlfooterCallback(){
  36. this.isHasDlfooter = false
  37. },
  38. //玩家排行
  39. getOscarRankList(){
  40. let self = this
  41. let url = `${lib.apiUrl}/share/oscarRankList.do`
  42. let uid = lib.getParam("uid"),token = lib.getParam("token")
  43. let param = {
  44. channel : "LuciferChannel",
  45. ver : 1,
  46. os : 1,
  47. uid : uid || 1,
  48. token : token || "lucifer_test_token"
  49. }
  50. self.isloading = true
  51. $.ajax({
  52. type: "get",
  53. url: url,
  54. data: param,
  55. dataType: "jsonp",
  56. success: function(ret) {
  57. ret = lib.formatHttpProtocol(ret);
  58. self.isloading = false
  59. if(ret.code == 0) {
  60. let data = ret.data
  61. self.latestUsers = data.latestUsers
  62. self.userBonus = data.userBonus
  63. self.totalTopUsers = data.totalUsers.splice(0,3) //截取前三,改变数组
  64. self.totalLastUsers = data.totalUsers
  65. if(data.latestShow) self.latestShow = data.latestShow
  66. if(data.userBonus) self.userHeadInfo = data.userBonus.userHeadInfo
  67. } else {
  68. lib.showDialog(ret.msg)
  69. }
  70. }
  71. })
  72. }
  73. },
  74. filters : {
  75. parseBonus(value){
  76. if(value>1e6){
  77. return Math.floor((value/1e4))/100+"万"
  78. } else {
  79. return "¥"+(value/100)
  80. }
  81. },
  82. parseReleaseDate(value){
  83. return lib.handleTime(value,2)
  84. }
  85. }
  86. }