b84bc627a59670f5963b0ce92a9c9f6ca8100731.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="gameResult">
  3. <!-- <div class="box">
  4. <div class="title">赛事结果</div>
  5. <div class='home' @click="goHome">返回首页</div>
  6. </div> -->
  7. <div class="box">
  8. <div class="select">
  9. <span class="select-name">体育类型:</span>
  10. <el-select v-model="physicaLType" size="small" style="width: 150px" @change="getMatchData">
  11. <el-option
  12. v-for="(item, index) of type"
  13. :key="index"
  14. :value="item.value"
  15. :label="item.label"
  16. ></el-option>
  17. </el-select>
  18. </div>
  19. <!-- <check-all></check-all> -->
  20. <div class="interval"></div>
  21. <div class="search">
  22. <el-button size="small" type="info" @click="search">搜索</el-button>
  23. </div>
  24. <div class="search">
  25. <el-button size="small" type="text" @click="goHome" style="color: #ffffff;">返回首页</el-button>
  26. </div>
  27. </div>
  28. <div class="content">
  29. <!-- <el-tabs type="border-card">
  30. <el-tab-pane v-for="(item, index) of dateArr" :key="index" :label="item.date">{{item}}</el-tab-pane>
  31. </el-tabs> -->
  32. <div class="head-date" v-for="(item, index) of dateArr" :key="index"
  33. @click="changeMatchData(item, index)" :id="'head' + index">
  34. <div>
  35. <div>{{item.date}}</div>
  36. <div>{{index == 0 ? '今日' : item.weekday}}</div>
  37. </div>
  38. </div>
  39. <!-- <football-table :footballData="gameData" :loading="loading" v-if="physicaLType ==='zq'"></football-table> -->
  40. <new-football-table :footballData="gameData" :loading="loading" v-if="physicaLType === 'zq'"></new-football-table>
  41. <basketball-table :basketballData="gameData" :loading="loading" v-if="physicaLType === 'lq'"></basketball-table>
  42. <tennis-table :tennisData="gameData" :loading="loading" v-if="physicaLType === 'wq'"></tennis-table>
  43. <baseball-table :baseballData="gameData" :laoding="loading" v-if="physicaLType === 'bq'"></baseball-table>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import FootballTable from '../../components/Gametable/FootballTable'
  49. import BasketballTable from '../../components/Gametable/BasketballTable'
  50. import TennisTable from '../../components/Gametable/TennisTable'
  51. import BaseballTable from '../../components/Gametable/BaseballTable'
  52. import NewFootballTable from '../../components/Gametable/NewFootballTable'
  53. import CheckAll from '../../components/Gametable/CheckAll'
  54. export default {
  55. name: "gameResult",
  56. data() {
  57. return {
  58. physicaLType: 'bq',
  59. type: [{ value: 'zq', label: "足球" }, { value: 'lq', label: "篮球" },
  60. {value: 'wq', label: '网球'}, {value: 'bq', label: '棒球'}],
  61. showGame: false,
  62. game: [],
  63. selectGame: [],
  64. date: '',
  65. dateArr: [], // 最近7天的时间,
  66. matchDate: '', // 查询时间
  67. updateTime: 'update', // 时间跟新标志,
  68. gameData: [],
  69. loading: false
  70. };
  71. },
  72. created() {
  73. this.getNowDate();
  74. this.getMatchData();
  75. },
  76. mounted() {
  77. this.setFirstDate();
  78. },
  79. methods: {
  80. search() {
  81. this.getMatchData();
  82. },
  83. showGameSet() {
  84. this.showGame = !this.showGame
  85. },
  86. // 获取现在的时间
  87. getNowDate() {
  88. if(this.updateTime === 'update') {
  89. this.setDateArr(new Date(), 7)
  90. }
  91. },
  92. setDateArr(date, num) { // 设置过去一周的时间
  93. for(let i=0; i<num; i++) {
  94. let nowDate = new Date(date.getTime() - 24*60*60*1000*i)
  95. this.dateArr.push(
  96. {
  97. weekday: this.getweekDay(nowDate), // 星期几
  98. date: nowDate.toLocaleDateString() // 年月日
  99. }
  100. )
  101. }
  102. this.matchDate = this.dateArr[0].date // 默认查询时间为当前时间
  103. this.updateTime = 'stop'
  104. },
  105. getweekDay(date) {
  106. let weekday = new Array(7)
  107. weekday[0] = "星期日"
  108. weekday[1] = "星期一"
  109. weekday[2] = "星期二"
  110. weekday[3] = "星期三"
  111. weekday[4] = "星期四"
  112. weekday[5] = "星期五"
  113. weekday[6] = "星期六"
  114. return weekday[date.getDay()];
  115. },
  116. // 获取赛事数据
  117. getMatchData() {
  118. let params = {
  119. game_code: this.physicaLType,
  120. match_date: this.matchDate
  121. }
  122. this.loading = true
  123. this.$http.get(this.$ports.home.getMatchResult, params)
  124. .then(res => {
  125. if(res.data.data) {
  126. this.gameData = res.data.data[1] ? res.data.data[1] : {}
  127. }
  128. this.loading = false
  129. })
  130. .catch(err => {
  131. this.loading = false
  132. this.$message.error(err.message)
  133. })
  134. },
  135. changeMatchData(item, index) { // 选项卡操作,并查询改时间的赛果
  136. // 样式切换
  137. let allhead = document.getElementsByClassName('head-date')
  138. let head = document.getElementById('head'+ index)
  139. for(let i =0; i<allhead.length;i ++) {
  140. allhead[i].style.color = '#747474'
  141. allhead[i].style.backgroundColor = '#e3e3e3'
  142. }
  143. head.style.color = "#ffffff"
  144. head.style.backgroundColor = '#373737'
  145. // 当前选中的时间作为搜索条件
  146. this.matchDate = item.date
  147. this.getMatchData();
  148. },
  149. setFirstDate() { // 初始化时, 当前时间默认选中
  150. let allhead = document.getElementsByClassName('head-date')
  151. allhead[0].style.color = "#ffffff"
  152. allhead[0].style.backgroundColor = '#373737'
  153. },
  154. goHome() { // 返回首页
  155. this.$router.push('/');
  156. }
  157. },
  158. components: {
  159. FootballTable,
  160. BasketballTable,
  161. TennisTable,
  162. BaseballTable,
  163. NewFootballTable,
  164. CheckAll
  165. }
  166. }
  167. </script>
  168. <style>
  169. .el-select .el-input__inner:focus {
  170. border-color: #999999;
  171. }
  172. .el-select .el-input.is-focus .el-input__inner {
  173. border-color: #999999;
  174. }
  175. .el-input .el-input__inner:focus {
  176. border-color: #999999;
  177. }
  178. .el-input .el-input.is-focus .el-input__inner {
  179. border-color: #999999;
  180. }
  181. </style>
  182. <style scoped>
  183. /deep/ .el-checkbox__input {
  184. display: inline-grid;
  185. white-space: pre-line;
  186. word-wrap: break-word;
  187. overflow: hidden;
  188. line-height: 20px;
  189. }
  190. /deep/ .el-checkbox__label {
  191. font-size: 0.2rem;
  192. }
  193. .box {
  194. display: flex;
  195. height: 60px;
  196. align-items: center;
  197. background: linear-gradient(to bottom, #999999, #6a6a6b);
  198. }
  199. .title {
  200. flex: 1;
  201. font-size: 16px;
  202. color: #ffffff;
  203. margin-left: 50px;
  204. }
  205. .home {
  206. flex: 0 1 50px;
  207. font-size: 14px;
  208. color: #ffffff;
  209. margin-right: 50px;
  210. }
  211. .select-name {
  212. color: #ffffff;
  213. margin-left: 50px;
  214. margin-right: 10px;
  215. }
  216. .select {
  217. width: 400px;
  218. }
  219. .interval {
  220. flex: 1;
  221. }
  222. .search {
  223. flex: 0 1 50px;
  224. margin-right: 20px;
  225. }
  226. .option-content {
  227. display: flex;
  228. width: 400px;
  229. flex-flow: row wrap;
  230. align-items: center;
  231. }
  232. .option-title {
  233. width: 100%;
  234. height: 80px;
  235. font-size: 14px;
  236. /* background-color: #2d2d2d; */
  237. }
  238. .game-content {
  239. position: absolute;
  240. margin-top: 10px;
  241. background-color: #ffffff;
  242. font-size: 0.2rem;
  243. }
  244. .game-title {
  245. background-color: #373737;
  246. height: 40px;
  247. line-height: 40px;
  248. padding-left: 10px;
  249. }
  250. .game-item-content {
  251. /* display: flex;
  252. flex-flow: row wrap; */
  253. height: 300px;
  254. width: 500px;
  255. background-color: #ffffff;
  256. padding-left: 10px;
  257. padding-top: 10px;
  258. overflow-y: auto;
  259. overflow-x: hidden;
  260. }
  261. .game-item {
  262. display: inline-block;
  263. width: 150px;
  264. height: auto;
  265. }
  266. .content {
  267. width: 800px;
  268. margin: 20px auto;
  269. overflow-x: hidden;
  270. }
  271. .head-date {
  272. display: inline-block;
  273. box-sizing: content-box;
  274. height: 40px;
  275. width: 80px;
  276. padding: 10px 10px 0 10px;
  277. text-align: center;
  278. color: #747474;
  279. font-weight: 700;
  280. background-color: #e3e3e3;
  281. }
  282. .head-date:hover {
  283. opacity: 0.8;
  284. }
  285. .game-grid {
  286. box-sizing: border-box;
  287. width: 100%;
  288. border: solid 1px #e3e3e3;
  289. }
  290. .game-grid-head {
  291. width: 100%;
  292. height: 40px;
  293. line-height: 40px;
  294. background-color: #373737;
  295. color: #ffffff;
  296. font-size: 14px;
  297. font-weight: 700;
  298. text-align: center;
  299. }
  300. .game-grid-one {
  301. display:table-cell;
  302. vertical-align: middle;
  303. text-align: center;
  304. font-size: 13px;
  305. border-collapse: collapse;
  306. }
  307. .game-grid-cell {
  308. display:table-cell;
  309. vertical-align: middle;
  310. text-align: center;
  311. font-size: 13px;
  312. border-collapse: collapse;
  313. padding: 6px 0;
  314. border-right: 1px solid #d7d7d7;
  315. }
  316. </style>