7aa1305ec88f008eca20c29c8798fb0468e6106c.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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=" item.today.name"
  44. :index=" item.today.count"
  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_chinese" :gameCode='item.game_code' :lgId ='item_a.lg_id' :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. timers:true
  104. };
  105. },
  106. methods: {
  107. // leagueBetting: function(pId, id) {
  108. // this.$router.push({ path: "/StBallBettingPage", query: { pId, id } });
  109. // }
  110. leagueBetting: function(game_code, id) {
  111. //console.log(game_code,id);
  112. this.$router.push({
  113. path: "/StRollBallBettingPage",
  114. query: { gameCode:game_code}
  115. });
  116. this.$store.dispatch("MACTH_ID", id);
  117. },
  118. // 体育概览激活样式
  119. survey(val) {
  120. this.issurvey = val;
  121. },
  122. getAjax(url) {
  123. this.$store.dispatch("GETSHOW", true);
  124. this.$http.get(url).then(res => {
  125. if (res.data.status == 1 && res.data != [] && res.data != null) {
  126. if (this.issurvey == true) {
  127. this.list = res.data.data;
  128. console.log("体育", this.list);
  129. this.list.forEach(res => {
  130. res.league.forEach(val => {
  131. this.ball.index += Number(val.count);
  132. });
  133. });
  134. } else {
  135. let arr = Object.values(res.data.data);
  136. this.list = arr;
  137. }
  138. }
  139. this.$store.dispatch("GETSHOW", false);
  140. });
  141. }
  142. },
  143. components: { rollingBall },
  144. mounted() {
  145. let _this =this;
  146. this.$public.ajaxTimerFun(function(timing){
  147. _this.getAjax(_this.$ports.home.sports);
  148. if (!_this.timers){
  149. clearInterval(timing);
  150. }
  151. })
  152. this.getAjax(this.$ports.home.sports);
  153. },
  154. computed: {
  155. getInfo: function() {
  156. return this.issurvey;
  157. }
  158. },
  159. watch: {
  160. getInfo(val) {
  161. if (val == true) {
  162. this.getAjax(this.$ports.home.sports);
  163. } else {
  164. this.getAjax(this.$ports.home.getSon);
  165. }
  166. }
  167. },
  168. beforeDestroy(){
  169. this.timers = false;
  170. }
  171. };
  172. </script>
  173. <style scoped>
  174. .box-active {
  175. height: 1.1rem;
  176. }
  177. .box-active div {
  178. width: 1.84rem;
  179. height: 0.68rem;
  180. background: #a0a0a0;
  181. color: #dcdcdc;
  182. font-size: 0.28rem;
  183. border-radius: 8px;
  184. }
  185. .box-active div.active {
  186. background: #dcdcdc;
  187. color: #363636;
  188. }
  189. .sports {
  190. background: #f8f8f8;
  191. /* padding: 0.28rem 0.3rem 0.34rem 0.45rem; */
  192. text-align: left;
  193. /* padding-bottom: 0.68rem; */
  194. }
  195. .sports .title {
  196. color: #000000;
  197. font-size: 0.32rem;
  198. display: flex;
  199. background: #a0a0a0;
  200. height: 0.88rem;
  201. line-height: 0.88rem;
  202. padding: 0 0.32rem 0;
  203. justify-content: space-between;
  204. }
  205. .sportName {
  206. padding: 0.1rem 0rem 0.4rem;
  207. background: #f8f8f8;
  208. width: 92%;
  209. margin: 0 auto;
  210. border-bottom: 1px solid #dfdfdf;
  211. }
  212. .sportName h3 {
  213. color: #f76649;
  214. font-size: 0.28rem;
  215. font-weight: 400;
  216. margin-bottom: 0.25rem;
  217. }
  218. .sportName h3 img {
  219. width: 0.44rem;
  220. height: 0.44rem;
  221. margin-right: 0.3rem;
  222. }
  223. .sportName .list {
  224. background: #dcdcdc;
  225. border-radius: 0.08rem;
  226. padding: 0.28rem 0.5rem 0.28rem 0.3rem;
  227. display: flex;
  228. justify-content: space-between;
  229. margin-bottom: 0.2rem;
  230. }
  231. .sportName .list .teamName {
  232. font-size: 0.28rem;
  233. color: #333333;
  234. max-width: 50%;
  235. }
  236. .sportName .list .teamName div {
  237. margin: 0.05rem 0;
  238. }
  239. .sportName .timer {
  240. text-align: center;
  241. display: flex;
  242. flex-direction: column;
  243. justify-content: space-between;
  244. }
  245. .sportName .minute {
  246. align-items: center;
  247. flex-direction: row;
  248. }
  249. .timer div i {
  250. display: inline-block;
  251. width: 0.34rem;
  252. height: 0.24rem;
  253. }
  254. </style>