Wait.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. <template>
  2. <div :class="pageStyle">
  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.Result[0].Unite}}</s>
  13. <em>{{rs.Result[0].Values}}</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 == 'tops'">
  24. <h5>{{Rs.Title}}</h5>
  25. <ul>
  26. <li v-for="(tops,i) in Rs.Result">
  27. <div class="dgCenter">
  28. <div class="dghead">
  29. <img :id="'circle_'+i"
  30. v-bind:src="tops.Head" alt="" v-if="tops.Head">
  31. <img :id="'circle_'+i"
  32. v-bind:src="require('../static/img/people/flyhead.png')" alt=""
  33. v-if="!tops.Head">
  34. <s>{{ tops.UserName }}</s>
  35. </div>
  36. <div class="score">
  37. <em>{{ tops.Values}}</em>
  38. <span>
  39. {{tops.Message}}
  40. </span>
  41. </div>
  42. </div>
  43. </li>
  44. </ul>
  45. </div>
  46. <div class="heros" v-if="Rs.Style == 'heros'">
  47. <h5>{{Rs.Title}}</h5>
  48. <ul>
  49. <li v-for="(hero,i) in Rs.Result">
  50. <img :id="'circle_'+i"
  51. v-bind:src="hero.Head" alt="" v-if="hero.Head">
  52. <img :id="'circle_'+i" v-bind:src="require('../static/img/people/flyhead.png')"
  53. alt="" v-if="!hero.Head">
  54. <img src="../static/img/wait/boy.png" class="sex" v-if="hero.Sex == 1"/>
  55. <img src="../static/img/wait/girl.png" class="sex" v-if="hero.Sex == 2"/>
  56. <div>
  57. <em :id="'red_'+i">No.{{i+1}}</em> {{ hero.UserName }}
  58. </div>
  59. <span>{{ hero.Values }} {{hero.Unite}}</span>
  60. </li>
  61. </ul>
  62. </div>
  63. </el-carousel-item>
  64. </el-carousel>
  65. </div>
  66. </div>
  67. <div class="rt">
  68. <el-carousel :interval="15000" height="610px">
  69. <el-carousel-item v-for="Rs in rt">
  70. <h5>{{Rs.Title}}</h5>
  71. <ul>
  72. <li v-for="s in Rs.Result">
  73. <img :src="s.Head" alt="" v-if="s.Head">
  74. <img v-bind:src="require('../static/img/people/flyhead.png')" alt="" v-if="!s.Head">
  75. <em>{{s.UserName}}</em>
  76. <s>{{s.Values}}</s>
  77. </li>
  78. </ul>
  79. </el-carousel-item>
  80. </el-carousel>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import Headside from '@/components/Headside'
  87. import {
  88. getHello,
  89. getClassStat,
  90. HerosRankingQuery,
  91. CalorieStatsQuery,
  92. UserRankingQuery
  93. } from '@/api/getApiRes'
  94. import '../libs/rem';
  95. import '../Global'
  96. let qs = require('qs');
  97. export default {
  98. data() {
  99. return {
  100. eqSn: '30:9C:23:0C:8B:1E',
  101. pageStyle: RandomBg(),
  102. trueDate: true,//真实数据 true false
  103. fakeNums: 8,//
  104. unite: '卡路里',
  105. topMsg: '',
  106. students: [],
  107. studentsLimit: [],
  108. showType: 2,//1 单人
  109. recordMain: [],
  110. bottom: {},
  111. rt: [],
  112. }
  113. },
  114. mounted() {
  115. if (this.trueDate) {
  116. this.waitTimer = setInterval(() => {
  117. // this.GetgetUserList();
  118. this.curgetClassStat();
  119. this.GetHerosRankingQuery();
  120. this.GetCalorieStatsQuery();
  121. this.GetUserRankingQuery();
  122. }, 1000);
  123. } else {
  124. this.students = this.fakeNews();
  125. this.studentsLimit = this.fakeNewsLimit();
  126. this.topMsg = this.students[0];
  127. this.bottom = [
  128. {
  129. "Title": "本周消耗卡路里英雄榜",
  130. "Style": "heros",
  131. "Result": [
  132. {
  133. "UserName": "段长鹏",
  134. "Sex": 1,
  135. "Head": "",
  136. "Values": "4744",
  137. "Unite": "千卡",
  138. "Message": ""
  139. },
  140. {
  141. "UserName": "贾雨奇",
  142. "Sex": 1,
  143. "Head": "http://192.168.0.2/flyhead.png",
  144. "Values": "4034",
  145. "Unite": "千卡",
  146. "Message": ""
  147. },
  148. {
  149. "UserName": "郑伟",
  150. "Sex": 1,
  151. "Head": "http://192.168.0.2/flyhead.png",
  152. "Values": "2290",
  153. "Unite": "千卡",
  154. "Message": ""
  155. }
  156. ]
  157. },
  158. {
  159. "Title": "单次CK值(新个人记录)",
  160. "Style": "tops",
  161. "Result": [
  162. {
  163. "UserName": "郑伟",
  164. "Sex": 1,
  165. "Head": "",
  166. "Values": "1022",
  167. "Unite": "",
  168. "Message": "打破了历史记录100000"
  169. },
  170. {
  171. "UserName": "郑伟",
  172. "Sex": 1,
  173. "Head": "http://192.168.0.2/flyhead.png",
  174. "Values": "1020",
  175. "Unite": "",
  176. "Message": "打破了历史记录100000"
  177. }
  178. ]
  179. }
  180. ];
  181. this.rt = [
  182. {
  183. Title: '月度CK值排行',
  184. Result: this.fakeNews(),
  185. },
  186. {
  187. Title: '月度卡路里值排行',
  188. Result: this.fakeNews(),
  189. }
  190. ];
  191. console.log(this.rt[0].Result);
  192. this.recordMain = [
  193. {
  194. Title: '本周场馆卡路里总消耗',
  195. Result: [{'Values': 1234, Unite: '千卡'}],
  196. }
  197. ]
  198. }
  199. },
  200. methods: {
  201. fakeNews() {
  202. let item = [];
  203. for (var i = 0; i < 7; i++) {
  204. item.push(
  205. {
  206. "hubId": 0,
  207. "deviceId": 22756,
  208. "calorie": 96.5,
  209. "Values ": 96.5,
  210. "heartRate": i * 5,
  211. "step": i * 40,
  212. "userName": "杨东艳",
  213. "userNmae": "杨东艳",
  214. "UserName": "杨东艳",
  215. "name": "杨东艳",
  216. "updateTime": 1604568915582,
  217. "activePercent": i * 5,
  218. "ck": 115.9 - i,
  219. "head": 'flyhead.png'
  220. }
  221. )
  222. }
  223. return item;
  224. },
  225. fakeNewsLimit() {
  226. let item = [];
  227. for (var i = 0; i < 3; i++) {
  228. item.push(
  229. {
  230. "hubId": 0,
  231. "deviceId": 22756,
  232. "calorie": 999.5,
  233. "heartRate": i * 5,
  234. "step": i * 40,
  235. "userName": "杨东艳",
  236. "userNmae": "杨东艳",
  237. "name": "杨东艳",
  238. "updateTime": 1604568915582,
  239. "activePercent": i * 5,
  240. "ck": i + 115.1,
  241. "sex": 1,
  242. "head": 'flyhead.png'
  243. }
  244. )
  245. }
  246. return item;
  247. },
  248. GetgetUserList() {
  249. let that = this;
  250. let param = {
  251. eqSn: localStorage.eqSn,
  252. token: localStorage.token,
  253. };
  254. let postdata = qs.stringify(param);
  255. getHello(postdata).then(res => {
  256. let json = res;
  257. if (json.Code == 0) {
  258. that.topMsg = json.Rs[0];
  259. that.students = json.Rs;
  260. } else {
  261. that.$message.error(json.Memo);
  262. }
  263. })
  264. },
  265. GetHerosRankingQuery() {
  266. let that = this;
  267. let param = {
  268. eqSn: localStorage.eqSn,
  269. dispNum: 3
  270. };
  271. let postdata = qs.stringify(param);
  272. HerosRankingQuery(postdata).then(res => {
  273. let json = res;
  274. if (json.Code == 0) {
  275. that.bottom = json.Rs;
  276. } else {
  277. that.$message.error(json.Memo);
  278. }
  279. })
  280. },
  281. GetUserRankingQuery() {
  282. let that = this;
  283. let param = {
  284. eqSn: localStorage.eqSn,
  285. dispNum: 7
  286. };
  287. let postdata = qs.stringify(param);
  288. UserRankingQuery(postdata).then(res => {
  289. let json = res;
  290. if (json.Code == 0) {
  291. that.rt = json.Rs;
  292. } else {
  293. that.$message.error(json.Memo);
  294. }
  295. })
  296. },
  297. GetCalorieStatsQuery() {
  298. let that = this;
  299. let param = {
  300. eqSn: localStorage.eqSn,
  301. };
  302. let postdata = qs.stringify(param);
  303. CalorieStatsQuery(postdata).then(res => {
  304. let json = res;
  305. if (json.Code == 0) {
  306. that.recordMain = json.Rs;
  307. } else {
  308. that.$message.error(json.Memo);
  309. }
  310. })
  311. },
  312. curgetClassStat() {
  313. console.log(123);
  314. let that = this;
  315. let param = {
  316. token: localStorage.token,
  317. eqSn: localStorage.eqSn
  318. };
  319. let postdata = qs.stringify(param);
  320. getClassStat(postdata).then(res => {
  321. let json = res;
  322. console.log(json);
  323. if (json.Code == 0) {
  324. // alert(JSON.stringify(json.ClassOn));
  325. // alert("alert:"+json.ClassOn);
  326. // 上课了
  327. if (json.ClassOn== 1){
  328. // 1:团课
  329. // 2:竞技课PK
  330. // 3:私教课
  331. // alert("alert:"+json.ClassOn);
  332. switch (parseInt(json.dp)) {
  333. case 0:
  334. that.$router.push({path: '/rank'});
  335. break;
  336. case 1:
  337. that.$router.push({path: '/'});
  338. break;
  339. case 2:
  340. that.$router.push({path: '/pk'});
  341. break;
  342. case 3:
  343. that.$router.push({path: '/'});
  344. break;
  345. }
  346. }
  347. } else {
  348. // that.$message.error(json.Memo);
  349. }
  350. })
  351. },
  352. },
  353. watch: {
  354. '$route': function (val) {
  355. if (val.path == '/wait') {
  356. if (this.trueDate) {
  357. this.waitTimer = setInterval(() => {
  358. this.curgetClassStat();
  359. this.GetHerosRankingQuery();
  360. this.GetCalorieStatsQuery();
  361. this.GetUserRankingQuery();
  362. }, 1000);
  363. } else {
  364. this.students = this.fakeNews();
  365. this.topMsg = this.students[0];
  366. }
  367. } else {
  368. clearInterval(this.waitTimer);
  369. }
  370. }
  371. },
  372. components: {
  373. Headside
  374. }
  375. }
  376. </script>
  377. <style scoped>
  378. @import "../assets/css/bg.css";
  379. .pages {
  380. position: absolute;
  381. top: 0;
  382. left: 0;
  383. right: 0;
  384. bottom: 0;
  385. width: 100%;
  386. overflow: hidden;
  387. display: block;
  388. margin: 0 auto;
  389. }
  390. .rankContainer {
  391. width: 90%;
  392. height: 100%;
  393. overflow: hidden;
  394. display: block;
  395. margin: 0 auto;
  396. }
  397. .rankContainer .lt {
  398. width: 60%;
  399. height: 100%;
  400. float: left;
  401. }
  402. .rankContainer .rt {
  403. width: 40%;
  404. float: right;
  405. }
  406. .rankContainer .lt .recordMain h5 {
  407. font-family: vista;
  408. font-weight: normal;
  409. font-size: 0.6rem;
  410. text-align: left;
  411. color: #fff;
  412. margin: 5% auto;
  413. }
  414. .rankContainer .sum {
  415. position: relative;
  416. top: 0.4rem;
  417. width: 100%;
  418. height: 35%;
  419. overflow: visible;
  420. display: block;
  421. margin: 0 auto;
  422. text-align: center;
  423. z-index: 666;
  424. }
  425. .sumBg {
  426. position: relative;
  427. bottom: 0.8rem;
  428. width: 100%;
  429. height: 2rem;
  430. overflow: hidden;
  431. display: block;
  432. margin: 0 auto;
  433. background: url("../static/img/pingtai.png") bottom center;
  434. background-size: 100% 100%;
  435. background-repeat: no-repeat;
  436. }
  437. .sum em {
  438. width: 7.2rem;
  439. float: right;
  440. font-weight: 900;
  441. font-family: vista;
  442. font-weight: 900;
  443. font-size: 2rem;
  444. text-align: center;
  445. color: #fff;
  446. font-style: normal;
  447. text-shadow: #E85297 5px 0 0, #E85297 0 5px 0, #E85297 -5px 0 0, #E85297 0 -5px 0;
  448. }
  449. .sum s {
  450. position: relative;
  451. bottom: -2rem;
  452. width: 2rem;
  453. float: right;
  454. font-style: normal;
  455. font-family: vista;
  456. font-weight: normal;
  457. font-size: 44px;
  458. text-align: center;
  459. color: #fff;
  460. text-decoration: none;
  461. }
  462. .sumContainer {
  463. width: 100%;
  464. height: 4rem;
  465. overflow: hidden;
  466. display: block;
  467. margin: 0 auto;
  468. }
  469. .topOne {
  470. width: 100%;
  471. overflow: hidden;
  472. display: block;
  473. margin: 0 auto;
  474. }
  475. .topOne h5 {
  476. font-family: vista;
  477. font-weight: normal;
  478. font-size: 0.4rem;
  479. text-align: left;
  480. color: #fff;
  481. margin: 1% 0;
  482. }
  483. ul, li {
  484. list-style: none;
  485. margin: 0;
  486. padding: 0;
  487. }
  488. .topOne ul {
  489. width: 100%;
  490. overflow: hidden;
  491. display: block;
  492. margin: 0 auto;
  493. padding-left: 2px;
  494. padding-top: 0.1rem;
  495. padding-bottom: 0.1rem;
  496. }
  497. .topOne li {
  498. width: 33.3%;
  499. float: left;
  500. }
  501. .topOne .dgCenter {
  502. width: 93%;
  503. overflow: hidden;
  504. float: left;
  505. border-radius: 5px;
  506. background: rgba(0.0 .0 .0 .1);
  507. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  508. padding-top: 0.1rem;
  509. padding-bottom: 0.1rem;
  510. }
  511. .dgCenter .dghead {
  512. width: 40%;
  513. float: left;
  514. }
  515. .dghead img {
  516. width: 1rem;
  517. height: 1rem;
  518. overflow: hidden;
  519. display: block;
  520. margin: 0 auto;
  521. padding: 0;
  522. border-radius: 250px;
  523. border: 2px solid #fff;
  524. }
  525. .dghead s {
  526. width: 100%;
  527. overflow: hidden;
  528. display: block;
  529. font-weight: normal;
  530. font-size: 0.3rem;
  531. text-align: center;
  532. color: #fff;
  533. font-style: normal;
  534. text-decoration: none;
  535. margin-top: 0.2rem;
  536. }
  537. .score {
  538. width: 60%;
  539. float: right;
  540. }
  541. .score em {
  542. width: 100%;
  543. overflow: hidden;
  544. display: block;
  545. margin: 0 auto;
  546. font-family: vista;
  547. font-weight: bold;
  548. font-size: 0.7rem;
  549. text-align: center;
  550. color: #fff;
  551. font-style: normal;
  552. height: 1.4rem;
  553. line-height: 1.4rem;
  554. }
  555. .score span {
  556. width: 100%;
  557. overflow: hidden;
  558. display: block;
  559. margin: 0 auto;
  560. font-family: vista;
  561. font-weight: normal;
  562. font-size: 0.2rem;
  563. color: #fff;
  564. text-align: center;
  565. }
  566. .rt {
  567. padding-top: 0.6rem;
  568. }
  569. .rt h5 {
  570. font-family: vista;
  571. font-weight: normal;
  572. font-size: 36px;
  573. text-align: center;
  574. color: #fff;
  575. margin: 0;
  576. margin-bottom: 0.6rem;
  577. text-indent: 0.2rem;
  578. }
  579. .rt ul {
  580. width: 80%;
  581. overflow: hidden;
  582. display: block;
  583. margin: 0 auto;
  584. padding-top: 3px;
  585. padding-bottom: 3px;
  586. }
  587. .rt li {
  588. width: 80%;
  589. overflow: hidden;
  590. display: block;
  591. margin: 0 auto;
  592. margin-bottom: 0.24rem;
  593. padding: 0.1rem 4%;
  594. background: rgba(0, 0, 0, 0.1);
  595. border-radius: 5px;
  596. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  597. }
  598. .rt li img {
  599. width: 0.6rem;
  600. height: 0.6rem;
  601. filter: drop-shadow(0px 0px 6px #bf00ff);
  602. border: 2px solid #fff;
  603. float: left;
  604. border-radius: 250px;
  605. margin-right: 3%;
  606. }
  607. .rt li em {
  608. font-family: vista;
  609. font-weight: normal;
  610. font-size: 0.35rem;
  611. text-align: center;
  612. color: #fff;
  613. font-style: normal;
  614. float: left;
  615. height: 0.6rem;
  616. line-height: 0.6rem;
  617. }
  618. .rt li s {
  619. font-family: vista;
  620. font-weight: normal;
  621. font-size: 0.35rem;
  622. text-align: right;
  623. color: #fff;
  624. text-decoration: none;
  625. height: 0.6rem;
  626. line-height: 0.6rem;
  627. float: right;
  628. }
  629. .heros > h5 {
  630. font-family: vista;
  631. font-weight: normal;
  632. font-size: 0.35rem;
  633. text-align: left;
  634. color: #fff;
  635. margin: 1% 0;
  636. }
  637. .heros ul {
  638. width: 100%;
  639. overflow: hidden;
  640. display: block;
  641. margin: 0 auto;
  642. padding-left: 3px;
  643. padding-top: 6px;
  644. padding-bottom: 6px;
  645. }
  646. .heros li {
  647. width: 2.5rem;
  648. height: 2.35rem;
  649. float: left;
  650. border-radius: 5px;
  651. background: rgba(0.0 .0 .0 .1);
  652. box-shadow: 0px 0px 6px rgba(255, 255, 255, 0.3);
  653. padding-top: 0.2rem;
  654. padding-bottom: 0.2rem;
  655. color: #fff;
  656. font-size: 0.3rem;
  657. text-align: center;
  658. margin-right: 5%;
  659. }
  660. .heros li > img {
  661. width: 1.2rem;
  662. height: 1.2rem;
  663. overflow: hidden;
  664. display: block;
  665. margin: 0 auto;
  666. margin-bottom: 0.2rem;
  667. border-radius: 100%;
  668. border: 2px solid #fff;
  669. }
  670. .heros li > img.sex {
  671. position: relative;
  672. top: -1.5rem;
  673. right: 0.55rem;
  674. width: 0.4rem;
  675. height: 0.4rem;
  676. overflow: hidden;
  677. float: right;
  678. border: none;
  679. }
  680. .heros li em {
  681. font-family: vista;
  682. font-weight: bold;
  683. font-size: 30px;
  684. text-align: center;
  685. font-style: normal;
  686. }
  687. .heros li em#red_0 {
  688. color: #FA5114;
  689. }
  690. .heros li em#red_1 {
  691. color: #FA981F;
  692. }
  693. .heros li em#red_2 {
  694. color: #FFE13C;
  695. }
  696. .heros li #circle_0 {
  697. border: 2px solid #FA5114;
  698. }
  699. .heros li #circle_1 {
  700. border: 2px solid #FA981F;
  701. }
  702. .heros li #circle_2 {
  703. border: 2px solid #FFE13C;
  704. }
  705. .heros li div {
  706. position: relative;
  707. top: -0.7rem;
  708. width: 100%;
  709. overflow: hidden;
  710. display: block;
  711. margin: 0 auto;
  712. text-align: center;
  713. }
  714. .heros li span {
  715. position: relative;
  716. top: -0.67rem;
  717. width: 100%;
  718. overflow: hidden;
  719. display: block;
  720. margin: 0 auto;
  721. }
  722. .bottom {
  723. position: relative;
  724. width: 100%;
  725. padding-top: 0.1rem;
  726. bottom: 0.2rem;
  727. }
  728. /deep/ .el-carousel__indicators--horizontal {
  729. display: none;
  730. }
  731. </style>