e125e4cdb165ef46662c164db0581ec93ba4c4dc.svn-base 7.7 KB

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