07a0e91061d3e6ecded45d9b1b3092a887e372ce.svn-base 7.1 KB

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