356f09a59b32420fc114a5039bf44692ff61e41a.svn-base 6.9 KB

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