813c870fdab83f52d2381a5c160d3604440e89a7.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="sports">
  3. <div class="title">
  4. <span style="font-size:.3rem;color:#fff; font-weight: bold;">体育</span>
  5. <i></i>
  6. </div>
  7. <div class="box-active row average item-center">
  8. <div class="row center" :class="{active:issurvey==true}" @click="survey(true)">显示</div>
  9. <div class="row center" :class="{active:issurvey==false}" @click="survey(false)">即将开赛</div>
  10. </div>
  11. <!-- 显示 -->
  12. <div v-if="issurvey" v-for="item in list" class="sportName" :key="item.id">
  13. <!-- <div v-for="item in list" class="sportName" :key="item.id" v-if="list[0].match.length != 0"> -->
  14. <!-- <div class="sportName" v-if="list.match.length != 0"> -->
  15. <!-- <h3>{{item.title}}</h3> -->
  16. <h3 class="row item-center allAlignment">
  17. {{item.name}}
  18. <img v-if="list.name=='足球'" src="../assets/st-imges/footballimg.png">
  19. <img v-if="list.name=='篮球'" src="../assets/st-imges/basketballimg.png">
  20. <img v-if="list.name=='棒球'" src="../assets/st-imges/baseballimg.png">
  21. <img v-if="list.name=='网球'" src="../assets/st-imges/tennisimg.png">
  22. </h3>
  23. <div
  24. class="list"
  25. v-for="(items,index) in item.match"
  26. :key="index"
  27. @click="leagueBetting(item.game_code,items.match_id)"
  28. >
  29. <div class="teamName">
  30. <span>{{items.home_team}}</span>
  31. <div>vs</div>
  32. <span>{{items.guest_team}}</span>
  33. </div>
  34. <div class="timer">
  35. <span>{{items.match_date}}</span>
  36. <div>
  37. <i :style="field"></i>
  38. </div>
  39. <span>{{items.match_time}}</span>
  40. </div>
  41. </div>
  42. <rollingBall
  43. :ballName="ball.name"
  44. :index="ball.index"
  45. style="margin-top:0.47rem;margin-bottom:0.16rem;"
  46. ></rollingBall>
  47. <div v-for=" item_a in item.league" :key="item_a.id">
  48. <rollingBall :ballName="item_a.name" :index="item_a.count" style="margin-bottom:0.16rem;"></rollingBall>
  49. </div>
  50. </div>
  51. <!-- 即将开赛 -->
  52. <div v-if="!issurvey" v-for="item in list" :key="item.id" class="sportName">
  53. <!-- <div v-for="item in list" class="sportName" :key="item.id" v-if="item.match.length != 0"> -->
  54. <!-- <div class="sportName" v-if="list.match.length != 0"> -->
  55. <!-- <h3>{{item.title}}</h3> -->
  56. <h3 class="row item-center allAlignment">{{item.gameName}}</h3>
  57. <div
  58. class="list"
  59. v-for="(items,index) in item.matchData"
  60. :key="index"
  61. @click="leagueBetting(item.gameCode,items.match_id)"
  62. >
  63. <div class="teamName">
  64. <span>{{items.home_team}}</span>
  65. <div>vs</div>
  66. <span>{{items.guest_team}}</span>
  67. </div>
  68. <div class="timer minute">
  69. <span>{{items.wait_time}}分钟</span>
  70. </div>
  71. </div>
  72. <rollingBall
  73. :ballName="issurvey?ball.name:'所有' + item.gameName + '即将开赛' "
  74. :index="issurvey?ball.index:item.matchNum"
  75. style="margin-top:0.47rem;margin-bottom:0.16rem;"
  76. ></rollingBall>
  77. <!-- <div v-for=" item_a in list.league" :key="item_a.id">
  78. <rollingBall :ballName="item_a.name" :index="item_a.count" style="margin-bottom:0.16rem;"></rollingBall>
  79. </div>-->
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import rollingBall from "@/components/StRollingBall";
  85. import "../css/index.css";
  86. export default {
  87. data() {
  88. return {
  89. issurvey: true,
  90. field: {
  91. backgroundImage:
  92. "url(" + require("../assets/st-imges/stadium.png") + ")",
  93. backgroundRepeat: "no-repeat",
  94. backgroundSize: "100% 100%"
  95. },
  96. list: "",
  97. ball: {
  98. name: "今日",
  99. index: 0
  100. },
  101. matchNum: "", //btn数量
  102. gameCode: "", //传入betting的值
  103. };
  104. },
  105. methods: {
  106. // leagueBetting: function(pId, id) {
  107. // this.$router.push({ path: "/StBallBettingPage", query: { pId, id } });
  108. // }
  109. leagueBetting: function(game_code, id) {
  110. //console.log(game_code,id);
  111. this.$router.push({
  112. path: "/StRollBallBettingPage",
  113. query: { gameCode:game_code}
  114. });
  115. this.$store.dispatch("MACTH_ID", id);
  116. },
  117. // 体育概览激活样式
  118. survey(val) {
  119. this.issurvey = val;
  120. },
  121. getAjax(url) {
  122. this.$store.dispatch("GETSHOW", true);
  123. this.$http.get(url).then(res => {
  124. if (res.data.status == 1 && res.data != [] && res.data != null) {
  125. if (this.issurvey == true) {
  126. this.list = res.data.data;
  127. console.log("体育", this.list);
  128. this.list.forEach(res => {
  129. res.league.forEach(val => {
  130. this.ball.index += Number(val.count);
  131. });
  132. });
  133. } else {
  134. let arr = Object.values(res.data.data);
  135. this.list = arr;
  136. }
  137. }
  138. this.$store.dispatch("GETSHOW", false);
  139. });
  140. }
  141. },
  142. components: { rollingBall },
  143. mounted() {
  144. this.getAjax(this.$ports.home.sports);
  145. },
  146. computed: {
  147. getInfo: function() {
  148. return this.issurvey;
  149. }
  150. },
  151. watch: {
  152. getInfo(val) {
  153. if (val == true) {
  154. this.getAjax(this.$ports.home.sports);
  155. } else {
  156. this.getAjax(this.$ports.home.getSon);
  157. }
  158. }
  159. }
  160. };
  161. </script>
  162. <style scoped>
  163. .box-active {
  164. height: 1.1rem;
  165. }
  166. .box-active div {
  167. width: 1.84rem;
  168. height: 0.68rem;
  169. background: #a0a0a0;
  170. color: #dcdcdc;
  171. font-size: 0.28rem;
  172. border-radius: 8px;
  173. }
  174. .box-active div.active {
  175. background: #dcdcdc;
  176. color: #363636;
  177. }
  178. .sports {
  179. background: #f8f8f8;
  180. /* padding: 0.28rem 0.3rem 0.34rem 0.45rem; */
  181. text-align: left;
  182. /* padding-bottom: 0.68rem; */
  183. }
  184. .sports .title {
  185. color: #000000;
  186. font-size: 0.32rem;
  187. display: flex;
  188. background: #a0a0a0;
  189. height: 0.88rem;
  190. line-height: 0.88rem;
  191. padding: 0 0.32rem 0;
  192. justify-content: space-between;
  193. }
  194. .sportName {
  195. padding: 0.1rem 0rem 0.4rem;
  196. background: #f8f8f8;
  197. width: 92%;
  198. margin: 0 auto;
  199. border-bottom: 1px solid #dfdfdf;
  200. }
  201. .sportName h3 {
  202. color: #f76649;
  203. font-size: 0.28rem;
  204. font-weight: 400;
  205. margin-bottom: 0.25rem;
  206. }
  207. .sportName h3 img {
  208. width: 0.44rem;
  209. height: 0.44rem;
  210. margin-right: 0.3rem;
  211. }
  212. .sportName .list {
  213. background: #dcdcdc;
  214. border-radius: 0.08rem;
  215. padding: 0.28rem 0.5rem 0.28rem 0.3rem;
  216. display: flex;
  217. justify-content: space-between;
  218. margin-bottom: 0.2rem;
  219. }
  220. .sportName .list .teamName {
  221. font-size: 0.28rem;
  222. color: #333333;
  223. max-width: 50%;
  224. }
  225. .sportName .list .teamName div {
  226. margin: 0.05rem 0;
  227. }
  228. .sportName .timer {
  229. text-align: center;
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: space-between;
  233. }
  234. .sportName .minute {
  235. align-items: center;
  236. flex-direction: row;
  237. }
  238. .timer div i {
  239. display: inline-block;
  240. width: 0.34rem;
  241. height: 0.24rem;
  242. }
  243. </style>