Rank.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <div class="rank">
  3. <Headside></Headside>
  4. <div class="rankContainer">
  5. <div class="lt">
  6. <div class="recordMain">
  7. <el-carousel :interval="30000" height="370px" >
  8. <el-carousel-item v-for="rs in recordMain">
  9. <h5>{{rs.title}}</h5>
  10. <div class="sumContainer">
  11. <div class="sum">
  12. <s>{{rs.Unite}}</s>
  13. <em>{{rs.Result}}</em>
  14. </div>
  15. <span class="sumBg"></span>
  16. </div>
  17. </el-carousel-item>
  18. </el-carousel>
  19. </div>
  20. <div class="bottom">
  21. <el-carousel :interval="15000" height="280px">
  22. <el-carousel-item v-for="Rs in bottom">
  23. <div class="topOne" v-if="Rs.style == 'topOne'">
  24. <h5>{{Rs.title}}</h5>
  25. {{bottom.students}}
  26. <ul>
  27. <li v-for="(hero,i) in Rs.students">
  28. <div class="dgCenter">
  29. <div class="dghead">
  30. <!--<img v-bind:src="require('../static/img/people/' + topMsg.head)" alt="">-->
  31. <img :id="'circle_'+i"
  32. v-bind:src="require('../static/img/people/' + hero.head)" alt="">
  33. <s>{{ topMsg.userName }}</s>
  34. </div>
  35. <div class="score">
  36. <em>{{ topMsg.ck }}</em>
  37. <span>
  38. 打破了历史记录{{ topMsg.topCk }}
  39. </span>
  40. </div>
  41. </div>
  42. </li>
  43. </ul>
  44. </div>
  45. <div class="heros" v-if="Rs.style == 'heros'">
  46. <h5>{{Rs.title}}</h5>
  47. <ul>
  48. <li v-for="(hero,i) in Rs.students">
  49. <img :id="'circle_'+i" v-bind:src="require('../static/img/people/' + hero.head)"
  50. alt="">
  51. <img src="../static/img/rank/boy.png" class="sex" v-if="hero.sex == 1"/>
  52. <img src="../static/img/rank/girl.png" class="sex" v-if="hero.sex == 2"/>
  53. <div>
  54. <em :id="'red_'+i">No.{{i+1}}</em> {{ hero.userName }}
  55. </div>
  56. <span>{{ hero.calorie }} 千卡</span>
  57. </li>
  58. </ul>
  59. </div>
  60. </el-carousel-item>
  61. </el-carousel>
  62. </div>
  63. </div>
  64. <div class="rt">
  65. <el-carousel :interval="15000" height="610px">
  66. <el-carousel-item v-for="Rs in rt">
  67. <h5>{{Rs.title}}</h5>
  68. <ul>
  69. <li v-for="s in Rs.students">
  70. <img v-bind:src="require('../static/img/people/' + s.head)" alt="">
  71. <em>{{s.name}}</em>
  72. <s>{{s.ck}}</s>
  73. </li>
  74. </ul>
  75. </el-carousel-item>
  76. </el-carousel>
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import Headside from '@/components/Headside'
  83. import {getHello, getClassStat} from '@/api/getApiRes'
  84. import '../libs/rem';
  85. let qs = require('qs');
  86. export default {
  87. data() {
  88. return {
  89. trueDate: false,//真实数据 true false
  90. fakeNums: 8,//
  91. unite: '卡路里',
  92. topMsg: '',
  93. students: [],
  94. studentsLimit: [],
  95. showType: 2,//1 单人
  96. recordMain:[
  97. {title:'本周场馆卡路里总消耗',Result:'1234',Unite:'千卡'},
  98. {title:'本月场馆卡路里总消耗',Result:'12345',Unite:'千卡'},
  99. ],
  100. bottom:[
  101. {
  102. title:'单次CK值(新个人记录)',
  103. students:this.fakeNewsLimit(),
  104. style:'topOne'
  105. },
  106. {
  107. title:'本周卡路里消耗英雄榜',
  108. students:this.fakeNewsLimit(),
  109. style:'heros'
  110. },
  111. ],
  112. rt:[
  113. {
  114. title:'月度CK值排行',
  115. students:this.fakeNews(),
  116. },
  117. {
  118. title:'月度卡路里值排行',
  119. students:this.fakeNews(),
  120. }
  121. ]
  122. }
  123. },
  124. mounted() {
  125. if (this.trueDate) {
  126. this.timer = setInterval(() => {
  127. // this.GetgetUserList();
  128. this.curgetClassStat();
  129. }, 1000);
  130. } else {
  131. this.students = this.fakeNews();
  132. this.studentsLimit = this.fakeNewsLimit();
  133. this.topMsg = this.students[0];
  134. }
  135. },
  136. methods: {
  137. fakeNews() {
  138. let item = [];
  139. for (var i = 0; i < 7; i++) {
  140. item.push(
  141. {
  142. "hubId": 0,
  143. "deviceId": 22756,
  144. "calorie": 96.5,
  145. "heartRate": i * 5,
  146. "step": i * 40,
  147. "userName": "杨东艳",
  148. "userNmae": "杨东艳",
  149. "name": "杨东艳",
  150. "updateTime": 1604568915582,
  151. "activePercent": i * 5,
  152. "ck": 115.9 - i,
  153. "head": 'gc.png'
  154. }
  155. )
  156. }
  157. return item;
  158. },
  159. fakeNewsLimit() {
  160. let item = [];
  161. for (var i = 0; i < 3; i++) {
  162. item.push(
  163. {
  164. "hubId": 0,
  165. "deviceId": 22756,
  166. "calorie": 999.5,
  167. "heartRate": i * 5,
  168. "step": i * 40,
  169. "userName": "杨东艳",
  170. "userNmae": "杨东艳",
  171. "name": "杨东艳",
  172. "updateTime": 1604568915582,
  173. "activePercent": i * 5,
  174. "ck": i + 115.1,
  175. "sex": 1,
  176. "head": 'gc.png'
  177. }
  178. )
  179. }
  180. return item;
  181. },
  182. GetgetUserList() {
  183. let that = this;
  184. let param = {
  185. token: localStorage.token,
  186. };
  187. let postdata = qs.stringify(param);
  188. getHello(postdata).then(res => {
  189. let json = res;
  190. if (json.Code == 0) {
  191. that.topMsg = json.Rs[0];
  192. that.students = json.Rs;
  193. } else {
  194. that.$message.error(json.Memo);
  195. }
  196. })
  197. },
  198. curgetClassStat() {
  199. let that = this;
  200. let param = {
  201. token: localStorage.token,
  202. };
  203. let postdata = qs.stringify(param);
  204. getClassStat(postdata).then(res => {
  205. let json = res;
  206. if (json.Code == 0) {
  207. // 上课了
  208. if (json.ClassOn) {
  209. that.$router.push({path: '/'});
  210. }
  211. } else {
  212. // that.$message.error(json.Memo);
  213. }
  214. })
  215. },
  216. },
  217. watch: {
  218. '$route': function (val) {
  219. if (val.path == '/rank') {
  220. if (this.trueDate) {
  221. this.timer = setInterval(() => {
  222. // this.GetgetUserList();
  223. this.curgetClassStat();
  224. }, 1000);
  225. } else {
  226. this.students = this.fakeNews();
  227. this.topMsg = this.students[0];
  228. }
  229. } else {
  230. clearInterval(this.timer);
  231. }
  232. }
  233. },
  234. components: {
  235. Headside
  236. }
  237. }
  238. </script>
  239. <style scoped>
  240. .rank {
  241. position: absolute;
  242. top: 0;
  243. left: 0;
  244. right: 0;
  245. bottom: 0;
  246. width: 100%;
  247. overflow: hidden;
  248. display: block;
  249. margin: 0 auto;
  250. background: url("../static/img/rankBg.png");
  251. background-size: 100%;
  252. background-repeat: no-repeat;
  253. }
  254. .rankContainer {
  255. width: 90%;
  256. height: 100%;
  257. overflow: hidden;
  258. display: block;
  259. margin: 0 auto;
  260. }
  261. .rankContainer .lt {
  262. width: 60%;
  263. height: 100%;
  264. float: left;
  265. }
  266. .rankContainer .rt {
  267. width: 40%;
  268. float: right;
  269. }
  270. .rankContainer .lt .recordMain h5 {
  271. font-family: Roboto;
  272. font-weight: normal;
  273. font-size: 0.6rem;
  274. text-align: left;
  275. color: #fff;
  276. margin: 5% auto;
  277. }
  278. .rankContainer .sum {
  279. position: relative;
  280. top: -0.4rem;
  281. width: 100%;
  282. height: 35%;
  283. overflow: visible;
  284. display: block;
  285. margin: 0 auto;
  286. text-align: center;
  287. z-index: 666;
  288. }
  289. .sumBg {
  290. position: relative;
  291. bottom: 2.3rem;
  292. width: 100%;
  293. height: 2rem;
  294. overflow: hidden;
  295. display: block;
  296. margin: 0 auto;
  297. background: url("../static/img/pingtai.png") bottom center;
  298. background-size: 100% 100%;
  299. background-repeat: no-repeat;
  300. }
  301. .sum em {
  302. float: right;
  303. font-weight: 900;
  304. font-family: Roboto;
  305. font-weight: 900;
  306. font-size: 3rem;
  307. text-align: right;
  308. color: #fff;
  309. font-style: normal;
  310. text-shadow: #E85297 5px 0 0, #E85297 0 5px 0, #E85297 -5px 0 0, #E85297 0 -5px 0;
  311. }
  312. .sum s {
  313. position: relative;
  314. bottom: -2rem;
  315. width: 2rem;
  316. float: right;
  317. font-style: normal;
  318. font-family: Roboto;
  319. font-weight: normal;
  320. font-size: 44px;
  321. text-align: center;
  322. color: #fff;
  323. text-decoration: none;
  324. }
  325. .sumContainer {
  326. width: 100%;
  327. height: 4rem;
  328. overflow: hidden;
  329. display: block;
  330. margin: 0 auto;
  331. }
  332. .topOne {
  333. width: 100%;
  334. overflow: hidden;
  335. display: block;
  336. margin: 0 auto;
  337. }
  338. .topOne h5 {
  339. font-family: Roboto;
  340. font-weight: normal;
  341. font-size: 0.4rem;
  342. text-align: left;
  343. color: #fff;
  344. margin: 1% 0;
  345. }
  346. ul, li {
  347. list-style: none;
  348. margin: 0;
  349. padding: 0;
  350. }
  351. .topOne ul {
  352. width: 100%;
  353. overflow: hidden;
  354. display: block;
  355. margin: 0 auto;
  356. padding-left: 2px;
  357. padding-top: 0.1rem;
  358. padding-bottom: 0.1rem;
  359. }
  360. .topOne li {
  361. width: 33.3%;
  362. float: left;
  363. }
  364. .topOne .dgCenter {
  365. width: 93%;
  366. overflow: hidden;
  367. float: left;
  368. border-radius: 5px;
  369. background: rgba(0.0 .0 .0 .1);
  370. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  371. padding-top: 0.1rem;
  372. padding-bottom: 0.1rem;
  373. }
  374. .dgCenter .dghead {
  375. width: 40%;
  376. float: left;
  377. }
  378. .dghead img {
  379. width: 1rem;
  380. height: 1rem;
  381. overflow: hidden;
  382. display: block;
  383. margin: 0 auto;
  384. padding: 3px;
  385. border-radius: 250px;
  386. border: 2px solid #fff;
  387. }
  388. .dghead s {
  389. width: 100%;
  390. overflow: hidden;
  391. display: block;
  392. font-weight: normal;
  393. font-size: 0.3rem;
  394. text-align: center;
  395. color: #fff;
  396. font-style: normal;
  397. text-decoration: none;
  398. margin-top: 0.2rem;
  399. }
  400. .score {
  401. width: 60%;
  402. float: right;
  403. }
  404. .score em {
  405. width: 100%;
  406. overflow: hidden;
  407. display: block;
  408. margin: 0 auto;
  409. font-family: Roboto;
  410. font-weight: bold;
  411. font-size: 0.7rem;
  412. text-align: center;
  413. color: #fff;
  414. font-style: normal;
  415. height: 1.4rem;
  416. line-height: 1.4rem;
  417. }
  418. .score span {
  419. width: 100%;
  420. overflow: hidden;
  421. display: block;
  422. margin: 0 auto;
  423. font-family: Roboto;
  424. font-weight: normal;
  425. font-size: 0.2rem;
  426. color: #fff;
  427. text-align: center;
  428. }
  429. .rt {
  430. padding-top: 0.6rem;
  431. }
  432. .rt h5 {
  433. font-family: Roboto;
  434. font-weight: normal;
  435. font-size: 36px;
  436. text-align: center;
  437. color: #fff;
  438. margin: 0;
  439. margin-bottom: 0.6rem;
  440. text-indent: 0.2rem;
  441. }
  442. .rt ul {
  443. width: 80%;
  444. overflow: hidden;
  445. display: block;
  446. margin: 0 auto;
  447. padding-top: 3px;
  448. padding-bottom: 3px;
  449. }
  450. .rt li {
  451. width: 80%;
  452. overflow: hidden;
  453. display: block;
  454. margin: 0 auto;
  455. margin-bottom: 0.24rem;
  456. padding: 0.1rem 4%;
  457. background: rgba(0, 0, 0, 0.1);
  458. border-radius: 5px;
  459. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  460. }
  461. .rt li img {
  462. width: 0.6rem;
  463. height: 0.6rem;
  464. filter: drop-shadow(0px 0px 6px #bf00ff);
  465. border: 2px solid #fff;
  466. float: left;
  467. border-radius: 250px;
  468. margin-right: 3%;
  469. }
  470. .rt li em {
  471. font-family: Roboto;
  472. font-weight: normal;
  473. font-size: 0.35rem;
  474. text-align: center;
  475. color: #fff;
  476. font-style: normal;
  477. float: left;
  478. height: 0.6rem;
  479. line-height: 0.6rem;
  480. }
  481. .rt li s {
  482. font-family: Roboto;
  483. font-weight: normal;
  484. font-size: 0.35rem;
  485. text-align: right;
  486. color: #fff;
  487. text-decoration: none;
  488. height: 0.6rem;
  489. line-height: 0.6rem;
  490. float: right;
  491. }
  492. .heros > h5 {
  493. font-family: Roboto;
  494. font-weight: normal;
  495. font-size: 0.35rem;
  496. text-align: left;
  497. color: #fff;
  498. margin: 1% 0;
  499. }
  500. .heros ul {
  501. width: 100%;
  502. overflow: hidden;
  503. display: block;
  504. margin: 0 auto;
  505. padding-left: 3px;
  506. padding-top: 6px;
  507. padding-bottom: 6px;
  508. }
  509. .heros li {
  510. width: 2.5rem;
  511. height: 2.35rem;
  512. float: left;
  513. border-radius: 5px;
  514. background: rgba(0.0 .0 .0 .1);
  515. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  516. padding-top: 0.2rem;
  517. padding-bottom: 0.2rem;
  518. color: #fff;
  519. font-size: 0.3rem;
  520. text-align: center;
  521. margin-right: 5%;
  522. }
  523. .heros li > img {
  524. width: 1.2rem;
  525. height: 1.2rem;
  526. overflow: hidden;
  527. display: block;
  528. margin: 0 auto;
  529. margin-bottom: 0.2rem;
  530. border-radius: 100%;
  531. border: 2px solid #fff;
  532. }
  533. .heros li > img.sex {
  534. position: relative;
  535. top: -1.5rem;
  536. right: 0.55rem;
  537. width: 0.4rem;
  538. height: 0.4rem;
  539. overflow: hidden;
  540. float: right;
  541. border: none;
  542. }
  543. .heros li em {
  544. font-family: Roboto;
  545. font-weight: bold;
  546. font-size: 30px;
  547. text-align: center;
  548. font-style: normal;
  549. }
  550. .heros li em#red_0 {
  551. color: #FA5114;
  552. }
  553. .heros li em#red_1 {
  554. color: #FA981F;
  555. }
  556. .heros li em#red_2 {
  557. color: #FFE13C;
  558. }
  559. .heros li #circle_0 {
  560. border: 2px solid #FA5114;
  561. }
  562. .heros li #circle_1 {
  563. border: 2px solid #FA981F;
  564. }
  565. .heros li #circle_2 {
  566. border: 2px solid #FFE13C;
  567. }
  568. .heros li div {
  569. position: relative;
  570. top: -0.7rem;
  571. width: 100%;
  572. overflow: hidden;
  573. display: block;
  574. margin: 0 auto;
  575. text-align: center;
  576. }
  577. .heros li span {
  578. position: relative;
  579. top: -0.67rem;
  580. width: 100%;
  581. overflow: hidden;
  582. display: block;
  583. margin: 0 auto;
  584. }
  585. .bottom {
  586. position: relative;
  587. width: 100%;
  588. padding-top: 0.1rem;
  589. bottom: 0.2rem;
  590. }
  591. /deep/ .el-carousel__indicators--horizontal {
  592. display: none;
  593. }
  594. </style>