736c0d7a9702f014b63cfaeb92213e23c4d93903.svn-base 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div>
  3. <div class="title" v-if="isShow">
  4. <span style="font-size:.28rem;color:#F76649;">{{titel}}</span>
  5. </div>
  6. <div
  7. v-for="(item,id) in data"
  8. @click="getInfo(id,item.match_id)"
  9. class="macth row allAlignment"
  10. :key="id"
  11. v-if="isShow"
  12. >
  13. <div class="row">
  14. <div class="column allAlignment center">
  15. <div class="score-icon row center">
  16. <span style=" margin:0.07rem; ">{{item.home_score}}</span>
  17. </div>
  18. <div class="score-icon row center">
  19. <span style=" margin:0.07rem; ">{{item.guest_score}}</span>
  20. </div>
  21. </div>
  22. <div class="team-box column allAlignment">
  23. <span class="teamName">{{item.home_team}}</span>
  24. <span style="font-size:0.2rem;padding:0.06rem 0 ;">vs</span>
  25. <span class="teamName">{{item.guest_team}}</span>
  26. </div>
  27. </div>
  28. <div class="row">
  29. <div class="column allAlignment center">
  30. <span class="macth-time">{{item.match_process}}</span>
  31. <img src="../assets/st-imges/stadium.png" alt>
  32. <span class="macth-time">{{item.match_time}}</span>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="rolling" v-if="isShow">
  37. <RollingBall :ballName="ball.name" :name="name" :index="ball.index" :gameCode="gameCode"></RollingBall>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import "../css/index.css";
  43. import RollingBall from "./StRollingBall";
  44. import Loading from "./StLoading";
  45. export default {
  46. name: "BasketballBlock",
  47. props: ["type"],
  48. data() {
  49. return {
  50. titel: "篮球",
  51. timer: [], //存储时间
  52. idx: "",
  53. isShow : false,
  54. gameCode: "", //球类别名
  55. name: "", //球类名称传值
  56. ball: {
  57. name: "",
  58. index: ""
  59. },
  60. data: "",
  61. timers:true // 定时器
  62. };
  63. },
  64. components: {
  65. RollingBall,
  66. Loading
  67. },
  68. methods: {
  69. getInfo: function(val, match_id) {
  70. console.log("id", val);
  71. this.$router.push({
  72. path: "./StRollBallBettingPage",
  73. query: { gameCode: this.gameCode, match_id: match_id,status : 1, number: 0 ,home:true}
  74. });
  75. },
  76. getAjax:function(){
  77. if (this.type == 1) {
  78. let _this = this;
  79. // vuex传值,状态管理
  80. this.$store.dispatch('GETSHOW',true);
  81. this.$http.get(this.$ports.home.trollingBall).then(res => {
  82. console.log("这是足球",res)
  83. // this.sssd();
  84. if (res.data.status == 1 && res.data.data != null && res.data.data.matchData.length > 0) {
  85. this.isShow = true;
  86. console.log('res', res.data)
  87. this.data = res.data.data.matchData;
  88. this.titel = res.data.data.gameName;
  89. this.name = this.titel;
  90. this.ball.name = "所有" + this.titel + "滚球";
  91. this.ball.index = this.data.length;
  92. this.gameCode = res.data.data.game_code;
  93. let [f, s] = this.data[0].match_time.split(":");
  94. _this.data.forEach(val => {
  95. if (val.match_time != "") {
  96. let [f, s] = val.match_time.split(":");
  97. this.$public.timer(f, s, function(f, s) {
  98. val.match_time = f + ":" + s;
  99. });
  100. }
  101. });
  102. this.$store.dispatch('GETSHOW',false);
  103. }else{
  104. this.$store.dispatch('GETSHOW',false);
  105. }
  106. });
  107. } else if (this.type == 2) {
  108. this.$store.dispatch('GETSHOW',true);
  109. this.$http.get(this.$ports.home.rollingBall).then(res => {
  110. if (res.data.status == 1 && res.data.data != null && res.data.data.matchData.length > 0) {
  111. this.isShow = true;
  112. this.data = res.data.data.matchData;
  113. this.titel = res.data.data.gameName;
  114. this.name = this.titel;
  115. this.ball.index = this.data.length;
  116. this.ball.name = "所有" + this.titel + "滚球";
  117. this.gameCode = res.data.data.game_code;
  118. this.$store.dispatch('GETSHOW',false);
  119. }else{
  120. this.$store.dispatch('GETSHOW',false);
  121. }
  122. });
  123. } else if (this.type == 3) {
  124. this.$store.dispatch('GETSHOW',true);
  125. this.$http.get(this.$ports.home.bqrollingBall).then(res => {
  126. if (res.data.status == 1 && res.data.data != null && res.data.data.matchData.length > 0) {
  127. this.isShow = true;
  128. this.data = res.data.data.matchData;
  129. this.titel = res.data.data.gameName;
  130. this.ball.index = this.data.length;
  131. this.name = this.titel;
  132. this.ball.name = "所有" + this.titel + "滚球";
  133. this.gameCode = res.data.data.game_code;
  134. this.$store.dispatch('GETSHOW',false);
  135. }else{
  136. this.$store.dispatch('GETSHOW',false);
  137. }
  138. });
  139. }
  140. },
  141. },
  142. mounted() {
  143. let _this =this;
  144. this.$public.ajaxTimerFun(function(timing){
  145. _this.getAjax();
  146. if (!_this.timers){
  147. clearInterval(timing);
  148. }
  149. })
  150. this.getAjax();
  151. },
  152. beforeDestroy(){
  153. this.timers = false;
  154. }
  155. };
  156. </script>
  157. <style scoped>
  158. /* .box{
  159. border-bottom: 1px soild red;
  160. } */
  161. .macth {
  162. height: 1.76rem;
  163. margin-top: 0.2rem;
  164. color: #333333;
  165. background: #dcdcdc;
  166. border-radius: 0.08rem;
  167. /* border:2px solid #CECECE; */
  168. padding: 0.24rem;
  169. font-size: 0.22rem;
  170. }
  171. .score-icon {
  172. min-width: 0.66rem;
  173. background: #f76649;
  174. border-radius: 0.17rem;
  175. color: #f5f5f5;
  176. font-size: 0.2rem;
  177. }
  178. .teamName {
  179. font-size: 0.26rem;
  180. }
  181. .team-box {
  182. margin-left: 0.29rem;
  183. max-width: 3.4rem;
  184. }
  185. .macth-time {
  186. font-size: 0.24rem;
  187. }
  188. .title {
  189. padding-top: 0.1rem;
  190. margin: 0.1rem 0;
  191. font-size: 0.28rem;
  192. color: #000000;
  193. }
  194. .rolling {
  195. padding-top: 0.41rem;
  196. padding-bottom: 0.46rem;
  197. }
  198. </style>