864e405584cc9db4d7a02cf0ae6d557720163710.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div>
  3. <div class="lod">
  4. <Loading></Loading>
  5. </div>
  6. <SportsHead></SportsHead>
  7. <div v-if="arr.length >0 ">
  8. <div id="NavSlide" class="row allAlignment center">
  9. <div class="nav-div">
  10. <nav>
  11. <div
  12. class="column center img-div"
  13. v-for="(item,$index) in arr"
  14. @click="toggle(item.game_code,item.game_name)"
  15. >
  16. <img
  17. :class="gameCode == item.game_code?'img-box imgactive':'img-box'"
  18. :src="item.game_ico_url"
  19. >
  20. <span
  21. class="text"
  22. style="font-size:.2rem;"
  23. :class="{active:item.game_code == gameCode}"
  24. >{{item.game_name}}</span>
  25. </div>
  26. </nav>
  27. </div>
  28. </div>
  29. <RollingBallHead v-if="nameShow" :name="name" :ishow="ishow"/>
  30. </div>
  31. <Match v-show="nameShow" :gameCode="gameCode" :ishow="ishow" :name="name"></Match>
  32. <NavBall v-show="!nameShow" :name="name"/>
  33. <!-- <NavBall v-show="!nameShow" :name="name" :headShow = 'headShow'/> -->
  34. <LinkFooter></LinkFooter>
  35. </div>
  36. </template>
  37. <script>
  38. import SportsHead from "@/components/StSportsHead";
  39. import SerchBox from "@/components/StSerchBox";
  40. import Match from "@/components/StMatch";
  41. import RollingBallHead from "@/components/StRollingBallHead";
  42. import LinkFooter from "@/components/StLinkFooter";
  43. import ActivitySlider from "@/components/StActivitySlider";
  44. import Loading from "@/components/StLoading";
  45. import NavBall from "@/components/StNavBall";
  46. export default {
  47. name: "RollBallpage",
  48. data() {
  49. return {
  50. gameCode: "",
  51. ishow: false, //显示1X2还是独赢盘状态 //true 为1x2
  52. name: "",//球类名字
  53. // code: "",
  54. nameShow: true, //判断是否为滚球或者是即将的状态
  55. getNameId: "", //获取头部导航别名
  56. arr: [],
  57. headShow:true, // 如果没有头部导航数据则不显示..
  58. number:'',//活动别名
  59. };
  60. },
  61. /**
  62. * 计算属性
  63. */
  64. computed: {
  65. // 获取活动vuex的活动类型
  66. getNumber: function() {
  67. //this.$store.getters.getActivity;
  68. if (
  69. this.$store.getters.getActivity != "StSoon" &&
  70. this.$store.getters.getActivity != "StRollBall"
  71. ) {
  72. this.nameShow = false;
  73. } else {
  74. this.nameShow = true;
  75. }
  76. return this.$store.getters.getActivity;
  77. }
  78. },
  79. /**
  80. * 数据监听
  81. */
  82. watch: {
  83. getNumber(val) {
  84. this.getNameId = val;
  85. let activityId = val;
  86. // 判定别名是否为滚球或者即将,否则调用另外一个组件
  87. // if (val != "StSoon" && val != "StRollBall") {
  88. // this.nameShow = false;
  89. // } else {
  90. // this.nameShow = true;
  91. // }
  92. // console.log('valll',val)
  93. //
  94. if (this.number != activityId ) {
  95. this.getAjax(this.$store.getters.getActivity);
  96. // this.gameCode = this.arr[0].game_code;
  97. // this.$store.dispatch("GET_BALL_ID", this.arr[0].game_code);
  98. }
  99. this.number = activityId;
  100. }
  101. },
  102. /**
  103. * 函数方法
  104. */
  105. methods: {
  106. //切换球类样式
  107. toggle: function(id, name) {
  108. this.gameCode = id;
  109. this.name = name;
  110. console.log("id", name);
  111. if (id != "zq") {
  112. this.ishow = true;
  113. } else {
  114. this.ishow = false;
  115. }
  116. this.$store.dispatch("GET_BALL_ID", id); //将球类别存入vuex里面
  117. },
  118. getAjax: function(type_code) {
  119. this.$http
  120. .get(this.$ports.rollBall.getGame, {
  121. type_code
  122. })
  123. .then(res => {
  124. // console.log("头部导航", res);
  125. this.arr = [
  126. {
  127. game_ico_url: require("@/assets/st-imges/football.png"),
  128. titel: "足球",
  129. game_code: "zq"
  130. },
  131. {
  132. game_ico_url: require("@/assets/st-imges/basketball.png"),
  133. titel: "篮球",
  134. game_code: "lq"
  135. },
  136. {
  137. game_ico_url: require("@/assets/st-imges/baseball.png"),
  138. titel: "棒球",
  139. game_code: "bq"
  140. },
  141. {
  142. game_ico_url: require("@/assets/st-imges/tennis.png"),
  143. titel: "网球",
  144. game_code: "wq"
  145. }
  146. ];
  147. //console.log('滚球类',res);
  148. if (res.data.status == 1 && res.data.data.length > 0 && res.data.data != null ) {
  149. // this.headShow = true;
  150. let dtatArry = [];
  151. this.arr.forEach(e => {
  152. res.data.data.forEach(val => {
  153. if (e.game_code == val.game_code) {
  154. val.game_ico_url = e.game_ico_url;
  155. dtatArry.push(val);
  156. }
  157. });
  158. });
  159. this.arr = dtatArry;
  160. this.gameCode =dtatArry[0].game_code;
  161. this.name = dtatArry[0].game_name;
  162. this.$store.dispatch("GET_BALL_ID", this.arr[0].game_code);
  163. if (this.gameCode != "zq") {
  164. this.ishow = true;
  165. } else {
  166. this.ishow = false;
  167. }
  168. } else {
  169. this.arr = [];
  170. // this.headShow = false;
  171. this.$store.dispatch('GETSHOW',false);
  172. }
  173. });
  174. }
  175. },
  176. mounted() {
  177. this.getAjax(this.$store.getters.getActivity);
  178. },
  179. components: {
  180. SportsHead,
  181. SerchBox,
  182. Match,
  183. LinkFooter,
  184. ActivitySlider,
  185. RollingBallHead,
  186. Loading,
  187. NavBall
  188. }
  189. };
  190. </script>
  191. <style scoped>
  192. .lod {
  193. z-index: 999;
  194. position: fixed;
  195. width: 100%;
  196. }
  197. .text {
  198. margin-top: 0.08rem;
  199. }
  200. #NavSlide {
  201. height: 1rem;
  202. background: #f8f8f8;
  203. }
  204. .nav-div {
  205. width: 6.28rem;
  206. }
  207. .img-icon {
  208. width: 0.24rem;
  209. height: 0.4rem;
  210. }
  211. .img-box {
  212. width: 0.48rem;
  213. height: 0.48rem;
  214. margin: 0 0.35rem;
  215. }
  216. @keyframes rotating {
  217. from {
  218. transform: rotate(0);
  219. }
  220. to {
  221. transform: rotate(360deg);
  222. }
  223. }
  224. @-moz-keyframes rotating {
  225. from {
  226. transform: rotate(0);
  227. }
  228. to {
  229. transform: rotate(360deg);
  230. }
  231. }
  232. @-webkit-keyframes rotating {
  233. from {
  234. transform: rotate(0);
  235. }
  236. to {
  237. transform: rotate(360deg);
  238. }
  239. }
  240. @-o-keyframes rotating {
  241. from {
  242. transform: rotate(0);
  243. }
  244. to {
  245. transform: rotate(360deg);
  246. }
  247. }
  248. .imgactive {
  249. animation: rotating 4s linear infinite;
  250. -webkit-animation: rotating 4s linear infinite;
  251. -moz-animation: rotating 4s linear infinite;
  252. -ms-animation: rotating 4s linear infinite;
  253. -o-animation: rotating 4s linear infinite;
  254. }
  255. .img-div {
  256. height: 1rem;
  257. }
  258. #NavSlide nav {
  259. /* padding: 0 0.43rem; */
  260. display: -webkit-box;
  261. display: -ms-flexbox;
  262. display: flex;
  263. -webkit-box-align: middle;
  264. -ms-flex-align: middle;
  265. align-items: middle;
  266. overflow-x: auto;
  267. background-color: #f8f8f8;
  268. -webkit-overflow-scrolling: touch;
  269. }
  270. #NavSlide div {
  271. text-align: center;
  272. font-size: 0.16rem;
  273. -ms-flex-negative: 0;
  274. flex-shrink: 0;
  275. /* padding:0 0.1rem;
  276. margin:0 0.05rem; */
  277. color: #000000;
  278. }
  279. span.active {
  280. color: #f76649;
  281. }
  282. </style>