Rank.vue 23 KB

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