16031d3e18005026fadcd29f37aa6a78ff956140.svn-base 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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,item.game_code)"
  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" v-if="item.game_code != 'lq'">{{item.match_process}}</span>
  31. <span class="macth-time" v-else-if="item.game_code == 'lq' && item.match_process == 'Q1'">第一节</span>
  32. <span class="macth-time" v-else-if="item.game_code == 'lq' && item.match_process == 'Q2'">第二节</span>
  33. <span class="macth-time" v-else-if="item.game_code == 'lq' && item.match_process == 'Q3'">第三节</span>
  34. <span class="macth-time" v-else-if="item.game_code == 'lq' && item.match_process == 'Q4'">第四节</span>
  35. <img src="../assets/st-imges/stadium.png" alt>
  36. <span class="macth-time">{{item.a_time ? item.a_time :'00:00'}} </span>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="rolling" v-if="isShow">
  41. <RollingBall :ballName="ball.name" :bm='bm' :name="name" :index="ball.index" :gameCode="gameCode"></RollingBall>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import "../css/index.css";
  47. import RollingBall from "./StRollingBall";
  48. import Loading from "./StLoading";
  49. export default {
  50. name: "BasketballBlock",
  51. props: ["type"],
  52. data() {
  53. return {
  54. titel: "",
  55. timer: [], //存储时间
  56. idx: "",
  57. isShow: false,
  58. gameCode: "", //球类别名
  59. name: "", //球类名称传值
  60. bm: "gq",
  61. ball: {
  62. name: "",
  63. index: ""
  64. },
  65. data: "",
  66. timers: true, // 定时器
  67. getIsShow:true
  68. };
  69. },
  70. components: {
  71. RollingBall,
  72. Loading
  73. },
  74. methods: {
  75. getInfo: function(val, match_id,game_code) {
  76. this.$store.dispatch("GETACTIVITY", "StRollBall");
  77. //onsole.log("id", val);
  78. this.$router.push({
  79. path: "./StRollBallBettingPage",
  80. query: {
  81. gameCode: this.gameCode,
  82. status: 1,
  83. number: 0,
  84. home: true,
  85. name: this.titel
  86. }
  87. });
  88. this.$store.dispatch('GET_BALL_ID',game_code)
  89. this.$store.dispatch("MACTH_ID", match_id);
  90. },
  91. getAjax: function(data) {
  92. if(!data.matchData) return false;
  93. let _this = this;
  94. if (this.type == 1) {
  95. let matchDtat_leng = data.matchData.length;
  96. if(matchDtat_leng < 0) return false;
  97. for(var i = 0; i < matchDtat_leng; i++){
  98. data.matchData[i].game_code = data.game_code;
  99. }
  100. if(matchDtat_leng > 6){
  101. this.data = data.matchData.slice(0,6);
  102. }else{
  103. this.data = data.matchData
  104. }
  105. this.isShow = true;
  106. this.titel = data.gameName;
  107. this.name = this.titel;
  108. this.ball.name = "所有" + this.titel + "滚球";
  109. this.ball.index = data.matchData.length;
  110. this.gameCode = data.game_code;
  111. // let [f, s] = this.data[0].match_time.split(":");
  112. // _this.data.forEach(val => {
  113. // if (val.match_time != "") {
  114. // let [f, s] = val.match_time.split(":");
  115. // this.$public.timer(f, s, function(f, s) {
  116. // val.match_time = f + ":" + s;
  117. // });
  118. // }
  119. // });
  120. } else if (this.type == 2) {
  121. let matchDtat_leng = data.matchData.length;
  122. if(matchDtat_leng < 0) return false;
  123. for(var i = 0; i < matchDtat_leng; i++){
  124. data.matchData[i].game_code = data.game_code;
  125. }
  126. if(matchDtat_leng > 6){
  127. this.data = data.matchData.slice(0,6);
  128. }else{
  129. this.data = data.matchData
  130. }
  131. this.isShow = true;
  132. this.titel = data.gameName;
  133. this.name = this.titel;
  134. this.ball.index = this.data.length;
  135. this.ball.name = "所有" + this.titel + "滚球";
  136. this.gameCode = data.game_code;
  137. } else if (this.type == 3) {
  138. let matchDtat_leng = data.matchData.length;
  139. if(matchDtat_leng < 0 ) return false;
  140. for(var i = 0; i < matchDtat_leng; i++){
  141. data.matchData[i].game_code = data.game_code;
  142. }
  143. if(matchDtat_leng > 6){
  144. this.data = data.matchData.slice(0,6);
  145. }else{
  146. this.data = data.matchData
  147. }
  148. this.isShow = true;
  149. this.titel = data.gameName;
  150. this.ball.index = this.data.length;
  151. this.name = this.titel;
  152. this.ball.name = "所有" + this.titel + "滚球";
  153. this.gameCode = data.game_code;
  154. }
  155. setTimeout(()=>{
  156. _this.$store.dispatch("GETSHOW", false);
  157. },1000)
  158. }
  159. },
  160. /**
  161. * 计算属性
  162. */
  163. computed: {
  164. getHomeRollBall() {
  165. return this.$store.getters.getHomeRollBall;
  166. },
  167. },
  168. /**
  169. * 监听器
  170. */
  171. watch: {
  172. getHomeRollBall(val){
  173. if(this.type == 1){
  174. this.getAjax(val.zqData);
  175. }else if(this.type == 2){
  176. this.getAjax(val.lqData);
  177. }else if(this.type == 3){
  178. this.getAjax(val.bqData);
  179. }
  180. }
  181. },
  182. mounted() {
  183. if(this.getIsShow){
  184. this.$store.dispatch("GETSHOW", true);
  185. this.getIsShow = false;
  186. }
  187. },
  188. beforeDestroy() {
  189. this.timers = false;
  190. }
  191. };
  192. </script>
  193. <style scoped>
  194. /* .box{
  195. border-bottom: 1px soild red;
  196. } */
  197. .macth {
  198. height: 1.76rem;
  199. margin-top: 0.2rem;
  200. color: #333333;
  201. background: #dcdcdc;
  202. border-radius: 0.08rem;
  203. /* border:2px solid #CECECE; */
  204. padding: 0.24rem;
  205. font-size: 0.22rem;
  206. }
  207. .score-icon {
  208. min-width: 0.66rem;
  209. background: #f76649;
  210. border-radius: 0.17rem;
  211. color: #f5f5f5;
  212. font-size: 0.2rem;
  213. }
  214. .teamName {
  215. font-size: 0.26rem;
  216. }
  217. .team-box {
  218. margin-left: 0.29rem;
  219. max-width: 3.4rem;
  220. }
  221. .macth-time {
  222. font-size: 0.24rem;
  223. }
  224. .title {
  225. padding-top: 0.1rem;
  226. margin: 0.1rem 0;
  227. font-size: 0.28rem;
  228. color: #000000;
  229. }
  230. .rolling {
  231. padding-top: 0.41rem;
  232. padding-bottom: 0.46rem;
  233. }
  234. </style>