Wait.vue 24 KB

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