team-info.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. (function(){
  2. Vue.component('team-info',{
  3. template: '<div>\
  4. <div class="pt15" id="teamInfoBox">\
  5. <div class="plr15 pb20">\
  6. <span class="c-f14 c-bold c-333">团队名称:</span>\
  7. <span class="c-f14 c-333">{{team.name}}</span>\
  8. </div>\
  9. <div class="plr15 pb20">\
  10. <span class="c-f14 c-bold c-333">所在社区:</span>\
  11. <span class="c-f14 c-333">{{team.hospitalName}}</span>\
  12. </div>\
  13. <div class="plr15 pb20">\
  14. <span class="c-f14 c-bold c-333">团队长:</span>\
  15. <span class="c-f14 c-333">{{team.leaderName}}</span>\
  16. </div>\
  17. <div class="plr15 pb20">\
  18. <span class="c-f14 c-bold c-333">团队成员(<span class="span-team-count">{{memberLength}}</span>人):</span>\
  19. <p class="c-f14 c-333 mt10">\
  20. <span v-for="(member, index) in members">{{index==0? "": " 、"}}{{member.name}}</span>\
  21. </p>\
  22. </div>\
  23. </div></div>',
  24. props:['teamId'],
  25. data: function(){
  26. return {
  27. team: {},
  28. members: [],
  29. memberLength: 0
  30. }
  31. },
  32. mounted: function(){
  33. console.log(this.teamId);
  34. var vm = this;
  35. getTeamInfo(vm);
  36. }
  37. });
  38. function getTeamInfo(vm){
  39. var params = {
  40. teamId: vm.teamId
  41. };
  42. statisticAPI.getTeamInfo(params).then(function(res){
  43. if(res.status == 200){
  44. vm.team = res.data.team;
  45. vm.members = res.data.members;
  46. vm.memberLength = res.data.members.length;
  47. }else{
  48. console.log(res.msg);
  49. }
  50. })
  51. }
  52. })()