threestudent.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <ul :class="[{'many':students.length >= 2}]">
  3. <li v-for="(s,i) in students.slice(0, maxShowNum)" :class="s.className">
  4. <div v-show="i<10" class="centerLi">
  5. <!-- <div class="power" v-if="s.RealHr != 0"> -->
  6. <div class="power">
  7. <power :cur-power="s.PowerPercent" :cur-hr="s.RealHr"></power>
  8. </div>
  9. <div class="userinfo">
  10. <div class="lt">
  11. <span>
  12. <em v-if="s.RealHr != 0">{{ s.ActivePercent |max100 }}</em>
  13. <em v-else>---</em>
  14. <s>%</s>
  15. </span>
  16. </div>
  17. <div class="md">
  18. <div class="head">
  19. <img :src="s.Head" alt="" v-if="s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]">
  20. <!-- <img src="../static/img/people/flyhead.png" alt="" v-if="!s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]"> -->
  21. <default-head v-if="!s.Head" :class="[{'boy':s.Sex == 1},{'girl':s.Sex == 2}]"></default-head>
  22. <div class="names">
  23. <span>
  24. {{ s.Name }}
  25. </span>
  26. </div>
  27. </div>
  28. <img src="../assets/imgs/student/star.svg" class="IsPrivate" alt="IsPrivate" v-if="s.IsPrivate == 1">
  29. <img src="../assets/imgs/student/birthday.png" class="IsBirthday" alt="IsBirthday" v-if="s.IsBirthday == 1">
  30. </div>
  31. <div class="rt">
  32. <span>
  33. <div :class="[{'heartJump':true}]">
  34. <div class="heartImgContainer">
  35. <img src="../assets/imgs/student/heart.svg" class=""/>
  36. </div>
  37. <em class="fastJump" v-if="s.RealHr != 0"
  38. v-show="parseInt(s.ActivePercent) > 90">{{ s.RealHr }}
  39. </em>
  40. <em class="normalJump" v-if="s.RealHr != 0"
  41. v-show="parseInt(s.ActivePercent) <= 90 && parseInt(s.ActivePercent) > 30">{{ s.RealHr }}
  42. </em>
  43. <em class="slowJump" v-if="s.RealHr != 0"
  44. v-show="parseInt(s.ActivePercent) <= 30">{{ s.RealHr }}
  45. </em>
  46. <em v-else>---</em>
  47. </div>
  48. </span>
  49. </div>
  50. </div>
  51. <div class="userSport">
  52. <span>
  53. <img src="../assets/imgs/student/calc.svg" class=""/>
  54. <em>{{ s.Cle |fmtInt }}</em>
  55. </span>
  56. <span>
  57. <img src="../assets/imgs/student/ck.svg" class=""/>
  58. <em>{{ s.Ck |fmtFloat }}</em>
  59. </span>
  60. <span>
  61. <img src="../assets/imgs/student/ei.svg" class=""/>
  62. <em>{{ s.EI |fmtInt }}</em>
  63. </span>
  64. <!-- <span>
  65. <img src="../assets/imgs/student/sport.svg" class=""/>
  66. <em>{{ s.PureCalorieNoVo2 |fmtInt }}</em>
  67. </span> -->
  68. </div>
  69. </div>
  70. </li>
  71. <li v-for="(s,i) in studentsFake" :class="FakeclassName" v-show="students"
  72. v-if="students.length > 0">
  73. <div class="fakePart"></div>
  74. </li>
  75. </ul>
  76. </template>
  77. <script>
  78. import power from '@/components/power'
  79. import defaultHead from '@/components/defaultHead'
  80. export default {
  81. data() {
  82. return {
  83. maxShowNum: 10, //最大显示记录数
  84. studentsFake: [],
  85. FakeclassName: ''
  86. }
  87. },
  88. props: ['students'],
  89. watch: {
  90. 'students': {
  91. // 自动计算补全空白处
  92. handler(newName, oldName) {
  93. if (!newName) {
  94. console.log('没有传入学生数据');
  95. }
  96. let sum = 0;
  97. let that = this;
  98. sum = newName.length;
  99. that.studentsFake = 0;
  100. if (sum <= 2) {
  101. that.studentsFake = 2 - sum;
  102. }
  103. else if (sum >= 3) {
  104. that.studentsFake = 10 - sum;
  105. }
  106. else if (sum >= 10) {
  107. that.studentsFake = 0
  108. }
  109. let numberClass = '';
  110. let colorClass = '';
  111. for (let i = 0; i < sum; i++) {
  112. switch (true) {
  113. // case sum == 1:
  114. // numberClass = 'max';
  115. // break;
  116. // case sum == 2:
  117. case sum <= 2:
  118. numberClass = 'two';
  119. break;
  120. case sum > 2:
  121. numberClass = 'ten';
  122. break;
  123. }
  124. let per = parseInt(newName[i].ActivePercent);
  125. switch (true) {
  126. case per >= 90:
  127. colorClass = 'red';
  128. break;
  129. case per <= 89 && per > 79:
  130. colorClass = 'brown';
  131. break;
  132. case per <= 79 && per > 69:
  133. colorClass = 'yellow';
  134. break;
  135. case per <= 69 && per > 54:
  136. colorClass = 'green';
  137. break;
  138. case per <= 54 && per > 39:
  139. colorClass = 'violet';
  140. break;
  141. case per <= 39:
  142. colorClass = 'blue';
  143. break
  144. }
  145. newName[i].className = numberClass + ' ' + colorClass;
  146. that.FakeclassName = numberClass + ' ' + colorClass;
  147. }
  148. },
  149. deep: true,
  150. immediate: true
  151. }
  152. },
  153. filters: {
  154. fmtNum(val) {
  155. if (val == 0) {
  156. return '--'
  157. } else {
  158. if (parseInt(val) < 0) return 0;
  159. if (parseInt(val) > 0) return val
  160. }
  161. },
  162. fmtFloat(val) {
  163. if (val == 0) {
  164. return '0.0'
  165. } else {
  166. return parseFloat(val).toFixed(1);
  167. }
  168. },
  169. fmtInt(val) {
  170. if (val == 0) {
  171. return '0'
  172. } else {
  173. // return parseFloat(val).toFixed(2);
  174. return parseInt(val);
  175. }
  176. },
  177. max100(val) {
  178. if (val <= 100) {
  179. return val
  180. } else {
  181. return 100
  182. }
  183. }
  184. },
  185. components: {
  186. power, defaultHead
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. @mixin cube {
  192. width: 100%;
  193. overflow: hidden;
  194. display: block;
  195. margin: 0 auto;
  196. }
  197. em, i, ul, li, s {
  198. margin: 0;
  199. padding: 0;
  200. list-style: none;
  201. font-style: normal;
  202. text-decoration: none;
  203. }
  204. ul {
  205. @include cube;
  206. width: 100%;
  207. display: inline-flex;
  208. align-items: center;
  209. align-content: center;
  210. justify-content: center;
  211. flex-wrap: wrap;
  212. flex-grow: 1;
  213. &.many {
  214. justify-content: space-between;
  215. }
  216. }
  217. .blue .centerLi {
  218. // background: linear-gradient(#007ec7 0%, #007dc6 33%, #4cbbfc 100%);
  219. background: #007ec7;
  220. }
  221. .violet .centerLi {
  222. // background: linear-gradient(#3500ac 0%, #4300ad 33%, #7766f8 100%);
  223. background: #3519AB;
  224. }
  225. .green .centerLi {
  226. // background: linear-gradient(#0ab105 0%, #0ab105 33%, #37e06b 100%);
  227. background: #05A200;
  228. }
  229. .yellow .centerLi {
  230. // background: linear-gradient(#ffb308 0%, #f5c600 33%, #ffe61f 100%);
  231. background: #ffb308;
  232. }
  233. .brown .centerLi {
  234. // background: linear-gradient(#ff6200 0%, #ff6200 34.48%, #ff9d2b 100%);
  235. background: #ff6200;
  236. }
  237. .red .centerLi {
  238. // background: linear-gradient(#d11122 0%, #d11122 48.28%, #ff3445 100%);
  239. background: #d11122;
  240. }
  241. .slowJump {
  242. animation: moveAct 3s infinite;
  243. -webkit-animation: moveAct 3s infinite; /*Safari and Chrome*/
  244. animation-direction: alternate; /*轮流反向播放动画。*/
  245. animation-timing-function: ease-in-out; /*动画的速度曲线*/
  246. /* Safari 和 Chrome */
  247. -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
  248. -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
  249. }
  250. .normalJump {
  251. animation: moveAct 2s infinite;
  252. -webkit-animation: moveAct 2s infinite; /*Safari and Chrome*/
  253. animation-direction: alternate; /*轮流反向播放动画。*/
  254. animation-timing-function: ease-in-out; /*动画的速度曲线*/
  255. /* Safari 和 Chrome */
  256. -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
  257. -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
  258. }
  259. .fastJump {
  260. animation: moveAct 1s infinite;
  261. -webkit-animation: moveAct 1s infinite; /*Safari and Chrome*/
  262. animation-direction: alternate; /*轮流反向播放动画。*/
  263. animation-timing-function: ease-in-out; /*动画的速度曲线*/
  264. /* Safari 和 Chrome */
  265. -webkit-animation-direction: alternate; /*轮流反向播放动画。*/
  266. -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
  267. }
  268. @keyframes moveAct {
  269. 0% {
  270. transform: scale(1); /*开始为原始大小*/
  271. }
  272. 25% {
  273. transform: scale(1.1); /*放大1.1倍*/
  274. }
  275. 50% {
  276. transform: scale(1);
  277. }
  278. 75% {
  279. transform: scale(1.1);
  280. }
  281. }
  282. @-webkit-keyframes moveAct /*Safari and Chrome*/
  283. {
  284. 0% {
  285. transform: scale(1); /*开始为原始大小*/
  286. }
  287. 25% {
  288. transform: scale(1.1); /*放大1.1倍*/
  289. }
  290. 50% {
  291. transform: scale(1);
  292. }
  293. 75% {
  294. transform: scale(1.1);
  295. }
  296. }
  297. .centerLi {
  298. width: 99.8%;
  299. height: 100%;
  300. overflow: hidden;
  301. float: left;
  302. color: #fff;
  303. border-radius: 0.1rem;
  304. }
  305. .power {
  306. margin-top: 0.1rem;
  307. margin-right: 0.1rem;
  308. }
  309. .userinfo {
  310. @include cube;
  311. .lt {
  312. width: 31%;
  313. float: left;
  314. padding-right: 4%;
  315. margin-top: 0.2rem;
  316. span {
  317. float: right;
  318. em {
  319. color: white;
  320. font-size: 0.75rem;
  321. line-height: 1.90rem;
  322. font-weight: bold;
  323. letter-spacing: 0.03rem;
  324. }
  325. s {
  326. font-size: 0.4rem;
  327. float: right;
  328. text-align: right;
  329. margin-top: 0.43rem;
  330. font-family: "Arial Black";
  331. font-weight: bold;
  332. }
  333. }
  334. }
  335. .md {
  336. width: 30%;
  337. float: left;
  338. padding-top: 3%;
  339. height: 2rem;
  340. .head {
  341. @include cube;
  342. height: 2rem;
  343. img {
  344. @include cube;
  345. width: 1.7rem;
  346. height: 1.7rem;
  347. border-radius: 250rem;
  348. &.girl {
  349. border: 2px solid #EA26EA;
  350. }
  351. &.boy {
  352. border: 2px solid #39B6FF;
  353. }
  354. }
  355. }
  356. .names {
  357. @include cube;
  358. width: 1.36rem;
  359. background: rgba(0, 0, 0, 0.7);
  360. font-size: 0.25rem;
  361. text-align: center;
  362. padding: 1% 1%;
  363. border-radius: 250rem;
  364. position: relative;
  365. bottom: 0.37rem;
  366. }
  367. .IsPrivate {
  368. width: 0.6rem;
  369. float: right;
  370. position: relative;
  371. right: -0.15rem;
  372. bottom: 2.09rem;
  373. }
  374. .IsBirthday {
  375. width: 1.1rem;
  376. float: left;
  377. position: relative;
  378. bottom: 2.18rem;
  379. left: 0.4rem;
  380. }
  381. }
  382. .rt {
  383. width: 32%;
  384. float: right;
  385. margin-top: 0.2rem;
  386. .heartJump {
  387. width: 100%;
  388. float: right;
  389. letter-spacing: 0.03rem;
  390. span {
  391. float: right;
  392. }
  393. }
  394. > span {
  395. width: 100%;
  396. text-align: right;
  397. float: right;
  398. font-size: 0.727rem;
  399. line-height: 1.90rem;
  400. font-weight: bold;
  401. padding-right: 15%;
  402. }
  403. em {
  404. color: white;
  405. width: 80%;
  406. float: right;
  407. text-align: right;
  408. }
  409. .heartImgContainer {
  410. width: 20%;
  411. // height: 2rem;
  412. float: right;
  413. }
  414. img {
  415. width: 0.36rem;
  416. float: right;
  417. margin-right: 0%;
  418. margin-top: 0.60rem;
  419. }
  420. }
  421. }
  422. .userSport {
  423. @include cube;
  424. line-height: 0.8rem;
  425. margin-top: 0.1rem;
  426. span {
  427. width: 33.333%;
  428. float: left;
  429. img {
  430. width: 0.32rem;
  431. float: left;
  432. margin-left: 0.36rem;
  433. margin-top: 0.2rem;
  434. }
  435. em {
  436. float: left;
  437. font-size: 0.38rem;
  438. font-family: Georgia, Arial;
  439. vertical-align: top;
  440. margin-left: 0.12rem;
  441. }
  442. }
  443. }
  444. .max {
  445. width: 9.5rem;
  446. height: 3.5rem;
  447. margin-top: 25%;
  448. .userinfo {
  449. height: 2.2rem;
  450. }
  451. .userSport {
  452. span:nth-child(1)>img {
  453. margin-left: 0.43rem;
  454. }
  455. span:nth-child(2)>img {
  456. margin-left: 0.46rem;
  457. }
  458. span:nth-child(3)>img {
  459. margin-left: 0.4rem;
  460. }
  461. }
  462. }
  463. .two {
  464. width: 9.5rem;
  465. height: 3.5rem;
  466. margin-top: 0.1rem;
  467. // margin-top: 0.2rem;
  468. .userinfo {
  469. height: 2.2rem;
  470. }
  471. .userSport {
  472. span:nth-child(1)>img {
  473. margin-left: 0.43rem;
  474. }
  475. span:nth-child(2)>img {
  476. margin-left: 0.46rem;
  477. }
  478. span:nth-child(3)>img {
  479. margin-left: 0.4rem;
  480. }
  481. }
  482. }
  483. .ten {
  484. width: 3.12rem;
  485. height: 1.46rem;
  486. margin-top: 0.1rem;
  487. .power {
  488. margin-top: 0.03rem;
  489. margin-right: 0.01rem;
  490. }
  491. /deep/ .powerContainer {
  492. height: 0.16rem;
  493. }
  494. /deep/ .powerContainer img {
  495. position: relative;
  496. right: -0.1rem;
  497. bottom: 0.1rem;
  498. width: 0.2rem;
  499. }
  500. .userinfo {
  501. height: 0.92rem;
  502. .lt {
  503. width: 33%;
  504. margin-top: -0.55rem;
  505. padding-right: 2.5%;
  506. em {
  507. font-size: 0.38rem;
  508. line-height: 2.0rem;
  509. letter-spacing: 0.01rem;
  510. }
  511. s {
  512. font-size: 0.2rem;
  513. margin-top: 0.73rem;
  514. }
  515. }
  516. .md {
  517. height: 1.0rem;
  518. margin-top: -0.01rem;
  519. .head {
  520. height: 0.9rem;
  521. img {
  522. width: 0.75rem;
  523. height: 0.75rem;
  524. border-width: 2px !important;
  525. }
  526. }
  527. .names {
  528. width: 0.72rem !important;
  529. font-size: 0.15rem !important;
  530. bottom: 0.22rem !important;
  531. }
  532. .IsPrivate {
  533. width: 0.25rem;
  534. bottom: 0.92rem;
  535. // bottom: 2.65rem;
  536. right: -0.03rem;
  537. }
  538. .IsBirthday {
  539. width: 0.49rem;
  540. bottom: 0.98rem;
  541. left: 0.23rem;
  542. }
  543. }
  544. .rt {
  545. margin-top: -0.55rem;
  546. span {
  547. font-size: 0.345rem;
  548. line-height: 2.0rem;
  549. padding-right: 5%;
  550. em {
  551. letter-spacing: 0.01rem;
  552. }
  553. }
  554. .heartJump {
  555. margin-right: 0.12rem;
  556. }
  557. .heartImgContainer {
  558. width: 20%;
  559. }
  560. img {
  561. width: 0.16rem;
  562. margin-right: 0%;
  563. margin-top: 0.8rem;
  564. }
  565. }
  566. }
  567. .userSport {
  568. line-height: 0.3rem;
  569. margin-top: 0rem;
  570. img {
  571. width: 0.18rem;
  572. margin-top: 0.08rem;
  573. }
  574. span:nth-child(1)>img {
  575. margin-left: 0.23rem;
  576. }
  577. span:nth-child(2)>img {
  578. margin-left: 0.23rem;
  579. }
  580. span:nth-child(3)>img {
  581. margin-left: 0.2rem;
  582. }
  583. em {
  584. font-size: 0.2rem;
  585. margin-top: 0.03rem;
  586. margin-left: 0.06rem;
  587. // line-height: 0.8rem;
  588. }
  589. }
  590. }
  591. .fakePart {
  592. width: 100%;
  593. height: 100%;
  594. background-color: rgba(255, 255, 255, 0.13);
  595. border-radius: 0.1rem;
  596. }
  597. </style>