2b1978bc45dae9b732d3b73acb1a3fd62c43a03b.svn-base 7.1 KB

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