detail.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import Vue from 'vue';
  2. import lib from 'lib';
  3. import BDY from '../../../depend/BDY/BDY';
  4. export default {
  5. data () {
  6. return {
  7. game_id : lib.getLocalData("game_id"),
  8. game_zone : lib.getLocalData("game_zone"),
  9. user_id : lib.getLocalData("user_id"),
  10. staticUrl : lib.staticUrl,
  11. matchInfo : {},
  12. team_win : {},
  13. team_lose : {}
  14. }
  15. },
  16. mounted () {
  17. this.getData();
  18. },
  19. beforeDestroy () {
  20. },
  21. methods: {
  22. getData () {
  23. let self = this;
  24. let api = `${lib.apiUrl}/v3/player/dx5/${self.user_id}/game/${self.game_id}/`;
  25. lib.get(api, (ret) => {
  26. if(ret.player_game_list && ret.player_game_list[0]) {
  27. self.formatData(ret.player_game_list[0]);
  28. }
  29. })
  30. },
  31. formatData (data) {
  32. this.matchInfo = {
  33. game_id : data.game_id,
  34. start_timestamp : data.start_timestamp.slice(-8,-3),
  35. game_length_in_minute : data.game_length_in_minute
  36. }
  37. this.team_win = data.team_win;
  38. this.team_lose = data.team_lose;
  39. },
  40. showFulData : function(event){
  41. var target = event.target;
  42. $(target).closest('li').removeClass('hiding-data').addClass("showing-data");
  43. },
  44. hideFulData : function(event){
  45. var target = event.target;
  46. $(target).closest('li').removeClass("showing-data").addClass('hiding-data');
  47. }
  48. }
  49. }