33a8a25bfb996bb1bf1b71f8efe54435238ed23b.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <div>
  3. <div class="elastic">
  4. <div class="title">
  5. <div>
  6. <div class="ball">
  7. <span>{{ball_type=='zq'?'足球':ball_type=='lq'?'篮球':ball_type=='bq'?'棒球':ball_type=='wq'?'网球':''}}</span>
  8. </div>
  9. <span class="menu" style="font-size:0.16rem">菜单</span>
  10. </div>
  11. <!-- <div @click="All()">
  12. <label>全选</label>
  13. <input type="checkBox" :checked="all">
  14. </div> -->
  15. </div>
  16. <div class="match">
  17. <div>联赛</div>
  18. <div class="btn">
  19. <div class="submit" v-if="showSubmit" @click="Submit()">提交</div>
  20. <div class="reset" @click="returns()">取消</div>
  21. </div>
  22. </div>
  23. <div class="info">
  24. <div v-for="(item,index) in data" :key="index">
  25. <div>
  26. <div class="title">
  27. <div>{{item.name}}</div>
  28. <div>
  29. <label for>全部</label>
  30. <input @click="Region(index)" type="checkBox" :checked="item.active">
  31. </div>
  32. </div>
  33. <div class="eventInfo row wrap">
  34. <div class="item row allAlignment " v-for="(itemList,j) in item.lg_list" :key="itemList.id">
  35. <div>
  36. <input @click="League(index,j,itemList.id)" type="checkBox" :checked="itemList.click">
  37. <span>{{itemList.leagueName}}</span>
  38. </div>
  39. <div class="num">{{itemList.matchNum}}</div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import navLIstData from "@/assets/navLIstData";
  50. export default {
  51. name:'elasticFrame',
  52. data() {
  53. return {
  54. play_code:'',
  55. ball_type:'',
  56. showSubmit:false,//提交按钮状态
  57. data: [],
  58. chooseData:[],
  59. };
  60. },
  61. methods: {
  62. /*-----------------------------------------*/
  63. //地区选中
  64. Region(index) {
  65. this.data.forEach((e,i)=>{
  66. if(i==index){
  67. this.$set(e,'active',!e.active)
  68. e.lg_list.forEach(a=>{
  69. this.$set(a,'click',e.active)
  70. })
  71. }
  72. })
  73. // this.getAll();
  74. this.showSubmit = false;
  75. this.getSubmit();
  76. },
  77. /*-----------------------------------------*/
  78. //联赛选中
  79. League(index, num,id) {
  80. this.$set(this.data[index].lg_list[num],'click',!this.data[index].lg_list[num].click)
  81. for(let i = 0 ;i <this.data[index].lg_list.length;i++){
  82. if(this.data[index].lg_list[i].click == true){
  83. this.data[index].active = true;
  84. }else{
  85. this.data[index].active = false;
  86. break;
  87. }
  88. }
  89. this.getLeague(index);
  90. // this.getAll();
  91. this.showSubmit = false;
  92. this.getSubmit();
  93. },
  94. /*-----------------------------------------*/
  95. //联赛选中判断父级选中
  96. getLeague(index){
  97. this.data[index].lg_list.forEach(e=>{
  98. if(e.click==false){
  99. this.data[index].active = false
  100. }
  101. })
  102. },
  103. /*-----------------------------------------*/
  104. // 取消返回父级
  105. returns(){
  106. this.$store.dispatch("SET_CONTROLROUTING",this.play_code);
  107. this.$store.dispatch("SET_LEAGUEDATA",[]);
  108. },
  109. // 数据交互,返回父级
  110. Submit(){
  111. // 发送请求
  112. this.$store.dispatch("SET_CONTROLROUTING",this.play_code);
  113. this.$store.dispatch("SET_LEAGUEDATA",[]);
  114. this.$store.dispatch("SET_LEAGUEDATA",this.chooseData);
  115. },
  116. // 获取提交按钮显示状态
  117. getSubmit(){
  118. this.chooseData =[];
  119. for(let i= 0 ;i< this.data.length;i++){
  120. for(let j = 0 ; j< this.data[i].lg_list.length ; j++){
  121. if(this.data[i].lg_list[j].click == true){
  122. this.showSubmit = true;
  123. this.chooseData.push(this.data[i].lg_list[j].lg_id)
  124. //return false
  125. }
  126. }
  127. }
  128. }
  129. },
  130. computed: {
  131. },
  132. mounted() {
  133. this.play_code = this.$store.getters.getPaly_code;
  134. this.ball_type = this.$store.getters.getBallCode
  135. //联赛赛事数据
  136. this.$http.get(this.$ports.home.gameList, {
  137. type: this.$store.getters.getActivity,
  138. p_code: this.play_code,
  139. game_code: this.ball_type,
  140. }).then(res => {
  141. if(res.data.data.length >0){
  142. this.data =res.data.data[1]
  143. }
  144. })
  145. },
  146. created(){
  147. this.data.forEach(e=>{
  148. this.$set(e,'active',false)
  149. e.lg_list.forEach(a=>{
  150. this.$set(a,'click',false)
  151. })
  152. })
  153. }
  154. };
  155. </script>
  156. <style scoped>
  157. .elastic {
  158. width: 100%;
  159. height: auto;
  160. }
  161. .elastic .title {
  162. background: rgba(170, 170, 170, 1);
  163. height: 0.5rem;
  164. line-height: 0.5rem;
  165. padding: 0 0.2rem;
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. }
  170. .elastic .title label {
  171. color: #666666;
  172. font-size: 0.16rem;
  173. vertical-align: middle;
  174. }
  175. .elastic .title .ball {
  176. display: inline-block;
  177. width: 0.5rem;
  178. height: 0.36rem;
  179. line-height: 0.36rem;
  180. text-align: center;
  181. background: rgba(204, 204, 204, 1);
  182. font-size: 0.18rem;
  183. color: #f76649;
  184. position: relative;
  185. margin-right: 0.15rem;
  186. }
  187. .elastic .title .ball::after {
  188. content: "";
  189. display: inline-block;
  190. width: 0.1rem;
  191. height: 0.1rem;
  192. position: absolute;
  193. right: -0.2rem;
  194. top: 0.08rem;
  195. border-width: 0.1rem;
  196. border-style: solid;
  197. border-color: transparent transparent transparent rgba(204, 204, 204, 1);
  198. }
  199. .elastic .title input {
  200. width: 0.2rem;
  201. height: 0.2rem;
  202. margin-left: 0.1rem;
  203. }
  204. /* 联赛 */
  205. .match {
  206. background: #888888;
  207. color: #ffffff;
  208. display: flex;
  209. padding: 0 0.2rem;
  210. justify-content: space-between;
  211. align-items: center;
  212. height: 0.5rem;
  213. margin-bottom: 0.1rem;
  214. }
  215. .match div {
  216. font-size: 0.16rem;
  217. }
  218. .match .btn {
  219. text-align: center;
  220. display: flex;
  221. }
  222. .match .btn div {
  223. width: 0.6rem;
  224. height: 0.3rem;
  225. line-height: 0.3rem;
  226. font-size: 0.14rem;
  227. background: #71ca18;
  228. border-radius: 0.05rem;
  229. cursor: pointer;
  230. }
  231. .match .btn .reset {
  232. margin-left: 0.2rem;
  233. background: #666666;
  234. color: #cccccc;
  235. }
  236. /* 数据格式 */
  237. .info {
  238. height: auto;
  239. background: #fff;
  240. }
  241. .info .title {
  242. background: #cccccc;
  243. height: 0.4rem;
  244. line-height: 0.4rem;
  245. font-size: 0.16rem;
  246. color: #333333;
  247. padding: 0.2rem;
  248. }
  249. .eventInfo {
  250. width:100% ;
  251. }
  252. .item {
  253. width: 50%;
  254. padding:0.1rem 0.2rem;
  255. border-right: 1px solid rgba(237, 237, 237, 1);
  256. }
  257. .item input {
  258. width: 0.2rem;
  259. height: 0.2rem;
  260. }
  261. .item span {
  262. vertical-align: middle;
  263. }
  264. .flex {
  265. display: flex;
  266. justify-content: space-between;
  267. align-items: center;
  268. padding-right: 0.14rem;
  269. }
  270. .num {
  271. width: 0.3rem;
  272. height: 0.3rem;
  273. line-height: 0.3rem;
  274. background: #999999;
  275. text-align: center;
  276. color: #fff;
  277. border-radius: 0.05rem;
  278. }
  279. .match .btn .reset:hover {
  280. background: #959595;
  281. color: #fff;
  282. }
  283. </style>